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 >=
|
||||
<{} [] swap
|
||||
<<{} [] rollup
|
||||
<< lshift
|
||||
>> rshift
|
||||
abs dup 0 < [] [neg] branch
|
||||
anamorphism [pop []] swap [dip swons] genrec
|
||||
app1 grba infrst
|
||||
|
|
@ -54,14 +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 [] concat bool not
|
||||
null [] swap concat bool not
|
||||
nullary [stack] dinfrirst
|
||||
of swap at
|
||||
over [dup] dip swap
|
||||
pam [i] map
|
||||
pm [+] [-] clop
|
||||
popd [pop] dip
|
||||
|
|
@ -82,6 +86,7 @@ roll< swapd swap
|
|||
rollup roll>
|
||||
rolldown roll<
|
||||
rrest rest rest
|
||||
rshift [2 /] times
|
||||
run <{} infra
|
||||
second rest first
|
||||
shift uncons [swons] dip
|
||||
|
|
@ -126,6 +131,8 @@ _mape popd reverse
|
|||
_map0 [_map1] dipd _map2
|
||||
_map1 stackd shift
|
||||
_map2 [infrst] cons dipd roll< swons
|
||||
_\/_ [not not] [not] branch
|
||||
/\ [not not] ii [pop false] [] branch
|
||||
\/ [not not] ii [] [pop true] branch
|
||||
_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
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ 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 -
|
||||
|
|
@ -85,6 +86,7 @@ roll< swapd swap
|
|||
rollup roll>
|
||||
rolldown roll<
|
||||
rrest rest rest
|
||||
rshift [2 /] times
|
||||
run <{} infra
|
||||
second rest first
|
||||
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 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? "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))
|
||||
|
|
|
|||
Loading…
Reference in New Issue