Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re^5: Replaying Santa Claus Golf Apocalypse with Pugs/Perl6

by rg0now (Chaplain)
on Mar 29, 2005 at 19:17 UTC ( #443236=note: print w/replies, xml ) Need Help??

in reply to Re^4: Replaying Santa Claus Golf Apocalypse with Pugs/Perl6
in thread Replaying Santa Claus Golf Apocalypse with Pugs/Perl6

Open this and then call the block for every line of the resulting file handle, closing the file at the end.

Ok, I see. How about this one?

This seems to work and it is semantically much closer to what you proposed: it opens the file, calls print (which is not a block, but I think, it could be made one for no good) for each requested line.

It is an interesting question, whether we could omit the parentheses around =<>. Although Pugs does not seem to like it, I am not entirely sure that [] should bind so tight.


Replies are listed 'Best First'.
Re^6: Replaying Santa Claus Golf Apocalypse with Pugs/Perl6
by nothingmuch (Priest) on Mar 30, 2005 at 16:00 UTC

    Shouldn't that be like this?


    zz zZ Z Z #!perl
      It might be clearer to write it that way, and it emphasizes that you're printing each element individually, but the other probably works as well, if we assume that most of the builtin types including the aggregate types respond to .print.
      I have just found the description of the construct you refer to in S12, and I like it pretty much. For those monks, who, just like me, quickly get tired of the overdose of Perl 6 that comes with a Synopsis, I copy the relevant part here verbatim:

      Parallel dispatch

      Any of the method call forms may be turned into a hyperoperator by treating the method call as a postfix:

      @object».meth(@args) # calls one method on each @object».?meth(@args) # calls method if there is one on each @object».*meth(@args) # calls all methods (0 or more) on each @object».+meth(@args) # calls all methods (1 or more) on each @object».=meth(@args) # calls mutator method on each @object».:meth(@args) # calls private method on each

      Pretty nice, I think. Is there any other programming language that allows anything similar to Perl 6 parallel dispatch?


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://443236]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2016-09-29 09:18 GMT
Find Nodes?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:

    Results (551 votes). Check out past polls.