Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://463409]
help
Chatterbox?
[chacham]: upgrading android studio means having all your projects not work.

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2017-03-29 06:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (344 votes). Check out past polls.