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

Re: Five Ways to Reverse a String of Words (C#, Perl 5, Perl6, Ruby, Haskell)

by TimToady (Parson)
on Dec 12, 2006 at 18:04 UTC ( #589343=note: print w/ replies, xml ) Need Help??


in reply to Five Ways to Reverse a String of Words (C#, Perl 5, Perl 6, Ruby, Haskell)

You're going to have to try harder if you want Haskell to outgolf Perl 6 here. The following all work in Pugs and are shorter than your Haskell version.

sub reverseWords ($_) {~reverse .comb} sub reverseWords {~reverse comb @_} my&reverseWords:={~.comb.reverse}
The first two could even be construed as readable.


Comment on Re: Five Ways to Reverse a String of Words (C#, Perl 5, Perl6, Ruby, Haskell)
Download Code
Re^2: Five Ways to Reverse a String of Words (C#, Perl 5, Perl6, Ruby, Haskell)
by apotheon (Deacon) on Dec 13, 2006 at 08:12 UTC

    If we're really concerned about golfing to the fewest strokes, you should check out the UCBLogo solution in my post down a few in the discussion. In UCBLogo, the number of (key)strokes needed is zero.

    print substr("Just another Perl hacker", 0, -2);
    - apotheon
    CopyWrite Chad Perrin

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2014-09-22 09:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (185 votes), past polls