Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,29 @@
SpecialObject {
classvar a = 42, <b = 0, <>c; // Class variables. 42 and 0 are default values.
var <>x, <>y; // Instance variables.
// Note: variables are private by default. In the above, "<" creates a getter, ">" creates a setter
*new { |value|
^super.new.init(value) // constructor is a class method. typically calls some instance method to set up, here "init"
}
init { |value|
x = value;
y = sqrt(squared(a) + squared(b))
}
// a class method
*randomizeAll {
a = 42.rand;
b = 42.rand;
c = 42.rannd;
}
// an instance method
coordinates {
^Point(x, y) // The "^" means to return the result. If not specified, then the object itself will be returned ("^this")
}
}

View file

@ -0,0 +1,3 @@
SpecialObject.randomizeAll;
a = SpecialObject(8);
a.coordinates;