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

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

by carcassonne (Pilgrim)
on Dec 15, 2006 at 02:31 UTC ( #589971=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)

Here goes in Smalltalk:

#('one' 'two' 'three' 'four') reversed

Do a print-It in the workspace and it gives:

#('four' 'three' 'two' 'one')

You put your things in an OrderedCollection and this collection has a reversed message that can be sent to it. Voilą !

  • Comment on Smalltalk - Re: Five Ways to Reverse a String of Words (C#, Perl 5, Perl 6, Ruby, Haskell)

Replies are listed 'Best First'.
Re: Smalltalk - Re: Five Ways to Reverse a String of Words (C#, Perl 5, Perl 6, Ruby, Haskell)
by jdporter (Canon) on Apr 04, 2009 at 13:11 UTC

    That utterly fails the requirement, which is to take a string like "one two three four" and return a string like "four three two one".

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2016-06-30 09:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (391 votes). Check out past polls.