Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
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 taking refuge in the Monastery: (7)
As of 2014-12-28 17:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (182 votes), past polls