Math ops, definitions for left- and right-shift.
This commit is contained in:
parent
99f01bec1f
commit
00f4bfcacd
|
|
@ -12,6 +12,8 @@ or nulco [nullary] dip [true] branch
|
||||||
!- 0 >=
|
!- 0 >=
|
||||||
<{} [] swap
|
<{} [] swap
|
||||||
<<{} [] rollup
|
<<{} [] rollup
|
||||||
|
<< lshift
|
||||||
|
>> rshift
|
||||||
abs dup 0 < [] [neg] branch
|
abs dup 0 < [] [neg] branch
|
||||||
anamorphism [pop []] swap [dip swons] genrec
|
anamorphism [pop []] swap [dip swons] genrec
|
||||||
app1 grba infrst
|
app1 grba infrst
|
||||||
|
|
@ -54,14 +56,16 @@ ifte [nullary] dipd swap branch
|
||||||
ii [dip] dupdip i
|
ii [dip] dupdip i
|
||||||
infra swons swaack [i] dip swaack
|
infra swons swaack [i] dip swaack
|
||||||
infrst infra first
|
infrst infra first
|
||||||
|
lshift [2 *] times
|
||||||
make_generator [codireco] ccons
|
make_generator [codireco] ccons
|
||||||
mod %
|
mod %
|
||||||
neg 0 swap -
|
neg 0 swap -
|
||||||
not [true] [false] branch
|
not [true] [false] branch
|
||||||
nulco [nullary] cons
|
nulco [nullary] cons
|
||||||
null [] concat bool not
|
null [] swap concat bool not
|
||||||
nullary [stack] dinfrirst
|
nullary [stack] dinfrirst
|
||||||
of swap at
|
of swap at
|
||||||
|
over [dup] dip swap
|
||||||
pam [i] map
|
pam [i] map
|
||||||
pm [+] [-] clop
|
pm [+] [-] clop
|
||||||
popd [pop] dip
|
popd [pop] dip
|
||||||
|
|
@ -82,6 +86,7 @@ roll< swapd swap
|
||||||
rollup roll>
|
rollup roll>
|
||||||
rolldown roll<
|
rolldown roll<
|
||||||
rrest rest rest
|
rrest rest rest
|
||||||
|
rshift [2 /] times
|
||||||
run <{} infra
|
run <{} infra
|
||||||
second rest first
|
second rest first
|
||||||
shift uncons [swons] dip
|
shift uncons [swons] dip
|
||||||
|
|
@ -126,6 +131,8 @@ _mape popd reverse
|
||||||
_map0 [_map1] dipd _map2
|
_map0 [_map1] dipd _map2
|
||||||
_map1 stackd shift
|
_map1 stackd shift
|
||||||
_map2 [infrst] cons dipd roll< swons
|
_map2 [infrst] cons dipd roll< swons
|
||||||
_\/_ [not not] [not] branch
|
_isnt_bool not not
|
||||||
/\ [not not] ii [pop false] [] branch
|
_isnt_two_bools [_isnt_bool] ii
|
||||||
\/ [not not] ii [] [pop true] branch
|
_\/_ [_isnt_bool] [not] branch
|
||||||
|
/\ _isnt_two_bools [pop false] [] branch
|
||||||
|
\/ _isnt_two_bools [] [pop true] branch
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ ifte [nullary] dipd swap branch
|
||||||
ii [dip] dupdip i
|
ii [dip] dupdip i
|
||||||
infra swons swaack [i] dip swaack
|
infra swons swaack [i] dip swaack
|
||||||
infrst infra first
|
infrst infra first
|
||||||
|
lshift [2 *] times
|
||||||
make_generator [codireco] ccons
|
make_generator [codireco] ccons
|
||||||
mod %
|
mod %
|
||||||
neg 0 swap -
|
neg 0 swap -
|
||||||
|
|
@ -85,6 +86,7 @@ roll< swapd swap
|
||||||
rollup roll>
|
rollup roll>
|
||||||
rolldown roll<
|
rolldown roll<
|
||||||
rrest rest rest
|
rrest rest rest
|
||||||
|
rshift [2 /] times
|
||||||
run <{} infra
|
run <{} infra
|
||||||
second rest first
|
second rest first
|
||||||
shift uncons [swons] dip
|
shift uncons [swons] dip
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,14 @@
|
||||||
((is-it? "+") ((joy-func +) stack expression dict))
|
((is-it? "+") ((joy-func +) stack expression dict))
|
||||||
((is-it? "-") ((joy-func -) stack expression dict))
|
((is-it? "-") ((joy-func -) stack expression dict))
|
||||||
((is-it? "*") ((joy-func *) stack expression dict))
|
((is-it? "*") ((joy-func *) stack expression dict))
|
||||||
|
((is-it? "/") ((joy-func quotient) stack expression dict)) ; but for negative divisor, no!?
|
||||||
|
((is-it? "%") ((joy-func modulo) stack expression dict))
|
||||||
|
|
||||||
|
((is-it? "add") ((joy-func +) stack expression dict))
|
||||||
|
((is-it? "sub") ((joy-func -) stack expression dict))
|
||||||
((is-it? "mul") ((joy-func *) stack expression dict))
|
((is-it? "mul") ((joy-func *) stack expression dict))
|
||||||
|
((is-it? "div") ((joy-func quotient) stack expression dict)) ; but for negative divisor, no!?
|
||||||
|
((is-it? "mod") ((joy-func modulo) stack expression dict))
|
||||||
|
|
||||||
((is-it? "<") ((joy-func <) stack expression dict))
|
((is-it? "<") ((joy-func <) stack expression dict))
|
||||||
((is-it? ">") ((joy-func >) stack expression dict))
|
((is-it? ">") ((joy-func >) stack expression dict))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue