[squeak-dev] Rosetta Code site

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Rosetta Code site

Dan Ingalls
Hi all -

Today while looking for an old reference to Rosetta Smalltalk, I came across this site:


In their own words, "The idea is to present solutions to the same task in as many different languages as possible, to demonstrate how languages are similar and different, and to aid a person with a grounding in one language in learning another.  Rosetta Code currently has 278 tasks, and covers 135 languages, though we do not have solutions to every task in every language."

It seemed to me that some of the Smalltalk examples are not as nice as they might be.  For instance the very first thing I looked at was the Ackermann function which is written as a block...

|ackermann|
ackermann := [ :n :m |
(n = 0) ifTrue: [ (m + 1) ]
ifFalse: [
(m = 0) ifTrue: [ ackermann value: (n-1) value: 1 ]
ifFalse: [
ackermann value: (n-1)
value: ( ackermann value: n
value: (m-1) )
]
]
].
To begin with, this is cluttered with value:value:;  it includes redundant parentheses which don't belong in an illustration of the language;  finally, it will not run in Smalltalks that do not allow recursive blocks.  Seems to me it might be more illustrative as an Integer method that will run in any Smalltalk, that runs faster too, and looks cleaner to me...

<Integer> ack: n  "The first parameter m is the receiver, self, in this Ackermann method"
self = 0 ifTrue: [^ n+1].
self > 0 ifTrue:
[n = 0 ifTrue: [^ self-1 ack: 1].
n > 0 ifTrue: [^ self-1 ack: (self ack: n-1)] ]
"
0 ack: 0 ==> 1
3 ack: 4 ==> 125
"

Anyway, I thought Smalltalk's representation on that site could use a little QA, and that folks on this list might have a good time playing TerseMan.  I could imagine the Squeak solutions being an interesting area in our Wiki, both as a staging area for such a project, and as a possibly interesting collection of TerseMan discussions (terseness is great fun, but not always the ideal).  A comment on the last line might point to our Wiki which might gain some new Squeak users, and would encourage checking with us before anyone overwrites our contributions.


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Rosetta Code site

Andres Valloud-4
Hey, this is great material for the book I am writing.  Thank you!

Daniel Ingalls wrote:

> Hi all -
>
> Today while looking for an old reference to Rosetta Smalltalk, I came
> across this site:
>
> http://rosettacode.org
>
> In their own words, "The idea is to present solutions to the same task
> in as many different languages as possible, to demonstrate how
> languages are similar and different, and to aid a person with a
> grounding in one language in learning another.  Rosetta Code currently
> has 278 tasks, and covers 135 languages, though we do not have
> solutions to every task in every language."
>
> It seemed to me that some of the Smalltalk examples are not as nice as
> they might be.  For instance the very first thing I looked at was the
> Ackermann function which is written as a block...
>
> |ackermann|
> ackermann := [ :n :m |
>   (n = 0) ifTrue: [ (m + 1) ]
>           ifFalse: [
>            (m = 0) ifTrue: [ ackermann value: (n-1) value: 1 ]
>                    ifFalse: [
>                         ackermann value: (n-1)
>                                   value: ( ackermann value: n
>                                                      value: (m-1) )
>                    ]
>           ]
> ].
>  
> To begin with, this is cluttered with value:value:;  it includes
> redundant parentheses which don't belong in an illustration of the
> language;  finally, it will not run in Smalltalks that do not allow
> recursive blocks.  Seems to me it might be more illustrative as an
> Integer method that will run in any Smalltalk, that runs faster too,
> and looks cleaner to me...
>
> <Integer> ack: n  "The first parameter m is the receiver, self, in
> this Ackermann method"
> self = 0 ifTrue: [^ n+1].
> self > 0 ifTrue:
> [n = 0 ifTrue: [^ self-1 ack: 1].
> n > 0 ifTrue: [^ self-1 ack: (self ack: n-1)] ]
> "
> 0 ack: 0 ==> 1
> 3 ack: 4 ==> 125
> "
>
> Anyway, I thought Smalltalk's representation on that site could use a
> little QA, and that folks on this list might have a good time playing
> TerseMan.  I could imagine the Squeak solutions being an interesting
> area in our Wiki, both as a staging area for such a project, and as a
> possibly interesting collection of TerseMan discussions (terseness is
> great fun, but not always the ideal).  A comment on the last line
> might point to our Wiki which might gain some new Squeak users, and
> would encourage checking with us before anyone overwrites our
> contributions.

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Rosetta Code site

Michael Mol
Please keep in mind that content on Rosetta Code is under the GFDL, so you may need to pay attention to some of the licensing restrictions.  If you need special exemptions for your book, let me know which bits you need exemptions for so that I can find out who in particular has the copyrights for the parts in question, and seek to get permission from them.

(I'm the owner/webmaster/server admin for Rosetta Code.  I believe Nabble will let you send me an email directly, or you could resort to WHOIS...)

Andres Valloud-4 wrote
Hey, this is great material for the book I am writing.  Thank you!

Daniel Ingalls wrote:
> Hi all -
>
> Today while looking for an old reference to Rosetta Smalltalk, I came
> across this site:
>
> http://rosettacode.org
>
> In their own words, "The idea is to present solutions to the same task
> in as many different languages as possible, to demonstrate how
> languages are similar and different, and to aid a person with a
> grounding in one language in learning another.  Rosetta Code currently
> has 278 tasks, and covers 135 languages, though we do not have
> solutions to every task in every language."
Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Rosetta Code site

Michael Mol
In reply to this post by Dan Ingalls
Feel free to come by and fix things up on the site!  We're always looking for more code, tasks, programming languages, paradigms, etc.  The site doubles as an educational resource, as well as a stage for language developers to test their ideas and languages against common problems, as well as get an audience for their languages. (There are many great and unique programming languages out there that nobody has ever heard of.  I encourage language advocacy on the site, so long as such advocacy takes the form of code.)

Dan Ingalls wrote
Hi all -

Today while looking for an old reference to Rosetta Smalltalk, I came  
across this site:

        http://rosettacode.org

In their own words, "The idea is to present solutions to the same task  
in as many different languages as possible, to demonstrate how  
languages are similar and different, and to aid a person with a  
grounding in one language in learning another.  Rosetta Code currently  
has 278 tasks, and covers 135 languages, though we do not have  
solutions to every task in every language."

It seemed to me that some of the Smalltalk examples are not as nice as  
they might be.  For instance the very first thing I looked at was the  
Ackermann function which is written as a block...