* `if` function stack ordering is changed to use condition, if-false, if-true (bottom to top). This is so we can pass a value on top of the stack directly to a new `if` in a condition, so we don't have to store a new value in a new variable. * Add __splat__ and __minus__ functions to Int * Add * and - builtins, which call the __splat__ and __minus__ functions of the top stack item, respectively. * Add factorial example because now factorials are possible with this skeleton implementation, albeit a little hacky with the recursion. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
7 lines
441 B
Plaintext
7 lines
441 B
Plaintext
0 [ "fail - 0 is not truthy" println! ] [ "OK" println! ] if!
|
|
1 [ "OK" println! ] [ "fail - 1 is truthy" println! ] if!
|
|
1.1 [ "OK" println! ] [ "fail - 1.1 is truthy" println! ] if!
|
|
0.1 [ "OK" println! ] [ "fail - 0.1 is truthy" println! ] if!
|
|
-0.1 [ "OK" println! ] [ "fail - -0.1 is truthy" println! ] if!
|
|
-0.0 [ "fail - -0.0 is not truthy" println! ] [ "OK" println! ] if!
|
|
0.0 [ "fail - 0.0 is not truthy" println! ] [ "OK" println! ] if! |