You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
631 B
GLSL
30 lines
631 B
GLSL
(
|
|
; core utilities
|
|
($x ^x ^x) $dup
|
|
($_) $drop
|
|
($x $y ^x ^y) $swap
|
|
($a $b $c ^b ^a ^c) $rot
|
|
(sub) $-
|
|
(0 swap - -) $+
|
|
(()) $nil
|
|
(nil eq) $null?
|
|
($x x) $force
|
|
(10 emit) $cr
|
|
|
|
; recursion via y-combinator
|
|
($f ($x (^x x) f) dup force) $Y ($g (^g Y)) $rec
|
|
|
|
; if-stmt
|
|
($c $t $f c ^f ^t rot cswap $_ force) $if
|
|
($f $t $c $fn ^f ^t ^c fn) $endif
|
|
|
|
; range
|
|
($self $body $start $end
|
|
^if (^start ^end eq) nil
|
|
(^start body ^end ^start 1 + ^body self)
|
|
endif
|
|
) rec $do
|
|
|
|
70 65 ^emit do cr
|
|
)
|