A few more functions.

reverse, shift, shunt, take, split_at
This commit is contained in:
Simon Forman 2019-08-09 07:26:37 -07:00
parent 712f0a0267
commit b9ae00cecb
2 changed files with 9 additions and 1 deletions

View File

@ -12,6 +12,7 @@ b == [i] dip i
binary == unary popd
ccons == cons cons
cleave == fork popdd
clop == cleave popdd
codireco == cons dip rest cons
dinfrirst == dip infrst
disenstacken == ? [uncons ?] loop pop
@ -37,7 +38,7 @@ neg == 0 swap -
nullary == [stack] dinfrirst
of == swap at
pam == [i] map
pm == [+] [-] cleave popdd
pm == [+] [-] clop
popd == [pop] dip
popdd == [pop] dipd
popop == pop pop
@ -48,14 +49,19 @@ product == 1 swap [*] step
quoted == [unit] dip
range == [0 <=] [1 - dup] anamorphism
range_to_zero == unit [down_to_zero] infra
reverse == [] swap shunt
rrest == rest rest
run == [] swap infra
second == rest first
shift == uncons [swons] dip
shunt == [swons] step
size == 0 swap [pop ++] step
split_at == [drop] [take] clop
sqr == dup *
step_zero == 0 roll> step
sum == 0 swap [+] step
swons == swap cons
take == [] rolldown [shift] times pop
ternary == binary popd
third == rest second
unary == nullary popd

View File

@ -175,6 +175,8 @@ func(dupd, [A, B|S], [A, B, B|S]).
func(over, [A, B|S], [B, A, B|S]).
func(tuck, [A, B|S], [A, B, A|S]).
func(shift, [[B|A], C|D], [A, [B|C]|D]).
func(rollup, Si, So) :- func(rolldown, So, Si).
func(uncons, Si, So) :- func(cons, So, Si).