OSDN Git Service

Add definition for xor.
[joypy/Thun.git] / implementations / defs.txt
index c152e90..185437c 100644 (file)
@@ -1,31 +1,41 @@
+eq [false] [true] [false] cmp
+gt [true] [false] [false] cmp
+lt [false] [false] [true] cmp
+neq [true] [false] [true] cmp
+le [false] [true] [true] cmp
+ge [true] [true] [false] cmp
 -- 1 -
 ? dup bool
-&& nulco [nullary [false]] dip branch
+and nulco [nullary [false]] dip branch
 ++ 1 +
-|| nulco [nullary] dip [true] branch
+or nulco [nullary] dip [true] branch
 !- 0 >=
 <{} [] swap
 <<{} [] rollup
+<< lshift
+>> rshift
 abs dup 0 < [] [neg] branch
 anamorphism [pop []] swap [dip swons] genrec
 app1 grba infrst
 app2 [grba swap grba swap] dip [infrst] cons ii
 app3 3 appN
-appN [grabN] codi map disenstacken
+appN [grabN] codi map reverse disenstacken
 at drop first
 average [sum] [size] cleave /
 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
+cmp [[>] swap] dipd [ifte] ccons [=] swons ifte
 codi cons dip
 codireco codi reco
 dinfrirst dip infrst
 dipd [dip] codi
-disenstacken ? [uncons ?] loop pop
+disenstacken swaack pop
+divmod [/] [%] clop
 down_to_zero [0 >] [dup --] while
 drop [rest] times
 dupd [dup] dip
@@ -33,6 +43,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
@@ -45,13 +56,16 @@ ifte [nullary] dipd swap branch
 ii [dip] dupdip i
 infra swons swaack [i] dip swaack
 infrst infra first
+lshift [2 *] times
 make_generator [codireco] ccons
 mod %
 neg 0 swap -
 not [true] [false] branch
 nulco [nullary] cons
+null [] swap concat bool not
 nullary [stack] dinfrirst
 of swap at
+over [dup] dip swap
 pam [i] map
 pm [+] [-] clop
 popd [pop] dip
@@ -62,25 +76,27 @@ popopd [popop] dip
 popopdd [popop] dipd
 product 1 swap [*] step
 quoted [unit] dip
-range [0 <=] [- dup] anamorphism
+range [0 <=] [-- 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
 rollup roll>
 rolldown roll<
 rrest rest rest
+rshift [2 /] times
 run <{} infra
 second rest first
 shift uncons [swons] dip
 shunt [swons] step
 size [pop ++] step_zero
-spiral_next [[[abs] ii <=] [[<>] [pop !-] ||] &&] [[!-] [[++]] [[--]] ifte dip] [[pop !-] [--] [++] ifte] ifte
+small dup null [rest null] [pop true] branch
+spiral_next [[[abs] ii <=] [[<>] [pop !-] or] and] [[!-] [[++]] [[--]] ifte dip] [[pop !-] [--] [++] ifte] ifte
 split_at [drop] [take] clop
 split_list [take reverse] [drop] clop
-sqr dup *
+sqr dup mul
 stackd [stack] dip
 step_zero 0 roll> step
 stuncons stack uncons
@@ -88,7 +104,6 @@ sum [+] step_zero
 swapd [swap] dip
 swons swap cons
 swoncat swap concat
-sqr dup mul
 tailrec [i] genrec
 take <<{} [shift] times pop
 ternary binary popd
@@ -98,6 +113,7 @@ unary nullary popd
 uncons [first] [rest] cleave
 unit [] cons
 unquoted [i] dip
+unstack [[] swaack] dip swoncat swaack pop
 unswons uncons swap
 while swap nulco dupdipd concat loop
 x dup i
@@ -115,3 +131,9 @@ _mape popd reverse
 _map0 [_map1] dipd _map2
 _map1 stackd shift
 _map2 [infrst] cons dipd roll< swons
+_isnt_bool not not
+_isnt_two_bools [_isnt_bool] ii
+_\/_ [_isnt_bool] [not] branch
+/\ _isnt_two_bools [pop false] [] branch
+\/ _isnt_two_bools [] [pop true] branch
+xor [] [not] branch