Config file and CLI arg parser.
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
see_stack == good_viewer_location open_stack
|
||||
see_resources == list_resources good_viewer_location open_viewer
|
||||
open_resource_at_good_location == good_viewer_location open_resource
|
||||
see_log == "log.txt" open_resource_at_good_location
|
||||
see_definitions == "definitions.txt" open_resource_at_good_location
|
||||
round_to_cents == 100 * ++ floor 100 /
|
||||
reset_log == "del log.lines[1:] ; log.at_line = 0" evaluate
|
||||
see_menu == "menu.txt" good_viewer_location open_resource
|
||||
|
||||
# Ordered Binary Tree datastructure functions.
|
||||
BTree-new == swap [[] []] cons cons
|
||||
_BTree-P == over [popop popop first] nullary
|
||||
_BTree-T> == [cons cons dipdd] cons cons cons infra
|
||||
_BTree-T< == [cons cons dipd] cons cons cons infra
|
||||
_BTree-E == pop swap roll< rest rest cons cons
|
||||
_BTree-recur == _BTree-P [_BTree-T>] [_BTree-E] [_BTree-T<] cmp
|
||||
BTree-add == [popop not] [[pop] dipd BTree-new] [] [_BTree-recur] genrec
|
||||
@@ -0,0 +1,4 @@
|
||||
Joypy - Copyright © 2018 Simon Forman
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details right-click "warranty". This is free software, and you are welcome to redistribute it under certain conditions; right-click "sharing" for details. Right-click on these commands to see docs on UI commands: key_bindings mouse_bindings
|
||||
|
||||
<-
|
||||
@@ -0,0 +1,120 @@
|
||||
reset_log words mouse_bindings key_bindings
|
||||
|
||||
Stack Chatter
|
||||
|
||||
dup dupd dupdd over tuck
|
||||
pop popd popdd popop popopd popopdd
|
||||
swap roll< roll> rolldown rollup
|
||||
unit clear
|
||||
|
||||
Math
|
||||
|
||||
add + sub - mul * truediv / mod %
|
||||
div divmod floor pm
|
||||
abs sqr sqrt neg pow
|
||||
max min sum average product
|
||||
pred -- succ ++ lshift << rshift >>
|
||||
|
||||
Logic
|
||||
|
||||
ge gt eq le lt ne
|
||||
< <= = >= > != <>
|
||||
and & or not xor ^
|
||||
bool truthy ?
|
||||
|
||||
Combinators
|
||||
|
||||
i x b infra dip dipd dipdd dupdip dupdipd
|
||||
cleave fork app1 app2 app3 map pam
|
||||
nullary unary binary ternary
|
||||
|
||||
Control Flow
|
||||
|
||||
branch cond ifte choice
|
||||
loop while genrec primrec
|
||||
make_generator
|
||||
|
||||
List Manipulation
|
||||
|
||||
enstacken disenstacken stack unstack
|
||||
first first_two second third fourth rest rrest
|
||||
flatten drop take reverse select zip
|
||||
size sort shunt getitem
|
||||
step step_zero times
|
||||
cons ccons uncons swons unswons
|
||||
concat unique
|
||||
remove
|
||||
at of pick
|
||||
unquoted quoted
|
||||
|
||||
Misc
|
||||
|
||||
down_to_zero cmp gcd help id
|
||||
least_fraction parse quoted
|
||||
range range_to_zero
|
||||
reset_log show_log
|
||||
run
|
||||
stuncons stununcons
|
||||
swaack
|
||||
void
|
||||
|
||||
|
||||
[ ] Add logging?
|
||||
[ ] INI file?
|
||||
[ ] definitions.txt
|
||||
[ ] Integrate inference
|
||||
[ ] command to (re-)run with trace
|
||||
[ ] Backtime button?
|
||||
|
||||
|
||||
------------------------------------------
|
||||
[23 18] [unit i]
|
||||
|
||||
sqr foo == uncons mul
|
||||
|
||||
swaack
|
||||
|
||||
over [[[neg] dupdip sqr 4] dipd * * - sqrt pm] dip 2 * [/] cons app2
|
||||
|
||||
5 sqrt 2 / 0.5 +
|
||||
5 sqrt 1 + 2 /
|
||||
phi == 5 sqrt ++ 2 /
|
||||
phi == 1.618033988749895
|
||||
(But this is Lambda Abstaction sneaking in the back door.)
|
||||
=
|
||||
clear
|
||||
|
||||
(n1 n2 -- ☯)
|
||||
|
||||
2018 20 18 20 23 0.5
|
||||
472 83 / -7
|
||||
100
|
||||
|
||||
100 * floor 100 / show_log
|
||||
|
||||
[2 3] [swap truediv] infra
|
||||
|
||||
dup infra key_bindings divmod
|
||||
|
||||
1 [dup 1 <<] make_generator 23 [x popd] times first
|
||||
|
||||
mcc91 == [100 >] [10 -] [11 + mcc91 mcc91] ifte
|
||||
== [100 >] [10 -] [11 + [mcc91] [mcc91] b] ifte
|
||||
== [100 >] [10 -] [11 + [mcc91] dup b] ifte
|
||||
mcc91 == [100 >] [10 -] [11 +] [dup b] genrec
|
||||
|
||||
279841 20 20 20 202318 279841 279841 27984127984120202318
|
||||
|
||||
inscribe
|
||||
|
||||
round_to_cents == 100 * ++ floor 100 /
|
||||
|
||||
|
||||
[12 18] [[pm] infra] make_generator
|
||||
|
||||
[12 18] [[[+] [3 /] fork popopdd] infra] make_generator
|
||||
|
||||
[stack] [pop] while
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
(t.
|
||||
@@ -0,0 +1,53 @@
|
||||
|
||||
[key bindings]
|
||||
<F5> = swap
|
||||
<F6> = dup
|
||||
<Shift-F5> = roll<
|
||||
<Shift-F6> = roll>
|
||||
<F7> = over
|
||||
<Shift-F7> = tuck
|
||||
<F8> = parse
|
||||
<F12> = words
|
||||
<F1> = reset_log show_log
|
||||
<Escape> = clear reset_log show_log
|
||||
<Control-Delete> = pop
|
||||
<Control-i> = i
|
||||
|
||||
|
||||
[Definitions]
|
||||
of = swap at
|
||||
product = 1 swap [*] step
|
||||
flatten = [] swap [concat] step
|
||||
quoted = [unit] dip
|
||||
unquoted = [i] dip
|
||||
enstacken = stack [clear] dip
|
||||
? = dup truthy
|
||||
disenstacken = ? [uncons ?] loop pop
|
||||
dinfrirst = dip infra first
|
||||
nullary = [stack] dinfrirst
|
||||
unary = nullary popd
|
||||
binary = nullary [popop] dip
|
||||
ternary = unary [popop] dip
|
||||
pam = [i] map
|
||||
run = [] swap infra
|
||||
sqr = dup mul
|
||||
size = 0 swap [pop ++] step
|
||||
fork = [i] app2
|
||||
cleave = fork [popd] dip
|
||||
average = [sum 1.0 *] [size] cleave /
|
||||
gcd = 1 [tuck modulus dup 0 >] loop pop
|
||||
least_fraction = dup [gcd] infra [div] concat map
|
||||
*fraction = [uncons] dip uncons [swap] dip concat [*] infra [*] dip cons
|
||||
*fraction0 = concat [[swap] dip * [*] dip] infra
|
||||
down_to_zero = [0 >] [dup --] while
|
||||
range_to_zero = unit [down_to_zero] infra
|
||||
anamorphism = [pop []] swap [dip swons] genrec
|
||||
range = [0 <=] [1 - dup] anamorphism
|
||||
while = swap [nullary] cons dup dipd concat loop
|
||||
dupdipd = dup dipd
|
||||
primrec = [i] genrec
|
||||
step_zero = 0 roll> step
|
||||
codireco = cons dip rest cons
|
||||
make_generator = [codireco] ccons
|
||||
ifte = [nullary not] dipd branch
|
||||
|
||||
Reference in New Issue
Block a user