From 9fe565a929d6fd260a1efb430f815b729a740a91 Mon Sep 17 00:00:00 2001 From: Simon Forman Date: Tue, 5 Apr 2022 10:06:40 -0700 Subject: [PATCH] uncons as basis - 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 | 3 ++- implementations/defs.txt | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/implementations/Nim/defs.txt b/implementations/Nim/defs.txt index a1be10d..c152e90 100644 --- a/implementations/Nim/defs.txt +++ b/implementations/Nim/defs.txt @@ -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 diff --git a/implementations/defs.txt b/implementations/defs.txt index c152e90..47b5ebb 100644 --- a/implementations/defs.txt +++ b/implementations/defs.txt @@ -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 -- 2.11.0