Skip to content

Instantly share code, notes, and snippets.

@Mon-Ouie
Created November 24, 2011 20:24
Show Gist options
  • Save Mon-Ouie/1392203 to your computer and use it in GitHub Desktop.
Save Mon-Ouie/1392203 to your computer and use it in GitHub Desktop.
SmallInt =>
define multiply_by: n and_add: stuff
self * n + stuff
Foo := Object subclass =>
define love
3
Block =>
define call
self call: []
True =>
define if_true: a if_false: b
a call
define if_false: a if_true: b
b call
define if_true: block
block call
define if_false: block
nil
define or: other
self
define and: other
other call
define not
false
False =>
define if_true: a if_false: b
b call
define if_false: a if_true: b
a call
define if_true: block
nil
define if_false: block
block call
define or: other
other call
define and: other
self
define not
true
SmallInt =>
define factorial
(self = 0) if_true: {1} if_false: { self * (self - 1) factorial }
self test: 10 factorial;
z := (x, y) { x + y } call: [1, 2];
[1, 2, 3, 4] do: (n) { self test: z + n }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment