1
0
forked from osmarks/potatOS

heavlisp "improvements"

This commit is contained in:
osmarks 2021-01-29 23:33:15 +00:00
parent 78d22d9f66
commit 5e67897a70
5 changed files with 63 additions and 5 deletions

View File

@ -5,6 +5,7 @@ cp src/polychoron.lua dist/startup
cp -r src/xlib/ dist cp -r src/xlib/ dist
cp -r src/signing-key.tbl dist cp -r src/signing-key.tbl dist
cp -r src/LICENSES dist cp -r src/LICENSES dist
cp -r src/stdlib.hvl dist
cp -r src/bin/ dist cp -r src/bin/ dist
cp src/potatobios.lua dist/ cp src/potatobios.lua dist/
luabundler bundle src/main.lua -p "src/lib/?.lua" | perl -pe 'chomp if eof' > dist/autorun.lua luabundler bundle src/main.lua -p "src/lib/?.lua" | perl -pe 'chomp if eof' > dist/autorun.lua

View File

@ -1,2 +1,2 @@
{"build":184,"description":"mild efficiency improvement on updates (fix even more so)","files":{"LICENSES":"f3549d84d66eb53dd4a421a4341d77d3d217c1b117d67e3be8f5211adcda0952","autorun.lua":"e8bcec7203fac0d544affd2ca1c23189f66b8648a99d9b5aaca4c418e981a045","bin/5rot26.lua":"91b66cd6d4b33081b25c456142dd7efcb894e819e842693c9e1e17ff48872ff5","bin/ccemux.lua":"239476f58835b86bbcac31ce8af3c3acd3d198a55ab9ada78c62fbf358625a98","bin/chronometer.lua":"db5363993a04382145aef7db2fbe262f0bf10697a589e1e2d2f9ce0f87430dd8","bin/kristminer.lua":"7e7f9fe2a6493d584ad6926cda915e02c1c3d800dc209680898ce930d0bb0e6f","bin/livegps.lua":"c3d17d495cda01aa1261e4c4fcd43439b29af422671972117ec34f68e32c5bba","bin/loading.lua":"c85f7aa1765170325155b921c1fceeb62643f552f12d41b529a22af3a67f5a97","bin/potatoflight.lua":"2fbb0b6f8d78728d8cb0ec64af1bc598bd00cb55f202378e7acdb86bba71efd1","bin/potatoplex.lua":"86c9e7597bbe23d7de7e7f1bfc976d0b94dcdf3af9e6c7c6c9b18b98596898c8","bin/relay.lua":"261ae6c220b83506e3326e8f2b091d246baae458ff0d2ee87512be2c4e35a75d","bin/tryhaskell.lua":"07810d85145da65a3e434154c79d5a9d72f2dcbe59c8d6829040fb925df878ec","potatobios.lua":"7593e0f9d0755eea05e3c0fff5c4c9e036745a8cbc20e9e19609d8743a77b87e","signing-key.tbl":"b32af5229c23af3bc03d538e42751b26044e404a7b1af064ed89894efe421607","startup":"f17bfb9b4322c4467dc9170d50827f2d75717e5c3125d734f21f3406657917bc","update-key.hex":"8d8afb7a45833bb7d68f929421ad60a211d4d73e0ee03b24dc0106ba1de2e1a0","xlib/00_cbor.lua":"464b075e4f094b8db42506bd4bdaad0db87699ea7fbf80e5b87739b4aa9279af","xlib/01_skynet.lua":"9cb565d639a0acd7c763c3e7422482532cd0bda0cdfcc720089ab4a87e551339","xlib/03_heavlisp.lua":"dfdd5ccbaa8d3b761d9c517e4c8db8121a1ace508d4232af8f5a9cc9c876bcaf"},"sizes":{"LICENSES":4725,"autorun.lua":182288,"bin/5rot26.lua":914,"bin/ccemux.lua":1673,"bin/chronometer.lua":1152,"bin/kristminer.lua":5566,"bin/livegps.lua":980,"bin/loading.lua":7707,"bin/potatoflight.lua":3417,"bin/potatoplex.lua":6526,"bin/relay.lua":3075,"bin/tryhaskell.lua":1867,"potatobios.lua":71272,"signing-key.tbl":190,"startup":8313,"update-key.hex":44,"xlib/00_cbor.lua":15808,"xlib/01_skynet.lua":3286,"xlib/03_heavlisp.lua":15399},"timestamp":1611962580} {"build":188,"description":"heavlisp stdlib bundling fix (throwerror should really throw an error)","files":{"LICENSES":"f3549d84d66eb53dd4a421a4341d77d3d217c1b117d67e3be8f5211adcda0952","autorun.lua":"af5c21733a989d61aaed06788d818bbc96a3f7e13e16c57c9bf4d833b6cc3848","bin/5rot26.lua":"91b66cd6d4b33081b25c456142dd7efcb894e819e842693c9e1e17ff48872ff5","bin/ccemux.lua":"239476f58835b86bbcac31ce8af3c3acd3d198a55ab9ada78c62fbf358625a98","bin/chronometer.lua":"db5363993a04382145aef7db2fbe262f0bf10697a589e1e2d2f9ce0f87430dd8","bin/kristminer.lua":"7e7f9fe2a6493d584ad6926cda915e02c1c3d800dc209680898ce930d0bb0e6f","bin/livegps.lua":"c3d17d495cda01aa1261e4c4fcd43439b29af422671972117ec34f68e32c5bba","bin/loading.lua":"c85f7aa1765170325155b921c1fceeb62643f552f12d41b529a22af3a67f5a97","bin/potatoflight.lua":"2fbb0b6f8d78728d8cb0ec64af1bc598bd00cb55f202378e7acdb86bba71efd1","bin/potatoplex.lua":"86c9e7597bbe23d7de7e7f1bfc976d0b94dcdf3af9e6c7c6c9b18b98596898c8","bin/relay.lua":"261ae6c220b83506e3326e8f2b091d246baae458ff0d2ee87512be2c4e35a75d","bin/tryhaskell.lua":"07810d85145da65a3e434154c79d5a9d72f2dcbe59c8d6829040fb925df878ec","potatobios.lua":"7593e0f9d0755eea05e3c0fff5c4c9e036745a8cbc20e9e19609d8743a77b87e","signing-key.tbl":"b32af5229c23af3bc03d538e42751b26044e404a7b1af064ed89894efe421607","startup":"f17bfb9b4322c4467dc9170d50827f2d75717e5c3125d734f21f3406657917bc","stdlib.hvl":"a6fd2620068f47794a9bbeed77bee3fd4962f848e6dd7c75137b30cd5665272e","update-key.hex":"8d8afb7a45833bb7d68f929421ad60a211d4d73e0ee03b24dc0106ba1de2e1a0","xlib/00_cbor.lua":"464b075e4f094b8db42506bd4bdaad0db87699ea7fbf80e5b87739b4aa9279af","xlib/01_skynet.lua":"9cb565d639a0acd7c763c3e7422482532cd0bda0cdfcc720089ab4a87e551339","xlib/03_heavlisp.lua":"82cdabd5286058c0ea4f27956f8c1144e198769c8b8ce9e91b26c930d711f710"},"sizes":{"LICENSES":4725,"autorun.lua":182346,"bin/5rot26.lua":914,"bin/ccemux.lua":1673,"bin/chronometer.lua":1152,"bin/kristminer.lua":5566,"bin/livegps.lua":980,"bin/loading.lua":7707,"bin/potatoflight.lua":3417,"bin/potatoplex.lua":6526,"bin/relay.lua":3075,"bin/tryhaskell.lua":1867,"potatobios.lua":71272,"signing-key.tbl":190,"startup":8313,"stdlib.hvl":851,"update-key.hex":44,"xlib/00_cbor.lua":15808,"xlib/01_skynet.lua":3286,"xlib/03_heavlisp.lua":15643},"timestamp":1611963170}
{"hash":"998e6650ac5d772d3c594cb2bbdfb5d1bd6c166916dcfd70379146ce15c4e893","sig":"07110cf31af9f23d6da75999a4ec13a01d87709a27f6a31a656560e014761ed8aa43ef3f1a5d2ca6630a"} {"hash":"68bbb5e12a6d76f3a5d38ba953a0b921bb609747daf61d18b9742e3f84ed7e63","sig":"c19cad6e6cb04d899318a782861cb0c0a59012f517519c11413125f92e7317d1ba1f5406643ee18be41b"}

View File

@ -1426,7 +1426,8 @@ else
elseif textutils.unserialise(value) ~= nil then value = textutils.unserialise(value) end elseif textutils.unserialise(value) ~= nil then value = textutils.unserialise(value) end
potatOS.registry.set(key, value) potatOS.registry.set(key, value)
end end
]] ]],
["/rom/heavlisp_lib/stdlib.hvl"] = fproxy "stdlib.hvl"
} }
for _, file in pairs(fs.list "bin") do for _, file in pairs(fs.list "bin") do

52
src/stdlib.hvl Normal file
View File

@ -0,0 +1,52 @@
(newvar '- [(+ arg1 (negate arg2))])
(newvar '-- [(- arg1 1)])
(newvar '++ [(+ arg1 1)])
(newvar '!! [
(if arg1 [false] [true])
])
(newvar 'ztb [
(if (== arg1 0) [false] [if (== arg1 false) [false] [true]])
])
(newvar 'ifz [
(if (ztb arg1) arg2 arg3)
])
(newvar 'inz [
(if (!! (ztb arg1)) arg2 arg3)
])
(newvar '! [
(inz arg1 [1] [(*
arg1
(! (-- arg1))
)])
])
(newvar 'for [
(if (arg2 arg1) [
(arg3 arg1)
(for (++ arg1) arg2 arg3)
][true])
])
(newvar 'inrng [
(for arg1 [(< arg1 (++ arg2))] arg3)
])
(newvar 'internal_in [
(newvar 'a arg1)
(newvar 'k (keys arg1) )
(inrng 1 (len arg1) [
(arg2 (at k arg1) (at a (at k arg1)))
])
])
(newvar 'in [
(internal_in arg1 arg2)
])
('exports
'- -
'-- --
'++ ++
'ifz ifz
'inz inz
'!! !!
'! !
'for for
'inrng inrng
'in in
)

View File

@ -275,8 +275,12 @@ function interpret(ast,imports)
end end
end end
local function throwerror(reason) local function throwerror(reason)
print("line "..cline..": "..reason) if os.exit then
os.exit(1) print("line "..cline..": "..reason)
os.exit(1)
else
error("line "..cline..": "..reason)
end
end end
local function get(k) local function get(k)
local t=top() local t=top()