Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^3: Yet Another Rosetta Code Problem (Perl, Ruby, Python, Haskell, ...)

by eyepopslikeamosquito (Canon)
on Sep 11, 2007 at 22:19 UTC ( #638449=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Yet Another Rosetta Code Problem (Perl, Ruby, Python, Haskell, ...)
in thread Yet Another Rosetta Code Problem (Perl, Ruby, Python, Haskell, ...)

I really dont like the regex magic of the ruby solution, cant you guys think of another solution :-)
How about some inject magic?
x = s.split(//).inject([]) {|a,e| (a.last && a.last[e] ? a.last : a) < +< e; a}


Comment on Re^3: Yet Another Rosetta Code Problem (Perl, Ruby, Python, Haskell, ...)
Download Code
Reaped: Re^4: Yet Another Rosetta Code Problem (Perl, Ruby, Python, Haskell, ...)
by NodeReaper (Curate) on Nov 26, 2008 at 14:11 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (7)
As of 2015-07-02 06:06 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 (29 votes), past polls