Re: Cleaner syntax for .map (is there already a way, or ruby2 idea?)



Hi --

On Fri, 28 Oct 2005, nobuyoshi nakada wrote:

Hi,

At Thu, 27 Oct 2005 21:07:03 +0900,
Trans wrote in [ruby-talk:162907]:
A shorthand for:

  people.every.email_addr

But I like your [*]. Hmm... I maybe able to adjust above to use [:*]

I feel your "every" much cleaner than [*].

I agree, visually, but I find both of the semantically opaque compared to people.each {|person| ... } I know that people.every could return some kind of generator or enumerator, which could then be fed "email_addr" symbolically... but it seems to conceal rather than reveal what's going on.


David

--
David A. Black
dblack@xxxxxxxxxxxx


.



Relevant Pages

  • Re: foreach enhancement
    ... It is a sequence generator which is expressed by ... to define behaviour based on syntax instead of semantics. ... automated input on expressions typed IEnumerable explicitly instead of any ... > and for more complicated things I would create my own enumerator. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Class and Iterator Design Question
    ... >>>would'nt it make more sense to have yield work coroutinish ... >> generator?). ... > of yielding better than returning an Enumerator, ... If you want external iterators, I don't think Generator is the ...
    (comp.lang.ruby)
  • Re: Class and Iterator Design Question
    ... basically integrating the enumerator ... That sounds unnecesarily complex. ... Anyway, yes, just like a Generator, and for all the usage of yield, not ...
    (comp.lang.ruby)

Loading