Interpreter and library.
Révision | 9fe565a929d6fd260a1efb430f815b729a740a91 (tree) |
---|---|
l'heure | 2022-04-06 02:06:40 |
Auteur | ![]() |
Commiter | Simon Forman |
uncons as basis
- clear deletes stack at once, not in a loop
- make uncons basis and define first and rest in tems of it
@@ -83,13 +83,14 @@ split_list [take reverse] [drop] clop | ||
83 | 83 | sqr dup * |
84 | 84 | stackd [stack] dip |
85 | 85 | step_zero 0 roll> step |
86 | +stuncons stack uncons | |
86 | 87 | sum [+] step_zero |
87 | 88 | swapd [swap] dip |
88 | 89 | swons swap cons |
89 | 90 | swoncat swap concat |
90 | 91 | sqr dup mul |
91 | 92 | tailrec [i] genrec |
92 | -take [] roll> [shift] times pop | |
93 | +take <<{} [shift] times pop | |
93 | 94 | ternary binary popd |
94 | 95 | third rest second |
95 | 96 | tuck dup swapd |
@@ -18,7 +18,7 @@ b [i] dip i | ||
18 | 18 | binary unary popd |
19 | 19 | ccccons ccons ccons |
20 | 20 | ccons cons cons |
21 | -clear stack bool [pop stack bool] loop | |
21 | +clear [] swaack pop | |
22 | 22 | cleave fork popdd |
23 | 23 | clop cleave popdd |
24 | 24 | codi cons dip |
@@ -33,6 +33,7 @@ dupdd [dup] dipd | ||
33 | 33 | dupdip dupd dip |
34 | 34 | dupdipd dup dipd |
35 | 35 | enstacken stack [clear] dip |
36 | +first uncons pop | |
36 | 37 | flatten <{} [concat] step |
37 | 38 | fork [i] app2 |
38 | 39 | fourth rest third |
@@ -65,7 +66,7 @@ quoted [unit] dip | ||
65 | 66 | range [0 <=] [1 - dup] anamorphism |
66 | 67 | range_to_zero unit [down_to_zero] infra |
67 | 68 | reco rest cons |
68 | -rest [pop] infra | |
69 | +rest uncons popd | |
69 | 70 | reverse <{} shunt |
70 | 71 | roll> swap swapd |
71 | 72 | roll< swapd swap |
@@ -95,7 +96,6 @@ ternary binary popd | ||
95 | 96 | third rest second |
96 | 97 | tuck dup swapd |
97 | 98 | unary nullary popd |
98 | -uncons [first] [rest] cleave | |
99 | 99 | unit [] cons |
100 | 100 | unquoted [i] dip |
101 | 101 | unswons uncons swap |