blob: 59ead4bd22ccff8be3c7bcc49549f99b39a79857 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#!/usr/local/bin/stem
# Author: Preston Pan
evalstr [ strquote eval ] func
include [ fread evalstr ] func
neg [ 0 swap - ] func
# Author of loop function: Andrei S
loop [
swap dup 0 > [
swap
dup eval
swap 1 - swap loop
] [ dsc dsc ] if
] func
swapd [ [ swap ] keep ] func
swapt [ [ [ swap ] keep ] keep ] func
dscd [ swap dsc ] func
dsct [ swapd swap dsc ] func
dsc2 [ dsc dsc ] func
dsc3 [ dsc dsc dsc ] func
# Author: Matthew H
dupd [ [ dup ] keep ] func
dupt [ [ [ dup ] keep ] keep ] func
dupq [ [ [ [ dup ] keep ] keep ] keep ] func
over [ dupd swap ] func
over2 [ dupt swapd swap ] func
over3 [ dupq swapt swapd swap ] func
dup2 [ over over ] func
dup3 [ over2 over2 over2 ] func
dup4 [ over3 over3 over3 over3 ] func
dip2 [ swap [ dip ] dip ] func
dip3 [ swap [ dip ] dip ] func
while [ dup2 [ [ ] if ] dip2 over [ while ] [ dsc dsc ] if ] func
when [ [ ] if ] func
loop-times [ dup2 [ swap [ ] if ] dip2
dup [ 1 - loop-times ] [ dsc2 ] if ] func
# d>base [ [ pow * "" swap ] keep2
# [ [ over ] [ [ dup2 / floor * swap over - ] keep [ [ "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "↊" "↋" ] vat swap + ] with dip2 ] while dsc2 dup len(str-len) ] dip
# - dup2 tail [ head "." ] dip + + ] func
# Author: Preston Pan
map [ [ ] over2 over2 len 0 swap
[ dup4 swap vat over2 eval dscd dscd quote compose swap 1 + dsct dsct dsct over3 swap over3 swap ] swap loop-times dsc3 dscd dscd ] func
filter [ [ ] over2 over2 len 0 swap
[ dup4 swap vat dup over3 eval dsct dsct [ quote compose ] [ dsc ] if swap 1 + dsct dsct dsct over3 swap over3 swap ] swap loop-times dsc3 dscd dscd ] func
|