home |
syllabus |
src |
submit |
chat |
©2019
by Tim Menzies
This homework is optional and wills core you zero marks.
But it will get you started with Smalltalk.
On codeanywhere:
sudo apt-get update
sudo apt-get install gnu-smalltalk
Test it out
$ gst
GNU Smalltalk ready
st> 1+1.
2
st> control-d
$
Working!
Now split your environment into a shell (on left) and editor (on right). Edit the file st101
#!/usr/bin/env gst
"things in quotes are comments"
Transcript nextPutAll: 1 printString;
cr " command are grouped by '!'"
!
! Object methods !
oo
Transcript nextPutAll: self printString;
cr!
!
| x y | "locals vars. live till next '!'"
x := 1.
y:=2.
(x+y) oo "should print 3"
!
"now go to
https://people.eecs.berkeley.edu/~fateman/264/papers/smalltalk-tutorial.html
and try the examples there in section 1 and 2"
"e.g. 1.2"
'Hello, world' oo!
Remember to chmod +x st101
before running it with
./st101