Anonymous user
GNU Smalltalk: Difference between revisions
m
Use the implementation template, removed link to "hello world"
m (Use the implementation template, removed link to "hello world") |
|||
Line 1:
{{implementation|Smalltalk}}'''GNU Smalltalk''' is an implementation of the [[:Category:Smalltalk|Smalltalk]] programming language by the GNU Project.
The implementation, unlike other Smalltalk environments, uses text files for program input and interprets the contents as Smalltalk code. In this way, GNU Smalltalk acts more like an interpreter rather than an environment in the traditional Smalltalk manner.
==Examples==
These examples only work on GNU Smalltalk 3.0 and later versions. Classic
'Hello World!' displayNl
Line 92:
"=> 6"
A method such as ''inject:into:'' can accept both a parameter and a block. It iterates over each member of a list, performing some function on while retaining an aggregate. This is analogous to the
#(1 3 5) inject: 10 into: [ :sum :element | sum + element ] "=> 19"
Line 115:
===Classes===
The following code defines a class named Person. By deriving from Magnitude, it automatically defines all comparison methods except one (<code><</code>).
Magnitude subclass: Person [
Line 184:
* [http://www.gnu.org GNU]
* [http://smalltalk.gnu.org/ GNU Smalltalk]
|