Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: Perl6 Contest #2: P6 That Doesn't Look Like P5

by dpuu (Chaplain)
on Jun 03, 2005 at 21:45 UTC ( #463409=note: print w/ replies, xml ) Need Help??


in reply to Re: Perl6 Contest #2: P6 That Doesn't Look Like P5
in thread Perl6 Contest #2: P6 That Doesn't Look Like P5

my &helper = -> @prev, @rest { ... }
Too much syntax! You can use lexically scoped subs in P6 -- you don't have to use pointy-blocks for everything:
my sub helper (@prev, @rest) { ... }
Now I'm wondering if its possible to get rid of the "if" statment using multi-subs; And after that if its possible to get rid of the indexing into @rest. Something like
sub outer(*@vals) { my multi sub helper (@prev) { take @prev } my multi sub helper (@prev, $current, *@rest) { $current.map: { helper [@prev, $_], *@rest } } gather { helper [], *@vals } }
This is totally untested -- I haven't been able to install pugs yet.

--Dave.


Comment on Re^2: Perl6 Contest #2: P6 That Doesn't Look Like P5
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2015-07-05 07:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls