OSDN Git Service

uncons as basis
authorSimon Forman <sforman@hushmail.com>
Tue, 5 Apr 2022 17:06:40 +0000 (10:06 -0700)
committerSimon Forman <sforman@hushmail.com>
Tue, 5 Apr 2022 17:06:40 +0000 (10:06 -0700)
- clear deletes stack at once, not in a loop
- make uncons basis and define first and rest in tems of it

implementations/Nim/defs.txt
implementations/defs.txt

index a1be10d..c152e90 100644 (file)
@@ -83,13 +83,14 @@ split_list [take reverse] [drop] clop
 sqr dup *
 stackd [stack] dip
 step_zero 0 roll> step
+stuncons stack uncons
 sum [+] step_zero
 swapd [swap] dip
 swons swap cons
 swoncat swap concat
 sqr dup mul
 tailrec [i] genrec
-take [] roll> [shift] times pop
+take <<{} [shift] times pop
 ternary binary popd
 third rest second
 tuck dup swapd
index c152e90..47b5ebb 100644 (file)
@@ -18,7 +18,7 @@ b [i] dip i
 binary unary popd
 ccccons ccons ccons
 ccons cons cons
-clear stack bool [pop stack bool] loop
+clear [] swaack pop
 cleave fork popdd
 clop cleave popdd
 codi cons dip
@@ -33,6 +33,7 @@ dupdd [dup] dipd
 dupdip dupd dip
 dupdipd dup dipd
 enstacken stack [clear] dip
+first uncons pop
 flatten <{} [concat] step
 fork [i] app2
 fourth rest third
@@ -65,7 +66,7 @@ quoted [unit] dip
 range [0 <=] [1 - dup] anamorphism
 range_to_zero unit [down_to_zero] infra
 reco rest cons
-rest [pop] infra
+rest uncons popd
 reverse <{} shunt
 roll> swap swapd
 roll< swapd swap
@@ -95,7 +96,6 @@ ternary binary popd
 third rest second
 tuck dup swapd
 unary nullary popd
-uncons [first] [rest] cleave
 unit [] cons
 unquoted [i] dip
 unswons uncons swap