Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^10: 99 Problems in Perl6

by gaal (Parson)
on Dec 16, 2006 at 07:31 UTC ( #590176=note: print w/ replies, xml ) Need Help??


in reply to Re^9: 99 Problems in Perl6
in thread 99 Problems in Perl6

Pure variants like this one are desugared into a case:

compress x = case x of [] -> [] [a] -> [a] -- singleton list (x:y:xs) -> (if x == y then [] else [x]) ++ compress (y:xs)

And can do no monadic monkey business because compress is pure. In this they are simply a more convenient way of spelling out some branches. You wouldn't say if is a sneaky way of doing sequential dependencies, would you?

Sure, with a monadic function you can also have pattern guards that do monadic stuff, but I don't think you can bind without noticing, and in any case the function type will tell you it's monadic.


Comment on Re^10: 99 Problems in Perl6
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (15)
As of 2015-07-29 13:31 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 (263 votes), past polls