Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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
Domain Nodelet?
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 studying the Monastery: (3)
As of 2023-10-01 06:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?