From 3e2bfcb800eca390c30da9eb6ba206fa33c9a32b Mon Sep 17 00:00:00 2001 From: Reuben Brooks Date: Tue, 14 Jul 2026 15:05:25 -0400 Subject: [PATCH] stdlib: load the standard library from S-lineage lib/StLib sources MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Retire the community stlib.kl overlay. Tarver's S41.2 (2026-07-11) refresh no longer ships the standard library as a precompiled KLambda blob; it ships Shen sources under Lib/StLib that the SBCL distribution loads into the image at install time. shen-lua now does the equivalent. - Vendor the S-lineage stdlib sources under lib/StLib/ (28 files, byte-identical to the mirror pyrex41/shen-upstream tag s41.2-pristine-20260711 / commit 11fc51b, formerly pyrex41/shen-s41.1). See lib/StLib/PROVENANCE.md. - Delete klambda/stlib.kl and drop it from the boot FILES list. - boot.lua load_stdlib(): run upstream's own install.shen (file order, factorise toggles, the package + systemf externals block) with two mechanical rewrites — relative (load "…") paths made absolute (no chdir needed), and (tc +) neutralised to (tc -) so the stdlib loads without typechecking. Called from initialise(), the single chokepoint every boot path runs (CLI, port specs, kernel certification). SHEN_NO_STDLIB=1 opts out; SHEN_STDLIB_DIR overrides the location. - Loading through the kernel's define pipeline (not raw stlib.kl defuns) registers each function's arity + shen.*lambdatable* entry, which FIXES the long-standing quirk where a bare (fn filter) / top-level (filter …) raised "fn: filter is undefined" (the old stlib.kl never called stlib.initialise, so those functions had runtime arity -1). - Single-file bundle: make-bundle.lua embeds the lib/StLib tree; load_stdlib materialises it to a temp dir at boot, so the bundle stays self-contained (and is smaller — the compact .shen sources replace the 366 KB stlib.kl). - Tests: new test/stdlib_spec.lua locks the (fn filter) / bare-(filter …) regression; library_spec.lua's "filter/take absent" assertions flipped to present-and-correct. Loaded with (tc -), so stdlib functions carry no registered type signatures — unchanged from the pre-refresh overlay. A typed stdlib (tc +) is a deliberate future option; it is slower and eagerly initialises the native typecheck drivers. Tests (LuaJIT 2.1): port specs 482/0 across 13 specs; kernel certification 134/134; bundle builds + boots standalone with stdlib live. Co-Authored-By: Claude Fable 5 --- README.md | 5 +- boot.lua | 113 ++++- build/make-bundle.lua | 26 +- klambda/PROVENANCE.md | 44 +- klambda/README.md | 15 +- klambda/stlib.kl | 738 -------------------------------- lib/StLib/Calendar/date.shen | 160 +++++++ lib/StLib/Data/data.shen | 26 ++ lib/StLib/IO/delete-file.shen | 7 + lib/StLib/IO/files.shen | 83 ++++ lib/StLib/IO/prettyprint.shen | 83 ++++ lib/StLib/Lists/lists.shen | 267 ++++++++++++ lib/StLib/Lists/lists.shen.kl | 110 +++++ lib/StLib/Maths/complex.dtype | 31 ++ lib/StLib/Maths/complex.shen | 38 ++ lib/StLib/Maths/macros.shen | 55 +++ lib/StLib/Maths/maths.shen | 542 +++++++++++++++++++++++ lib/StLib/Maths/numerals.dtype | 47 ++ lib/StLib/Maths/numerals.shen | 91 ++++ lib/StLib/Maths/r.shen | 6 + lib/StLib/Maths/rationals.dtype | 31 ++ lib/StLib/Maths/rationals.shen | 126 ++++++ lib/StLib/PROVENANCE.md | 55 +++ lib/StLib/README.txt | 1 + lib/StLib/Strings/macros.shen | 3 + lib/StLib/Strings/regex.shen | 286 +++++++++++++ lib/StLib/Strings/smart.shen | 60 +++ lib/StLib/Strings/smartmem.shen | 63 +++ lib/StLib/Strings/strings.shen | 300 +++++++++++++ lib/StLib/Symbols/symbols1.shen | 10 + lib/StLib/Symbols/symbols2.shen | 9 + lib/StLib/Tuples/tuples.shen | 30 ++ lib/StLib/Vectors/macros.shen | 26 ++ lib/StLib/install.shen | 51 +++ lib/StLib/package-stlib.shen | 4 + scripts/run-tests.lua | 1 + test/library_spec.lua | 30 +- test/stdlib_spec.lua | 53 +++ 38 files changed, 2831 insertions(+), 795 deletions(-) delete mode 100644 klambda/stlib.kl create mode 100644 lib/StLib/Calendar/date.shen create mode 100644 lib/StLib/Data/data.shen create mode 100644 lib/StLib/IO/delete-file.shen create mode 100644 lib/StLib/IO/files.shen create mode 100644 lib/StLib/IO/prettyprint.shen create mode 100644 lib/StLib/Lists/lists.shen create mode 100644 lib/StLib/Lists/lists.shen.kl create mode 100644 lib/StLib/Maths/complex.dtype create mode 100644 lib/StLib/Maths/complex.shen create mode 100644 lib/StLib/Maths/macros.shen create mode 100644 lib/StLib/Maths/maths.shen create mode 100644 lib/StLib/Maths/numerals.dtype create mode 100644 lib/StLib/Maths/numerals.shen create mode 100644 lib/StLib/Maths/r.shen create mode 100644 lib/StLib/Maths/rationals.dtype create mode 100644 lib/StLib/Maths/rationals.shen create mode 100644 lib/StLib/PROVENANCE.md create mode 100644 lib/StLib/README.txt create mode 100644 lib/StLib/Strings/macros.shen create mode 100644 lib/StLib/Strings/regex.shen create mode 100644 lib/StLib/Strings/smart.shen create mode 100644 lib/StLib/Strings/smartmem.shen create mode 100644 lib/StLib/Strings/strings.shen create mode 100644 lib/StLib/Symbols/symbols1.shen create mode 100644 lib/StLib/Symbols/symbols2.shen create mode 100644 lib/StLib/Tuples/tuples.shen create mode 100644 lib/StLib/Vectors/macros.shen create mode 100644 lib/StLib/install.shen create mode 100644 lib/StLib/package-stlib.shen create mode 100644 test/stdlib_spec.lua diff --git a/README.md b/README.md index cd639d6..bbb4163 100644 --- a/README.md +++ b/README.md @@ -281,8 +281,9 @@ browser. One `rules.shen`, two runtimes, no client/server drift. See its ## Certification / Testing -The port loads and initialises the full 41.2 kernel (including `stlib` and the new -extensions) and **passes the official 41.2 kernel test suite, 134/134**: +The port loads and initialises the full 41.2 kernel plus the standard library +(loaded at boot from the S-lineage Shen sources under `lib/StLib/`) and the +extensions, and **passes the official 41.2 kernel test suite, 134/134**: ```sh luajit run-kernel-tests.lua # => "passed ... 134 / failed ... 0 / pass rate ... 100%" diff --git a/boot.lua b/boot.lua index 8c6ceac..b40ab55 100644 --- a/boot.lua +++ b/boot.lua @@ -93,17 +93,19 @@ P.KLDIR = KLDIR -- resolved .kl directory (trailing /), for typecheck_native -- types; the refresh moved shen.rectify-type into t-star, so t-star must -- now precede types. Hence the tail: macros declarations t-star types. -- --- The trailing four are the community ShenOSKernel extensions + stlib, which --- Tarver's refresh no longer ships as KLambda (stlib is now lazy Shen sources --- under Lib/StLib). shen-lua keeps vendoring them on top so the standard --- library and the CLI launcher stay available and the kernel test suite still --- certifies. They are pure defuns/defmacros and reference only public kernel --- functions (get/put/… — never the removed dict.* or shen.initialise-*), so --- they load unchanged against the refreshed kernel. See klambda/PROVENANCE.md. +-- The trailing three are the community ShenOSKernel extensions, which Tarver's +-- refresh no longer ships as KLambda. shen-lua keeps vendoring them on top so +-- the CLI launcher etc. stay available; they are pure defuns/defmacros +-- referencing only public kernel functions, so they load unchanged. +-- +-- NOTE: stlib is NOT here. The standard library is no longer a precompiled +-- klambda/stlib.kl; it is loaded from the S-lineage Shen sources under +-- lib/StLib/ by load_stdlib() (below), which the refresh's own install.shen +-- drives. See lib/StLib/PROVENANCE.md and klambda/PROVENANCE.md. local FILES = { "yacc","core","load","prolog","reader","sequent","sys","toplevel", "track","writer","backend","macros","declarations","t-star","types", - "extension-features","extension-expand-dynamic","extension-launcher","stlib" + "extension-features","extension-expand-dynamic","extension-launcher" } -- ---- standard streams ---------------------------------------------------- @@ -830,6 +832,96 @@ local function install_fasl() end -- ---- initialise ---------------------------------------------------------- +-- ---- standard library (S-lineage lib/StLib sources) ---------------------- +-- Tarver's S41.2 refresh ships the standard library as Shen SOURCES under +-- Lib/StLib (loaded into the SBCL image at install time), not as a precompiled +-- stlib.kl. shen-lua vendors those sources under lib/StLib/ and loads them the +-- same way: through the kernel's own (load ...) / define pipeline. Unlike raw +-- stlib.kl defuns (which the pre-refresh port booted as a kernel module), the +-- define path registers each function's arity property + shen.*lambdatable* +-- entry, so `(fn filter)` and a bare top-level `(filter ...)` now resolve +-- instead of raising "fn: filter is undefined". +-- +-- We run upstream's own install.shen (its factorise toggles, the package + +-- systemf externals block, everything) with two mechanical rewrites: +-- 1. its relative (load "Sub/file.shen") paths are made absolute against the +-- vendored directory, so no process chdir is needed (a chdir would +-- invalidate the KLDIR-relative reads the fasl kernel-key hashing does); +-- 2. its (tc +) toggles are neutralised to (tc -), i.e. the stdlib is loaded +-- WITHOUT typechecking. This matches the pre-refresh behaviour (the old +-- precompiled stlib.kl registered no stdlib type signatures either — its +-- stlib.initialise was never called), it is markedly faster, and it keeps +-- the native typecheck drivers deferred at boot (a tc+ load would trigger +-- the typechecker and translate them eagerly). Functions are still fully +-- defined and arity-registered — only their type signatures are skipped. +-- SHEN_NO_STDLIB=1 skips the whole thing (a kernel-only embed); SHEN_STDLIB_DIR +-- overrides the location. +local STDLIB_LOADED = false +local function find_stdlib_dir() + local env = os.getenv("SHEN_STDLIB_DIR") + if env and env ~= "" then return env end + -- module-relative first (chdir-independent: boot.lua sits at the repo root) + local src = debug.getinfo(1, "S").source + local here = src:match("^@(.*)[/\\][^/\\]*$") + local candidates = {} + if here then candidates[#candidates+1] = here .. "/lib/StLib" end + candidates[#candidates+1] = "lib/StLib" + for _, d in ipairs(candidates) do + local f = io.open(d .. "/install.shen", "r") + if f then f:close(); return d end + end + -- Single-file bundle: no lib/StLib on disk, but make-bundle.lua embedded the + -- whole tree as P.STDLIB_SOURCES (relpath -> content). Materialise it once to + -- a temp dir and load from there (reuses the ordinary file-based load path). + if P.STDLIB_SOURCES then + local base = os.tmpname(); os.remove(base) + os.execute("mkdir -p '" .. base .. "'") + for rel, content in pairs(P.STDLIB_SOURCES) do + local full = base .. "/" .. rel + local sub = full:match("^(.*)/[^/]*$") + if sub then os.execute("mkdir -p '" .. sub .. "'") end + local fh = io.open(full, "wb") + if fh then fh:write(content); fh:close() end + end + return base + end + return nil +end + +local function load_stdlib(verbose) + if STDLIB_LOADED then return end + if os.getenv("SHEN_NO_STDLIB") == "1" then return end + local dir = find_stdlib_dir() + if not dir then + if verbose then io.stderr:write(" stdlib: lib/StLib not found; skipping (kernel-only)\n") end + return + end + local script = read_file(dir .. "/install.shen") + if not script then return end + -- Rewrite the relative (load "X") targets to absolute so no chdir is needed. + -- All install.shen load paths are relative; the replacement text is escaped + -- for gsub's % handling. + local prefix = ("(load \"" .. dir .. "/"):gsub("%%", "%%%%") + script = script:gsub('%(load "', prefix) + script = script:gsub("%(tc %+%)", "(tc -)") -- load without typechecking (see above) + local hush0 = P.GLOBALS["*hush*"] + P.GLOBALS["*hush*"] = true -- suppress the ~20 "loaded" echoes + local ok, err = pcall(function() + local forms = P.F["read-from-string"](script) + while R.is_cons(forms) do + P.F["eval"](forms[1]) + forms = forms[2] + end + end) + P.GLOBALS["*hush*"] = hush0 + if not ok then + error("stdlib load failed: " .. tostring(P.F["error-to-string"](err)), 0) + end + STDLIB_LOADED = true + if verbose then io.stderr:write(" loaded stdlib from " .. dir .. "\n") end +end +P.load_stdlib = load_stdlib + local function initialise() -- Kernel environment setup (env globals, *property-vector*, arity table). -- @@ -846,6 +938,11 @@ local function initialise() -- Register the lua.* interop entries in Shen's own arity/lambda-form -- tables (needs the *property-vector* the kernel just created). require("lua_interop").post_initialise() + -- Load the standard library from its S-lineage Shen sources (lib/StLib). + -- Done here, at the single post-kernel-init chokepoint every boot path runs + -- (shen.boot, run-kernel-tests, the port specs), so the stdlib is present + -- for all of them. SHEN_NO_STDLIB=1 opts out. + load_stdlib() return r end diff --git a/build/make-bundle.lua b/build/make-bundle.lua index 6218a04..577c31b 100644 --- a/build/make-bundle.lua +++ b/build/make-bundle.lua @@ -70,8 +70,24 @@ do if nm then kl_names[#kl_names + 1] = nm end end p:close() - -- 20 vendored .kl: 15 refreshed S41.2 kernel modules + stlib + 4 extensions. - assert(#kl_names >= 20, "klambda/ looks incomplete (" .. #kl_names .. " files)") + -- 19 vendored .kl: 15 refreshed S41.2 kernel modules + 4 extensions + -- (the standard library is no longer a .kl — see the stdlib payload below). + assert(#kl_names >= 19, "klambda/ looks incomplete (" .. #kl_names .. " files)") +end + +-- Standard-library Shen sources (lib/StLib). The refresh ships stdlib as +-- sources, loaded at boot by boot.lua load_stdlib; embed the whole tree +-- (relative paths, incl. install.shen) so the bundle stays self-contained. +-- On boot with no lib/StLib on disk, load_stdlib materialises these to a temp +-- dir and loads from there. +local stdlib_names = {} +do + local p = io.popen("cd '" .. root .. "/lib/StLib' && find . -type f | sed 's|^\\./||'") + for line in p:lines() do + if line ~= "" then stdlib_names[#stdlib_names + 1] = line end + end + p:close() + assert(#stdlib_names >= 20, "lib/StLib looks incomplete (" .. #stdlib_names .. " files)") end -- ---- 3. emit --------------------------------------------------------------- @@ -106,6 +122,11 @@ for _, nm in ipairs(kl_names) do emit(("kl[%q] = %s\n"):format(nm, quote(read_file(root .. "/klambda/" .. nm .. ".kl")))) end +emit("\nlocal stdlib = {}\n") +for _, rel in ipairs(stdlib_names) do + emit(("stdlib[%q] = %s\n"):format(rel, quote(read_file(root .. "/lib/StLib/" .. rel)))) +end + emit("\nlocal KERNEL = " .. quote(blob) .. "\n") emit([[ @@ -122,6 +143,7 @@ end local P = require("boot") P.KERNEL_CACHE_DATA = KERNEL -- boot.load_kernel() takes the embedded path P.KL_SOURCES = kl -- source fallback for a foreign LuaJIT +P.STDLIB_SOURCES = stdlib -- lib/StLib tree; load_stdlib materialises it return require("shen") ]]) diff --git a/klambda/PROVENANCE.md b/klambda/PROVENANCE.md index 9430814..6bbb075 100644 --- a/klambda/PROVENANCE.md +++ b/klambda/PROVENANCE.md @@ -54,40 +54,36 @@ that tag — equivalently, to the zip's `KLambda/` directory (both verified with `-signedfuncs` / `-environment` are gone; `shen.initialise-lambda-tables` (~renamed) and the arity table remain. - **Removed: `stlib.kl`** — the standard library is no longer shipped as a - precompiled KLambda blob; upstream now ships it as **lazy Shen sources** under - `Lib/StLib/` to be loaded on demand. See section 2 for how shen-lua bridges - this gap. + precompiled KLambda blob; upstream now ships it as **Shen sources** under + `Lib/StLib/`. shen-lua vendors those sources under `lib/StLib/` and loads them + at boot (see section 2 and `lib/StLib/PROVENANCE.md`); `stlib.kl` is gone. - Other renames observed: `hush` → `shen.hush`, `input+` → `shen.input-h+` / `shen.process-input+`, plus new `shen.rdecons`, `shen.shen`, pointer helpers. -## 2. Standard library + extensions — community ShenOSKernel-41.2 (retained) +## 2. Extensions — community ShenOSKernel-41.2 (retained); stdlib moved out -Because Tarver's refresh no longer ships a precompiled `stlib.kl` and shen-lua -does not yet have a lazy `Lib/StLib` loader, these five files are **retained -byte-identical from the community `ShenOSKernel-41.2`** release -(zip SHA-256 `49f1b85d02348d9b3ebc461570c5c56cc066270ab81e35d5257625fb9d17fe82`) -so the standard library and the CLI launcher stay available and the kernel test -suite still certifies 134/134: +**Extensions.** Tarver's refresh does not ship these; they are **retained +byte-identical from the community `ShenOSKernel-41.2`** release (zip SHA-256 +`49f1b85d02348d9b3ebc461570c5c56cc066270ab81e35d5257625fb9d17fe82`) so the CLI +launcher etc. stay available: -- `stlib.kl` — the precompiled standard library (`filter`, `take`, `drop`, - `reduce`, string/list/vector helpers, …). - `extension-features.kl`, `extension-expand-dynamic.kl` — booted. - `extension-launcher.kl` — booted; provides the launcher the CLI can use. - `extension-programmable-pattern-matching.kl` — vendored, opt-in, **not** booted. -These are all pure `defun`/`defmacro` and reference only public kernel functions +They are pure `defun`/`defmacro` referencing only public kernel functions (`get`/`put`/`arity`/…) — never the removed `dict.*`, `shen.<-dict`, or -`shen.initialise-*` functions — so they load unchanged against the refreshed -kernel. They are library/Shen-level code, effectively version-stable. - -> **Known limitation (pre-existing, not introduced by the refresh).** stlib -> functions get an `F` entry from their `defun` and a compiler arity from the -> boot prescan, so they compile as direct calls and work in loaded programs and -> the test suite. But `stlib.initialise` is never called, so their runtime -> `arity` *property* stays `-1`; a bare `(fn filter)` / top-level `(filter …)` -> reference that resolves through the lambda table fails with "fn: filter is -> undefined". This behaves identically on the pre-refresh kernel. The clean fix -> is a lazy `Lib/StLib` loader (see the PR's "remaining work"). +`shen.initialise-*` — so they load unchanged against the refreshed kernel. + +**Standard library.** No longer a `.kl` file here. It is loaded at boot from the +S-lineage Shen sources vendored under `lib/StLib/` — see +[`lib/StLib/PROVENANCE.md`](../lib/StLib/PROVENANCE.md) and `boot.lua` +`load_stdlib`. Loading through the kernel's own `define` path (rather than as +raw `stlib.kl` defuns) registers each function's `arity` property + lambda-table +entry, which **fixes** the long-standing quirk where a bare `(fn filter)` / +top-level `(filter …)` raised "fn: filter is undefined" (the pre-refresh +`stlib.kl` never called `stlib.initialise`, so those functions had runtime +`arity` = -1). A regression test lives in `test/stdlib_spec.lua`. ## Boot order diff --git a/klambda/README.md b/klambda/README.md index 6244071..260b29f 100644 --- a/klambda/README.md +++ b/klambda/README.md @@ -5,28 +5,29 @@ directly in this repository so that `shen-lua` is self-contained: you can `git clone` and run without needing a separate ShenOSKernel checkout. The tree has **two lineages** — the refreshed kernel proper from -shenlanguage.org, and the community standard library + extensions retained on -top. See [PROVENANCE.md](PROVENANCE.md) for exact sources, checksums, and the -full list of what the refresh added/removed. +shenlanguage.org, and the community extensions retained on top. The standard +library is no longer here; it lives as Shen sources under `../lib/StLib/` (see +that directory's PROVENANCE.md). See [PROVENANCE.md](PROVENANCE.md) for exact +sources, checksums, and the full list of what the refresh added/removed. ## Files -There are 20 `.kl` files. +There are 19 `.kl` files. **Kernel proper — S41.2 (2026-07-11 refresh), 15 files, byte-identical to `shenlanguage.org/Download/S41.2.zip`:** - yacc, core, load, prolog, reader, sequent, sys, t-star, toplevel, track, types, writer, backend, declarations, macros -**Standard library + extensions — retained from community ShenOSKernel-41.2:** -- stlib +**Extensions — retained from community ShenOSKernel-41.2:** - extension-features, extension-expand-dynamic, extension-launcher (booted) - extension-programmable-pattern-matching (vendored, opt-in; NOT on the boot list) The actual boot order is defined in `boot.lua` (`FILES`), not by this list. > Removed relative to the pre-refresh vendored set: `compiler.kl` (a shen-cl -> build artifact), `dict.kl`, and `init.kl` — see PROVENANCE.md. +> build artifact), `dict.kl`, `init.kl`, and `stlib.kl` — the standard library +> now loads from `../lib/StLib/` Shen sources. See PROVENANCE.md. ## License See the LICENSE in the root of this repository and the original Shen distribution. diff --git a/klambda/stlib.kl b/klambda/stlib.kl deleted file mode 100644 index f634847..0000000 --- a/klambda/stlib.kl +++ /dev/null @@ -1,738 +0,0 @@ -(defun concat* (V3 V4) (let W5 (concat V3 V4) (if (symbol? W5) W5 (simple-error (cn "'" (shen.app W5 "' is not a symbol -" shen.a)))))) - -(defun newv () (gensym X)) - -(defun maths.maths-macro (V8) (cond ((and (cons? V8) (and (= log10 (hd V8)) (and (cons? (tl V8)) (= () (tl (tl V8)))))) (cons log10 (cons (hd (tl V8)) (cons (cons tolerance ()) ())))) ((and (cons? V8) (and (= log2 (hd V8)) (and (cons? (tl V8)) (= () (tl (tl V8)))))) (cons log2 (cons (hd (tl V8)) (cons (cons tolerance ()) ())))) ((and (cons? V8) (and (= loge (hd V8)) (and (cons? (tl V8)) (= () (tl (tl V8)))))) (cons loge (cons (hd (tl V8)) (cons (cons tolerance ()) ())))) ((and (cons? V8) (and (= log (hd V8)) (and (cons? (tl V8)) (and (cons? (tl (tl V8))) (= () (tl (tl (tl V8)))))))) (cons log (cons (hd (tl V8)) (cons (hd (tl (tl V8))) (cons (cons tolerance ()) ()))))) ((and (cons? V8) (and (= sin (hd V8)) (and (cons? (tl V8)) (= () (tl (tl V8)))))) (cons sin (cons (hd (tl V8)) (cons (cons tolerance ()) ())))) ((and (cons? V8) (and (= tan (hd V8)) (and (cons? (tl V8)) (= () (tl (tl V8)))))) (cons tan (cons (hd (tl V8)) (cons (cons tolerance ()) ())))) ((and (cons? V8) (and (= cos (hd V8)) (and (cons? (tl V8)) (= () (tl (tl V8)))))) (cons cos (cons (hd (tl V8)) (cons (cons tolerance ()) ())))) ((and (cons? V8) (and (= tanh (hd V8)) (and (cons? (tl V8)) (= () (tl (tl V8)))))) (cons tanh (cons (hd (tl V8)) (cons (cons tolerance ()) ())))) ((and (cons? V8) (and (= cosh (hd V8)) (and (cons? (tl V8)) (= () (tl (tl V8)))))) (cons cosh (cons (hd (tl V8)) (cons (cons tolerance ()) ())))) ((and (cons? V8) (and (= sinh (hd V8)) (and (cons? (tl V8)) (= () (tl (tl V8)))))) (cons sinh (cons (hd (tl V8)) (cons (cons tolerance ()) ())))) ((and (cons? V8) (and (= sech (hd V8)) (and (cons? (tl V8)) (= () (tl (tl V8)))))) (cons sech (cons (hd (tl V8)) (cons (cons tolerance ()) ())))) ((and (cons? V8) (and (= csch (hd V8)) (and (cons? (tl V8)) (= () (tl (tl V8)))))) (cons csch (cons (hd (tl V8)) (cons (cons tolerance ()) ())))) ((and (cons? V8) (and (= coth (hd V8)) (and (cons? (tl V8)) (= () (tl (tl V8)))))) (cons coth (cons (hd (tl V8)) (cons (cons tolerance ()) ())))) ((and (cons? V8) (and (= nthrt (hd V8)) (and (cons? (tl V8)) (and (cons? (tl (tl V8))) (= () (tl (tl (tl V8)))))))) (cons nthrt (cons (hd (tl V8)) (cons (hd (tl (tl V8))) (cons (cons tolerance ()) ()))))) ((and (cons? V8) (and (= sqrt (hd V8)) (and (cons? (tl V8)) (= () (tl (tl V8)))))) (cons sqrt (cons (hd (tl V8)) (cons (cons tolerance ()) ())))) ((and (cons? V8) (and (= expt (hd V8)) (and (cons? (tl V8)) (and (cons? (tl (tl V8))) (= () (tl (tl (tl V8)))))))) (cons expt (cons (hd (tl V8)) (cons (hd (tl (tl V8))) (cons (cons tolerance ()) ()))))) ((and (cons? V8) (and (= max (hd V8)) (and (cons? (tl V8)) (and (cons? (tl (tl V8))) (cons? (tl (tl (tl V8)))))))) (cons max (cons (hd (tl V8)) (cons (cons max (tl (tl V8))) ())))) ((and (cons? V8) (and (= min (hd V8)) (and (cons? (tl V8)) (and (cons? (tl (tl V8))) (cons? (tl (tl (tl V8)))))))) (cons min (cons (hd (tl V8)) (cons (cons min (tl (tl V8))) ())))) ((and (cons? V8) (and (= tolerance (hd V8)) (and (cons? (tl V8)) (= () (tl (tl V8)))))) (cons maths.tolerance=n (tl V8))) ((and (cons? V8) (and (= for (hd V8)) (and (cons? (tl V8)) (and (cons? (tl (tl V8))) (and (= = (hd (tl (tl V8)))) (and (cons? (tl (tl (tl V8)))) (and (cons? (tl (tl (tl (tl V8))))) (and (cons? (tl (tl (tl (tl (tl V8)))))) (and (cons? (tl (tl (tl (tl (tl (tl V8))))))) (and (cons? (tl (tl (tl (tl (tl (tl (tl V8)))))))) (and (= and (hd (tl (tl (tl (tl (tl (tl (tl V8))))))))) (= () (tl (tl (tl (tl (tl (tl (tl (tl V8)))))))))))))))))))) (let W9 (lambda Z10 (lambda Z11 (if (> (occurrences Z10 Z11) 0) (cons /. (cons Z10 (cons Z11 ()))) Z11))) (cons maths.lazyfor-and (cons (hd (tl (tl (tl V8)))) (cons ((W9 (hd (tl V8))) (hd (tl (tl (tl (tl V8)))))) (cons ((W9 (hd (tl V8))) (hd (tl (tl (tl (tl (tl V8))))))) (cons (hd (tl (tl (tl (tl (tl (tl V8))))))) ()))))))) ((and (cons? V8) (and (= for (hd V8)) (and (cons? (tl V8)) (and (cons? (tl (tl V8))) (and (= = (hd (tl (tl V8)))) (and (cons? (tl (tl (tl V8)))) (and (cons? (tl (tl (tl (tl V8))))) (and (cons? (tl (tl (tl (tl (tl V8)))))) (and (cons? (tl (tl (tl (tl (tl (tl V8))))))) (and (cons? (tl (tl (tl (tl (tl (tl (tl V8)))))))) (and (= or (hd (tl (tl (tl (tl (tl (tl (tl V8))))))))) (= () (tl (tl (tl (tl (tl (tl (tl (tl V8)))))))))))))))))))) (let W12 (lambda Z13 (lambda Z14 (if (> (occurrences Z13 Z14) 0) (cons /. (cons Z13 (cons Z14 ()))) Z14))) (cons maths.lazyfor-or (cons (hd (tl (tl (tl V8)))) (cons ((W12 (hd (tl V8))) (hd (tl (tl (tl (tl V8)))))) (cons ((W12 (hd (tl V8))) (hd (tl (tl (tl (tl (tl V8))))))) (cons (hd (tl (tl (tl (tl (tl (tl V8))))))) ()))))))) ((and (cons? V8) (and (= for (hd V8)) (and (cons? (tl V8)) (and (cons? (tl (tl V8))) (and (= = (hd (tl (tl V8)))) (and (cons? (tl (tl (tl V8)))) (and (cons? (tl (tl (tl (tl V8))))) (and (cons? (tl (tl (tl (tl (tl V8)))))) (and (cons? (tl (tl (tl (tl (tl (tl V8))))))) (and (cons? (tl (tl (tl (tl (tl (tl (tl V8)))))))) (= () (tl (tl (tl (tl (tl (tl (tl (tl V8))))))))))))))))))) (let W15 (lambda Z16 (lambda Z17 (if (> (occurrences Z16 Z17) 0) (cons /. (cons Z16 (cons Z17 ()))) Z17))) (cons for (cons (hd (tl (tl (tl V8)))) (cons ((W15 (hd (tl V8))) (hd (tl (tl (tl (tl V8)))))) (cons ((W15 (hd (tl V8))) (hd (tl (tl (tl (tl (tl V8))))))) (tl (tl (tl (tl (tl (tl V8)))))))))))) ((and (cons? V8) (and (= for (hd V8)) (and (cons? (tl V8)) (and (cons? (tl (tl V8))) (and (= = (hd (tl (tl V8)))) (and (cons? (tl (tl (tl V8)))) (and (cons? (tl (tl (tl (tl V8))))) (and (cons? (tl (tl (tl (tl (tl V8)))))) (and (cons? (tl (tl (tl (tl (tl (tl V8))))))) (= () (tl (tl (tl (tl (tl (tl (tl V8))))))))))))))))) (let W18 (lambda Z19 (lambda Z20 (if (> (occurrences Z19 Z20) 0) (cons /. (cons Z19 (cons Z20 ()))) Z20))) (cons for (cons (hd (tl (tl (tl V8)))) (cons ((W18 (hd (tl V8))) (hd (tl (tl (tl (tl V8)))))) (cons ((W18 (hd (tl V8))) (hd (tl (tl (tl (tl (tl V8))))))) (cons (hd (tl (tl (tl (tl (tl (tl V8))))))) (cons (cons fn (cons do ())) ())))))))) ((and (cons? V8) (and (= for (hd V8)) (and (cons? (tl V8)) (and (cons? (tl (tl V8))) (and (= = (hd (tl (tl V8)))) (and (cons? (tl (tl (tl V8)))) (and (cons? (tl (tl (tl (tl V8))))) (and (cons? (tl (tl (tl (tl (tl V8)))))) (= () (tl (tl (tl (tl (tl (tl V8))))))))))))))) (let W21 (lambda Z22 (lambda Z23 (if (> (occurrences Z22 Z23) 0) (cons /. (cons Z22 (cons Z23 ()))) Z23))) (cons for (cons (hd (tl (tl (tl V8)))) (cons ((W21 (hd (tl V8))) (hd (tl (tl (tl (tl V8)))))) (cons (cons /. (cons (hd (tl V8)) (tl (tl (tl (tl (tl V8))))))) (cons (cons + (cons 1 ())) (cons (cons fn (cons do ())) ())))))))) (true V8))) - -(defun set-tolerance (V249) (set maths.*tolerance* V249)) - -(defun tolerance () (value maths.*tolerance*)) - -(defun sq (V251) (* V251 V251)) - -(defun cube (V253) (* V253 (* V253 V253))) - -(defun for (V255 V256 V257 V258 V259) (maths.for-h (V258 V255) V256 V257 V258 V259 (V257 V255))) - -(defun maths.for-h (V268 V269 V270 V271 V272 V273) (cond ((not (V269 V268)) V273) (true (maths.for-h (V271 V268) V269 V270 V271 V272 ((V272 V273) (V270 V268)))))) - -(defun maths.lazyfor-and (V290 V291 V292 V293) (cond ((not (V291 V290)) true) ((V292 V290) (maths.lazyfor-and (V293 V290) V291 V292 V293)) (true false))) - -(defun maths.lazyfor-or (V300 V301 V302 V303) (cond ((not (V301 V300)) false) ((V302 V300) true) (true (maths.lazyfor-or (V303 V300) V301 V302 V303)))) - -(defun max (V310 V311) (cond ((> V311 V310) V311) (true V310))) - -(defun min (V316 V317) (cond ((< V317 V316) V317) (true V316))) - -(defun expt (V320 V321 V322) (if (= V321 0) 1 (if (positive? V321) (maths.expt-h V320 (maths.n->r V321 1) V322) (/ 1 (maths.expt-h V320 (maths.n->r (~ V321) 1) V322))))) - -(defun maths.n->r (V326 V327) (cond ((integer? V326) (@p V326 V327)) (true (maths.n->r (* V326 10) (* V327 10))))) - -(defun maths.expt-h (V330 V331 V332) (cond ((tuple? V331) (power (nthrt V330 (snd V331) V332) (fst V331))) (true (shen.f-error maths.expt-h)))) - -(defun gcd (V336 V337) (if (and (integer? V336) (integer? V337)) (let W338 (abs V336) (let W339 (abs V337) (if (> W338 W339) (maths.gcd-help (- W338 W339) W339) (maths.gcd-help W338 (- W339 W338))))) (simple-error "gcd expects integer inputs"))) - -(defun maths.gcd-help (V342 V343) (if (> V342 V343) (maths.gcd-loop V342 V343 V343) (maths.gcd-loop V342 V343 V342))) - -(defun maths.gcd-loop (V350 V351 V352) (cond ((= 1 V352) 1) ((and (integer? (/ V350 V352)) (integer? (/ V351 V352))) V352) (true (maths.gcd-loop V350 V351 (- V352 1))))) - -(defun lcd (V356 V357) (cond ((and (even? V356) (even? V357)) 2) (true (maths.lcd-loop V356 V357 (if (> V356 V357) V357 V356) 3)))) - -(defun maths.lcd-loop (V363 V364 V365 V366) (cond ((> V366 V365) 1) ((and (integer? (/ V363 V366)) (integer? (/ V364 V366))) V366) (true (maths.lcd-loop V363 V364 V365 (+ 2 V366))))) - -(defun isqrt (V371) (maths.isqrt-loop V371 0)) - -(defun maths.isqrt-loop (V373 V374) (cond ((= (* V374 V374) V373) V374) ((> (* V374 V374) V373) (- V374 1)) (true (maths.isqrt-loop V373 (+ V374 1))))) - -(defun div (V377 V378) (floor (/ V377 V378))) - -(defun modf (V381) (let W382 (floor V381) (@p W382 (- V381 W382)))) - -(defun floor (V384) (cond ((negative? V384) (~ (ceiling (~ V384)))) (true (maths.rounding-loop floor V384 15 0)))) - -(defun maths.rounding-loop (V389 V390 V391 V392) (cond ((and (= 0 V391) (= V390 V392)) V392) ((and (= 0 V391) (> V392 V390)) (if (= V389 floor) (- V392 1) (if (= V389 ceiling) V392 (if (= V389 round) (let W393 (- V392 V390) (let W394 (- V390 (- V392 1)) (if (> W393 W394) (- V392 1) V392))) (simple-error "error: cases exhausted"))))) ((> V390 V392) (maths.rounding-loop V389 V390 V391 (+ V392 (power 10 V391)))) (true (maths.rounding-loop V389 V390 (- V391 1) (- V392 (power 10 V391)))))) - -(defun maths.float->pair (V399) (let W400 (floor V399) (@p W400 (- V399 W400)))) - -(defun ceiling (V402) (cond ((negative? V402) (~ (floor (~ V402)))) (true (maths.rounding-loop ceiling V402 15 0)))) - -(defun round (V404) (cond ((negative? V404) (~ (round (~ V404)))) (true (maths.rounding-loop round V404 15 0)))) - -(defun mod (V406 V407) (let W408 (/ V406 V407) (let W409 (floor W408) (if (and (integer? V406) (integer? V407)) (round (* V407 (- W408 W409))) (* V407 (- W408 W409)))))) - -(defun lcm (V412) (let W413 (maths.greatest V412) (maths.lcm-h W413 W413 V412))) - -(defun maths.greatest (V417) (cond ((and (cons? V417) (= () (tl V417))) (hd V417)) ((and (cons? V417) (and (cons? (tl V417)) (> (hd V417) (hd (tl V417))))) (maths.greatest (cons (hd V417) (tl (tl V417))))) ((and (cons? V417) (cons? (tl V417))) (maths.greatest (tl V417))) (true (shen.f-error maths.greatest)))) - -(defun maths.lcm-h (V419 V420 V421) (cond ((maths.lcm? V419 V421) V419) (true (maths.lcm-h (+ V419 V420) V420 V421)))) - -(defun maths.lcm? (V427 V428) (cond ((= () V428) true) ((cons? V428) (and (integer? (/ V427 (hd V428))) (maths.lcm? V427 (tl V428)))) (true (shen.f-error maths.lcm?)))) - -(defun random (V431 V432) (let W433 (maths.bbs (value maths.*seed*)) (let W434 (set maths.*seed* W433) (let W435 (min V431 V432) (+ W435 (mod W434 (abs (+ 1 (- V432 V431))))))))) - -(defun min (V440 V441) (cond ((> V440 V441) V441) (true V440))) - -(defun reseed () (set maths.*seed* (get-time unix))) - -(defun maths.bbs (V444) (let W445 (* 1201 1213) (mod (* V444 V444) W445))) - -(defun ~ (V447) (- 0 V447)) - -(defun positive? (V449) (> V449 0)) - -(defun negative? (V451) (< V451 0)) - -(defun natural? (V453) (cond ((= 0 V453) true) (true (and (integer? V453) (positive? V453))))) - -(defun converge (V455 V456 V457) (maths.converge-help V456 (V456 V455) V455 V457)) - -(defun maths.converge-help (V464 V465 V466 V467) (cond (((V467 V466) V465) V465) (true (maths.converge-help V464 (V464 V465) V465 V467)))) - -(defun nthrt (V476 V477 V478) (cond ((positive? V476) (converge V476 (lambda Z479 (maths.compute-nthrt V476 Z479 V477 V478)) (approx V478))) (true (simple-error (cn "nthrt: negA must be a positive numberneg%" ""))))) - -(defun sqrt (V483 V484) (nthrt V483 2 V484)) - -(defun maths.compute-nthrt (V487 V488 V489 V490) (let W491 (/ 1 V489) (let W492 (* (- V489 1) V488) (let W493 (expt V488 (- V489 1) V490) (let W494 (/ V487 W493) (let W495 (+ W492 W494) (* W491 W495))))))) - -(defun approx (V500) (lambda Z501 (lambda Z502 (let W503 (- Z501 Z502) (>= V500 (abs W503)))))) - -(defun abs (V505) (if (>= V505 0) V505 (- 0 V505))) - -(defun series (V507 V508 V509 V510) (maths.series-h (+ V507 1) V509 V508 (V508 V507) V510)) - -(defun maths.series-h (V515 V516 V517 V518 V519) (let W520 ((V519 (V517 V515)) V518) (if (<= (abs (- V518 W520)) V516) W520 (maths.series-h (+ V515 1) V516 V517 W520 V519)))) - -(defun product (V528 V529 V530) (series V528 V529 V530 (lambda Z531 (lambda Z532 (* Z531 Z532))))) - -(defun summation (V538 V539 V540) (series V538 V539 V540 (lambda Z541 (lambda Z542 (+ Z541 Z542))))) - -(defun odd? (V546) (and (integer? V546) (not (integer? (/ V546 2))))) - -(defun even? (V548) (and (integer? V548) (integer? (/ V548 2)))) - -(defun maths.compute-sine (V550 V551) (let W552 (+ (* 2 V551) 1) (let W553 (* (power -1 V551) (power V550 W552)) (let W554 (factorial W552) (/ W553 W554))))) - -(defun maths.compute-cos (V557 V558) (let W559 (* 2 V558) (let W560 (* (power -1 V558) (power V557 W559)) (let W561 (factorial W559) (/ W560 W561))))) - -(defun cos (V565 V566) (let W567 (radians V565) (summation 0 (lambda Z568 (maths.compute-cos W567 Z568)) V566))) - -(defun sin (V572 V573) (let W574 (radians V572) (summation 0 (lambda Z575 (maths.compute-sine W574 Z575)) V573))) - -(defun tan (V578 V579) (/ (sin V578 V579) (cos V578 V579))) - -(defun radians (V582) (* (/ V582 180) (pi))) - -(defun g () 1.6180339887498) - -(defun pi () 3.1415926535897) - -(defun e () 2.7182818284590002) - -(defun tan30 () 0.5773502691896) - -(defun cos30 () 0.8660254037844001) - -(defun cos45 () 0.70710678118651) - -(defun sin45 () 0.7071067811865) - -(defun sqrt2 () 1.4142135623731) - -(defun tan60 () 1.7320508075692) - -(defun maths.sin60 () 0.8660254037844001) - -(defun sin120 () 0.8660254037844001) - -(defun tan120 () -1.7320508075692) - -(defun sin135 () 0.7071067811865) - -(defun cos135 () -0.7071067811865) - -(defun cos150 () -0.8660254037844001) - -(defun tan150 () -0.5773502691905) - -(defun cos210 () -0.8660254037844001) - -(defun tan210 () 0.5773502691905) - -(defun sin225 () -0.7071067811865) - -(defun cos225 () -0.7071067811865) - -(defun sin240 () -0.8660254037844001) - -(defun tan240 () 1.7320508075692) - -(defun sin300 () -0.8660254037844001) - -(defun tan300 () -1.7320508075692) - -(defun sin315 () -0.7071067811865) - -(defun cos315 () 0.7071067811865) - -(defun cos330 () 0.8660254037844001) - -(defun tan330 () -0.5773502691905) - -(defun coth (V584 V585) (let W586 (e) (let W587 (expt W586 (~ (* 2 V584)) V585) (/ (+ 1 W587) (- 1 W587))))) - -(defun sinh (V590 V591) (let W592 (e) (let W593 (expt W592 V590 V591) (let W594 (expt W592 (~ V590) V591) (let W595 (- W593 W594) (/ W595 2)))))) - -(defun cosh (V598 V599) (let W600 (e) (let W601 (expt W600 V598 V599) (let W602 (expt W600 (~ V598) V599) (let W603 (+ W601 W602) (/ W603 2)))))) - -(defun tanh (V606 V607) (/ (sinh V606 V607) (cosh V606 V607))) - -(defun sech (V610 V611) (/ 1 (cosh V610 V611))) - -(defun csch (V614 V615) (/ 1 (sinh V614 V615))) - -(defun power (V620 V621) (cond ((= 0 V621) 1) (true (* V620 (power V620 (- V621 1)))))) - -(defun factorial (V624) (cond ((= 0 V624) 1) (true (* V624 (factorial (- V624 1)))))) - -(defun prime? (V626) (cond ((= 2 V626) true) ((even? V626) false) (true (maths.prime-h V626 (isqrt V626) 3)))) - -(defun maths.prime-h (V629 V630 V631) (cond ((> V631 V630) true) ((integer? (/ V629 V631)) false) (true (maths.prime-h V629 V630 (+ V631 2))))) - -(defun maths.sign (V637) (cond ((= 0 V637) 0) ((positive? V637) 1) (true -1))) - -(defun log (V639 V640 V641) (/ (log10 V639 V641) (log10 V640 V641))) - -(defun loge (V645 V646) (log V645 (e) V646)) - -(defun log2 (V649 V650) (log V649 2 V650)) - -(defun log10 (V653 V654) (if (>= V653 1) (maths.log10+ V653 V654) (~ (maths.log10+ (/ 1 V653) V654)))) - -(defun maths.log10+ (V657 V658) (cond ((<= (abs V657) V658) 0) ((>= V657 10) (+ 1 (maths.log10+ (/ V657 10) V658))) (true (* 0.1 (maths.log10+ (power V657 10) (* 10 V658)))))) - -(defun r# (V667 V668) (cond ((and (integer? V667) (integer? V668)) (let W669 (absvector 3) (let W670 (address-> W669 0 rational.print-rational) (let W671 (address-> W669 1 V667) (let W672 (address-> W669 2 V668) W669))))) (true (simple-error (cn "numerator " (shen.app V667 (cn " and divisor " (shen.app V668 " must be integers -" shen.s)) shen.s)))))) - -(defun rational.print-rational (V675) (shen.app (<-address V675 1) (cn "/" (shen.app (<-address V675 2) "" shen.s)) shen.s)) - -(defun rational? (V677) (trap-error (and (absvector? V677) (and (= (<-address V677 0) rational.print-rational) (and (integer? (<-address V677 1)) (integer? (<-address V677 2))))) (lambda Z678 false))) - -(defun numerator (V680) (<-address V680 1)) - -(defun denominator (V682) (<-address V682 2)) - -(defun r-op1 (V722 V723) (n->r (V722 (r->n V723)))) - -(defun r-op2 (V726 V727 V728) (n->r ((V726 (r->n V727)) (r->n V728)))) - -(defun r->n (V732) (/ (numerator V732) (denominator V732))) - -(defun r->pair (V734) (@p (numerator V734) (denominator V734))) - -(defun n->r (V736) (let W737 (maths.n->r V736 1) (r# (fst W737) (snd W737)))) - -(defun r-reduce (V739) (rational.r-reduce-help (numerator V739) (denominator V739))) - -(defun rational.r-reduce-help (V741 V742) (let W743 (lcd V741 V742) (if (= W743 1) (r# V741 V742) (rational.r-reduce-help (/ V741 W743) (/ V742 W743))))) - -(defun r= (V746 V747) (let W748 (numerator V746) (let W749 (denominator V746) (let W750 (numerator V747) (let W751 (denominator V747) (= (* W748 W751) (* W749 W750))))))) - -(defun r< (V754 V755) (let W756 (numerator V754) (let W757 (denominator V754) (let W758 (numerator V755) (let W759 (denominator V755) (< (* W756 W759) (* W757 W758))))))) - -(defun r> (V762 V763) (not (or (r= V762 V763) (r< V762 V763)))) - -(defun r>= (V766 V767) (or (r= V766 V767) (r> V766 V767))) - -(defun r<= (V770 V771) (or (r= V770 V771) (r< V770 V771))) - -(defun r+ (V774 V775) (let W776 (numerator V774) (let W777 (denominator V774) (let W778 (numerator V775) (let W779 (denominator V775) (r# (+ (* W776 W779) (* W777 W778)) (* W777 W779))))))) - -(defun r- (V782 V783) (let W784 (numerator V782) (let W785 (denominator V782) (let W786 (numerator V783) (let W787 (denominator V783) (r# (- (* W784 W787) (* W785 W786)) (* W785 W787))))))) - -(defun r* (V790 V791) (let W792 (numerator V790) (let W793 (denominator V790) (let W794 (numerator V791) (let W795 (denominator V791) (r# (* W792 W794) (* W793 W795))))))) - -(defun +-inverse (V798) (let W799 (numerator V798) (let W800 (denominator V798) (r# (~ W799) W800)))) - -(defun *-inverse (V802) (let W803 (numerator V802) (let W804 (denominator V802) (r# W804 W803)))) - -(defun r/ (V806 V807) (r* V806 (*-inverse V807))) - -(defun r-expt (V812 V813) (cond ((natural? V813) (let W814 (numerator V812) (let W815 (denominator V812) (r# (power W814 V813) (power W815 V813))))) ((and (integer? V813) (negative? V813)) (let W816 (numerator V812) (let W817 (denominator V812) (r# (power W817 (~ V813)) (power W816 (~ V813)))))) (true (simple-error (cn "cannot exponentiate a rational by a non-integer " (shen.app V813 " -" shen.a)))))) - -(defun r-approx (V820 V821) (rational.approx-r-h (r->n V820) V821 0)) - -(defun rational.approx-r-h (V824 V825 V826) (cond ((> (/ V826 V825) V824) (r# V826 V825)) (true (rational.approx-r-h V824 V825 (+ V826 1))))) - -(defun c# (V836 V837) (cond ((and (number? V836) (number? V837)) (let W838 (absvector 3) (let W839 (address-> W838 0 complex.print-complex) (let W840 (address-> W838 1 V836) (let W841 (address-> W838 2 V837) W838))))) (true (simple-error (cn "real " (shen.app V836 (cn " and imaginary " (shen.app V837 " must be numbers -" shen.a)) shen.a)))))) - -(defun complex.print-complex (V844) (shen.insert (<-address V844 2) (shen.insert (<-address V844 1) (shen.proc-nl (cn "(c" "# ~A ~A)"))))) - -(defun complex? (V846) (trap-error (and (absvector? V846) (and (= (<-address V846 0) complex.print-complex) (and (number? (<-address V846 1)) (number? (<-address V846 2))))) (lambda Z847 false))) - -(defun real (V849) (<-address V849 1)) - -(defun imaginary (V851) (<-address V851 2)) - -(defun c+ (V861 V862) (let W863 (real V861) (let W864 (imaginary V861) (let W865 (real V862) (let W866 (imaginary V862) (c# (+ W863 W865) (+ W864 W866))))))) - -(defun c- (V869 V870) (let W871 (real V869) (let W872 (imaginary V869) (let W873 (real V870) (let W874 (imaginary V870) (c# (- W871 W873) (- W872 W874))))))) - -(defun c* (V877 V878) (let W879 (real V877) (let W880 (imaginary V877) (let W881 (real V878) (let W882 (imaginary V878) (c# (- (* W879 W881) (* W880 W882)) (+ (* W880 W881) (* W879 W882)))))))) - -(defun c/ (V885 V886) (let W887 (real V885) (let W888 (imaginary V885) (let W889 (real V886) (let W890 (imaginary V886) (c# (/ (+ (* W887 W889) (* W888 W890)) (+ (* W889 W889) (* W890 W890))) (/ (- (* W888 W889) (* W887 W890)) (+ (* W889 W889) (* W890 W890))))))))) - -(defun n# (V903 V904) (cond ((and (natural? V903) (and (natural? V904) (> V904 0))) (let W905 (absvector 4) (let W906 (address-> W905 0 numerals.print-numeral) (let W907 (address-> W905 1 (((fn numerals.n->numeral) V903) V904)) (let W908 (address-> W905 2 V904) (let W909 (address-> W905 3 V903) W905)))))) (true (simple-error (cn "N = " (shen.app V903 (cn ", Radix = " (shen.app V904 "; N and Radix must be natural numbers where Radix > 0 -" shen.a)) shen.a)))))) - -(defun radix (V912) (<-address V912 2)) - -(defun numerals.numerals (V914) (<-address V914 1)) - -(defun n#->n (V916) (<-address V916 3)) - -(defun n#->ns (V918) (<-address V918 1)) - -(defun numerals.print-numeral (V920) (let W921 (radix V920) (let W922 (numerals.numerals V920) (@s (numerals.numeric->string W922 W921) (@s "#" (str W921)))))) - -(defun numerals.numeric->string (V926 V927) (cond ((= () V926) "") ((cons? V926) (let W928 (if (< (hd V926) 10) (str (hd V926)) (if (> V927 36) (cn (str (hd V926)) " ") (n->string (+ (hd V926) 55)))) (cn W928 (numerals.numeric->string (tl V926) V927)))) (true (shen.f-error numerals.numeric->string)))) - -(defun numeral? (V931) (and (absvector? V931) (= numerals.print-numeral (<-address V931 0)))) - -(defun numerals.numeral-macro (V969) (cond ((and (cons? V969) (and (= n-op2 (hd V969)) (and (cons? (tl V969)) (and (cons? (tl (tl V969))) (and (cons? (tl (tl (tl V969)))) (= () (tl (tl (tl (tl V969)))))))))) (cons n-op2 (cons (hd (tl V969)) (cons (hd (tl (tl V969))) (cons (hd (tl (tl (tl V969)))) (cons (cons radix (cons (hd (tl (tl V969))) ())) ())))))) ((and (cons? V969) (and (= n-op1 (hd V969)) (and (cons? (tl V969)) (and (cons? (tl (tl V969))) (= () (tl (tl (tl V969)))))))) (cons n-op1 (cons (hd (tl V969)) (cons (hd (tl (tl V969))) (cons (cons radix (tl (tl V969))) ()))))) ((and (cons? V969) (and (= n+ (hd V969)) (and (cons? (tl V969)) (and (cons? (tl (tl V969))) (= () (tl (tl (tl V969)))))))) (cons n+ (cons (hd (tl V969)) (cons (hd (tl (tl V969))) (cons (cons radix (cons (hd (tl V969)) ())) ()))))) ((and (cons? V969) (and (= n- (hd V969)) (and (cons? (tl V969)) (and (cons? (tl (tl V969))) (= () (tl (tl (tl V969)))))))) (cons n- (cons (hd (tl V969)) (cons (hd (tl (tl V969))) (cons (cons radix (cons (hd (tl V969)) ())) ()))))) ((and (cons? V969) (and (= n* (hd V969)) (and (cons? (tl V969)) (and (cons? (tl (tl V969))) (= () (tl (tl (tl V969)))))))) (cons n* (cons (hd (tl V969)) (cons (hd (tl (tl V969))) (cons (cons radix (cons (hd (tl V969)) ())) ()))))) ((and (cons? V969) (and (= n/ (hd V969)) (and (cons? (tl V969)) (and (cons? (tl (tl V969))) (= () (tl (tl (tl V969)))))))) (cons n/ (cons (hd (tl V969)) (cons (hd (tl (tl V969))) (cons (cons radix (cons (hd (tl V969)) ())) ()))))) (true V969))) - -(defun n-op2 (V971 V972 V973 V974) (n# ((V971 (n#->n V972)) (n#->n V973)) V974)) - -(defun n-op1 (V979 V980 V981) (n# (V979 (n#->n V980)) V981)) - -(defun n+ (V987 V988 V989) (n-op2 (lambda Z990 (lambda Z991 (+ Z990 Z991))) V987 V988 V989)) - -(defun n* (V997 V998 V999) (n-op2 (lambda Z1000 (lambda Z1001 (* Z1000 Z1001))) V997 V998 V999)) - -(defun n- (V1007 V1008 V1009) (n-op2 (lambda Z1010 (lambda Z1011 (- Z1010 Z1011))) V1007 V1008 V1009)) - -(defun n/ (V1017 V1018 V1019) (n-op2 (lambda Z1020 (lambda Z1021 (/ Z1020 Z1021))) V1017 V1018 V1019)) - -(defun binary (V1025) (n# V1025 2)) - -(defun hex (V1027) (n# V1027 16)) - -(defun octal (V1029) (n# V1029 8)) - -(defun duodecimal (V1031) (n# V1031 12)) - -(defun numerals.n->numeral (V1033 V1034) (cond ((> V1034 V1033) (cons V1033 ())) (true (let W1035 (numerals.largest-expt V1033 V1034 0) (let W1036 (power V1034 W1035) (let W1037 (div V1033 W1036) (let W1038 (cons W1037 (numerals.n-zeros W1035)) (let W1039 (- V1033 (* W1037 W1036)) (numerals.add W1038 (numerals.n->numeral W1039 V1034) V1034))))))))) - -(defun numerals.largest-expt (V1042 V1043 V1044) (cond ((> (power V1043 V1044) V1042) (- V1044 1)) (true (numerals.largest-expt V1042 V1043 (+ V1044 1))))) - -(defun numerals.n-zeros (V1048) (cond ((= 0 V1048) ()) (true (cons 0 (numerals.n-zeros (- V1048 1)))))) - -(defun numerals.add (V1050 V1051 V1052) (reverse (numerals.add-h (reverse V1050) (reverse V1051) V1052 0))) - -(defun numerals.add-h (V1060 V1061 V1062 V1063) (cond ((and (= () V1060) (and (= () V1061) (= 0 V1063))) ()) ((and (= () V1060) (= () V1061)) (cons V1063 ())) ((= () V1060) (numerals.add-h (cons 0 ()) V1061 V1062 V1063)) ((= () V1061) (numerals.add-h V1060 (cons 0 ()) V1062 V1063)) ((and (cons? V1060) (cons? V1061)) (let W1064 (+ (hd V1060) (+ (hd V1061) V1063)) (if (< W1064 V1062) (cons W1064 (numerals.add-h (tl V1060) (tl V1061) V1062 0)) (cons (- V1062 W1064) (numerals.add-h (tl V1060) (tl V1061) V1062 1))))) (true (shen.f-error numerals.add-h)))) - -(defun assoc-if (V1175 V1176) (cond ((= () V1176) ()) ((and (cons? V1176) (and (cons? (hd V1176)) (V1175 (hd (hd V1176))))) (hd V1176)) ((cons? V1176) (assoc-if V1175 (tl V1176))) (true (shen.f-error assoc-if)))) - -(defun assoc-if-not (V1184 V1185) (cond ((= () V1185) ()) ((and (cons? V1185) (and (cons? (hd V1185)) (not (V1184 (hd (hd V1185)))))) (hd V1185)) ((cons? V1185) (assoc-if V1184 (tl V1185))) (true (shen.f-error assoc-if-not)))) - -(defun drop (V1190 V1191) (cond ((= 0 V1190) V1191) ((cons? V1191) (drop (- V1190 1) (tl V1191))) (true (shen.f-error drop)))) - -(defun drop-last (V1194 V1195) (reverse (drop V1194 (reverse V1195)))) - -(defun index (V1198 V1199) (list.index-h V1198 V1199 1)) - -(defun list.index-h (V1211 V1212 V1213) (cond ((= () V1212) -1) ((and (cons? V1212) (= V1211 (hd V1212))) V1213) ((cons? V1212) (list.index-h V1211 (tl V1212) (+ V1213 1))) (true (shen.f-error list.index-h)))) - -(defun index-last (V1217 V1218) (let W1219 (length V1218) (let W1220 (index V1217 (reverse V1218)) (if (= W1220 -1) W1220 (+ (- W1219 W1220) 1))))) - -(defun insert (V1225 V1226 V1227) (cond ((= () V1227) (simple-error (cn "cannot insert " (shen.app V1226 " into list: index out of range -" shen.s)))) ((= 1 V1225) (cons V1226 V1227)) ((cons? V1227) (cons (hd V1227) (insert (- V1225 1) V1226 (tl V1227)))) (true (shen.f-error insert)))) - -(defun remove-duplicates (V1231) (cond ((= () V1231) ()) ((and (cons? V1231) (element? (hd V1231) (tl V1231))) (remove-duplicates (tl V1231))) ((cons? V1231) (cons (hd V1231) (remove-duplicates (tl V1231)))) (true (shen.f-error remove-duplicates)))) - -(defun trim-left-if (V1237 V1238) (cond ((= () V1238) ()) ((and (cons? V1238) (V1237 (hd V1238))) (trim-left-if V1237 (tl V1238))) (true V1238))) - -(defun trim-right-if (V1241 V1242) (reverse (trim-left-if V1241 (reverse V1242)))) - -(defun trim-if (V1245 V1246) (trim-right-if V1245 (trim-left-if V1245 V1246))) - -(defun trim-left (V1253 V1254) (cond ((= () V1254) ()) ((and (cons? V1254) (element? (hd V1254) V1253)) (trim-left V1253 (tl V1254))) (true V1254))) - -(defun trim-right (V1257 V1258) (reverse (trim-left V1257 (reverse V1258)))) - -(defun trim (V1261 V1262) (trim-right V1261 (trim-left V1261 V1262))) - -(defun prefix? (V1272 V1273) (cond ((= () V1272) true) ((and (cons? V1272) (and (cons? V1273) (= (hd V1272) (hd V1273)))) (prefix? (tl V1272) (tl V1273))) (true false))) - -(defun infix? (V1280 V1281) (cond ((prefix? V1280 V1281) true) ((= () V1281) false) ((cons? V1281) (infix? V1280 (tl V1281))) (true (shen.f-error infix?)))) - -(defun suffix? (V1284 V1285) (prefix? (reverse V1284) (reverse V1285))) - -(defun subset? (V1294 V1295) (cond ((= () V1294) true) ((and (cons? V1294) (element? (hd V1294) V1295)) (subset? (tl V1294) V1295)) (true false))) - -(defun set=? (V1298 V1299) (and (subset? V1298 V1299) (subset? V1299 V1298))) - -(defun set? (V1304) (cond ((= () V1304) true) ((and (cons? V1304) (element? (hd V1304) (tl V1304))) false) ((cons? V1304) (set? (tl V1304))) (true (shen.f-error set?)))) - -(defun n-times (V1306 V1307) (list.n-times-h V1307 V1306 ())) - -(defun list.n-times-h (V1310 V1311 V1312) (cond ((= 0 V1310) V1312) (true (list.n-times-h (- V1310 1) V1311 (cons V1311 V1312))))) - -(defun subbag? (V1316 V1317) (every? (lambda Z1318 (= (count Z1318 V1316) (count Z1318 V1317))) V1316)) - -(defun bag=? (V1321 V1322) (and (subbag? V1321 V1322) (subbag? V1322 V1321))) - -(defun mapc (V1327 V1328) (cond ((= () V1328) ()) ((cons? V1328) (mapc (do (V1327 (hd V1328)) V1327) (tl V1328))) (true (shen.f-error mapc)))) - -(defun permute (V1331) (cond ((= () V1331) (cons () ())) (true (mapcan (lambda Z1332 (map (lambda Z1333 (cons Z1332 Z1333)) (permute (remove Z1332 V1331)))) V1331)))) - -(defun count-if (V1335 V1336) (length (mapcan (lambda Z1337 (if (V1335 Z1337) (cons Z1337 ()) ())) V1336))) - -(defun count (V1341 V1342) (count-if (lambda Z1343 (= V1341 Z1343)) V1342)) - -(defun some? (V1351 V1352) (cond ((= () V1352) false) ((and (cons? V1352) (V1351 (hd V1352))) true) ((cons? V1352) (some? V1351 (tl V1352))) (true (shen.f-error some?)))) - -(defun every? (V1361 V1362) (cond ((= () V1362) true) ((and (cons? V1362) (V1361 (hd V1362))) (every? V1361 (tl V1362))) (true false))) - -(defun sort (V1369 V1370) (cond ((= () V1370) ()) ((and (cons? V1370) (= () (tl V1370))) V1370) ((cons? V1370) (let W1371 (mapcan (lambda Z1372 (if ((V1369 Z1372) (hd V1370)) (cons Z1372 ()) ())) (tl V1370)) (let W1373 (mapcan (lambda Z1374 (if (not ((V1369 Z1374) (hd V1370))) (cons Z1374 ()) ())) (tl V1370)) (append (sort V1369 W1371) (append (cons (hd V1370) ()) (sort V1369 W1373)))))) (true (shen.f-error sort)))) - -(defun find (V1382 V1383) (cond ((= () V1383) (simple-error "find has found no element -")) ((and (cons? V1383) (V1382 (hd V1383))) (hd V1383)) ((cons? V1383) (find V1382 (tl V1383))) (true (shen.f-error find)))) - -(defun foldr (V1388 V1389 V1390) (cond ((= () V1390) V1389) ((cons? V1390) (foldr V1388 ((V1388 (hd V1390)) V1389) (tl V1390))) (true (shen.f-error foldr)))) - -(defun foldl (V1396 V1397 V1398) (cond ((= () V1398) V1397) ((cons? V1398) (foldl V1396 ((V1396 V1397) (hd V1398)) (tl V1398))) (true (shen.f-error foldl)))) - -(defun mapf (V1406 V1407 V1408) (cond ((= () V1407) ()) ((cons? V1407) ((V1408 (V1406 (hd V1407))) (mapf V1406 (tl V1407) V1408))) (true (shen.f-error mapf)))) - -(defun filter (V1414 V1415) (cond ((= () V1415) ()) ((cons? V1415) (if (V1414 (hd V1415)) (cons (hd V1415) (filter V1414 (tl V1415))) (filter V1414 (tl V1415)))) (true (shen.f-error filter)))) - -(defun remove-if (V1420 V1421) (cond ((= () V1421) ()) ((cons? V1421) (if (V1420 (hd V1421)) (remove-if V1420 (tl V1421)) (cons (hd V1421) (remove-if V1420 (tl V1421))))) (true (shen.f-error remove-if)))) - -(defun list.reduce (V1424 V1425 V1426) (cond ((= () V1426) V1425) ((cons? V1426) (list.reduce V1424 ((V1424 V1425) (hd V1426)) (tl V1426))) (true (shen.f-error list.reduce)))) - -(defun take (V1434 V1435) (cond ((= 0 V1434) ()) ((= () V1435) ()) ((cons? V1435) (cons (hd V1435) (take (- V1434 1) (tl V1435)))) (true (shen.f-error take)))) - -(defun take-last (V1438 V1439) (reverse (take V1438 (reverse V1439)))) - -(defun cartprod (V1444 V1445) (cond ((= () V1444) ()) ((cons? V1444) (append (map (lambda Z1446 (cons (hd V1444) (cons Z1446 ()))) V1445) (cartprod (tl V1444) V1445))) (true (shen.f-error cartprod)))) - -(defun powerset (V1449) (cond ((= () V1449) (cons () ())) ((cons? V1449) (let W1450 (powerset (tl V1449)) (append W1450 (map (lambda Z1451 (cons (hd V1449) Z1451)) W1450)))) (true (shen.f-error powerset)))) - -(defun partition (V1459 V1460) (cond ((= () V1460) ()) ((cons? V1460) (let W1461 (mapcan (lambda Z1462 (if ((V1459 (hd V1460)) Z1462) (cons Z1462 ()) ())) V1460) (let W1463 (difference V1460 W1461) (cons W1461 (partition V1459 W1463))))) (true (simple-error "partition equires a list")))) - -(defun transitive-closure (V1466) (let W1467 (list.transitive-pass V1466 V1466) (if (= W1467 V1466) W1467 (list.transitive-pass W1467 W1467)))) - -(defun list.transitive-pass (V1469 V1470) (cond ((= () V1469) V1470) ((and (cons? V1469) (tuple? (hd V1469))) (let W1471 (list.find-trans (fst (hd V1469)) (snd (hd V1469)) V1470) (union W1471 (list.transitive-pass (tl V1469) V1470)))) (true (shen.f-error list.transitive-pass)))) - -(defun list.find-trans (V1481 V1482 V1483) (cond ((= () V1483) ()) ((and (cons? V1483) (and (tuple? (hd V1483)) (= V1482 (fst (hd V1483))))) (cons (@p V1481 (snd (hd V1483))) (list.find-trans V1481 (fst (hd V1483)) (tl V1483)))) ((cons? V1483) (list.find-trans V1481 V1482 (tl V1483))) (true (shen.f-error list.find-trans)))) - -(defun x->ascii (V1488) (map (lambda Z1489 (string->n Z1489)) (explode V1488))) - -(defun splice (V1491 V1492 V1493) (cond ((= 1 V1491) (append V1492 V1493)) ((cons? V1493) (cons (hd V1493) (splice (- V1491 1) V1492 (tl V1493)))) (true (shen.f-error splice)))) - -(defun string-macros (V1497) (cond ((and (cons? V1497) (and (= s-op1 (hd V1497)) (and (cons? (tl V1497)) (and (cons? (tl (tl V1497))) (= () (tl (tl (tl V1497)))))))) (cons s-op1 (cons (hd (tl V1497)) (cons (hd (tl (tl V1497))) (cons (cons /. (cons X (cons X ()))) ()))))) ((and (cons? V1497) (and (= s-op2 (hd V1497)) (and (cons? (tl V1497)) (and (cons? (tl (tl V1497))) (and (cons? (tl (tl (tl V1497)))) (= () (tl (tl (tl (tl V1497)))))))))) (cons s-op2 (cons (hd (tl V1497)) (cons (hd (tl (tl V1497))) (cons (hd (tl (tl (tl V1497)))) (cons (cons /. (cons X (cons X ()))) ())))))) (true V1497))) - -(defun string->list (V1587) (cond ((= "" V1587) ()) (true (string.s->l-h V1587 1 (pos V1587 0) ())))) - -(defun string.s->l-h (V1589 V1590 V1591 V1592) (cond ((= "" V1591) (reverse V1592)) (true (string.s->l-h V1589 (+ V1590 1) (trap-error (pos V1589 V1590) (lambda Z1593 "")) (cons V1591 V1592))))) - -(defun list->string (V1598) (cond ((= () V1598) "") ((cons? V1598) (cn (hd V1598) (list->string (tl V1598)))) (true (shen.f-error list->string)))) - -(defun s-op1 (V1600 V1601 V1602) (V1602 (V1600 (string->list V1601)))) - -(defun s-op2 (V1606 V1607 V1608 V1609) (V1609 ((V1606 (string->list V1607)) (string->list V1608)))) - -(defun string.count (V1619 V1620) (cond ((= "" V1620) 0) ((and (shen.+string? V1620) (= V1619 (hdstr V1620))) (+ 1 (string.count (hdstr V1620) (tlstr V1620)))) ((shen.+string? V1620) (string.count V1619 (tlstr V1620))) (true (shen.f-error string.count)))) - -(defun string.reverse (V1625) (s-op1 (lambda Z1626 (reverse Z1626)) V1625 (lambda Z1627 (list->string Z1627)))) - -(defun string.element? (V1629 V1630) (s-op1 (lambda Z1631 (element? V1629 Z1631)) V1630 (lambda Z1632 Z1632))) - -(defun string.prefix? (V1637 V1638) (s-op2 (lambda Z1639 (lambda Z1640 (prefix? Z1639 Z1640))) V1637 V1638 (lambda Z1641 Z1641))) - -(defun string.infix? (V1646 V1647) (s-op2 (lambda Z1648 (lambda Z1649 (infix? Z1648 Z1649))) V1646 V1647 (lambda Z1650 Z1650))) - -(defun string.suffix? (V1655 V1656) (s-op2 (lambda Z1657 (lambda Z1658 (suffix? Z1657 Z1658))) V1655 V1656 (lambda Z1659 Z1659))) - -(defun string.subset? (V1664 V1665) (s-op2 (lambda Z1666 (lambda Z1667 (subset? Z1666 Z1667))) V1664 V1665 (lambda Z1668 Z1668))) - -(defun string.set=? (V1673 V1674) (s-op2 (lambda Z1675 (lambda Z1676 (set=? Z1675 Z1676))) V1673 V1674 (lambda Z1677 Z1677))) - -(defun string.set? (V1681) (s-op1 (lambda Z1682 (set? Z1682)) V1681 (lambda Z1683 Z1683))) - -(defun file-extension (V1685 V1686) (cn (strip-extension V1685) V1686)) - -(defun strip-extension (V1691) (cond ((= "" V1691) "") ((and (shen.+string? V1691) (= "." (hdstr V1691))) "") ((shen.+string? V1691) (@s (hdstr V1691) (strip-extension (tlstr V1691)))) (true (shen.f-error strip-extension)))) - -(defun string.length (V1694) (s-op1 (lambda Z1695 (length Z1695)) V1694 (lambda Z1696 Z1696))) - -(defun string.trim (V1700 V1701) (s-op1 (lambda Z1702 (trim V1700 Z1702)) V1701 (lambda Z1703 (list->string Z1703)))) - -(defun string.trim-if (V1708 V1709) (s-op1 (lambda Z1710 (trim-if V1708 Z1710)) V1709 (lambda Z1711 (list->string Z1711)))) - -(defun string.trim-right-if (V1716 V1717) (s-op1 (lambda Z1718 (trim-right-if V1716 Z1718)) V1717 (lambda Z1719 (list->string Z1719)))) - -(defun string.trim-left-if (V1724 V1725) (s-op1 (lambda Z1726 (trim-left-if V1724 Z1726)) V1725 (lambda Z1727 (list->string Z1727)))) - -(defun string.trim-right (V1732 V1733) (s-op1 (lambda Z1734 (trim-right V1732 Z1734)) V1733 (lambda Z1735 (list->string Z1735)))) - -(defun string.trim-left (V1740 V1741) (s-op1 (lambda Z1742 (trim-left V1740 Z1742)) V1741 (lambda Z1743 (list->string Z1743)))) - -(defun string.some? (V1748 V1749) (cond ((= "" V1749) false) ((shen.+string? V1749) (or (V1748 (hdstr V1749)) (string.some? V1748 (tlstr V1749)))) (true (shen.f-error string.some?)))) - -(defun string.every? (V1754 V1755) (cond ((= "" V1755) true) ((shen.+string? V1755) (and (V1754 (hdstr V1755)) (string.every? V1754 (tlstr V1755)))) (true (shen.f-error string.every?)))) - -(defun string.difference (V1761 V1762) (s-op2 (lambda Z1763 (lambda Z1764 (difference Z1763 Z1764))) V1761 V1762 (lambda Z1765 (list->string Z1765)))) - -(defun string.intersection (V1771 V1772) (s-op2 (lambda Z1773 (lambda Z1774 (intersection Z1773 Z1774))) V1771 V1772 (lambda Z1775 (list->string Z1775)))) - -(defun string.nth (V1778 V1779) (pos V1779 (+ V1778 1))) - -(defun whitespace? (V1784) (cond ((shen.+string? V1784) (let W1785 (string->n (hdstr V1784)) (element? W1785 (cons 9 (cons 10 (cons 13 (cons 32 ()))))))) (true (shen.f-error whitespace?)))) - -(defun uppercase? (V1789) (cond ((shen.+string? V1789) (let W1790 (string->n (hdstr V1789)) (and (> W1790 64) (< W1790 91)))) (true (shen.f-error uppercase?)))) - -(defun lowercase? (V1794) (cond ((shen.+string? V1794) (let W1795 (string->n (hdstr V1794)) (and (> W1795 96) (< W1795 123)))) (true (shen.f-error lowercase?)))) - -(defun digit? (V1799) (cond ((shen.+string? V1799) (let W1800 (string->n (hdstr V1799)) (and (> W1800 47) (< W1800 58)))) (true (shen.f-error digit?)))) - -(defun alpha? (V1806) (cond ((shen.+string? V1806) (let W1807 (string->n (hdstr V1806)) (or (and (> W1807 64) (< W1807 91)) (and (> W1807 96) (< W1807 123))))) (true false))) - -(defun alphanum? (V1813) (cond ((shen.+string? V1813) (let W1814 (string->n (hdstr V1813)) (or (and (> W1814 64) (< W1814 91)) (or (and (> W1814 96) (< W1814 123)) (and (> W1814 47) (< W1814 58)))))) (true false))) - -(defun tokenise (V1816 V1817) (string.tokenise-h V1816 V1817 "")) - -(defun string.tokenise-h (V1822 V1823 V1824) (cond ((= "" V1823) (cons V1824 ())) ((and (shen.+string? V1823) (V1822 (hdstr V1823))) (cons V1824 (string.tokenise-h V1822 (tlstr V1823) ""))) ((shen.+string? V1823) (string.tokenise-h V1822 (tlstr V1823) (@s V1824 (hdstr V1823)))) (true (shen.f-error string.tokenise-h)))) - -(defun uppercase (V1828) (cond ((shen.+string? V1828) (if (lowercase? (hdstr V1828)) (@s (n->string (- (string->n (hdstr V1828)) 32)) (tlstr V1828)) V1828)) (true (shen.f-error uppercase)))) - -(defun lowercase (V1830) (cond ((shen.+string? V1830) (if (uppercase? (hdstr V1830)) (@s (n->string (+ (string->n (hdstr V1830)) 32)) (tlstr V1830)) V1830)) (true (shen.f-error lowercase)))) - -(defun string.map (V1834 V1835) (cond ((= "" V1835) "") ((shen.+string? V1835) (@s (V1834 (hdstr V1835)) (string.map V1834 (tlstr V1835)))) (true (shen.f-error string.map)))) - -(defun spell-number (V1839) (cond ((= 0 V1839) "zero") (true (string.scale (map (lambda Z1840 (string.digits Z1840)) (string.triples (explode V1839))))))) - -(defun string.digit (V1842) (cond ((= "0" V1842) "") ((= "1" V1842) "one") ((= "2" V1842) "two") ((= "3" V1842) "three") ((= "4" V1842) "four") ((= "5" V1842) "five") ((= "6" V1842) "six") ((= "7" V1842) "seven") ((= "8" V1842) "eight") ((= "9" V1842) "nine") (true (shen.f-error string.digit)))) - -(defun string.triples (V1844) (string.triples-h (reverse V1844) ())) - -(defun string.triples-h (V1846 V1847) (cond ((and (cons? V1846) (and (cons? (tl V1846)) (cons? (tl (tl V1846))))) (string.triples-h (tl (tl (tl V1846))) (cons (reverse (cons (hd V1846) (cons (hd (tl V1846)) (cons (hd (tl (tl V1846))) ())))) V1847))) (true (cons (reverse V1846) V1847)))) - -(defun string.digits (V1850) (cond ((and (cons? V1850) (and (= "0" (hd V1850)) (and (cons? (tl V1850)) (and (= "0" (hd (tl V1850))) (and (cons? (tl (tl V1850))) (and (= "0" (hd (tl (tl V1850)))) (= () (tl (tl (tl V1850)))))))))) "") ((and (cons? V1850) (and (cons? (tl V1850)) (and (= "0" (hd (tl V1850))) (and (cons? (tl (tl V1850))) (and (= "0" (hd (tl (tl V1850)))) (= () (tl (tl (tl V1850))))))))) (@s (string.digit (hd V1850)) (@s " " "hundred"))) ((and (cons? V1850) (and (= "0" (hd V1850)) (and (cons? (tl V1850)) (and (= "0" (hd (tl V1850))) (and (cons? (tl (tl V1850))) (= () (tl (tl (tl V1850))))))))) (@s "a" (@s "n" (@s "d" (@s " " (string.digit (hd (tl (tl V1850))))))))) ((and (cons? V1850) (and (= "0" (hd V1850)) (and (cons? (tl V1850)) (and (cons? (tl (tl V1850))) (= () (tl (tl (tl V1850)))))))) (@s "a" (@s "n" (@s "d" (@s " " (string.tens (hd (tl V1850)) (hd (tl (tl V1850))))))))) ((and (cons? V1850) (and (cons? (tl V1850)) (and (= "0" (hd (tl V1850))) (and (cons? (tl (tl V1850))) (= () (tl (tl (tl V1850)))))))) (@s (string.digit (hd V1850)) (@s " " (@s "h" (@s "u" (@s "n" (@s "d" (@s "r" (@s "e" (@s "d" (@s " " (@s "a" (@s "n" (@s "d" (@s " " (string.digit (hd (tl (tl V1850))))))))))))))))))) ((and (cons? V1850) (and (cons? (tl V1850)) (and (cons? (tl (tl V1850))) (= () (tl (tl (tl V1850))))))) (@s (string.digit (hd V1850)) (@s " " (@s "h" (@s "u" (@s "n" (@s "d" (@s "r" (@s "e" (@s "d" (@s " " (@s "a" (@s "n" (@s "d" (@s " " (string.tens (hd (tl V1850)) (hd (tl (tl V1850))))))))))))))))))) ((and (cons? V1850) (and (cons? (tl V1850)) (= () (tl (tl V1850))))) (string.tens (hd V1850) (hd (tl V1850)))) ((and (cons? V1850) (= () (tl V1850))) (string.digit (hd V1850))) ((= () V1850) "") (true (shen.f-error string.digits)))) - -(defun string.tens (V1852 V1853) (cond ((= "1" V1852) (if (= V1853 "0") "ten" (if (= V1853 "1") "eleven" (if (= V1853 "2") "twelve" (if (= V1853 "3") "thirteen" (if (= V1853 "4") "fourteen" (if (= V1853 "5") "fifteen" (if (= V1853 "6") "sixteen" (if (= V1853 "7") "seventeen" (if (= V1853 "8") "eighteen" (if (= V1853 "9") "nineteen" (simple-error "error: cases exhausted")))))))))))) ((= "2" V1852) (@s "t" (@s "w" (@s "e" (@s "n" (@s "t" (@s "y" (@s " " (string.digit V1853))))))))) ((= "3" V1852) (@s "t" (@s "h" (@s "i" (@s "r" (@s "t" (@s "y" (@s " " (string.digit V1853))))))))) ((= "4" V1852) (@s "f" (@s "o" (@s "r" (@s "t" (@s "y" (@s " " (string.digit V1853)))))))) ((= "5" V1852) (@s "f" (@s "i" (@s "f" (@s "t" (@s "y" (@s " " (string.digit V1853)))))))) ((= "6" V1852) (@s "s" (@s "i" (@s "x" (@s "t" (@s "y" (@s " " (string.digit V1853)))))))) ((= "7" V1852) (@s "s" (@s "e" (@s "v" (@s "e" (@s "n" (@s "t" (@s "y" (@s " " (string.digit V1853)))))))))) ((= "8" V1852) (@s "e" (@s "i" (@s "g" (@s "h" (@s "t" (@s "y" (@s " " (string.digit V1853))))))))) ((= "9" V1852) (@s "n" (@s "i" (@s "n" (@s "e" (@s "t" (@s "y" (@s " " (string.digit V1853))))))))) (true (shen.f-error string.tens)))) - -(defun string.scale (V1856) (cond ((and (cons? V1856) (= () (tl V1856))) (hd V1856)) ((and (cons? V1856) (= "" (hd V1856))) (string.scale (tl V1856))) ((cons? V1856) (@s (hd V1856) (@s (string.units (length V1856)) (string.scale (tl V1856))))) (true (shen.f-error string.scale)))) - -(defun string.units (V1860) (cond ((= 2 V1860) " thousand ") ((= 3 V1860) " million ") ((= 4 V1860) " billion ") ((= 5 V1860) " trillion ") (true (simple-error "this number has a magnitude beyond our text representation")))) - -(defun string>? (V1866 V1867) (cond ((= "" V1866) false) ((= "" V1867) true) ((and (shen.+string? V1866) (shen.+string? V1867)) (let W1868 (string->n (hdstr V1866)) (let W1869 (string->n (hdstr V1867)) (if (> W1868 W1869) true (if (< W1868 W1869) false (string>? (tlstr V1866) (tlstr V1867))))))) (true (shen.f-error string>?)))) - -(defun stringn (hdstr V1876)) (let W1879 (string->n (hdstr V1877)) (if (< W1878 W1879) true (if (> W1878 W1879) false (string=? (V1882 V1883) (or (= V1882 V1883) (string>? V1882 V1883))) - -(defun string<=? (V1886 V1887) (or (= V1886 V1887) (stringstrings W1900 ()) (let W1902 (compile (fn string.) W1901) (let W1903 (file-extension V1898 V1899) (let W1904 (write-to-file W1903 W1902) W1903)))))) - -(defun string.bytes->strings (V1907 V1908) (cond ((= () V1907) (reverse V1908)) ((cons? V1907) (string.bytes->strings (tl V1907) (cons (n->string (hd V1907)) V1908))) (true (shen.f-error string.bytes->strings)))) - -(defun render (V1911) (compile (fn string.) (string->list V1911))) - -(defun string.rendered? (V1917) (cond ((= "" V1917) true) ((and (shen.+string? V1917) (= "{" (hdstr V1917))) false) ((shen.+string? V1917) (string.rendered? (tlstr V1917))) (true (shen.f-error string.rendered?)))) - -(defun string. (V1924) (let W1925 (if (shen.hds=? V1924 "{") (let W1926 (tail V1924) (let W1927 ((fn string.) W1926) (if (shen.parse-failure? W1927) (shen.parse-failure) (let W1928 (shen.<-out W1927) (let W1929 (shen.in-> W1927) (let W1930 ((fn string.) W1929) (if (shen.parse-failure? W1930) (shen.parse-failure) (let W1931 (shen.in-> W1930) (let W1932 ((fn string.) W1931) (if (shen.parse-failure? W1932) (shen.parse-failure) (let W1933 (shen.<-out W1932) (let W1934 (shen.in-> W1932) (if (shen.hds=? W1934 "}") (let W1935 (tail W1934) (let W1936 ((fn string.) W1935) (if (shen.parse-failure? W1936) (shen.parse-failure) (let W1937 (shen.<-out W1936) (let W1938 (shen.in-> W1936) (shen.comb W1938 (cn (string.recapply (fn (intern W1928)) W1933) W1937))))))) (shen.parse-failure)))))))))))))) (shen.parse-failure)) (if (shen.parse-failure? W1925) (let W1939 (if (shen.hds=? V1924 "{") (let W1940 (tail V1924) (let W1941 ((fn string.) W1940) (if (shen.parse-failure? W1941) (shen.parse-failure) (let W1942 (shen.<-out W1941) (let W1943 (shen.in-> W1941) (if (shen.hds=? W1943 "}") (let W1944 (tail W1943) (let W1945 ((fn string.) W1944) (if (shen.parse-failure? W1945) (shen.parse-failure) (let W1946 (shen.<-out W1945) (let W1947 (shen.in-> W1945) (shen.comb W1947 (cn ((intern W1942)) W1946))))))) (shen.parse-failure))))))) (shen.parse-failure)) (if (shen.parse-failure? W1939) (let W1948 (let W1949 ((fn string.) V1924) (if (shen.parse-failure? W1949) (shen.parse-failure) (let W1950 (shen.<-out W1949) (let W1951 (shen.in-> W1949) (let W1952 ((fn string.) W1951) (if (shen.parse-failure? W1952) (shen.parse-failure) (let W1953 (shen.<-out W1952) (let W1954 (shen.in-> W1952) (shen.comb W1954 (cn W1950 W1953)))))))))) (if (shen.parse-failure? W1948) (let W1955 (let W1956 ( V1924) (if (shen.parse-failure? W1956) (shen.parse-failure) (let W1957 (shen.in-> W1956) (shen.comb W1957 "")))) (if (shen.parse-failure? W1955) (shen.parse-failure) W1955)) W1948)) W1939)) W1925))) - -(defun string. (V1961) (let W1962 (if (cons? V1961) (let W1963 (head V1961) (let W1964 (tail V1961) (if (and (not (= W1963 "}")) (not (= W1963 "\"))) (shen.comb W1964 W1963) (shen.parse-failure)))) (shen.parse-failure)) (if (shen.parse-failure? W1962) (shen.parse-failure) W1962))) - -(defun string.recapply (V1966 V1967) (cond ((= () V1967) V1966) ((cons? V1967) (string.recapply (V1966 (hd V1967)) (tl V1967))) (true (shen.f-error string.recapply)))) - -(defun string. (V1972) (let W1973 (let W1974 ((fn string.) V1972) (if (shen.parse-failure? W1974) (shen.parse-failure) (let W1975 (shen.<-out W1974) (let W1976 (shen.in-> W1974) (if (shen.hds=? W1976 "\") (let W1977 (tail W1976) (let W1978 ((fn string.) W1977) (if (shen.parse-failure? W1978) (shen.parse-failure) (let W1979 (shen.<-out W1978) (let W1980 (shen.in-> W1978) (shen.comb W1980 (cons W1975 W1979))))))) (shen.parse-failure)))))) (if (shen.parse-failure? W1973) (let W1981 (let W1982 ((fn string.) V1972) (if (shen.parse-failure? W1982) (shen.parse-failure) (let W1983 (shen.<-out W1982) (let W1984 (shen.in-> W1982) (shen.comb W1984 (cons W1983 ())))))) (if (shen.parse-failure? W1981) (shen.parse-failure) W1981)) W1973))) - -(defun string. (V1987) (let W1988 (let W1989 (string. V1987) (if (shen.parse-failure? W1989) (shen.parse-failure) (let W1990 (shen.<-out W1989) (let W1991 (shen.in-> W1989) (shen.comb W1991 W1990))))) (if (shen.parse-failure? W1988) (shen.parse-failure) W1988))) - -(defun string. (V1995) (let W1996 (if (cons? V1995) (let W1997 (head V1995) (let W1998 (tail V1995) (if (and (not (= W1997 "}")) (not (= W1997 "\"))) (shen.comb W1998 W1997) (shen.parse-failure)))) (shen.parse-failure)) (if (shen.parse-failure? W1996) (shen.parse-failure) W1996))) - -(defun string. (V2002) (let W2003 (if (cons? V2002) (let W2004 (head V2002) (let W2005 (tail V2002) (if (whitespace? W2004) (shen.comb W2005 string.skip) (shen.parse-failure)))) (shen.parse-failure)) (if (shen.parse-failure? W2003) (shen.parse-failure) W2003))) - -(defun string. (V2008) (let W2009 (let W2010 ((fn string.) V2008) (if (shen.parse-failure? W2010) (shen.parse-failure) (let W2011 (shen.<-out W2010) (let W2012 (shen.in-> W2010) (let W2013 ((fn string.) W2012) (if (shen.parse-failure? W2013) (shen.parse-failure) (let W2014 (shen.<-out W2013) (let W2015 (shen.in-> W2013) (shen.comb W2015 (cn W2011 W2014)))))))))) (if (shen.parse-failure? W2009) (let W2016 (let W2017 ( V2008) (if (shen.parse-failure? W2017) (shen.parse-failure) (let W2018 (shen.in-> W2017) (shen.comb W2018 "")))) (if (shen.parse-failure? W2016) (shen.parse-failure) W2016)) W2009))) - -(defun string. (V2022) (let W2023 (if (cons? V2022) (let W2024 (head V2022) (let W2025 (tail V2022) (if (and (not (= W2024 "}")) (and (not (= W2024 "\")) (not (whitespace? W2024)))) (shen.comb W2025 W2024) (shen.parse-failure)))) (shen.parse-failure)) (if (shen.parse-failure? W2023) (shen.parse-failure) W2023))) - -(defun vector.vector-macros (V2049) (cond ((and (cons? V2049) (and (= := (hd V2049)) (and (cons? (tl V2049)) (and (cons? (tl (tl V2049))) (= () (tl (tl (tl V2049)))))))) (vector.<-array (hd (tl V2049)) (hd (tl (tl V2049))))) ((and (cons? V2049) (and (cons? (tl V2049)) (and (cons? (tl (tl V2049))) (and (= := (hd (tl (tl V2049)))) (and (cons? (tl (tl (tl V2049)))) (cons? (tl (tl (tl (tl V2049)))))))))) (vector.key (hd V2049) (hd (tl V2049)) (vector.array-> (hd V2049) (hd (tl V2049)) (vector.<-array (hd (tl (tl (tl V2049)))) (hd (tl (tl (tl (tl V2049))))))) (tl (tl (tl (tl (tl V2049))))))) ((and (cons? V2049) (and (cons? (tl V2049)) (and (cons? (tl (tl V2049))) (and (= := (hd (tl (tl V2049)))) (cons? (tl (tl (tl V2049)))))))) (vector.key (hd V2049) (hd (tl V2049)) (vector.array-> (hd V2049) (hd (tl V2049)) (hd (tl (tl (tl V2049))))) (tl (tl (tl (tl V2049)))))) ((and (cons? V2049) (and (= vector.array-> (hd V2049)) (and (cons? (tl V2049)) (and (cons? (tl (tl V2049))) (and (cons? (tl (tl (tl V2049)))) (= () (tl (tl (tl (tl V2049)))))))))) (vector.array-> (hd (tl V2049)) (hd (tl (tl V2049))) (hd (tl (tl (tl V2049)))))) ((and (cons? V2049) (and (= array (hd V2049)) (and (cons? (tl V2049)) (= () (tl (tl V2049)))))) (vector.build-array (hd (tl V2049)))) ((and (cons? V2049) (and (= populate (hd V2049)) (and (cons? (tl V2049)) (and (cons? (tl (tl V2049))) (and (cons? (hd (tl (tl V2049)))) (and (= cons (hd (hd (tl (tl V2049))))) (and (cons? (tl (hd (tl (tl V2049))))) (and (cons? (tl (tl (hd (tl (tl V2049)))))) (and (= () (tl (tl (tl (hd (tl (tl V2049))))))) (= () (tl (tl (tl V2049))))))))))))) (vector.unfold-populate (hd (tl V2049)) (hd (tl (tl V2049))))) ((and (cons? V2049) (and (= vector->list (hd V2049)) (and (cons? (tl V2049)) (= () (tl (tl V2049)))))) (cons vector->list (cons (hd (tl V2049)) (cons () ())))) ((and (cons? V2049) (and (= v-op1 (hd V2049)) (and (cons? (tl V2049)) (and (cons? (tl (tl V2049))) (= () (tl (tl (tl V2049)))))))) (cons v-op1 (cons (hd (tl V2049)) (cons (hd (tl (tl V2049))) (cons () ()))))) ((and (cons? V2049) (and (= v-op2 (hd V2049)) (and (cons? (tl V2049)) (and (cons? (tl (tl V2049))) (and (cons? (tl (tl (tl V2049)))) (= () (tl (tl (tl (tl V2049)))))))))) (cons v-op2 (cons (hd (tl V2049)) (cons (hd (tl (tl V2049))) (cons (hd (tl (tl (tl V2049)))) (cons () ())))))) (true V2049))) - -(defun vector.key (V2065 V2066 V2067 V2068) (cond ((= () V2068) V2067) ((and (cons? V2068) (and (= error (hd V2068)) (= () (tl V2068)))) V2067) ((and (cons? V2068) (and (= ignore (hd V2068)) (= () (tl V2068)))) (cons trap-error (cons V2067 (cons (cons /. (cons (newv) (cons V2065 ()))) ())))) ((and (cons? V2068) (and (= insert (hd V2068)) (and (cons? (tl V2068)) (= () (tl (tl V2068)))))) (cons trap-error (cons V2067 (cons (cons /. (cons (newv) (cons (cons V2065 (cons V2066 (cons := (tl V2068)))) ()))) ())))) ((and (cons? V2068) (and (= overwrite (hd V2068)) (= () (tl V2068)))) (cons trap-error (cons V2067 (cons (cons /. (cons (newv) (cons (cons depopulate (cons V2065 (cons V2066 ()))) ()))) ())))) (true (simple-error (cn "key not recognised " (shen.app V2068 " -" shen.a)))))) - -(defun vector.build-array (V2073) (cond ((and (cons? V2073) (and (= cons (hd V2073)) (and (cons? (tl V2073)) (and (cons? (tl (tl V2073))) (and (= () (hd (tl (tl V2073)))) (= () (tl (tl (tl V2073))))))))) (cons vector (cons (hd (tl V2073)) ()))) ((and (cons? V2073) (and (= cons (hd V2073)) (and (cons? (tl V2073)) (and (cons? (tl (tl V2073))) (= () (tl (tl (tl V2073)))))))) (let W2074 (newv) (let W2075 (newv) (cons let (cons W2075 (cons (cons vector (cons (hd (tl V2073)) ())) (cons (cons for (cons W2074 (cons = (cons 1 (cons (cons <= (cons W2074 (cons (hd (tl V2073)) ()))) (cons (cons vector-> (cons W2075 (cons W2074 (cons (vector.build-array (hd (tl (tl V2073)))) ())))) ())))))) ()))))))) (true (simple-error (cn "array cannot macro expand the dimensional argument " (shen.app V2073 " -" shen.r)))))) - -(defun depopulate (V2079 V2080) (cond ((and (cons? V2080) (= () (tl V2080))) (address-> V2079 (hd V2080) (fail))) ((cons? V2080) (do (depopulate (<-vector V2079 (hd V2080)) (tl V2080)) V2079)) (true (simple-error (cn "depopulate cannot use the dimensional argument " (shen.app V2080 " -" shen.s)))))) - -(defun populated? (V2083 V2084) (cond ((and (cons? V2084) (= () (tl V2084))) (not (= (<-address V2083 (hd V2084)) (fail)))) ((cons? V2084) (populated? (<-address V2083 (hd V2084)) (tl V2084))) (true (shen.f-error populated?)))) - -(defun vector.unfold-populate (V2087 V2088) (cond ((and (cons? V2088) (and (= cons (hd V2088)) (and (cons? (tl V2088)) (and (cons? (tl (tl V2088))) (and (= () (hd (tl (tl V2088)))) (= () (tl (tl (tl V2088))))))))) (cons populate (cons V2087 (cons (hd (tl V2088)) ())))) ((and (cons? V2088) (and (= cons (hd V2088)) (and (cons? (tl V2088)) (and (cons? (tl (tl V2088))) (= () (tl (tl (tl V2088)))))))) (cons populate (cons (cons /. (cons (newv) (cons (vector.unfold-populate V2087 (hd (tl (tl V2088)))) ()))) (cons (hd (tl V2088)) ())))) (true (shen.f-error vector.unfold-populate)))) - -(defun populate (V2094 V2095) (let W2096 (absvector (+ V2095 1)) (let W2097 (address-> W2096 0 V2095) (for 1 (lambda Z2098 (<= Z2098 V2095)) (lambda Z2099 (address-> W2096 Z2099 (V2094 Z2099))) (lambda Z2100 (+ 1 Z2100)) (lambda Z2101 (lambda Z2102 (do Z2101 Z2102))))))) - -(defun vector.<-array (V2107 V2108) (cond ((and (cons? V2108) (and (= cons (hd V2108)) (and (cons? (tl V2108)) (and (cons? (tl (tl V2108))) (and (= () (hd (tl (tl V2108)))) (= () (tl (tl (tl V2108))))))))) (cons <-vector (cons V2107 (cons (hd (tl V2108)) ())))) ((and (cons? V2108) (and (= cons (hd V2108)) (and (cons? (tl V2108)) (and (cons? (tl (tl V2108))) (= () (tl (tl (tl V2108)))))))) (vector.<-array (cons <-vector (cons V2107 (cons (hd (tl V2108)) ()))) (hd (tl (tl V2108))))) (true (simple-error (cn "cannot macro expand the dimensional argument " (shen.app V2108 " -" shen.r)))))) - -(defun vector.array-> (V2111 V2112 V2113) (cond ((and (cons? V2112) (and (= cons (hd V2112)) (and (cons? (tl V2112)) (and (cons? (tl (tl V2112))) (and (= () (hd (tl (tl V2112)))) (= () (tl (tl (tl V2112))))))))) (cons vector-> (cons V2111 (cons (hd (tl V2112)) (cons V2113 ()))))) (true (let W2114 (newv) (cons let (cons W2114 (cons V2111 (cons (vector.unfold-vector-assignment W2114 W2114 V2112 V2113) ())))))))) - -(defun vector.unfold-vector-assignment (V2124 V2125 V2126 V2127) (cond ((and (cons? V2126) (and (= cons (hd V2126)) (and (cons? (tl V2126)) (and (cons? (tl (tl V2126))) (and (= () (hd (tl (tl V2126)))) (= () (tl (tl (tl V2126))))))))) (let W2128 (newv) (cons let (cons W2128 (cons (cons vector-> (cons V2125 (cons (hd (tl V2126)) (cons V2127 ())))) (cons V2124 ())))))) ((and (cons? V2126) (and (= cons (hd V2126)) (and (cons? (tl V2126)) (and (cons? (tl (tl V2126))) (= () (tl (tl (tl V2126)))))))) (let W2129 (newv) (cons let (cons W2129 (cons (cons <-vector (cons V2125 (cons (hd (tl V2126)) ()))) (cons (vector.unfold-vector-assignment V2124 W2129 (hd (tl (tl V2126))) V2127) ())))))) (true (simple-error (cn "cannot macro expand the dimensional argument " (shen.app V2126 " -" shen.r)))))) - -(defun compress (V2168) (list->vector (vector->list V2168 ()))) - -(defun vector.copy (V2174) (let W2175 (limit V2174) (let W2176 (vector W2175) (for 1 (lambda Z2177 (<= Z2177 W2175)) (lambda Z2178 (trap-error (vector-> W2176 Z2178 (<-vector V2174 Z2178)) (lambda Z2179 (depopulate W2176 (cons Z2178 ()))))) (lambda Z2180 (+ 1 Z2180)) (lambda Z2181 (lambda Z2182 (do Z2181 Z2182))))))) - -(defun vector.reverse (V2187) (let W2188 (limit V2187) (let W2189 (vector W2188) (let W2190 (for W2188 (lambda Z2191 (> Z2191 0)) (lambda Z2192 (trap-error (vector-> W2189 Z2192 (<-vector V2187 (+ 1 (- W2188 Z2192)))) (lambda Z2193 (depopulate W2189 (cons Z2192 ()))))) (lambda Z2194 (- Z2194 1)) (lambda Z2195 (lambda Z2196 (do Z2195 Z2196)))) W2189)))) - -(defun vector.append (V2206 V2207) (let W2208 (limit V2206) (let W2209 (limit V2207) (let W2210 (+ W2208 W2209) (let W2211 (vector W2210) (let W2212 (for 1 (lambda Z2213 (<= Z2213 W2208)) (lambda Z2214 (trap-error (vector-> W2211 Z2214 (<-vector V2206 Z2214)) (lambda Z2215 (depopulate W2211 (cons Z2214 ()))))) (lambda Z2216 (+ 1 Z2216)) (lambda Z2217 (lambda Z2218 (do Z2217 Z2218)))) (let W2219 (for (+ W2208 1) (lambda Z2220 (<= Z2220 W2210)) (lambda Z2221 (trap-error (vector-> W2211 Z2221 (<-vector V2207 Z2221)) (lambda Z2222 (depopulate W2211 (cons Z2221 ()))))) (lambda Z2223 (+ 1 Z2223)) (lambda Z2224 (lambda Z2225 (do Z2224 Z2225)))) W2211))))))) - -(defun vector.dfilter (V2231 V2232) (let W2233 (limit V2232) (let W2234 (for 1 (lambda Z2235 (<= Z2235 W2233)) (lambda Z2236 (if (and (populated? V2232 (cons Z2236 ())) (V2231 (<-vector V2232 Z2236))) (vector-> V2232 Z2236 (<-vector V2232 Z2236)) (depopulate V2232 (cons Z2236 ())))) (lambda Z2237 (+ 1 Z2237)) (lambda Z2238 (lambda Z2239 (do Z2238 Z2239)))) V2232))) - -(defun vector.element? (V2243 V2244) (let W2245 (limit V2244) (let W2246 (maths.lazyfor-or 1 (lambda Z2247 (<= Z2247 W2245)) (lambda Z2248 (if (populated? V2244 (cons Z2248 ())) (= V2243 (<-vector V2244 Z2248)) false)) (lambda Z2249 (+ 1 Z2249))) W2246))) - -(defun vector.map (V2256 V2257) (let W2258 (limit V2257) (let W2259 (vector W2258) (let W2260 (for 1 (lambda Z2261 (<= Z2261 W2258)) (lambda Z2262 (if (populated? V2257 (cons Z2262 ())) (vector-> W2259 Z2262 (V2256 (<-vector V2257 Z2262))) (trap-error (vector-> W2259 Z2262 (<-vector W2259 Z2262)) (lambda Z2263 (depopulate W2259 (cons Z2262 ())))))) (lambda Z2264 (+ 1 Z2264)) (lambda Z2265 (lambda Z2266 (do Z2265 Z2266)))) W2259)))) - -(defun vector.dmap (V2273 V2274) (let W2275 (limit V2274) (let W2276 (for 1 (lambda Z2277 (<= Z2277 W2275)) (lambda Z2278 (if (populated? V2274 (cons Z2278 ())) (vector-> V2274 Z2278 (V2273 (<-vector V2274 Z2278))) (trap-error (vector-> V2274 Z2278 (<-vector V2274 Z2278)) (lambda Z2279 (depopulate V2274 (cons Z2278 ())))))) (lambda Z2280 (+ 1 Z2280)) (lambda Z2281 (lambda Z2282 (do Z2281 Z2282)))) V2274))) - -(defun vector.every? (V2286 V2287) (let W2288 (limit V2287) (let W2289 (maths.lazyfor-and 1 (lambda Z2290 (<= Z2290 W2288)) (lambda Z2291 (if (populated? V2287 (cons Z2291 ())) (V2286 (<-vector V2287 Z2291)) true)) (lambda Z2292 (+ 1 Z2292))) W2289))) - -(defun vector.some? (V2296 V2297) (let W2298 (limit V2297) (let W2299 (maths.lazyfor-or 1 (lambda Z2300 (<= Z2300 W2298)) (lambda Z2301 (if (populated? V2297 (cons Z2301 ())) (V2296 (<-vector V2297 Z2301)) false)) (lambda Z2302 (+ 1 Z2302))) W2299))) - -(defun vector->list (V2308 V2309) (for 1 (lambda Z2310 (<= Z2310 (limit V2308))) (lambda Z2311 (if (populated? V2308 (cons Z2311 ())) (cons (<-vector V2308 Z2311) ()) V2309)) (lambda Z2312 (+ 1 Z2312)) (lambda Z2313 (lambda Z2314 (append Z2313 Z2314))))) - -(defun list->vector (V2317) (vector.list->vector-h V2317 1 (vector (length V2317)))) - -(defun vector.list->vector-h (V2321 V2322 V2323) (cond ((= () V2321) V2323) ((cons? V2321) (vector.list->vector-h (tl V2321) (+ V2322 1) (vector-> V2323 V2322 (hd V2321)))) (true (shen.f-error vector.list->vector-h)))) - -(defun vacant? (V2328) (maths.lazyfor-and 1 (lambda Z2329 (<= Z2329 (limit V2328))) (lambda Z2330 (not (populated? V2328 (cons Z2330 ())))) (lambda Z2331 (+ 1 Z2331)))) - -(defun dense? (V2334) (maths.lazyfor-and 1 (lambda Z2335 (<= Z2335 (limit V2334))) (lambda Z2336 (populated? V2334 (cons Z2336 ()))) (lambda Z2337 (+ 1 Z2337)))) - -(defun porous? (V2340) (maths.lazyfor-or 1 (lambda Z2341 (<= Z2341 (limit V2340))) (lambda Z2342 (not (populated? V2340 (cons Z2342 ())))) (lambda Z2343 (+ 1 Z2343)))) - -(defun sparse? (V2348) (let W2349 (limit V2348) (let W2350 (for 1 (lambda Z2351 (<= Z2351 (limit V2348))) (lambda Z2352 (if (populated? V2348 (cons Z2352 ())) 1 0)) (lambda Z2353 (+ 1 Z2353)) (lambda Z2354 (lambda Z2355 (+ Z2354 Z2355)))) (let W2356 (- W2349 W2350) (> W2356 W2350))))) - -(defun v-op1 (V2358 V2359 V2360) (list->vector (V2358 (vector->list V2359 V2360)))) - -(defun v-op2 (V2364 V2365 V2366 V2367) (list->vector ((V2364 (vector->list V2365 V2367)) (vector->list V2366 V2367)))) - -(defun print.pprint-macro (V2453) (cond ((and (cons? V2453) (and (= pprint (hd V2453)) (and (cons? (tl V2453)) (= () (tl (tl V2453)))))) (cons pprint (cons (hd (tl V2453)) (cons (cons stoutput ()) ())))) ((and (cons? V2453) (and (= pps (hd V2453)) (and (cons? (tl V2453)) (= () (tl (tl V2453)))))) (cons pps (cons (hd (tl V2453)) (cons (cons stoutput ()) ())))) (true V2453))) - -(defun linelength () (value print.*linelength*)) - -(defun indentation () (value print.*indentation*)) - -(defun set-linelength (V2455) (cond ((and (positive? V2455) (integer? V2455)) (set print.*linelength* V2455)) (true (simple-error "line length must be a positive integer -")))) - -(defun set-indentation (V2457) (cond ((and (positive? V2457) (integer? V2457)) (set print.*indentation* V2457)) (true (simple-error "indentation must be a positive integer -")))) - -(defun pps (V2459 V2460) (let W2461 (ps V2459) (let W2462 (shen.app W2461 "" shen.r) (let W2463 (pretty-string W2462) (let W2464 (pr W2463 V2460) (let W2465 (nl 1) V2459)))))) - -(defun pprint (V2468 V2469) (let W2470 (shen.app V2468 "" shen.s) (let W2471 (pretty-string W2470) (let W2472 (pr W2471 V2469) (let W2473 (nl 1) V2468))))) - -(defun pretty-string (V2476) (print.pretty-string-h V2476 0 0)) - -(defun print.pretty-string-h (V2482 V2483 V2484) (cond ((= "" V2482) "") ((and (shen.+string? V2482) (= "[" (hdstr V2482))) (@s (print.indent V2483) (@s "[" (print.pretty-string-h (tlstr V2482) (+ V2483 1) 0)))) ((and (shen.+string? V2482) (= "(" (hdstr V2482))) (@s (print.indent V2483) (@s "(" (print.pretty-string-h (tlstr V2482) (+ V2483 1) 0)))) ((and (shen.+string? V2482) (= "]" (hdstr V2482))) (@s "]" (print.pretty-string-h (tlstr V2482) (- V2483 1) 0))) ((and (shen.+string? V2482) (= ")" (hdstr V2482))) (@s ")" (print.pretty-string-h (tlstr V2482) (- V2483 1) 0))) ((and (shen.+string? V2482) (and (= " " (hdstr V2482)) (> V2484 (linelength)))) (@s (print.indent V2483) (print.pretty-string-h (tlstr V2482) V2483 0))) ((shen.+string? V2482) (@s (hdstr V2482) (print.pretty-string-h (tlstr V2482) V2483 (+ V2484 1)))) (true (shen.f-error print.pretty-string-h)))) - -(defun print.indent (V2488) (cond ((= 0 V2488) "") (true (@s " -" (print.indent-h V2488))))) - -(defun print.indent-h (V2490) (cond ((= 0 V2490) "") (true (cn (print.n-space (indentation)) (print.indent-h (- V2490 1)))))) - -(defun print.n-space (V2492) (cond ((= 0 V2492) "") (true (cn " " (print.n-space (- V2492 1)))))) - -(defun delete-file (V2495) (if (= (language) "Common Lisp") ((fn lisp.delete-file) V2495) (close (open V2495 out)))) - -(defun file.file-macro (V2523) (cond ((and (cons? V2523) (and (= errout (hd V2523)) (and (cons? (tl V2523)) (and (cons? (tl (tl V2523))) (and (cons? (tl (tl (tl V2523)))) (= () (tl (tl (tl (tl V2523)))))))))) (let W2524 (newv) (let W2525 (newv) (let W2526 (newv) (let W2527 (newv) (let W2528 (newv) (cons trap-error (cons (hd (tl V2523)) (cons (cons /. (cons W2528 (cons (cons let (cons W2524 (cons (cons error-to-string (cons W2528 ())) (cons W2525 (cons (cons trap-error (cons (cons reopen (tl (tl (tl V2523)))) (cons (cons /. (cons W2528 (cons (cons open (cons (hd (tl (tl (tl V2523)))) (cons out ()))) ()))) ()))) (cons W2526 (cons (cons pr (cons W2524 (cons W2525 ()))) (cons W2527 (cons (cons close (cons W2525 ())) (cons (hd (tl (tl V2523))) ())))))))))) ()))) ()))))))))) (true V2523))) - -(defun append-files (V2530 V2531) (let W2532 (append-files-with-open-stream V2530 V2531) (let W2533 (close W2532) V2531))) - -(defun append-files-with-open-stream (V2536 V2537) (cond ((element? V2537 V2536) (simple-error (cn "cannot read and write to " (shen.app V2537 " at the same time -" shen.a)))) (true (let W2538 (open V2537 out) (let W2539 (mapc (lambda Z2540 (file.read&write (open Z2540 in) W2538)) V2536) W2538))))) - -(defun file.read&write (V2543 V2544) (file.read&write-h (read-byte V2543) V2543 V2544)) - -(defun file.read&write-h (V2547 V2548 V2549) (cond ((= -1 V2547) -1) (true (file.read&write-h (read-byte V2548) V2548 (do (write-byte V2547 V2549) V2549))))) - -(defun reopen (V2553) (let W2554 (read-file-as-bytelist V2553) (let W2555 (open V2553 out) (let W2556 (mapc (lambda Z2557 (write-byte Z2557 W2555)) W2554) W2555)))) - -(defun copy-file (V2559 V2560) (append-files (cons V2559 ()) V2560)) - -(defun copy-file-with-open-stream (V2563 V2564) (append-files-with-open-stream (cons V2563 ()) V2564)) - -(defun file-exists? (V2567) (trap-error (do (close (open V2567 in)) true) (lambda Z2568 false))) - -(defun file-size (V2570) (let W2571 (open V2570 in) (let W2572 (file.file-size-loop W2571 0 (read-byte W2571)) (let W2573 (close W2571) W2572)))) - -(defun file.file-size-loop (V2579 V2580 V2581) (cond ((= -1 V2581) V2580) (true (file.file-size-loop V2579 (+ 1 V2580) (read-byte V2579))))) - -(defun ascii (V2585 V2586 V2587) (let W2588 (read-file-as-bytelist V2587) (file.scan-bytes V2585 V2586 W2588 ""))) - -(defun file.scan-bytes (V2594 V2595 V2596 V2597) (cond ((= () V2596) V2597) ((and (cons? V2596) (and (>= (hd V2596) V2594) (<= (hd V2596) V2595))) (file.scan-bytes V2594 V2595 (tl V2596) (cn V2597 (n->string (hd V2596))))) ((cons? V2596) (simple-error (cn "character has code " (shen.app (hd V2596) (cn ": parsed to here - -" (shen.app V2597 "" shen.a)) shen.a)))) (true (shen.f-error file.scan-bytes)))) - -(defun pairoff (V2616 V2617) (cond ((= () V2616) ()) ((= () V2617) ()) ((and (cons? V2616) (cons? V2617)) (cons (@p (hd V2616) (hd V2617)) (pairoff (tl V2616) (tl V2617)))) (true (shen.f-error pairoff)))) - -(defun assocp (V2627 V2628) (cond ((= () V2628) (simple-error "pair not found -")) ((and (cons? V2628) (and (tuple? (hd V2628)) (= V2627 (fst (hd V2628))))) (hd V2628)) ((cons? V2628) (assocp V2627 (tl V2628))) (true (shen.f-error assocp)))) - -(defun cartprodp (V2633 V2634) (cond ((= () V2633) ()) ((cons? V2633) (append (map (lambda Z2635 (@p (hd V2633) Z2635)) V2634) (cartprodp (tl V2633) V2634))) (true (shen.f-error cartprodp)))) - -(defun assocp-if (V2643 V2644) (cond ((= () V2644) (simple-error "pair not found -")) ((and (cons? V2644) (and (tuple? (hd V2644)) (V2643 (fst (hd V2644))))) (hd V2644)) ((cons? V2644) (assocp-if V2643 (tl V2644))) (true (shen.f-error assocp-if)))) - -(defun assocp-if-not (V2652 V2653) (cond ((= () V2653) (simple-error "pair not found -")) ((and (cons? V2653) (and (tuple? (hd V2653)) (not (V2652 (fst (hd V2653)))))) (hd V2653)) ((cons? V2653) (assocp-if-not V2652 (tl V2653))) (true (shen.f-error assocp-if-not)))) - -(defun stlib.initialise-environment () (do (set maths.*seed* 95795) (do (set maths.*tolerance* 1e-4) (do (set print.*indentation* 1) (do (set print.*linelength* 60) (do (preclude (cons print ())) (do stlib.void (do (put symbol shen.external-symbols (cons newv (cons concat* ())) (value *property-vector*)) (do (put symbol shen.internal-symbols () (value *property-vector*)) (do (put maths shen.external-symbols (cons expt (cons =r (cons gcd (cons lcd (cons isqrt (cons sqrt (cons nthrt (cons floor (cons ceiling (cons round (cons mod (cons lcm (cons random (cons min (cons max (cons reseed (cons ~ (cons positive? (cons negative? (cons natural? (cons converge (cons series (cons odd? (cons even? (cons cos (cons sin (cons tan (cons radians (cons pi (cons e (cons tan30 (cons cos30 (cons cos45 (cons sin45 (cons sqrt2 (cons tan60 (cons sin120 (cons tan120 (cons sin135 (cons cos135 (cons cos150 (cons tan150 (cons cos210 (cons tan210 (cons sin225 (cons cos225 (cons sin240 (cons tan240 (cons sin300 (cons tan300 (cons sin315 (cons cos315 (cons cos330 (cons tan330 (cons sinh (cons cosh (cons tanh (cons sech (cons csch (cons power (cons factorial (cons prime? (cons unix (cons div (cons modf (cons product (cons summation (cons set-tolerance (cons tolerance (cons coth (cons for (cons sq (cons cube (cons newv (cons abs (cons approx (cons log (cons log2 (cons loge (cons log10 (cons g ()))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) (value *property-vector*)) (do (put maths shen.internal-symbols (cons maths.maths (cons maths.*tolerance* (cons maths.for-h (cons maths.n->r (cons maths.expt-h (cons maths.gcd-help (cons maths.gcd-loop (cons maths.lcd-loop (cons maths.isqrt-loop (cons maths.float->pair (cons maths.rounding-loop (cons maths.greatest (cons maths.lcm-h (cons maths.lcm? (cons maths.*seed* (cons maths.bbs (cons maths.converge-help (cons maths.compute-nthrt (cons maths.series-h (cons maths.compute-cos (cons maths.compute-sine (cons maths.sin60 (cons maths.prime-h (cons maths.sign (cons maths.log10+ (cons maths.maths-macro (cons maths.tolerance=n (cons maths.lazyfor-and (cons maths.lazyfor-or ()))))))))))))))))))))))))))))) (value *property-vector*)) (do (put rational shen.external-symbols (cons r-reduce (cons r= (cons r< (cons r> (cons r>= (cons r<= (cons r+ (cons r- (cons r* (cons r/ (cons r-expr (cons +-inverse (cons *-inverse (cons r-expt (cons r->n (cons r->pair (cons n->r (cons maths.n->r (cons r-approx (cons maths.lcd-loop (cons r-op1 (cons r-op2 (cons expt (cons =r (cons gcd (cons lcd (cons isqrt (cons sqrt (cons nthrt (cons floor (cons ceiling (cons round (cons mod (cons lcm (cons random (cons min (cons max (cons reseed (cons ~ (cons positive? (cons negative? (cons natural? (cons converge (cons series (cons odd? (cons even? (cons cos (cons sin (cons tan (cons radians (cons pi (cons e (cons tan30 (cons cos30 (cons cos45 (cons sin45 (cons sqrt2 (cons tan60 (cons sin120 (cons tan120 (cons sin135 (cons cos135 (cons cos150 (cons tan150 (cons cos210 (cons tan210 (cons sin225 (cons cos225 (cons sin240 (cons tan240 (cons sin300 (cons tan300 (cons sin315 (cons cos315 (cons cos330 (cons tan330 (cons sinh (cons cosh (cons tanh (cons sech (cons csch (cons power (cons factorial (cons prime? (cons unix (cons div (cons modf (cons product (cons summation (cons set-tolerance (cons tolerance (cons coth (cons for (cons sq (cons cube (cons newv (cons abs (cons approx (cons log (cons log2 (cons loge (cons log10 (cons g (cons r# (cons rational? (cons rational (cons numerator (cons denominator ())))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) (value *property-vector*)) (do (put rational shen.internal-symbols (cons rational.r-reduce-help (cons rational.approx-r-h (cons rational.print-rational ()))) (value *property-vector*)) (do (put complex shen.external-symbols (cons c+ (cons c- (cons c* (cons c/ (cons expt (cons =r (cons gcd (cons lcd (cons isqrt (cons sqrt (cons nthrt (cons floor (cons ceiling (cons round (cons mod (cons lcm (cons random (cons min (cons max (cons reseed (cons ~ (cons positive? (cons negative? (cons natural? (cons converge (cons series (cons odd? (cons even? (cons cos (cons sin (cons tan (cons radians (cons pi (cons e (cons tan30 (cons cos30 (cons cos45 (cons sin45 (cons sqrt2 (cons tan60 (cons sin120 (cons tan120 (cons sin135 (cons cos135 (cons cos150 (cons tan150 (cons cos210 (cons tan210 (cons sin225 (cons cos225 (cons sin240 (cons tan240 (cons sin300 (cons tan300 (cons sin315 (cons cos315 (cons cos330 (cons tan330 (cons sinh (cons cosh (cons tanh (cons sech (cons csch (cons power (cons factorial (cons prime? (cons unix (cons div (cons modf (cons product (cons summation (cons set-tolerance (cons tolerance (cons coth (cons for (cons sq (cons cube (cons newv (cons abs (cons approx (cons log (cons log2 (cons loge (cons log10 (cons g (cons c# (cons complex? (cons real (cons imaginary (cons complex ())))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) (value *property-vector*)) (do (put complex shen.internal-symbols (cons complex.print-complex ()) (value *property-vector*)) (do (put numerals shen.external-symbols (cons hex (cons octal (cons duodecimal (cons binary (cons n-op2 (cons n-op1 (cons n+ (cons n- (cons n* (cons n/ (cons expt (cons =r (cons gcd (cons lcd (cons isqrt (cons sqrt (cons nthrt (cons floor (cons ceiling (cons round (cons mod (cons lcm (cons random (cons min (cons max (cons reseed (cons ~ (cons positive? (cons negative? (cons natural? (cons converge (cons series (cons odd? (cons even? (cons cos (cons sin (cons tan (cons radians (cons pi (cons e (cons tan30 (cons cos30 (cons cos45 (cons sin45 (cons sqrt2 (cons tan60 (cons sin120 (cons tan120 (cons sin135 (cons cos135 (cons cos150 (cons tan150 (cons cos210 (cons tan210 (cons sin225 (cons cos225 (cons sin240 (cons tan240 (cons sin300 (cons tan300 (cons sin315 (cons cos315 (cons cos330 (cons tan330 (cons sinh (cons cosh (cons tanh (cons sech (cons csch (cons power (cons factorial (cons prime? (cons unix (cons div (cons modf (cons product (cons summation (cons set-tolerance (cons tolerance (cons coth (cons for (cons sq (cons cube (cons newv (cons abs (cons approx (cons log (cons log2 (cons loge (cons log10 (cons g (cons numeral? (cons numeral (cons radix (cons n#->ns (cons n# (cons n#->n ()))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) (value *property-vector*)) (do (put numerals shen.internal-symbols (cons numerals.numeral-macro (cons numerals.largest-expt (cons numerals.n-zeros (cons numerals.add (cons numerals.add-h (cons numerals.n->numeral (cons numerals.numerals (cons numerals.numeric->string (cons numerals.print-numeral ()))))))))) (value *property-vector*)) (do (put list shen.external-symbols (cons prefix? (cons suffix? (cons subset? (cons set=? (cons set? (cons permute (cons nthhd (cons cartprod (cons powerset (cons subbag? (cons bag=? (cons n-times (cons trim-right (cons trim-left (cons trim (cons trim-right-if (cons trim-left-if (cons trim-if (cons assoc-if (cons assoc-if-not (cons infix? (cons count-if (cons count (cons remove-duplicates (cons foldr (cons foldl (cons find (cons mapf (cons remove-if (cons some? (cons every? (cons mapc (cons filter (cons transitive-closure (cons x->ascii (cons take (cons take-last (cons drop (cons drop-last (cons index (cons index-last (cons insert (cons splice (cons sort (cons partition ()))))))))))))))))))))))))))))))))))))))))))))) (value *property-vector*)) (do (put list shen.internal-symbols (cons list.index-h (cons list.n-times-h (cons list.reduce (cons list.transitive-pass (cons list.find-trans ()))))) (value *property-vector*)) (do (put string shen.external-symbols (cons render-file (cons render (cons s-op1 (cons s-op2 (cons string.reverse (cons string.element? (cons string.infix? (cons string.suffix? (cons string.prefix? (cons string.length (cons string.difference (cons string.intersection (cons string.nth (cons whitespace? (cons lowercase? (cons uppercase? (cons digit? (cons alpha? (cons alphanum? (cons string.subset? (cons string.set=? (cons string.set? (cons string.nth (cons string.trim (cons string.trim-right (cons string.trim-left (cons tokenise (cons list->string (cons string->list (cons string.trim-left-if (cons string.trim-right-if (cons string.trim-if (cons uppercase (cons lowercase (cons string.map (cons file-extension (cons strip-extension (cons string.count (cons spell-number (cons string>? (cons string=? (cons string<=? (cons string.some? (cons string.every? (cons prefix? (cons suffix? (cons subset? (cons set=? (cons set? (cons permute (cons nthhd (cons cartprod (cons powerset (cons subbag? (cons bag=? (cons n-times (cons trim-right (cons trim-left (cons trim (cons trim-right-if (cons trim-left-if (cons trim-if (cons assoc-if (cons assoc-if-not (cons infix? (cons count-if (cons count (cons remove-duplicates (cons foldr (cons foldl (cons find (cons mapf (cons remove-if (cons some? (cons every? (cons mapc (cons filter (cons transitive-closure (cons x->ascii (cons take (cons take-last (cons drop (cons drop-last (cons index (cons index-last (cons insert (cons splice (cons sort (cons partition ())))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) (value *property-vector*)) (do (put string shen.internal-symbols (cons string.bytes->strings (cons string.rendered? (cons string. (cons string.recapply (cons string. (cons string. (cons string. (cons string. (cons string. (cons string.skip (cons string. (cons string. (cons string.s->l-h (cons string.tokenise-h (cons string.triples (cons string.triples-h (cons string.digits (cons string.tens (cons string.digit (cons string.scale (cons string.units ()))))))))))))))))))))) (value *property-vector*)) (do (put vector shen.external-symbols (cons expt (cons =r (cons gcd (cons lcd (cons isqrt (cons sqrt (cons nthrt (cons floor (cons ceiling (cons round (cons mod (cons lcm (cons random (cons min (cons max (cons reseed (cons ~ (cons positive? (cons negative? (cons natural? (cons converge (cons series (cons odd? (cons even? (cons cos (cons sin (cons tan (cons radians (cons pi (cons e (cons tan30 (cons cos30 (cons cos45 (cons sin45 (cons sqrt2 (cons tan60 (cons sin120 (cons tan120 (cons sin135 (cons cos135 (cons cos150 (cons tan150 (cons cos210 (cons tan210 (cons sin225 (cons cos225 (cons sin240 (cons tan240 (cons sin300 (cons tan300 (cons sin315 (cons cos315 (cons cos330 (cons tan330 (cons sinh (cons cosh (cons tanh (cons sech (cons csch (cons power (cons factorial (cons prime? (cons unix (cons div (cons modf (cons product (cons summation (cons set-tolerance (cons tolerance (cons coth (cons sq (cons cube (cons abs (cons approx (cons log (cons log2 (cons loge (cons log10 (cons g (cons list->vector (cons dense? (cons porous? (cons vector.reverse (cons vector.append (cons vector.dfilter (cons vector.element? (cons sparse? (cons vacant? (cons vector.some? (cons vector.map (cons vector.dmap (cons vector.every? (cons maths.lazyfor-and (cons maths.lazyfor-or (cons compress (cons newv (cons for (cons overwrite (cons insert (cons ignore (cons depopulate (cons populate (cons populated? (cons vector->list (cons v-op1 (cons v-op2 (cons array ()))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) (value *property-vector*)) (do (put vector shen.internal-symbols (cons vector.copy (cons vector.list->vector-h (cons vector.vector-macros (cons vector.key (cons vector.build-array (cons vector.unfold-populate (cons vector.<-array (cons vector.array-> (cons vector.unfold-vector-assignment ()))))))))) (value *property-vector*)) (do (put print shen.external-symbols (cons expt (cons =r (cons gcd (cons lcd (cons isqrt (cons sqrt (cons nthrt (cons floor (cons ceiling (cons round (cons mod (cons lcm (cons random (cons min (cons max (cons reseed (cons ~ (cons positive? (cons negative? (cons natural? (cons converge (cons series (cons odd? (cons even? (cons cos (cons sin (cons tan (cons radians (cons pi (cons e (cons tan30 (cons cos30 (cons cos45 (cons sin45 (cons sqrt2 (cons tan60 (cons sin120 (cons tan120 (cons sin135 (cons cos135 (cons cos150 (cons tan150 (cons cos210 (cons tan210 (cons sin225 (cons cos225 (cons sin240 (cons tan240 (cons sin300 (cons tan300 (cons sin315 (cons cos315 (cons cos330 (cons tan330 (cons sinh (cons cosh (cons tanh (cons sech (cons csch (cons power (cons factorial (cons prime? (cons unix (cons div (cons modf (cons product (cons summation (cons set-tolerance (cons tolerance (cons coth (cons for (cons sq (cons cube (cons newv (cons abs (cons approx (cons log (cons log2 (cons loge (cons log10 (cons g (cons pps (cons pprint (cons pretty-string (cons linelength (cons indentation (cons set-linelength (cons set-indentation ())))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) (value *property-vector*)) (do (put print shen.internal-symbols (cons print.pprint-macro (cons print.*linelength* (cons print.*indentation* (cons print.pretty-string-h (cons print.indent (cons print.indent-h (cons print.n-space ()))))))) (value *property-vector*)) (do (put file shen.external-symbols (cons append-files (cons append-files-with-open-stream (cons mapc (cons copy-file (cons file-size (cons reopen (cons errout (cons copy-file-with-open-stream (cons file-exists? (cons newv (cons ascii ()))))))))))) (value *property-vector*)) (do (put file shen.internal-symbols (cons file.file-macro (cons file.read&write (cons file.read&write-h (cons file.file-size-loop (cons file.scan-bytes ()))))) (value *property-vector*)) (do (put tuple shen.external-symbols (cons pairoff (cons assocp (cons cartprodp (cons assocp-if (cons assocp-if-not ()))))) (value *property-vector*)) (do (put tuple shen.internal-symbols () (value *property-vector*)) (do (put stlib shen.external-symbols (cons prefix? (cons suffix? (cons subset? (cons set=? (cons set? (cons permute (cons nthhd (cons cartprod (cons powerset (cons subbag? (cons bag=? (cons n-times (cons trim-right (cons trim-left (cons trim (cons trim-right-if (cons trim-left-if (cons trim-if (cons assoc-if (cons assoc-if-not (cons infix? (cons count-if (cons count (cons remove-duplicates (cons foldr (cons foldl (cons find (cons mapf (cons remove-if (cons some? (cons every? (cons mapc (cons filter (cons transitive-closure (cons x->ascii (cons take (cons take-last (cons drop (cons drop-last (cons index (cons index-last (cons insert (cons splice (cons sort (cons partition (cons render-file (cons render (cons s-op1 (cons s-op2 (cons string.reverse (cons string.element? (cons string.infix? (cons string.suffix? (cons string.prefix? (cons string.length (cons string.difference (cons string.intersection (cons string.nth (cons whitespace? (cons lowercase? (cons uppercase? (cons digit? (cons alpha? (cons alphanum? (cons string.subset? (cons string.set=? (cons string.set? (cons string.nth (cons string.trim (cons string.trim-right (cons string.trim-left (cons tokenise (cons list->string (cons string->list (cons string.trim-left-if (cons string.trim-right-if (cons string.trim-if (cons uppercase (cons lowercase (cons string.map (cons file-extension (cons strip-extension (cons string.count (cons spell-number (cons string>? (cons string=? (cons string<=? (cons string.some? (cons string.every? (cons prefix? (cons suffix? (cons subset? (cons set=? (cons set? (cons permute (cons nthhd (cons cartprod (cons powerset (cons subbag? (cons bag=? (cons n-times (cons trim-right (cons trim-left (cons trim (cons trim-right-if (cons trim-left-if (cons trim-if (cons assoc-if (cons assoc-if-not (cons infix? (cons count-if (cons count (cons remove-duplicates (cons foldr (cons foldl (cons find (cons mapf (cons remove-if (cons some? (cons every? (cons mapc (cons filter (cons transitive-closure (cons x->ascii (cons take (cons take-last (cons drop (cons drop-last (cons index (cons index-last (cons insert (cons splice (cons sort (cons partition (cons expt (cons =r (cons gcd (cons lcd (cons isqrt (cons sqrt (cons nthrt (cons floor (cons ceiling (cons round (cons mod (cons lcm (cons random (cons min (cons max (cons reseed (cons ~ (cons positive? (cons negative? (cons natural? (cons converge (cons series (cons odd? (cons even? (cons cos (cons sin (cons tan (cons radians (cons pi (cons e (cons tan30 (cons cos30 (cons cos45 (cons sin45 (cons sqrt2 (cons tan60 (cons sin120 (cons tan120 (cons sin135 (cons cos135 (cons cos150 (cons tan150 (cons cos210 (cons tan210 (cons sin225 (cons cos225 (cons sin240 (cons tan240 (cons sin300 (cons tan300 (cons sin315 (cons cos315 (cons cos330 (cons tan330 (cons sinh (cons cosh (cons tanh (cons sech (cons csch (cons power (cons factorial (cons prime? (cons unix (cons div (cons modf (cons product (cons summation (cons set-tolerance (cons tolerance (cons coth (cons for (cons sq (cons cube (cons newv (cons abs (cons approx (cons log (cons log2 (cons loge (cons log10 (cons g (cons expt (cons =r (cons gcd (cons lcd (cons isqrt (cons sqrt (cons nthrt (cons floor (cons ceiling (cons round (cons mod (cons lcm (cons random (cons min (cons max (cons reseed (cons ~ (cons positive? (cons negative? (cons natural? (cons converge (cons series (cons odd? (cons even? (cons cos (cons sin (cons tan (cons radians (cons pi (cons e (cons tan30 (cons cos30 (cons cos45 (cons sin45 (cons sqrt2 (cons tan60 (cons sin120 (cons tan120 (cons sin135 (cons cos135 (cons cos150 (cons tan150 (cons cos210 (cons tan210 (cons sin225 (cons cos225 (cons sin240 (cons tan240 (cons sin300 (cons tan300 (cons sin315 (cons cos315 (cons cos330 (cons tan330 (cons sinh (cons cosh (cons tanh (cons sech (cons csch (cons power (cons factorial (cons prime? (cons unix (cons div (cons modf (cons product (cons summation (cons set-tolerance (cons tolerance (cons coth (cons sq (cons cube (cons abs (cons approx (cons log (cons log2 (cons loge (cons log10 (cons g (cons list->vector (cons dense? (cons porous? (cons vector.reverse (cons vector.append (cons vector.dfilter (cons vector.element? (cons sparse? (cons vacant? (cons vector.some? (cons vector.map (cons vector.dmap (cons vector.every? (cons maths.lazyfor-and (cons maths.lazyfor-or (cons compress (cons newv (cons for (cons overwrite (cons insert (cons ignore (cons depopulate (cons populate (cons populated? (cons vector->list (cons v-op1 (cons v-op2 (cons array (cons newv (cons concat* (cons pairoff (cons assocp (cons cartprodp (cons assocp-if (cons assocp-if-not (cons append-files (cons append-files-with-open-stream (cons mapc (cons copy-file (cons file-size (cons reopen (cons errout (cons copy-file-with-open-stream (cons file-exists? (cons newv (cons ascii (cons expt (cons =r (cons gcd (cons lcd (cons isqrt (cons sqrt (cons nthrt (cons floor (cons ceiling (cons round (cons mod (cons lcm (cons random (cons min (cons max (cons reseed (cons ~ (cons positive? (cons negative? (cons natural? (cons converge (cons series (cons odd? (cons even? (cons cos (cons sin (cons tan (cons radians (cons pi (cons e (cons tan30 (cons cos30 (cons cos45 (cons sin45 (cons sqrt2 (cons tan60 (cons sin120 (cons tan120 (cons sin135 (cons cos135 (cons cos150 (cons tan150 (cons cos210 (cons tan210 (cons sin225 (cons cos225 (cons sin240 (cons tan240 (cons sin300 (cons tan300 (cons sin315 (cons cos315 (cons cos330 (cons tan330 (cons sinh (cons cosh (cons tanh (cons sech (cons csch (cons power (cons factorial (cons prime? (cons unix (cons div (cons modf (cons product (cons summation (cons set-tolerance (cons tolerance (cons coth (cons for (cons sq (cons cube (cons newv (cons abs (cons approx (cons log (cons log2 (cons loge (cons log10 (cons g (cons pps (cons pprint (cons pretty-string (cons linelength (cons indentation (cons set-linelength (cons set-indentation ()))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) (value *property-vector*)) (put stlib shen.internal-symbols (cons stlib.void ()) (value *property-vector*)))))))))))))))))))))))))))))))) - -(defun stlib.initialise-arities () (do (update-lambda-table concat* 2) (do (update-lambda-table newv 0) (do (update-lambda-table maths.maths-macro 1) (do (update-lambda-table set-tolerance 1) (do (update-lambda-table tolerance 0) (do (update-lambda-table sq 1) (do (update-lambda-table cube 1) (do (update-lambda-table for 5) (do (update-lambda-table maths.for-h 6) (do (update-lambda-table maths.lazyfor-and 4) (do (update-lambda-table maths.lazyfor-or 4) (do (update-lambda-table max 2) (do (update-lambda-table min 2) (do (update-lambda-table expt 3) (do (update-lambda-table maths.n->r 2) (do (update-lambda-table maths.expt-h 3) (do (update-lambda-table gcd 2) (do (update-lambda-table maths.gcd-help 2) (do (update-lambda-table maths.gcd-loop 3) (do (update-lambda-table lcd 2) (do (update-lambda-table maths.lcd-loop 4) (do (update-lambda-table isqrt 1) (do (update-lambda-table maths.isqrt-loop 2) (do (update-lambda-table div 2) (do (update-lambda-table modf 1) (do (update-lambda-table floor 1) (do (update-lambda-table maths.rounding-loop 4) (do (update-lambda-table maths.float->pair 1) (do (update-lambda-table ceiling 1) (do (update-lambda-table round 1) (do (update-lambda-table mod 2) (do (update-lambda-table lcm 1) (do (update-lambda-table maths.greatest 1) (do (update-lambda-table maths.lcm-h 3) (do (update-lambda-table maths.lcm? 2) (do (update-lambda-table random 2) (do (update-lambda-table min 2) (do (update-lambda-table reseed 0) (do (update-lambda-table maths.bbs 1) (do (update-lambda-table ~ 1) (do (update-lambda-table positive? 1) (do (update-lambda-table negative? 1) (do (update-lambda-table natural? 1) (do (update-lambda-table converge 3) (do (update-lambda-table maths.converge-help 4) (do (update-lambda-table nthrt 3) (do (update-lambda-table sqrt 2) (do (update-lambda-table maths.compute-nthrt 4) (do (update-lambda-table approx 1) (do (update-lambda-table abs 1) (do (update-lambda-table series 4) (do (update-lambda-table maths.series-h 5) (do (update-lambda-table product 3) (do (update-lambda-table summation 3) (do (update-lambda-table odd? 1) (do (update-lambda-table even? 1) (do (update-lambda-table maths.compute-sine 2) (do (update-lambda-table maths.compute-cos 2) (do (update-lambda-table cos 2) (do (update-lambda-table sin 2) (do (update-lambda-table tan 2) (do (update-lambda-table radians 1) (do (update-lambda-table g 0) (do (update-lambda-table pi 0) (do (update-lambda-table e 0) (do (update-lambda-table tan30 0) (do (update-lambda-table cos30 0) (do (update-lambda-table cos45 0) (do (update-lambda-table sin45 0) (do (update-lambda-table sqrt2 0) (do (update-lambda-table tan60 0) (do (update-lambda-table maths.sin60 0) (do (update-lambda-table sin120 0) (do (update-lambda-table tan120 0) (do (update-lambda-table sin135 0) (do (update-lambda-table cos135 0) (do (update-lambda-table cos150 0) (do (update-lambda-table tan150 0) (do (update-lambda-table cos210 0) (do (update-lambda-table tan210 0) (do (update-lambda-table sin225 0) (do (update-lambda-table cos225 0) (do (update-lambda-table sin240 0) (do (update-lambda-table tan240 0) (do (update-lambda-table sin300 0) (do (update-lambda-table tan300 0) (do (update-lambda-table sin315 0) (do (update-lambda-table cos315 0) (do (update-lambda-table cos330 0) (do (update-lambda-table tan330 0) (do (update-lambda-table coth 2) (do (update-lambda-table sinh 2) (do (update-lambda-table cosh 2) (do (update-lambda-table tanh 2) (do (update-lambda-table sech 2) (do (update-lambda-table csch 2) (do (update-lambda-table power 2) (do (update-lambda-table factorial 1) (do (update-lambda-table prime? 1) (do (update-lambda-table maths.prime-h 3) (do (update-lambda-table maths.sign 1) (do (update-lambda-table log 3) (do (update-lambda-table loge 2) (do (update-lambda-table log2 2) (do (update-lambda-table log10 2) (do (update-lambda-table maths.log10+ 2) (do (update-lambda-table r# 2) (do (update-lambda-table rational.print-rational 1) (do (update-lambda-table rational? 1) (do (update-lambda-table numerator 1) (do (update-lambda-table denominator 1) (do (update-lambda-table r-op1 2) (do (update-lambda-table r-op2 3) (do (update-lambda-table r->n 1) (do (update-lambda-table r->pair 1) (do (update-lambda-table n->r 1) (do (update-lambda-table r-reduce 1) (do (update-lambda-table rational.r-reduce-help 2) (do (update-lambda-table r= 2) (do (update-lambda-table r< 2) (do (update-lambda-table r> 2) (do (update-lambda-table r>= 2) (do (update-lambda-table r<= 2) (do (update-lambda-table r+ 2) (do (update-lambda-table r- 2) (do (update-lambda-table r* 2) (do (update-lambda-table +-inverse 1) (do (update-lambda-table *-inverse 1) (do (update-lambda-table r/ 2) (do (update-lambda-table r-expt 2) (do (update-lambda-table r-approx 2) (do (update-lambda-table rational.approx-r-h 3) (do (update-lambda-table c# 2) (do (update-lambda-table complex.print-complex 1) (do (update-lambda-table complex? 1) (do (update-lambda-table real 1) (do (update-lambda-table imaginary 1) (do (update-lambda-table c+ 2) (do (update-lambda-table c- 2) (do (update-lambda-table c* 2) (do (update-lambda-table c/ 2) (do (update-lambda-table n# 2) (do (update-lambda-table radix 1) (do (update-lambda-table numerals.numerals 1) (do (update-lambda-table n#->n 1) (do (update-lambda-table n#->ns 1) (do (update-lambda-table numerals.print-numeral 1) (do (update-lambda-table numerals.numeric->string 2) (do (update-lambda-table numeral? 1) (do (update-lambda-table numerals.numeral-macro 1) (do (update-lambda-table n-op2 4) (do (update-lambda-table n-op1 3) (do (update-lambda-table n+ 3) (do (update-lambda-table n* 3) (do (update-lambda-table n- 3) (do (update-lambda-table n/ 3) (do (update-lambda-table binary 1) (do (update-lambda-table hex 1) (do (update-lambda-table octal 1) (do (update-lambda-table duodecimal 1) (do (update-lambda-table numerals.n->numeral 2) (do (update-lambda-table numerals.largest-expt 3) (do (update-lambda-table numerals.n-zeros 1) (do (update-lambda-table numerals.add 3) (do (update-lambda-table numerals.add-h 4) (do (update-lambda-table assoc-if 2) (do (update-lambda-table assoc-if-not 2) (do (update-lambda-table drop 2) (do (update-lambda-table drop-last 2) (do (update-lambda-table index 2) (do (update-lambda-table list.index-h 3) (do (update-lambda-table index-last 2) (do (update-lambda-table insert 3) (do (update-lambda-table remove-duplicates 1) (do (update-lambda-table trim-left-if 2) (do (update-lambda-table trim-right-if 2) (do (update-lambda-table trim-if 2) (do (update-lambda-table trim-left 2) (do (update-lambda-table trim-right 2) (do (update-lambda-table trim 2) (do (update-lambda-table prefix? 2) (do (update-lambda-table infix? 2) (do (update-lambda-table suffix? 2) (do (update-lambda-table subset? 2) (do (update-lambda-table set=? 2) (do (update-lambda-table set? 1) (do (update-lambda-table n-times 2) (do (update-lambda-table list.n-times-h 3) (do (update-lambda-table subbag? 2) (do (update-lambda-table bag=? 2) (do (update-lambda-table mapc 2) (do (update-lambda-table permute 1) (do (update-lambda-table count-if 2) (do (update-lambda-table count 2) (do (update-lambda-table some? 2) (do (update-lambda-table every? 2) (do (update-lambda-table sort 2) (do (update-lambda-table find 2) (do (update-lambda-table foldr 3) (do (update-lambda-table foldl 3) (do (update-lambda-table mapf 3) (do (update-lambda-table filter 2) (do (update-lambda-table remove-if 2) (do (update-lambda-table list.reduce 3) (do (update-lambda-table take 2) (do (update-lambda-table take-last 2) (do (update-lambda-table cartprod 2) (do (update-lambda-table powerset 1) (do (update-lambda-table partition 2) (do (update-lambda-table transitive-closure 1) (do (update-lambda-table list.transitive-pass 2) (do (update-lambda-table list.find-trans 3) (do (update-lambda-table x->ascii 1) (do (update-lambda-table splice 3) (do (update-lambda-table string-macros 1) (do (update-lambda-table string->list 1) (do (update-lambda-table string.s->l-h 4) (do (update-lambda-table list->string 1) (do (update-lambda-table s-op1 3) (do (update-lambda-table s-op2 4) (do (update-lambda-table string.count 2) (do (update-lambda-table string.reverse 1) (do (update-lambda-table string.element? 2) (do (update-lambda-table string.prefix? 2) (do (update-lambda-table string.infix? 2) (do (update-lambda-table string.suffix? 2) (do (update-lambda-table string.subset? 2) (do (update-lambda-table string.set=? 2) (do (update-lambda-table string.set? 1) (do (update-lambda-table file-extension 2) (do (update-lambda-table strip-extension 1) (do (update-lambda-table string.length 1) (do (update-lambda-table string.trim 2) (do (update-lambda-table string.trim-if 2) (do (update-lambda-table string.trim-right-if 2) (do (update-lambda-table string.trim-left-if 2) (do (update-lambda-table string.trim-right 2) (do (update-lambda-table string.trim-left 2) (do (update-lambda-table string.some? 2) (do (update-lambda-table string.every? 2) (do (update-lambda-table string.difference 2) (do (update-lambda-table string.intersection 2) (do (update-lambda-table string.nth 2) (do (update-lambda-table whitespace? 1) (do (update-lambda-table uppercase? 1) (do (update-lambda-table lowercase? 1) (do (update-lambda-table digit? 1) (do (update-lambda-table alpha? 1) (do (update-lambda-table alphanum? 1) (do (update-lambda-table tokenise 2) (do (update-lambda-table string.tokenise-h 3) (do (update-lambda-table uppercase 1) (do (update-lambda-table lowercase 1) (do (update-lambda-table string.map 2) (do (update-lambda-table spell-number 1) (do (update-lambda-table string.digit 1) (do (update-lambda-table string.triples 1) (do (update-lambda-table string.triples-h 2) (do (update-lambda-table string.digits 1) (do (update-lambda-table string.tens 2) (do (update-lambda-table string.scale 1) (do (update-lambda-table string.units 1) (do (update-lambda-table string>? 2) (do (update-lambda-table string=? 2) (do (update-lambda-table string<=? 2) (do (update-lambda-table render-file 2) (do (update-lambda-table string.bytes->strings 2) (do (update-lambda-table render 1) (do (update-lambda-table string.rendered? 1) (do (update-lambda-table string. 1) (do (update-lambda-table string. 1) (do (update-lambda-table string.recapply 2) (do (update-lambda-table string. 1) (do (update-lambda-table string. 1) (do (update-lambda-table string. 1) (do (update-lambda-table string. 1) (do (update-lambda-table string. 1) (do (update-lambda-table string. 1) (do (update-lambda-table vector.vector-macros 1) (do (update-lambda-table vector.key 4) (do (update-lambda-table vector.build-array 1) (do (update-lambda-table depopulate 2) (do (update-lambda-table populated? 2) (do (update-lambda-table vector.unfold-populate 2) (do (update-lambda-table populate 2) (do (update-lambda-table vector.<-array 2) (do (update-lambda-table vector.array-> 3) (do (update-lambda-table vector.unfold-vector-assignment 4) (do (update-lambda-table compress 1) (do (update-lambda-table vector.copy 1) (do (update-lambda-table vector.reverse 1) (do (update-lambda-table vector.append 2) (do (update-lambda-table vector.dfilter 2) (do (update-lambda-table vector.element? 2) (do (update-lambda-table vector.map 2) (do (update-lambda-table vector.dmap 2) (do (update-lambda-table vector.every? 2) (do (update-lambda-table vector.some? 2) (do (update-lambda-table vector->list 2) (do (update-lambda-table list->vector 1) (do (update-lambda-table vector.list->vector-h 3) (do (update-lambda-table vacant? 1) (do (update-lambda-table dense? 1) (do (update-lambda-table porous? 1) (do (update-lambda-table sparse? 1) (do (update-lambda-table v-op1 3) (do (update-lambda-table v-op2 4) (do (update-lambda-table print.pprint-macro 1) (do (update-lambda-table linelength 0) (do (update-lambda-table indentation 0) (do (update-lambda-table set-linelength 1) (do (update-lambda-table set-indentation 1) (do (update-lambda-table pps 2) (do (update-lambda-table pprint 2) (do (update-lambda-table pretty-string 1) (do (update-lambda-table print.pretty-string-h 3) (do (update-lambda-table print.indent 1) (do (update-lambda-table print.indent-h 1) (do (update-lambda-table print.n-space 1) (do (update-lambda-table delete-file 1) (do (update-lambda-table file.file-macro 1) (do (update-lambda-table append-files 2) (do (update-lambda-table append-files-with-open-stream 2) (do (update-lambda-table file.read&write 2) (do (update-lambda-table file.read&write-h 3) (do (update-lambda-table reopen 1) (do (update-lambda-table copy-file 2) (do (update-lambda-table copy-file-with-open-stream 2) (do (update-lambda-table file-exists? 1) (do (update-lambda-table file-size 1) (do (update-lambda-table file.file-size-loop 3) (do (update-lambda-table ascii 3) (do (update-lambda-table file.scan-bytes 4) (do (update-lambda-table pairoff 2) (do (update-lambda-table assocp 2) (do (update-lambda-table cartprodp 2) (do (update-lambda-table assocp-if 2) (update-lambda-table assocp-if-not 2)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) - -(defun stlib.initialise-macros () (do (shen.record-macro maths.maths-macro (lambda X (maths.maths-macro X))) (do (shen.record-macro numerals.numeral-macro (lambda X (numerals.numeral-macro X))) (do (shen.record-macro string-macros (lambda X (string-macros X))) (do (shen.record-macro vector.vector-macros (lambda X (vector.vector-macros X))) (do (shen.record-macro print.pprint-macro (lambda X (print.pprint-macro X))) (shen.record-macro file.file-macro (lambda X (file.file-macro X))))))))) - -(defun stlib.initialise-synonyms () ()) - -(defun stlib.initialise-datatypes () (do (shen.process-datatype maths.maths (cons _________________ (cons (cons value (cons maths.*seed* ())) (cons : (cons number (cons ; (cons _______________________ (cons (cons value (cons maths.*tolerance* ())) (cons : (cons number (cons ; ()))))))))))) (shen.process-datatype print (cons _______________________________ (cons (cons value (cons print.*indentation* ())) (cons : (cons number (cons ; (cons _______________________________ (cons (cons value (cons print.*linelength* ())) (cons : (cons number (cons ; ()))))))))))))) - -(defun stlib.initialise-types () (do (declare concat* (cons A (cons --> (cons (cons B (cons --> (cons symbol ()))) ())))) (do (declare newv (cons --> (cons symbol ()))) (do (declare set-tolerance (cons number (cons --> (cons number ())))) (do (declare tolerance (cons --> (cons number ()))) (do (declare sq (cons number (cons --> (cons number ())))) (do (declare cube (cons number (cons --> (cons number ())))) (do (declare for (cons number (cons --> (cons (cons (cons number (cons --> (cons boolean ()))) (cons --> (cons (cons (cons number (cons --> (cons (protect A) ()))) (cons --> (cons (cons (cons number (cons --> (cons number ()))) (cons --> (cons (cons (cons (protect A) (cons --> (cons (cons (protect A) (cons --> (cons (protect A) ()))) ()))) (cons --> (cons (protect A) ()))) ()))) ()))) ()))) ())))) (do (declare maths.for-h (cons number (cons --> (cons (cons (cons number (cons --> (cons boolean ()))) (cons --> (cons (cons (cons number (cons --> (cons (protect A) ()))) (cons --> (cons (cons (cons number (cons --> (cons number ()))) (cons --> (cons (cons (cons (protect A) (cons --> (cons (cons (protect A) (cons --> (cons (protect A) ()))) ()))) (cons --> (cons (cons (protect A) (cons --> (cons (protect A) ()))) ()))) ()))) ()))) ()))) ())))) (do (declare maths.lazyfor-and (cons number (cons --> (cons (cons (cons number (cons --> (cons boolean ()))) (cons --> (cons (cons (cons number (cons --> (cons boolean ()))) (cons --> (cons (cons (cons number (cons --> (cons number ()))) (cons --> (cons boolean ()))) ()))) ()))) ())))) (do (declare maths.lazyfor-or (cons number (cons --> (cons (cons (cons number (cons --> (cons boolean ()))) (cons --> (cons (cons (cons number (cons --> (cons boolean ()))) (cons --> (cons (cons (cons number (cons --> (cons number ()))) (cons --> (cons boolean ()))) ()))) ()))) ())))) (do (declare max (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ())))) (do (declare min (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ())))) (do (declare expt (cons number (cons --> (cons (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ()))) ())))) (do (declare maths.n->r (cons number (cons --> (cons (cons number (cons --> (cons (cons number (cons * (cons number ()))) ()))) ())))) (do (declare maths.expt-h (cons number (cons --> (cons (cons (cons number (cons * (cons number ()))) (cons --> (cons (cons number (cons --> (cons number ()))) ()))) ())))) (do (declare gcd (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ())))) (do (declare maths.gcd-help (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ())))) (do (declare maths.gcd-loop (cons number (cons --> (cons (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ()))) ())))) (do (declare lcd (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ())))) (do (declare maths.lcd-loop (cons number (cons --> (cons (cons number (cons --> (cons (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ()))) ()))) ())))) (do (declare isqrt (cons number (cons --> (cons number ())))) (do (declare maths.isqrt-loop (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ())))) (do (declare div (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ())))) (do (declare modf (cons number (cons --> (cons (cons number (cons * (cons number ()))) ())))) (do (declare floor (cons number (cons --> (cons number ())))) (do (declare maths.rounding-loop (cons symbol (cons --> (cons (cons number (cons --> (cons (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ()))) ()))) ())))) (do (declare maths.float->pair (cons number (cons --> (cons (cons number (cons * (cons number ()))) ())))) (do (declare ceiling (cons number (cons --> (cons number ())))) (do (declare round (cons number (cons --> (cons number ())))) (do (declare mod (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ())))) (do (declare lcm (cons (cons list (cons number ())) (cons --> (cons number ())))) (do (declare maths.greatest (cons (cons list (cons number ())) (cons --> (cons number ())))) (do (declare maths.lcm-h (cons number (cons --> (cons (cons number (cons --> (cons (cons (cons list (cons number ())) (cons --> (cons number ()))) ()))) ())))) (do (declare maths.lcm? (cons number (cons --> (cons (cons (cons list (cons number ())) (cons --> (cons boolean ()))) ())))) (do (declare random (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ())))) (do (declare min (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ())))) (do (declare reseed (cons --> (cons number ()))) (do (declare maths.bbs (cons number (cons --> (cons number ())))) (do (declare ~ (cons number (cons --> (cons number ())))) (do (declare positive? (cons number (cons --> (cons boolean ())))) (do (declare negative? (cons number (cons --> (cons boolean ())))) (do (declare natural? (cons number (cons --> (cons boolean ())))) (do (declare converge (cons (protect A) (cons --> (cons (cons (cons (protect A) (cons --> (cons (protect A) ()))) (cons --> (cons (cons (cons (protect A) (cons --> (cons (cons (protect A) (cons --> (cons boolean ()))) ()))) (cons --> (cons (protect A) ()))) ()))) ())))) (do (declare maths.converge-help (cons (cons (protect A) (cons --> (cons (protect A) ()))) (cons --> (cons (cons (protect A) (cons --> (cons (cons (protect A) (cons --> (cons (cons (cons (protect A) (cons --> (cons (cons (protect A) (cons --> (cons boolean ()))) ()))) (cons --> (cons (protect A) ()))) ()))) ()))) ())))) (do (declare nthrt (cons number (cons --> (cons (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ()))) ())))) (do (declare sqrt (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ())))) (do (declare maths.compute-nthrt (cons number (cons --> (cons (cons number (cons --> (cons (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ()))) ()))) ())))) (do (declare approx (cons number (cons --> (cons (cons number (cons --> (cons (cons number (cons --> (cons boolean ()))) ()))) ())))) (do (declare abs (cons number (cons --> (cons number ())))) (do (declare series (cons number (cons --> (cons (cons (cons number (cons --> (cons number ()))) (cons --> (cons (cons number (cons --> (cons (cons (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ()))) (cons --> (cons number ()))) ()))) ()))) ())))) (do (declare maths.series-h (cons number (cons --> (cons (cons number (cons --> (cons (cons (cons number (cons --> (cons number ()))) (cons --> (cons (cons number (cons --> (cons (cons (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ()))) (cons --> (cons number ()))) ()))) ()))) ()))) ())))) (do (declare product (cons number (cons --> (cons (cons (cons number (cons --> (cons number ()))) (cons --> (cons (cons number (cons --> (cons number ()))) ()))) ())))) (do (declare summation (cons number (cons --> (cons (cons (cons number (cons --> (cons number ()))) (cons --> (cons (cons number (cons --> (cons number ()))) ()))) ())))) (do (declare odd? (cons number (cons --> (cons boolean ())))) (do (declare even? (cons number (cons --> (cons boolean ())))) (do (declare maths.compute-sine (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ())))) (do (declare maths.compute-cos (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ())))) (do (declare cos (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ())))) (do (declare sin (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ())))) (do (declare tan (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ())))) (do (declare radians (cons number (cons --> (cons number ())))) (do (declare g (cons --> (cons number ()))) (do (declare pi (cons --> (cons number ()))) (do (declare e (cons --> (cons number ()))) (do (declare tan30 (cons --> (cons number ()))) (do (declare cos30 (cons --> (cons number ()))) (do (declare cos45 (cons --> (cons number ()))) (do (declare sin45 (cons --> (cons number ()))) (do (declare sqrt2 (cons --> (cons number ()))) (do (declare tan60 (cons --> (cons number ()))) (do (declare maths.sin60 (cons --> (cons number ()))) (do (declare sin120 (cons --> (cons number ()))) (do (declare tan120 (cons --> (cons number ()))) (do (declare sin135 (cons --> (cons number ()))) (do (declare cos135 (cons --> (cons number ()))) (do (declare cos150 (cons --> (cons number ()))) (do (declare tan150 (cons --> (cons number ()))) (do (declare cos210 (cons --> (cons number ()))) (do (declare tan210 (cons --> (cons number ()))) (do (declare sin225 (cons --> (cons number ()))) (do (declare cos225 (cons --> (cons number ()))) (do (declare sin240 (cons --> (cons number ()))) (do (declare tan240 (cons --> (cons number ()))) (do (declare sin300 (cons --> (cons number ()))) (do (declare tan300 (cons --> (cons number ()))) (do (declare sin315 (cons --> (cons number ()))) (do (declare cos315 (cons --> (cons number ()))) (do (declare cos330 (cons --> (cons number ()))) (do (declare tan330 (cons --> (cons number ()))) (do (declare coth (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ())))) (do (declare sinh (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ())))) (do (declare cosh (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ())))) (do (declare tanh (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ())))) (do (declare sech (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ())))) (do (declare csch (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ())))) (do (declare power (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ())))) (do (declare factorial (cons number (cons --> (cons number ())))) (do (declare prime? (cons number (cons --> (cons boolean ())))) (do (declare maths.prime-h (cons number (cons --> (cons (cons number (cons --> (cons (cons number (cons --> (cons boolean ()))) ()))) ())))) (do (declare maths.sign (cons number (cons --> (cons number ())))) (do (declare log (cons number (cons --> (cons (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ()))) ())))) (do (declare loge (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ())))) (do (declare log2 (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ())))) (do (declare log10 (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ())))) (do (declare maths.log10+ (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ())))) (do (declare r# (cons number (cons --> (cons (cons number (cons --> (cons rational ()))) ())))) (do (declare rational? (cons A (cons --> (cons boolean ())))) (do (declare numerator (cons rational (cons --> (cons number ())))) (do (declare denominator (cons rational (cons --> (cons number ())))) (do (declare r-op1 (cons (cons number (cons --> (cons number ()))) (cons --> (cons (cons rational (cons --> (cons rational ()))) ())))) (do (declare r-op2 (cons (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ()))) (cons --> (cons (cons rational (cons --> (cons (cons rational (cons --> (cons rational ()))) ()))) ())))) (do (declare r->n (cons rational (cons --> (cons number ())))) (do (declare r->pair (cons rational (cons --> (cons (cons number (cons * (cons number ()))) ())))) (do (declare n->r (cons number (cons --> (cons rational ())))) (do (declare r-reduce (cons rational (cons --> (cons rational ())))) (do (declare rational.r-reduce-help (cons number (cons --> (cons (cons number (cons --> (cons rational ()))) ())))) (do (declare r= (cons rational (cons --> (cons (cons rational (cons --> (cons boolean ()))) ())))) (do (declare r< (cons rational (cons --> (cons (cons rational (cons --> (cons boolean ()))) ())))) (do (declare r> (cons rational (cons --> (cons (cons rational (cons --> (cons boolean ()))) ())))) (do (declare r>= (cons rational (cons --> (cons (cons rational (cons --> (cons boolean ()))) ())))) (do (declare r<= (cons rational (cons --> (cons (cons rational (cons --> (cons boolean ()))) ())))) (do (declare r+ (cons rational (cons --> (cons (cons rational (cons --> (cons rational ()))) ())))) (do (declare r- (cons rational (cons --> (cons (cons rational (cons --> (cons rational ()))) ())))) (do (declare r* (cons rational (cons --> (cons (cons rational (cons --> (cons rational ()))) ())))) (do (declare +-inverse (cons rational (cons --> (cons rational ())))) (do (declare *-inverse (cons rational (cons --> (cons rational ())))) (do (declare r/ (cons rational (cons --> (cons (cons rational (cons --> (cons rational ()))) ())))) (do (declare r-expt (cons rational (cons --> (cons (cons number (cons --> (cons rational ()))) ())))) (do (declare r-approx (cons rational (cons --> (cons (cons number (cons --> (cons rational ()))) ())))) (do (declare rational.approx-r-h (cons number (cons --> (cons (cons number (cons --> (cons (cons number (cons --> (cons rational ()))) ()))) ())))) (do (declare c# (cons number (cons --> (cons (cons number (cons --> (cons complex ()))) ())))) (do (declare complex? (cons A (cons --> (cons boolean ())))) (do (declare real (cons complex (cons --> (cons number ())))) (do (declare imaginary (cons complex (cons --> (cons number ())))) (do (declare c+ (cons complex (cons --> (cons (cons complex (cons --> (cons complex ()))) ())))) (do (declare c- (cons complex (cons --> (cons (cons complex (cons --> (cons complex ()))) ())))) (do (declare c* (cons complex (cons --> (cons (cons complex (cons --> (cons complex ()))) ())))) (do (declare c/ (cons complex (cons --> (cons (cons complex (cons --> (cons complex ()))) ())))) (do (declare radix (cons numeral (cons --> (cons number ())))) (do (declare n#->ns (cons numeral (cons --> (cons (cons list (cons number ())) ())))) (do (declare n#->n (cons numeral (cons --> (cons number ())))) (do (declare n# (cons number (cons --> (cons (cons number (cons --> (cons numeral ()))) ())))) (do (declare numeral? (cons A (cons --> (cons boolean ())))) (do (declare n-op2 (cons (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ()))) (cons --> (cons (cons numeral (cons --> (cons (cons numeral (cons --> (cons (cons number (cons --> (cons numeral ()))) ()))) ()))) ())))) (do (declare n-op1 (cons (cons number (cons --> (cons number ()))) (cons --> (cons (cons numeral (cons --> (cons (cons number (cons --> (cons numeral ()))) ()))) ())))) (do (declare n+ (cons numeral (cons --> (cons (cons numeral (cons --> (cons (cons number (cons --> (cons numeral ()))) ()))) ())))) (do (declare n* (cons numeral (cons --> (cons (cons numeral (cons --> (cons (cons number (cons --> (cons numeral ()))) ()))) ())))) (do (declare n- (cons numeral (cons --> (cons (cons numeral (cons --> (cons (cons number (cons --> (cons numeral ()))) ()))) ())))) (do (declare n/ (cons numeral (cons --> (cons (cons numeral (cons --> (cons (cons number (cons --> (cons numeral ()))) ()))) ())))) (do (declare binary (cons number (cons --> (cons numeral ())))) (do (declare hex (cons number (cons --> (cons numeral ())))) (do (declare octal (cons number (cons --> (cons numeral ())))) (do (declare duodecimal (cons number (cons --> (cons numeral ())))) (do (declare numerals.n->numeral (cons number (cons --> (cons (cons number (cons --> (cons (cons list (cons number ())) ()))) ())))) (do (declare numerals.largest-expt (cons number (cons --> (cons (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ()))) ())))) (do (declare numerals.n-zeros (cons number (cons --> (cons (cons list (cons number ())) ())))) (do (declare numerals.add (cons (cons list (cons number ())) (cons --> (cons (cons (cons list (cons number ())) (cons --> (cons (cons number (cons --> (cons (cons list (cons number ())) ()))) ()))) ())))) (do (declare numerals.add-h (cons (cons list (cons number ())) (cons --> (cons (cons (cons list (cons number ())) (cons --> (cons (cons number (cons --> (cons (cons number (cons --> (cons (cons list (cons number ())) ()))) ()))) ()))) ())))) (do (declare assoc-if (cons (cons (protect A) (cons --> (cons boolean ()))) (cons --> (cons (cons (cons list (cons (cons list (cons (protect A) ())) ())) (cons --> (cons (cons list (cons (protect A) ())) ()))) ())))) (do (declare assoc-if-not (cons (cons (protect A) (cons --> (cons boolean ()))) (cons --> (cons (cons (cons list (cons (cons list (cons (protect A) ())) ())) (cons --> (cons (cons list (cons (protect A) ())) ()))) ())))) (do (declare drop (cons number (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons (cons list (cons (protect A) ())) ()))) ())))) (do (declare drop-last (cons number (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons (cons list (cons (protect A) ())) ()))) ())))) (do (declare index (cons (protect A) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons number ()))) ())))) (do (declare list.index-h (cons (protect A) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons (cons number (cons --> (cons number ()))) ()))) ())))) (do (declare index-last (cons (protect A) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons number ()))) ())))) (do (declare insert (cons number (cons --> (cons (cons (protect A) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons (cons list (cons (protect A) ())) ()))) ()))) ())))) (do (declare remove-duplicates (cons (cons list (cons (protect A) ())) (cons --> (cons (cons list (cons (protect A) ())) ())))) (do (declare trim-left-if (cons (cons (protect A) (cons --> (cons boolean ()))) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons (cons list (cons (protect A) ())) ()))) ())))) (do (declare trim-right-if (cons (cons (protect A) (cons --> (cons boolean ()))) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons (cons list (cons (protect A) ())) ()))) ())))) (do (declare trim-if (cons (cons (protect A) (cons --> (cons boolean ()))) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons (cons list (cons (protect A) ())) ()))) ())))) (do (declare trim-left (cons (cons list (cons (protect A) ())) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons (cons list (cons (protect A) ())) ()))) ())))) (do (declare trim-right (cons (cons list (cons (protect A) ())) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons (cons list (cons (protect A) ())) ()))) ())))) (do (declare trim (cons (cons list (cons (protect A) ())) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons (cons list (cons (protect A) ())) ()))) ())))) (do (declare prefix? (cons (cons list (cons (protect A) ())) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons boolean ()))) ())))) (do (declare infix? (cons (cons list (cons (protect A) ())) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons boolean ()))) ())))) (do (declare suffix? (cons (cons list (cons (protect A) ())) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons boolean ()))) ())))) (do (declare subset? (cons (cons list (cons (protect A) ())) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons boolean ()))) ())))) (do (declare set=? (cons (cons list (cons (protect A) ())) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons boolean ()))) ())))) (do (declare set? (cons (cons list (cons (protect A) ())) (cons --> (cons boolean ())))) (do (declare n-times (cons (protect A) (cons --> (cons (cons number (cons --> (cons (cons list (cons (protect A) ())) ()))) ())))) (do (declare list.n-times-h (cons number (cons --> (cons (cons (protect A) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons (cons list (cons (protect A) ())) ()))) ()))) ())))) (do (declare subbag? (cons (cons list (cons (protect A) ())) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons boolean ()))) ())))) (do (declare bag=? (cons (cons list (cons (protect A) ())) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons boolean ()))) ())))) (do (declare mapc (cons (cons (protect A) (cons --> (cons (protect B) ()))) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons (cons list (cons (protect C) ())) ()))) ())))) (do (declare permute (cons (cons list (cons (protect A) ())) (cons --> (cons (cons list (cons (cons list (cons (protect A) ())) ())) ())))) (do (declare count-if (cons (cons (protect A) (cons --> (cons boolean ()))) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons number ()))) ())))) (do (declare count (cons (protect A) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons number ()))) ())))) (do (declare some? (cons (cons (protect A) (cons --> (cons boolean ()))) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons boolean ()))) ())))) (do (declare every? (cons (cons (protect A) (cons --> (cons boolean ()))) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons boolean ()))) ())))) (do (declare sort (cons (cons (protect A) (cons --> (cons (cons (protect A) (cons --> (cons boolean ()))) ()))) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons (cons list (cons (protect A) ())) ()))) ())))) (do (declare find (cons (cons (protect A) (cons --> (cons boolean ()))) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons (protect A) ()))) ())))) (do (declare foldr (cons (cons (protect A) (cons --> (cons (cons (protect B) (cons --> (cons (protect B) ()))) ()))) (cons --> (cons (cons (protect B) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons (protect B) ()))) ()))) ())))) (do (declare foldl (cons (cons (protect A) (cons --> (cons (cons (protect B) (cons --> (cons (protect A) ()))) ()))) (cons --> (cons (cons (protect A) (cons --> (cons (cons (cons list (cons (protect B) ())) (cons --> (cons (protect A) ()))) ()))) ())))) (do (declare mapf (cons (cons (protect A) (cons --> (cons (protect B) ()))) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons (cons (cons (protect B) (cons --> (cons (cons (cons list (cons (protect C) ())) (cons --> (cons (cons list (cons (protect C) ())) ()))) ()))) (cons --> (cons (cons list (cons (protect C) ())) ()))) ()))) ())))) (do (declare filter (cons (cons (protect A) (cons --> (cons boolean ()))) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons (cons list (cons (protect A) ())) ()))) ())))) (do (declare remove-if (cons (cons (protect A) (cons --> (cons boolean ()))) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons (cons list (cons (protect A) ())) ()))) ())))) (do (declare list.reduce (cons (cons (protect A) (cons --> (cons (cons (protect B) (cons --> (cons (protect A) ()))) ()))) (cons --> (cons (cons (protect A) (cons --> (cons (cons (cons list (cons (protect B) ())) (cons --> (cons (protect A) ()))) ()))) ())))) (do (declare take (cons number (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons (cons list (cons (protect A) ())) ()))) ())))) (do (declare take-last (cons number (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons (cons list (cons (protect A) ())) ()))) ())))) (do (declare cartprod (cons (cons list (cons (protect A) ())) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons (cons list (cons (cons list (cons (protect A) ())) ())) ()))) ())))) (do (declare powerset (cons (cons list (cons (protect A) ())) (cons --> (cons (cons list (cons (cons list (cons (protect A) ())) ())) ())))) (do (declare partition (cons (cons (protect A) (cons --> (cons (cons (protect A) (cons --> (cons boolean ()))) ()))) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons (cons list (cons (cons list (cons (protect A) ())) ())) ()))) ())))) (do (declare transitive-closure (cons (cons list (cons (cons (protect A) (cons * (cons (protect A) ()))) ())) (cons --> (cons (cons list (cons (cons (protect A) (cons * (cons (protect A) ()))) ())) ())))) (do (declare list.transitive-pass (cons (cons list (cons (cons (protect A) (cons * (cons (protect A) ()))) ())) (cons --> (cons (cons (cons list (cons (cons (protect A) (cons * (cons (protect A) ()))) ())) (cons --> (cons (cons list (cons (cons (protect A) (cons * (cons (protect A) ()))) ())) ()))) ())))) (do (declare list.find-trans (cons (protect A) (cons --> (cons (cons (protect A) (cons --> (cons (cons (cons list (cons (cons (protect A) (cons * (cons (protect A) ()))) ())) (cons --> (cons (cons list (cons (cons (protect A) (cons * (cons (protect A) ()))) ())) ()))) ()))) ())))) (do (declare x->ascii (cons (protect A) (cons --> (cons (cons list (cons number ())) ())))) (do (declare splice (cons number (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons (cons list (cons (protect A) ())) ()))) ()))) ())))) (do (declare string->list (cons string (cons --> (cons (cons list (cons string ())) ())))) (do (declare string.s->l-h (cons string (cons --> (cons (cons number (cons --> (cons (cons string (cons --> (cons (cons (cons list (cons string ())) (cons --> (cons (cons list (cons string ())) ()))) ()))) ()))) ())))) (do (declare list->string (cons (cons list (cons string ())) (cons --> (cons string ())))) (do (declare s-op1 (cons (cons (cons list (cons string ())) (cons --> (cons (protect A) ()))) (cons --> (cons (cons string (cons --> (cons (cons (cons (protect A) (cons --> (cons (protect B) ()))) (cons --> (cons (protect B) ()))) ()))) ())))) (do (declare s-op2 (cons (cons (cons list (cons string ())) (cons --> (cons (cons (cons list (cons string ())) (cons --> (cons (protect A) ()))) ()))) (cons --> (cons (cons string (cons --> (cons (cons string (cons --> (cons (cons (cons (protect A) (cons --> (cons (protect B) ()))) (cons --> (cons (protect B) ()))) ()))) ()))) ())))) (do (declare string.count (cons string (cons --> (cons (cons string (cons --> (cons number ()))) ())))) (do (declare string.reverse (cons string (cons --> (cons string ())))) (do (declare string.element? (cons string (cons --> (cons (cons string (cons --> (cons boolean ()))) ())))) (do (declare string.prefix? (cons string (cons --> (cons (cons string (cons --> (cons boolean ()))) ())))) (do (declare string.infix? (cons string (cons --> (cons (cons string (cons --> (cons boolean ()))) ())))) (do (declare string.suffix? (cons string (cons --> (cons (cons string (cons --> (cons boolean ()))) ())))) (do (declare string.subset? (cons string (cons --> (cons (cons string (cons --> (cons boolean ()))) ())))) (do (declare string.set=? (cons string (cons --> (cons (cons string (cons --> (cons boolean ()))) ())))) (do (declare string.set? (cons string (cons --> (cons boolean ())))) (do (declare file-extension (cons string (cons --> (cons (cons string (cons --> (cons string ()))) ())))) (do (declare strip-extension (cons string (cons --> (cons string ())))) (do (declare string.length (cons string (cons --> (cons number ())))) (do (declare string.trim (cons (cons list (cons string ())) (cons --> (cons (cons string (cons --> (cons string ()))) ())))) (do (declare string.trim-if (cons (cons string (cons --> (cons boolean ()))) (cons --> (cons (cons string (cons --> (cons string ()))) ())))) (do (declare string.trim-right-if (cons (cons string (cons --> (cons boolean ()))) (cons --> (cons (cons string (cons --> (cons string ()))) ())))) (do (declare string.trim-left-if (cons (cons string (cons --> (cons boolean ()))) (cons --> (cons (cons string (cons --> (cons string ()))) ())))) (do (declare string.trim-right (cons (cons list (cons string ())) (cons --> (cons (cons string (cons --> (cons string ()))) ())))) (do (declare string.trim-left (cons (cons list (cons string ())) (cons --> (cons (cons string (cons --> (cons string ()))) ())))) (do (declare string.some? (cons (cons string (cons --> (cons boolean ()))) (cons --> (cons (cons string (cons --> (cons boolean ()))) ())))) (do (declare string.every? (cons (cons string (cons --> (cons boolean ()))) (cons --> (cons (cons string (cons --> (cons boolean ()))) ())))) (do (declare string.difference (cons string (cons --> (cons (cons string (cons --> (cons string ()))) ())))) (do (declare string.intersection (cons string (cons --> (cons (cons string (cons --> (cons string ()))) ())))) (do (declare string.nth (cons number (cons --> (cons (cons string (cons --> (cons string ()))) ())))) (do (declare whitespace? (cons string (cons --> (cons boolean ())))) (do (declare uppercase? (cons string (cons --> (cons boolean ())))) (do (declare lowercase? (cons string (cons --> (cons boolean ())))) (do (declare digit? (cons string (cons --> (cons boolean ())))) (do (declare alpha? (cons string (cons --> (cons boolean ())))) (do (declare alphanum? (cons string (cons --> (cons boolean ())))) (do (declare tokenise (cons (cons string (cons --> (cons boolean ()))) (cons --> (cons (cons string (cons --> (cons (cons list (cons string ())) ()))) ())))) (do (declare string.tokenise-h (cons (cons string (cons --> (cons boolean ()))) (cons --> (cons (cons string (cons --> (cons (cons string (cons --> (cons (cons list (cons string ())) ()))) ()))) ())))) (do (declare uppercase (cons string (cons --> (cons string ())))) (do (declare lowercase (cons string (cons --> (cons string ())))) (do (declare string.map (cons (cons string (cons --> (cons string ()))) (cons --> (cons (cons string (cons --> (cons string ()))) ())))) (do (declare spell-number (cons number (cons --> (cons string ())))) (do (declare string.digit (cons string (cons --> (cons string ())))) (do (declare string.triples (cons (cons list (cons (protect A) ())) (cons --> (cons (cons list (cons (cons list (cons (protect A) ())) ())) ())))) (do (declare string.triples-h (cons (cons list (cons (protect A) ())) (cons --> (cons (cons (cons list (cons (cons list (cons (protect A) ())) ())) (cons --> (cons (cons list (cons (cons list (cons (protect A) ())) ())) ()))) ())))) (do (declare string.digits (cons (cons list (cons string ())) (cons --> (cons string ())))) (do (declare string.tens (cons string (cons --> (cons (cons string (cons --> (cons string ()))) ())))) (do (declare string.scale (cons (cons list (cons string ())) (cons --> (cons string ())))) (do (declare string.units (cons number (cons --> (cons string ())))) (do (declare string>? (cons string (cons --> (cons (cons string (cons --> (cons boolean ()))) ())))) (do (declare string (cons (cons string (cons --> (cons boolean ()))) ())))) (do (declare string>=? (cons string (cons --> (cons (cons string (cons --> (cons boolean ()))) ())))) (do (declare string<=? (cons string (cons --> (cons (cons string (cons --> (cons boolean ()))) ())))) (do (declare render (cons string (cons --> (cons string ())))) (do (declare render-file (cons string (cons --> (cons (cons string (cons --> (cons string ()))) ())))) (do (declare depopulate (cons (cons vector (cons A ())) (cons --> (cons (cons (cons list (cons number ())) (cons --> (cons (cons vector (cons A ())) ()))) ())))) (do (declare populated? (cons (cons vector (cons A ())) (cons --> (cons (cons (cons list (cons number ())) (cons --> (cons boolean ()))) ())))) (do (declare populate (cons (cons number (cons --> (cons A ()))) (cons --> (cons (cons number (cons --> (cons (cons vector (cons A ())) ()))) ())))) (do (declare compress (cons (cons vector (cons (protect A) ())) (cons --> (cons (cons vector (cons (protect A) ())) ())))) (do (declare vector.copy (cons (cons vector (cons (protect A) ())) (cons --> (cons (cons vector (cons (protect A) ())) ())))) (do (declare vector.reverse (cons (cons vector (cons (protect A) ())) (cons --> (cons (cons vector (cons (protect A) ())) ())))) (do (declare vector.append (cons (cons vector (cons (protect A) ())) (cons --> (cons (cons (cons vector (cons (protect A) ())) (cons --> (cons (cons vector (cons (protect A) ())) ()))) ())))) (do (declare vector.dfilter (cons (cons (protect A) (cons --> (cons boolean ()))) (cons --> (cons (cons (cons vector (cons (protect A) ())) (cons --> (cons (cons vector (cons (protect A) ())) ()))) ())))) (do (declare vector.element? (cons (protect A) (cons --> (cons (cons (cons vector (cons (protect A) ())) (cons --> (cons boolean ()))) ())))) (do (declare vector.map (cons (cons (protect A) (cons --> (cons (protect B) ()))) (cons --> (cons (cons (cons vector (cons (protect A) ())) (cons --> (cons (cons vector (cons (protect B) ())) ()))) ())))) (do (declare vector.dmap (cons (cons (protect A) (cons --> (cons (protect A) ()))) (cons --> (cons (cons (cons vector (cons (protect A) ())) (cons --> (cons (cons vector (cons (protect A) ())) ()))) ())))) (do (declare vector.every? (cons (cons (protect A) (cons --> (cons boolean ()))) (cons --> (cons (cons (cons vector (cons (protect A) ())) (cons --> (cons boolean ()))) ())))) (do (declare vector.some? (cons (cons (protect A) (cons --> (cons boolean ()))) (cons --> (cons (cons (cons vector (cons (protect A) ())) (cons --> (cons boolean ()))) ())))) (do (declare vector->list (cons (cons vector (cons (protect A) ())) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons (cons list (cons (protect A) ())) ()))) ())))) (do (declare list->vector (cons (cons list (cons (protect A) ())) (cons --> (cons (cons vector (cons (protect A) ())) ())))) (do (declare vector.list->vector-h (cons (cons list (cons (protect A) ())) (cons --> (cons (cons number (cons --> (cons (cons (cons vector (cons (protect A) ())) (cons --> (cons (cons vector (cons (protect A) ())) ()))) ()))) ())))) (do (declare vacant? (cons (cons vector (cons (protect A) ())) (cons --> (cons boolean ())))) (do (declare dense? (cons (cons vector (cons (protect A) ())) (cons --> (cons boolean ())))) (do (declare porous? (cons (cons vector (cons (protect A) ())) (cons --> (cons boolean ())))) (do (declare sparse? (cons (cons vector (cons (protect A) ())) (cons --> (cons boolean ())))) (do (declare v-op1 (cons (cons (cons list (cons (protect A) ())) (cons --> (cons (cons list (cons (protect A) ())) ()))) (cons --> (cons (cons (cons vector (cons (protect A) ())) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons (cons vector (cons (protect A) ())) ()))) ()))) ())))) (do (declare v-op2 (cons (cons (cons list (cons (protect A) ())) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons (cons list (cons (protect A) ())) ()))) ()))) (cons --> (cons (cons (cons vector (cons (protect A) ())) (cons --> (cons (cons (cons vector (cons (protect A) ())) (cons --> (cons (cons (cons list (cons (protect A) ())) (cons --> (cons (cons vector (cons (protect A) ())) ()))) ()))) ()))) ())))) (do (declare linelength (cons --> (cons number ()))) (do (declare indentation (cons --> (cons number ()))) (do (declare set-linelength (cons number (cons --> (cons number ())))) (do (declare set-indentation (cons number (cons --> (cons number ())))) (do (declare pps (cons symbol (cons --> (cons (cons (cons stream (cons out ())) (cons --> (cons symbol ()))) ())))) (do (declare pprint (cons (protect A) (cons --> (cons (cons (cons stream (cons out ())) (cons --> (cons (protect A) ()))) ())))) (do (declare pretty-string (cons string (cons --> (cons string ())))) (do (declare print.pretty-string-h (cons string (cons --> (cons (cons number (cons --> (cons (cons number (cons --> (cons string ()))) ()))) ())))) (do (declare print.indent (cons number (cons --> (cons string ())))) (do (declare print.indent-h (cons number (cons --> (cons string ())))) (do (declare print.n-space (cons number (cons --> (cons string ())))) (do (declare delete-file (cons string (cons --> (cons (cons list (cons A ())) ())))) (do (declare append-files (cons (cons list (cons string ())) (cons --> (cons (cons string (cons --> (cons string ()))) ())))) (do (declare append-files-with-open-stream (cons (cons list (cons string ())) (cons --> (cons (cons string (cons --> (cons (cons stream (cons out ())) ()))) ())))) (do (declare file.read&write (cons (cons stream (cons in ())) (cons --> (cons (cons (cons stream (cons out ())) (cons --> (cons number ()))) ())))) (do (declare file.read&write-h (cons number (cons --> (cons (cons (cons stream (cons in ())) (cons --> (cons (cons (cons stream (cons out ())) (cons --> (cons number ()))) ()))) ())))) (do (declare reopen (cons string (cons --> (cons (cons stream (cons out ())) ())))) (do (declare copy-file (cons string (cons --> (cons (cons string (cons --> (cons string ()))) ())))) (do (declare copy-file-with-open-stream (cons string (cons --> (cons (cons string (cons --> (cons (cons stream (cons out ())) ()))) ())))) (do (declare file-exists? (cons string (cons --> (cons boolean ())))) (do (declare file-size (cons string (cons --> (cons number ())))) (do (declare file.file-size-loop (cons (cons stream (cons in ())) (cons --> (cons (cons number (cons --> (cons (cons number (cons --> (cons number ()))) ()))) ())))) (do (declare ascii (cons number (cons --> (cons (cons number (cons --> (cons (cons string (cons --> (cons string ()))) ()))) ())))) (do (declare file.scan-bytes (cons number (cons --> (cons (cons number (cons --> (cons (cons (cons list (cons number ())) (cons --> (cons (cons string (cons --> (cons string ()))) ()))) ()))) ())))) (do (declare pairoff (cons (cons list (cons (protect A) ())) (cons --> (cons (cons (cons list (cons (protect B) ())) (cons --> (cons (cons list (cons (cons (protect A) (cons * (cons (protect B) ()))) ())) ()))) ())))) (do (declare assocp (cons (protect A) (cons --> (cons (cons (cons list (cons (cons (protect A) (cons * (cons (protect B) ()))) ())) (cons --> (cons (cons (protect A) (cons * (cons (protect B) ()))) ()))) ())))) (do (declare cartprodp (cons (cons list (cons (protect A) ())) (cons --> (cons (cons (cons list (cons (protect B) ())) (cons --> (cons (cons list (cons (cons (protect A) (cons * (cons (protect B) ()))) ())) ()))) ())))) (do (declare assocp-if (cons (cons (protect A) (cons --> (cons boolean ()))) (cons --> (cons (cons (cons list (cons (cons (protect A) (cons * (cons (protect B) ()))) ())) (cons --> (cons (cons (protect A) (cons * (cons (protect B) ()))) ()))) ())))) (declare assocp-if-not (cons (cons (protect A) (cons --> (cons boolean ()))) (cons --> (cons (cons (cons list (cons (cons (protect A) (cons * (cons (protect B) ()))) ())) (cons --> (cons (cons (protect A) (cons * (cons (protect B) ()))) ()))) ()))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) - -(defun stlib.initialise-sources () (do (shen.record-kl concat* (cons defun (cons concat* (cons (cons (protect V3) (cons (protect V4) ())) (cons (cons let (cons (protect W5) (cons (cons concat (cons (protect V3) (cons (protect V4) ()))) (cons (cons if (cons (cons symbol? (cons (protect W5) ())) (cons (protect W5) (cons (cons simple-error (cons (cons cn (cons "'" (cons (cons shen.app (cons (protect W5) (cons "' is not a symbol -" (cons shen.a ())))) ()))) ())) ())))) ())))) ()))))) (do (shen.record-kl newv (cons defun (cons newv (cons () (cons (cons gensym (cons (protect X) ())) ()))))) (do (shen.record-kl maths.maths-macro (cons defun (cons maths.maths-macro (cons (cons (protect V8) ()) (cons (cons cond (cons (cons (cons and (cons (cons cons? (cons (protect V8) ())) (cons (cons and (cons (cons = (cons log10 (cons (cons hd (cons (protect V8) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V8) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ()))) ()))) ()))) ()))) (cons (cons cons (cons log10 (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V8) ())) ())) (cons (cons cons (cons (cons cons (cons tolerance (cons () ()))) (cons () ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V8) ())) (cons (cons and (cons (cons = (cons log2 (cons (cons hd (cons (protect V8) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V8) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ()))) ()))) ()))) ()))) (cons (cons cons (cons log2 (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V8) ())) ())) (cons (cons cons (cons (cons cons (cons tolerance (cons () ()))) (cons () ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V8) ())) (cons (cons and (cons (cons = (cons loge (cons (cons hd (cons (protect V8) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V8) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ()))) ()))) ()))) ()))) (cons (cons cons (cons loge (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V8) ())) ())) (cons (cons cons (cons (cons cons (cons tolerance (cons () ()))) (cons () ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V8) ())) (cons (cons and (cons (cons = (cons log (cons (cons hd (cons (protect V8) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V8) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) (cons (cons cons (cons log (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V8) ())) ())) (cons (cons cons (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) (cons (cons cons (cons (cons cons (cons tolerance (cons () ()))) (cons () ()))) ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V8) ())) (cons (cons and (cons (cons = (cons sin (cons (cons hd (cons (protect V8) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V8) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ()))) ()))) ()))) ()))) (cons (cons cons (cons sin (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V8) ())) ())) (cons (cons cons (cons (cons cons (cons tolerance (cons () ()))) (cons () ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V8) ())) (cons (cons and (cons (cons = (cons tan (cons (cons hd (cons (protect V8) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V8) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ()))) ()))) ()))) ()))) (cons (cons cons (cons tan (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V8) ())) ())) (cons (cons cons (cons (cons cons (cons tolerance (cons () ()))) (cons () ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V8) ())) (cons (cons and (cons (cons = (cons cos (cons (cons hd (cons (protect V8) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V8) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ()))) ()))) ()))) ()))) (cons (cons cons (cons cos (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V8) ())) ())) (cons (cons cons (cons (cons cons (cons tolerance (cons () ()))) (cons () ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V8) ())) (cons (cons and (cons (cons = (cons tanh (cons (cons hd (cons (protect V8) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V8) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ()))) ()))) ()))) ()))) (cons (cons cons (cons tanh (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V8) ())) ())) (cons (cons cons (cons (cons cons (cons tolerance (cons () ()))) (cons () ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V8) ())) (cons (cons and (cons (cons = (cons cosh (cons (cons hd (cons (protect V8) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V8) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ()))) ()))) ()))) ()))) (cons (cons cons (cons cosh (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V8) ())) ())) (cons (cons cons (cons (cons cons (cons tolerance (cons () ()))) (cons () ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V8) ())) (cons (cons and (cons (cons = (cons sinh (cons (cons hd (cons (protect V8) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V8) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ()))) ()))) ()))) ()))) (cons (cons cons (cons sinh (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V8) ())) ())) (cons (cons cons (cons (cons cons (cons tolerance (cons () ()))) (cons () ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V8) ())) (cons (cons and (cons (cons = (cons sech (cons (cons hd (cons (protect V8) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V8) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ()))) ()))) ()))) ()))) (cons (cons cons (cons sech (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V8) ())) ())) (cons (cons cons (cons (cons cons (cons tolerance (cons () ()))) (cons () ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V8) ())) (cons (cons and (cons (cons = (cons csch (cons (cons hd (cons (protect V8) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V8) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ()))) ()))) ()))) ()))) (cons (cons cons (cons csch (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V8) ())) ())) (cons (cons cons (cons (cons cons (cons tolerance (cons () ()))) (cons () ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V8) ())) (cons (cons and (cons (cons = (cons coth (cons (cons hd (cons (protect V8) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V8) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ()))) ()))) ()))) ()))) (cons (cons cons (cons coth (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V8) ())) ())) (cons (cons cons (cons (cons cons (cons tolerance (cons () ()))) (cons () ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V8) ())) (cons (cons and (cons (cons = (cons nthrt (cons (cons hd (cons (protect V8) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V8) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) (cons (cons cons (cons nthrt (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V8) ())) ())) (cons (cons cons (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) (cons (cons cons (cons (cons cons (cons tolerance (cons () ()))) (cons () ()))) ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V8) ())) (cons (cons and (cons (cons = (cons sqrt (cons (cons hd (cons (protect V8) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V8) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ()))) ()))) ()))) ()))) (cons (cons cons (cons sqrt (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V8) ())) ())) (cons (cons cons (cons (cons cons (cons tolerance (cons () ()))) (cons () ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V8) ())) (cons (cons and (cons (cons = (cons expt (cons (cons hd (cons (protect V8) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V8) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) (cons (cons cons (cons expt (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V8) ())) ())) (cons (cons cons (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) (cons (cons cons (cons (cons cons (cons tolerance (cons () ()))) (cons () ()))) ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V8) ())) (cons (cons and (cons (cons = (cons max (cons (cons hd (cons (protect V8) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V8) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ()))) ()))) ()))) ()))) (cons (cons cons (cons max (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V8) ())) ())) (cons (cons cons (cons (cons cons (cons max (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ()))) (cons () ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V8) ())) (cons (cons and (cons (cons = (cons min (cons (cons hd (cons (protect V8) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V8) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ()))) ()))) ()))) ()))) (cons (cons cons (cons min (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V8) ())) ())) (cons (cons cons (cons (cons cons (cons min (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ()))) (cons () ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V8) ())) (cons (cons and (cons (cons = (cons tolerance (cons (cons hd (cons (protect V8) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V8) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ()))) ()))) ()))) ()))) (cons (cons cons (cons maths.tolerance=n (cons (cons tl (cons (protect V8) ())) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V8) ())) (cons (cons and (cons (cons = (cons for (cons (cons hd (cons (protect V8) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V8) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) (cons (cons and (cons (cons = (cons = (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) ())) ())) (cons (cons and (cons (cons = (cons and (cons (cons hd (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) ())) ())) ()))) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) (cons (cons let (cons (protect W9) (cons (cons lambda (cons (protect Z10) (cons (cons lambda (cons (protect Z11) (cons (cons if (cons (cons > (cons (cons occurrences (cons (protect Z10) (cons (protect Z11) ()))) (cons 0 ()))) (cons (cons cons (cons /. (cons (cons cons (cons (protect Z10) (cons (cons cons (cons (protect Z11) (cons () ()))) ()))) ()))) (cons (protect Z11) ())))) ()))) ()))) (cons (cons cons (cons maths.lazyfor-and (cons (cons cons (cons (cons hd (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) (cons (cons cons (cons (cons (cons (protect W9) (cons (cons hd (cons (cons tl (cons (protect V8) ())) ())) ())) (cons (cons hd (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) (cons (cons cons (cons (cons (cons (protect W9) (cons (cons hd (cons (cons tl (cons (protect V8) ())) ())) ())) (cons (cons hd (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) ())) (cons (cons cons (cons (cons hd (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) ())) (cons () ()))) ()))) ()))) ()))) ()))) ())))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V8) ())) (cons (cons and (cons (cons = (cons for (cons (cons hd (cons (protect V8) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V8) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) (cons (cons and (cons (cons = (cons = (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) ())) ())) (cons (cons and (cons (cons = (cons or (cons (cons hd (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) ())) ())) ()))) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) (cons (cons let (cons (protect W12) (cons (cons lambda (cons (protect Z13) (cons (cons lambda (cons (protect Z14) (cons (cons if (cons (cons > (cons (cons occurrences (cons (protect Z13) (cons (protect Z14) ()))) (cons 0 ()))) (cons (cons cons (cons /. (cons (cons cons (cons (protect Z13) (cons (cons cons (cons (protect Z14) (cons () ()))) ()))) ()))) (cons (protect Z14) ())))) ()))) ()))) (cons (cons cons (cons maths.lazyfor-or (cons (cons cons (cons (cons hd (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) (cons (cons cons (cons (cons (cons (protect W12) (cons (cons hd (cons (cons tl (cons (protect V8) ())) ())) ())) (cons (cons hd (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) (cons (cons cons (cons (cons (cons (protect W12) (cons (cons hd (cons (cons tl (cons (protect V8) ())) ())) ())) (cons (cons hd (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) ())) (cons (cons cons (cons (cons hd (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) ())) (cons () ()))) ()))) ()))) ()))) ()))) ())))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V8) ())) (cons (cons and (cons (cons = (cons for (cons (cons hd (cons (protect V8) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V8) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) (cons (cons and (cons (cons = (cons = (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) (cons (cons let (cons (protect W15) (cons (cons lambda (cons (protect Z16) (cons (cons lambda (cons (protect Z17) (cons (cons if (cons (cons > (cons (cons occurrences (cons (protect Z16) (cons (protect Z17) ()))) (cons 0 ()))) (cons (cons cons (cons /. (cons (cons cons (cons (protect Z16) (cons (cons cons (cons (protect Z17) (cons () ()))) ()))) ()))) (cons (protect Z17) ())))) ()))) ()))) (cons (cons cons (cons for (cons (cons cons (cons (cons hd (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) (cons (cons cons (cons (cons (cons (protect W15) (cons (cons hd (cons (cons tl (cons (protect V8) ())) ())) ())) (cons (cons hd (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) (cons (cons cons (cons (cons (cons (protect W15) (cons (cons hd (cons (cons tl (cons (protect V8) ())) ())) ())) (cons (cons hd (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) ())) (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) ()))) ()))) ()))) ()))) ())))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V8) ())) (cons (cons and (cons (cons = (cons for (cons (cons hd (cons (protect V8) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V8) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) (cons (cons and (cons (cons = (cons = (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) (cons (cons let (cons (protect W18) (cons (cons lambda (cons (protect Z19) (cons (cons lambda (cons (protect Z20) (cons (cons if (cons (cons > (cons (cons occurrences (cons (protect Z19) (cons (protect Z20) ()))) (cons 0 ()))) (cons (cons cons (cons /. (cons (cons cons (cons (protect Z19) (cons (cons cons (cons (protect Z20) (cons () ()))) ()))) ()))) (cons (protect Z20) ())))) ()))) ()))) (cons (cons cons (cons for (cons (cons cons (cons (cons hd (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) (cons (cons cons (cons (cons (cons (protect W18) (cons (cons hd (cons (cons tl (cons (protect V8) ())) ())) ())) (cons (cons hd (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) (cons (cons cons (cons (cons (cons (protect W18) (cons (cons hd (cons (cons tl (cons (protect V8) ())) ())) ())) (cons (cons hd (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) ())) (cons (cons cons (cons (cons hd (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) ())) (cons (cons cons (cons (cons cons (cons fn (cons (cons cons (cons do (cons () ()))) ()))) (cons () ()))) ()))) ()))) ()))) ()))) ()))) ())))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V8) ())) (cons (cons and (cons (cons = (cons for (cons (cons hd (cons (protect V8) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V8) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) (cons (cons and (cons (cons = (cons = (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) (cons (cons let (cons (protect W21) (cons (cons lambda (cons (protect Z22) (cons (cons lambda (cons (protect Z23) (cons (cons if (cons (cons > (cons (cons occurrences (cons (protect Z22) (cons (protect Z23) ()))) (cons 0 ()))) (cons (cons cons (cons /. (cons (cons cons (cons (protect Z22) (cons (cons cons (cons (protect Z23) (cons () ()))) ()))) ()))) (cons (protect Z23) ())))) ()))) ()))) (cons (cons cons (cons for (cons (cons cons (cons (cons hd (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) (cons (cons cons (cons (cons (cons (protect W21) (cons (cons hd (cons (cons tl (cons (protect V8) ())) ())) ())) (cons (cons hd (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ())) (cons (cons cons (cons (cons cons (cons /. (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V8) ())) ())) (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V8) ())) ())) ())) ())) ())) ()))) ()))) (cons (cons cons (cons (cons cons (cons + (cons (cons cons (cons 1 (cons () ()))) ()))) (cons (cons cons (cons (cons cons (cons fn (cons (cons cons (cons do (cons () ()))) ()))) (cons () ()))) ()))) ()))) ()))) ()))) ()))) ())))) ())) (cons (cons true (cons (protect V8) ())) ())))))))))))))))))))))))))) ()))))) (do (shen.record-kl set-tolerance (cons defun (cons set-tolerance (cons (cons (protect V249) ()) (cons (cons set (cons maths.*tolerance* (cons (protect V249) ()))) ()))))) (do (shen.record-kl tolerance (cons defun (cons tolerance (cons () (cons (cons value (cons maths.*tolerance* ())) ()))))) (do (shen.record-kl sq (cons defun (cons sq (cons (cons (protect V251) ()) (cons (cons * (cons (protect V251) (cons (protect V251) ()))) ()))))) (do (shen.record-kl cube (cons defun (cons cube (cons (cons (protect V253) ()) (cons (cons * (cons (protect V253) (cons (cons * (cons (protect V253) (cons (protect V253) ()))) ()))) ()))))) (do (shen.record-kl for (cons defun (cons for (cons (cons (protect V255) (cons (protect V256) (cons (protect V257) (cons (protect V258) (cons (protect V259) ()))))) (cons (cons maths.for-h (cons (cons (protect V258) (cons (protect V255) ())) (cons (protect V256) (cons (protect V257) (cons (protect V258) (cons (protect V259) (cons (cons (protect V257) (cons (protect V255) ())) ()))))))) ()))))) (do (shen.record-kl maths.for-h (cons defun (cons maths.for-h (cons (cons (protect V268) (cons (protect V269) (cons (protect V270) (cons (protect V271) (cons (protect V272) (cons (protect V273) ())))))) (cons (cons cond (cons (cons (cons not (cons (cons (protect V269) (cons (protect V268) ())) ())) (cons (protect V273) ())) (cons (cons true (cons (cons maths.for-h (cons (cons (protect V271) (cons (protect V268) ())) (cons (protect V269) (cons (protect V270) (cons (protect V271) (cons (protect V272) (cons (cons (cons (protect V272) (cons (protect V273) ())) (cons (cons (protect V270) (cons (protect V268) ())) ())) ()))))))) ())) ()))) ()))))) (do (shen.record-kl maths.lazyfor-and (cons defun (cons maths.lazyfor-and (cons (cons (protect V290) (cons (protect V291) (cons (protect V292) (cons (protect V293) ())))) (cons (cons cond (cons (cons (cons not (cons (cons (protect V291) (cons (protect V290) ())) ())) (cons true ())) (cons (cons (cons (protect V292) (cons (protect V290) ())) (cons (cons maths.lazyfor-and (cons (cons (protect V293) (cons (protect V290) ())) (cons (protect V291) (cons (protect V292) (cons (protect V293) ()))))) ())) (cons (cons true (cons false ())) ())))) ()))))) (do (shen.record-kl maths.lazyfor-or (cons defun (cons maths.lazyfor-or (cons (cons (protect V300) (cons (protect V301) (cons (protect V302) (cons (protect V303) ())))) (cons (cons cond (cons (cons (cons not (cons (cons (protect V301) (cons (protect V300) ())) ())) (cons false ())) (cons (cons (cons (protect V302) (cons (protect V300) ())) (cons true ())) (cons (cons true (cons (cons maths.lazyfor-or (cons (cons (protect V303) (cons (protect V300) ())) (cons (protect V301) (cons (protect V302) (cons (protect V303) ()))))) ())) ())))) ()))))) (do (shen.record-kl max (cons defun (cons max (cons (cons (protect V310) (cons (protect V311) ())) (cons (cons cond (cons (cons (cons > (cons (protect V311) (cons (protect V310) ()))) (cons (protect V311) ())) (cons (cons true (cons (protect V310) ())) ()))) ()))))) (do (shen.record-kl min (cons defun (cons min (cons (cons (protect V316) (cons (protect V317) ())) (cons (cons cond (cons (cons (cons < (cons (protect V317) (cons (protect V316) ()))) (cons (protect V317) ())) (cons (cons true (cons (protect V316) ())) ()))) ()))))) (do (shen.record-kl expt (cons defun (cons expt (cons (cons (protect V320) (cons (protect V321) (cons (protect V322) ()))) (cons (cons if (cons (cons = (cons (protect V321) (cons 0 ()))) (cons 1 (cons (cons if (cons (cons positive? (cons (protect V321) ())) (cons (cons maths.expt-h (cons (protect V320) (cons (cons maths.n->r (cons (protect V321) (cons 1 ()))) (cons (protect V322) ())))) (cons (cons / (cons 1 (cons (cons maths.expt-h (cons (protect V320) (cons (cons maths.n->r (cons (cons ~ (cons (protect V321) ())) (cons 1 ()))) (cons (protect V322) ())))) ()))) ())))) ())))) ()))))) (do (shen.record-kl maths.n->r (cons defun (cons maths.n->r (cons (cons (protect V326) (cons (protect V327) ())) (cons (cons cond (cons (cons (cons integer? (cons (protect V326) ())) (cons (cons @p (cons (protect V326) (cons (protect V327) ()))) ())) (cons (cons true (cons (cons maths.n->r (cons (cons * (cons (protect V326) (cons 10 ()))) (cons (cons * (cons (protect V327) (cons 10 ()))) ()))) ())) ()))) ()))))) (do (shen.record-kl maths.expt-h (cons defun (cons maths.expt-h (cons (cons (protect V330) (cons (protect V331) (cons (protect V332) ()))) (cons (cons cond (cons (cons (cons tuple? (cons (protect V331) ())) (cons (cons power (cons (cons nthrt (cons (protect V330) (cons (cons snd (cons (protect V331) ())) (cons (protect V332) ())))) (cons (cons fst (cons (protect V331) ())) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons maths.expt-h ())) ())) ()))) ()))))) (do (shen.record-kl gcd (cons defun (cons gcd (cons (cons (protect V336) (cons (protect V337) ())) (cons (cons if (cons (cons and (cons (cons integer? (cons (protect V336) ())) (cons (cons integer? (cons (protect V337) ())) ()))) (cons (cons let (cons (protect W338) (cons (cons abs (cons (protect V336) ())) (cons (cons let (cons (protect W339) (cons (cons abs (cons (protect V337) ())) (cons (cons if (cons (cons > (cons (protect W338) (cons (protect W339) ()))) (cons (cons maths.gcd-help (cons (cons - (cons (protect W338) (cons (protect W339) ()))) (cons (protect W339) ()))) (cons (cons maths.gcd-help (cons (protect W338) (cons (cons - (cons (protect W339) (cons (protect W338) ()))) ()))) ())))) ())))) ())))) (cons (cons simple-error (cons "gcd expects integer inputs" ())) ())))) ()))))) (do (shen.record-kl maths.gcd-help (cons defun (cons maths.gcd-help (cons (cons (protect V342) (cons (protect V343) ())) (cons (cons if (cons (cons > (cons (protect V342) (cons (protect V343) ()))) (cons (cons maths.gcd-loop (cons (protect V342) (cons (protect V343) (cons (protect V343) ())))) (cons (cons maths.gcd-loop (cons (protect V342) (cons (protect V343) (cons (protect V342) ())))) ())))) ()))))) (do (shen.record-kl maths.gcd-loop (cons defun (cons maths.gcd-loop (cons (cons (protect V350) (cons (protect V351) (cons (protect V352) ()))) (cons (cons cond (cons (cons (cons = (cons 1 (cons (protect V352) ()))) (cons 1 ())) (cons (cons (cons and (cons (cons integer? (cons (cons / (cons (protect V350) (cons (protect V352) ()))) ())) (cons (cons integer? (cons (cons / (cons (protect V351) (cons (protect V352) ()))) ())) ()))) (cons (protect V352) ())) (cons (cons true (cons (cons maths.gcd-loop (cons (protect V350) (cons (protect V351) (cons (cons - (cons (protect V352) (cons 1 ()))) ())))) ())) ())))) ()))))) (do (shen.record-kl lcd (cons defun (cons lcd (cons (cons (protect V356) (cons (protect V357) ())) (cons (cons cond (cons (cons (cons and (cons (cons even? (cons (protect V356) ())) (cons (cons even? (cons (protect V357) ())) ()))) (cons 2 ())) (cons (cons true (cons (cons maths.lcd-loop (cons (protect V356) (cons (protect V357) (cons (cons if (cons (cons > (cons (protect V356) (cons (protect V357) ()))) (cons (protect V357) (cons (protect V356) ())))) (cons 3 ()))))) ())) ()))) ()))))) (do (shen.record-kl maths.lcd-loop (cons defun (cons maths.lcd-loop (cons (cons (protect V363) (cons (protect V364) (cons (protect V365) (cons (protect V366) ())))) (cons (cons cond (cons (cons (cons > (cons (protect V366) (cons (protect V365) ()))) (cons 1 ())) (cons (cons (cons and (cons (cons integer? (cons (cons / (cons (protect V363) (cons (protect V366) ()))) ())) (cons (cons integer? (cons (cons / (cons (protect V364) (cons (protect V366) ()))) ())) ()))) (cons (protect V366) ())) (cons (cons true (cons (cons maths.lcd-loop (cons (protect V363) (cons (protect V364) (cons (protect V365) (cons (cons + (cons 2 (cons (protect V366) ()))) ()))))) ())) ())))) ()))))) (do (shen.record-kl isqrt (cons defun (cons isqrt (cons (cons (protect V371) ()) (cons (cons maths.isqrt-loop (cons (protect V371) (cons 0 ()))) ()))))) (do (shen.record-kl maths.isqrt-loop (cons defun (cons maths.isqrt-loop (cons (cons (protect V373) (cons (protect V374) ())) (cons (cons cond (cons (cons (cons = (cons (cons * (cons (protect V374) (cons (protect V374) ()))) (cons (protect V373) ()))) (cons (protect V374) ())) (cons (cons (cons > (cons (cons * (cons (protect V374) (cons (protect V374) ()))) (cons (protect V373) ()))) (cons (cons - (cons (protect V374) (cons 1 ()))) ())) (cons (cons true (cons (cons maths.isqrt-loop (cons (protect V373) (cons (cons + (cons (protect V374) (cons 1 ()))) ()))) ())) ())))) ()))))) (do (shen.record-kl div (cons defun (cons div (cons (cons (protect V377) (cons (protect V378) ())) (cons (cons floor (cons (cons / (cons (protect V377) (cons (protect V378) ()))) ())) ()))))) (do (shen.record-kl modf (cons defun (cons modf (cons (cons (protect V381) ()) (cons (cons let (cons (protect W382) (cons (cons floor (cons (protect V381) ())) (cons (cons @p (cons (protect W382) (cons (cons - (cons (protect V381) (cons (protect W382) ()))) ()))) ())))) ()))))) (do (shen.record-kl floor (cons defun (cons floor (cons (cons (protect V384) ()) (cons (cons cond (cons (cons (cons negative? (cons (protect V384) ())) (cons (cons ~ (cons (cons ceiling (cons (cons ~ (cons (protect V384) ())) ())) ())) ())) (cons (cons true (cons (cons maths.rounding-loop (cons floor (cons (protect V384) (cons 15 (cons 0 ()))))) ())) ()))) ()))))) (do (shen.record-kl maths.rounding-loop (cons defun (cons maths.rounding-loop (cons (cons (protect V389) (cons (protect V390) (cons (protect V391) (cons (protect V392) ())))) (cons (cons cond (cons (cons (cons and (cons (cons = (cons 0 (cons (protect V391) ()))) (cons (cons = (cons (protect V390) (cons (protect V392) ()))) ()))) (cons (protect V392) ())) (cons (cons (cons and (cons (cons = (cons 0 (cons (protect V391) ()))) (cons (cons > (cons (protect V392) (cons (protect V390) ()))) ()))) (cons (cons if (cons (cons = (cons (protect V389) (cons floor ()))) (cons (cons - (cons (protect V392) (cons 1 ()))) (cons (cons if (cons (cons = (cons (protect V389) (cons ceiling ()))) (cons (protect V392) (cons (cons if (cons (cons = (cons (protect V389) (cons round ()))) (cons (cons let (cons (protect W393) (cons (cons - (cons (protect V392) (cons (protect V390) ()))) (cons (cons let (cons (protect W394) (cons (cons - (cons (protect V390) (cons (cons - (cons (protect V392) (cons 1 ()))) ()))) (cons (cons if (cons (cons > (cons (protect W393) (cons (protect W394) ()))) (cons (cons - (cons (protect V392) (cons 1 ()))) (cons (protect V392) ())))) ())))) ())))) (cons (cons simple-error (cons "error: cases exhausted" ())) ())))) ())))) ())))) ())) (cons (cons (cons > (cons (protect V390) (cons (protect V392) ()))) (cons (cons maths.rounding-loop (cons (protect V389) (cons (protect V390) (cons (protect V391) (cons (cons + (cons (protect V392) (cons (cons power (cons 10 (cons (protect V391) ()))) ()))) ()))))) ())) (cons (cons true (cons (cons maths.rounding-loop (cons (protect V389) (cons (protect V390) (cons (cons - (cons (protect V391) (cons 1 ()))) (cons (cons - (cons (protect V392) (cons (cons power (cons 10 (cons (protect V391) ()))) ()))) ()))))) ())) ()))))) ()))))) (do (shen.record-kl maths.float->pair (cons defun (cons maths.float->pair (cons (cons (protect V399) ()) (cons (cons let (cons (protect W400) (cons (cons floor (cons (protect V399) ())) (cons (cons @p (cons (protect W400) (cons (cons - (cons (protect V399) (cons (protect W400) ()))) ()))) ())))) ()))))) (do (shen.record-kl ceiling (cons defun (cons ceiling (cons (cons (protect V402) ()) (cons (cons cond (cons (cons (cons negative? (cons (protect V402) ())) (cons (cons ~ (cons (cons floor (cons (cons ~ (cons (protect V402) ())) ())) ())) ())) (cons (cons true (cons (cons maths.rounding-loop (cons ceiling (cons (protect V402) (cons 15 (cons 0 ()))))) ())) ()))) ()))))) (do (shen.record-kl round (cons defun (cons round (cons (cons (protect V404) ()) (cons (cons cond (cons (cons (cons negative? (cons (protect V404) ())) (cons (cons ~ (cons (cons round (cons (cons ~ (cons (protect V404) ())) ())) ())) ())) (cons (cons true (cons (cons maths.rounding-loop (cons round (cons (protect V404) (cons 15 (cons 0 ()))))) ())) ()))) ()))))) (do (shen.record-kl mod (cons defun (cons mod (cons (cons (protect V406) (cons (protect V407) ())) (cons (cons let (cons (protect W408) (cons (cons / (cons (protect V406) (cons (protect V407) ()))) (cons (cons let (cons (protect W409) (cons (cons floor (cons (protect W408) ())) (cons (cons if (cons (cons and (cons (cons integer? (cons (protect V406) ())) (cons (cons integer? (cons (protect V407) ())) ()))) (cons (cons round (cons (cons * (cons (protect V407) (cons (cons - (cons (protect W408) (cons (protect W409) ()))) ()))) ())) (cons (cons * (cons (protect V407) (cons (cons - (cons (protect W408) (cons (protect W409) ()))) ()))) ())))) ())))) ())))) ()))))) (do (shen.record-kl lcm (cons defun (cons lcm (cons (cons (protect V412) ()) (cons (cons let (cons (protect W413) (cons (cons maths.greatest (cons (protect V412) ())) (cons (cons maths.lcm-h (cons (protect W413) (cons (protect W413) (cons (protect V412) ())))) ())))) ()))))) (do (shen.record-kl maths.greatest (cons defun (cons maths.greatest (cons (cons (protect V417) ()) (cons (cons cond (cons (cons (cons and (cons (cons cons? (cons (protect V417) ())) (cons (cons = (cons () (cons (cons tl (cons (protect V417) ())) ()))) ()))) (cons (cons hd (cons (protect V417) ())) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V417) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V417) ())) ())) (cons (cons > (cons (cons hd (cons (protect V417) ())) (cons (cons hd (cons (cons tl (cons (protect V417) ())) ())) ()))) ()))) ()))) (cons (cons maths.greatest (cons (cons cons (cons (cons hd (cons (protect V417) ())) (cons (cons tl (cons (cons tl (cons (protect V417) ())) ())) ()))) ())) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V417) ())) (cons (cons cons? (cons (cons tl (cons (protect V417) ())) ())) ()))) (cons (cons maths.greatest (cons (cons tl (cons (protect V417) ())) ())) ())) (cons (cons true (cons (cons shen.f-error (cons maths.greatest ())) ())) ()))))) ()))))) (do (shen.record-kl maths.lcm-h (cons defun (cons maths.lcm-h (cons (cons (protect V419) (cons (protect V420) (cons (protect V421) ()))) (cons (cons cond (cons (cons (cons maths.lcm? (cons (protect V419) (cons (protect V421) ()))) (cons (protect V419) ())) (cons (cons true (cons (cons maths.lcm-h (cons (cons + (cons (protect V419) (cons (protect V420) ()))) (cons (protect V420) (cons (protect V421) ())))) ())) ()))) ()))))) (do (shen.record-kl maths.lcm? (cons defun (cons maths.lcm? (cons (cons (protect V427) (cons (protect V428) ())) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V428) ()))) (cons true ())) (cons (cons (cons cons? (cons (protect V428) ())) (cons (cons and (cons (cons integer? (cons (cons / (cons (protect V427) (cons (cons hd (cons (protect V428) ())) ()))) ())) (cons (cons maths.lcm? (cons (protect V427) (cons (cons tl (cons (protect V428) ())) ()))) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons maths.lcm? ())) ())) ())))) ()))))) (do (shen.record-kl random (cons defun (cons random (cons (cons (protect V431) (cons (protect V432) ())) (cons (cons let (cons (protect W433) (cons (cons maths.bbs (cons (cons value (cons maths.*seed* ())) ())) (cons (cons let (cons (protect W434) (cons (cons set (cons maths.*seed* (cons (protect W433) ()))) (cons (cons let (cons (protect W435) (cons (cons min (cons (protect V431) (cons (protect V432) ()))) (cons (cons + (cons (protect W435) (cons (cons mod (cons (protect W434) (cons (cons abs (cons (cons + (cons 1 (cons (cons - (cons (protect V432) (cons (protect V431) ()))) ()))) ())) ()))) ()))) ())))) ())))) ())))) ()))))) (do (shen.record-kl min (cons defun (cons min (cons (cons (protect V440) (cons (protect V441) ())) (cons (cons cond (cons (cons (cons > (cons (protect V440) (cons (protect V441) ()))) (cons (protect V441) ())) (cons (cons true (cons (protect V440) ())) ()))) ()))))) (do (shen.record-kl reseed (cons defun (cons reseed (cons () (cons (cons set (cons maths.*seed* (cons (cons get-time (cons unix ())) ()))) ()))))) (do (shen.record-kl maths.bbs (cons defun (cons maths.bbs (cons (cons (protect V444) ()) (cons (cons let (cons (protect W445) (cons (cons * (cons 1201 (cons 1213 ()))) (cons (cons mod (cons (cons * (cons (protect V444) (cons (protect V444) ()))) (cons (protect W445) ()))) ())))) ()))))) (do (shen.record-kl ~ (cons defun (cons ~ (cons (cons (protect V447) ()) (cons (cons - (cons 0 (cons (protect V447) ()))) ()))))) (do (shen.record-kl positive? (cons defun (cons positive? (cons (cons (protect V449) ()) (cons (cons > (cons (protect V449) (cons 0 ()))) ()))))) (do (shen.record-kl negative? (cons defun (cons negative? (cons (cons (protect V451) ()) (cons (cons < (cons (protect V451) (cons 0 ()))) ()))))) (do (shen.record-kl natural? (cons defun (cons natural? (cons (cons (protect V453) ()) (cons (cons cond (cons (cons (cons = (cons 0 (cons (protect V453) ()))) (cons true ())) (cons (cons true (cons (cons and (cons (cons integer? (cons (protect V453) ())) (cons (cons positive? (cons (protect V453) ())) ()))) ())) ()))) ()))))) (do (shen.record-kl converge (cons defun (cons converge (cons (cons (protect V455) (cons (protect V456) (cons (protect V457) ()))) (cons (cons maths.converge-help (cons (protect V456) (cons (cons (protect V456) (cons (protect V455) ())) (cons (protect V455) (cons (protect V457) ()))))) ()))))) (do (shen.record-kl maths.converge-help (cons defun (cons maths.converge-help (cons (cons (protect V464) (cons (protect V465) (cons (protect V466) (cons (protect V467) ())))) (cons (cons cond (cons (cons (cons (cons (protect V467) (cons (protect V466) ())) (cons (protect V465) ())) (cons (protect V465) ())) (cons (cons true (cons (cons maths.converge-help (cons (protect V464) (cons (cons (protect V464) (cons (protect V465) ())) (cons (protect V465) (cons (protect V467) ()))))) ())) ()))) ()))))) (do (shen.record-kl nthrt (cons defun (cons nthrt (cons (cons (protect V476) (cons (protect V477) (cons (protect V478) ()))) (cons (cons cond (cons (cons (cons positive? (cons (protect V476) ())) (cons (cons converge (cons (protect V476) (cons (cons lambda (cons (protect Z479) (cons (cons maths.compute-nthrt (cons (protect V476) (cons (protect Z479) (cons (protect V477) (cons (protect V478) ()))))) ()))) (cons (cons approx (cons (protect V478) ())) ())))) ())) (cons (cons true (cons (cons simple-error (cons (cons cn (cons "nthrt: negA must be a positive numberneg%" (cons "" ()))) ())) ())) ()))) ()))))) (do (shen.record-kl sqrt (cons defun (cons sqrt (cons (cons (protect V483) (cons (protect V484) ())) (cons (cons nthrt (cons (protect V483) (cons 2 (cons (protect V484) ())))) ()))))) (do (shen.record-kl maths.compute-nthrt (cons defun (cons maths.compute-nthrt (cons (cons (protect V487) (cons (protect V488) (cons (protect V489) (cons (protect V490) ())))) (cons (cons let (cons (protect W491) (cons (cons / (cons 1 (cons (protect V489) ()))) (cons (cons let (cons (protect W492) (cons (cons * (cons (cons - (cons (protect V489) (cons 1 ()))) (cons (protect V488) ()))) (cons (cons let (cons (protect W493) (cons (cons expt (cons (protect V488) (cons (cons - (cons (protect V489) (cons 1 ()))) (cons (protect V490) ())))) (cons (cons let (cons (protect W494) (cons (cons / (cons (protect V487) (cons (protect W493) ()))) (cons (cons let (cons (protect W495) (cons (cons + (cons (protect W492) (cons (protect W494) ()))) (cons (cons * (cons (protect W491) (cons (protect W495) ()))) ())))) ())))) ())))) ())))) ())))) ()))))) (do (shen.record-kl approx (cons defun (cons approx (cons (cons (protect V500) ()) (cons (cons lambda (cons (protect Z501) (cons (cons lambda (cons (protect Z502) (cons (cons let (cons (protect W503) (cons (cons - (cons (protect Z501) (cons (protect Z502) ()))) (cons (cons >= (cons (protect V500) (cons (cons abs (cons (protect W503) ())) ()))) ())))) ()))) ()))) ()))))) (do (shen.record-kl abs (cons defun (cons abs (cons (cons (protect V505) ()) (cons (cons if (cons (cons >= (cons (protect V505) (cons 0 ()))) (cons (protect V505) (cons (cons - (cons 0 (cons (protect V505) ()))) ())))) ()))))) (do (shen.record-kl series (cons defun (cons series (cons (cons (protect V507) (cons (protect V508) (cons (protect V509) (cons (protect V510) ())))) (cons (cons maths.series-h (cons (cons + (cons (protect V507) (cons 1 ()))) (cons (protect V509) (cons (protect V508) (cons (cons (protect V508) (cons (protect V507) ())) (cons (protect V510) ())))))) ()))))) (do (shen.record-kl maths.series-h (cons defun (cons maths.series-h (cons (cons (protect V515) (cons (protect V516) (cons (protect V517) (cons (protect V518) (cons (protect V519) ()))))) (cons (cons let (cons (protect W520) (cons (cons (cons (protect V519) (cons (cons (protect V517) (cons (protect V515) ())) ())) (cons (protect V518) ())) (cons (cons if (cons (cons <= (cons (cons abs (cons (cons - (cons (protect V518) (cons (protect W520) ()))) ())) (cons (protect V516) ()))) (cons (protect W520) (cons (cons maths.series-h (cons (cons + (cons (protect V515) (cons 1 ()))) (cons (protect V516) (cons (protect V517) (cons (protect W520) (cons (protect V519) ())))))) ())))) ())))) ()))))) (do (shen.record-kl product (cons defun (cons product (cons (cons (protect V528) (cons (protect V529) (cons (protect V530) ()))) (cons (cons series (cons (protect V528) (cons (protect V529) (cons (protect V530) (cons (cons lambda (cons (protect Z531) (cons (cons lambda (cons (protect Z532) (cons (cons * (cons (protect Z531) (cons (protect Z532) ()))) ()))) ()))) ()))))) ()))))) (do (shen.record-kl summation (cons defun (cons summation (cons (cons (protect V538) (cons (protect V539) (cons (protect V540) ()))) (cons (cons series (cons (protect V538) (cons (protect V539) (cons (protect V540) (cons (cons lambda (cons (protect Z541) (cons (cons lambda (cons (protect Z542) (cons (cons + (cons (protect Z541) (cons (protect Z542) ()))) ()))) ()))) ()))))) ()))))) (do (shen.record-kl odd? (cons defun (cons odd? (cons (cons (protect V546) ()) (cons (cons and (cons (cons integer? (cons (protect V546) ())) (cons (cons not (cons (cons integer? (cons (cons / (cons (protect V546) (cons 2 ()))) ())) ())) ()))) ()))))) (do (shen.record-kl even? (cons defun (cons even? (cons (cons (protect V548) ()) (cons (cons and (cons (cons integer? (cons (protect V548) ())) (cons (cons integer? (cons (cons / (cons (protect V548) (cons 2 ()))) ())) ()))) ()))))) (do (shen.record-kl maths.compute-sine (cons defun (cons maths.compute-sine (cons (cons (protect V550) (cons (protect V551) ())) (cons (cons let (cons (protect W552) (cons (cons + (cons (cons * (cons 2 (cons (protect V551) ()))) (cons 1 ()))) (cons (cons let (cons (protect W553) (cons (cons * (cons (cons power (cons -1 (cons (protect V551) ()))) (cons (cons power (cons (protect V550) (cons (protect W552) ()))) ()))) (cons (cons let (cons (protect W554) (cons (cons factorial (cons (protect W552) ())) (cons (cons / (cons (protect W553) (cons (protect W554) ()))) ())))) ())))) ())))) ()))))) (do (shen.record-kl maths.compute-cos (cons defun (cons maths.compute-cos (cons (cons (protect V557) (cons (protect V558) ())) (cons (cons let (cons (protect W559) (cons (cons * (cons 2 (cons (protect V558) ()))) (cons (cons let (cons (protect W560) (cons (cons * (cons (cons power (cons -1 (cons (protect V558) ()))) (cons (cons power (cons (protect V557) (cons (protect W559) ()))) ()))) (cons (cons let (cons (protect W561) (cons (cons factorial (cons (protect W559) ())) (cons (cons / (cons (protect W560) (cons (protect W561) ()))) ())))) ())))) ())))) ()))))) (do (shen.record-kl cos (cons defun (cons cos (cons (cons (protect V565) (cons (protect V566) ())) (cons (cons let (cons (protect W567) (cons (cons radians (cons (protect V565) ())) (cons (cons summation (cons 0 (cons (cons lambda (cons (protect Z568) (cons (cons maths.compute-cos (cons (protect W567) (cons (protect Z568) ()))) ()))) (cons (protect V566) ())))) ())))) ()))))) (do (shen.record-kl sin (cons defun (cons sin (cons (cons (protect V572) (cons (protect V573) ())) (cons (cons let (cons (protect W574) (cons (cons radians (cons (protect V572) ())) (cons (cons summation (cons 0 (cons (cons lambda (cons (protect Z575) (cons (cons maths.compute-sine (cons (protect W574) (cons (protect Z575) ()))) ()))) (cons (protect V573) ())))) ())))) ()))))) (do (shen.record-kl tan (cons defun (cons tan (cons (cons (protect V578) (cons (protect V579) ())) (cons (cons / (cons (cons sin (cons (protect V578) (cons (protect V579) ()))) (cons (cons cos (cons (protect V578) (cons (protect V579) ()))) ()))) ()))))) (do (shen.record-kl radians (cons defun (cons radians (cons (cons (protect V582) ()) (cons (cons * (cons (cons / (cons (protect V582) (cons 180 ()))) (cons (cons pi ()) ()))) ()))))) (do (shen.record-kl g (cons defun (cons g (cons () (cons 1.6180339887498 ()))))) (do (shen.record-kl pi (cons defun (cons pi (cons () (cons 3.1415926535897 ()))))) (do (shen.record-kl e (cons defun (cons e (cons () (cons 2.7182818284590002 ()))))) (do (shen.record-kl tan30 (cons defun (cons tan30 (cons () (cons 0.5773502691896 ()))))) (do (shen.record-kl cos30 (cons defun (cons cos30 (cons () (cons 0.8660254037844001 ()))))) (do (shen.record-kl cos45 (cons defun (cons cos45 (cons () (cons 0.70710678118651 ()))))) (do (shen.record-kl sin45 (cons defun (cons sin45 (cons () (cons 0.7071067811865 ()))))) (do (shen.record-kl sqrt2 (cons defun (cons sqrt2 (cons () (cons 1.4142135623731 ()))))) (do (shen.record-kl tan60 (cons defun (cons tan60 (cons () (cons 1.7320508075692 ()))))) (do (shen.record-kl maths.sin60 (cons defun (cons maths.sin60 (cons () (cons 0.8660254037844001 ()))))) (do (shen.record-kl sin120 (cons defun (cons sin120 (cons () (cons 0.8660254037844001 ()))))) (do (shen.record-kl tan120 (cons defun (cons tan120 (cons () (cons -1.7320508075692 ()))))) (do (shen.record-kl sin135 (cons defun (cons sin135 (cons () (cons 0.7071067811865 ()))))) (do (shen.record-kl cos135 (cons defun (cons cos135 (cons () (cons -0.7071067811865 ()))))) (do (shen.record-kl cos150 (cons defun (cons cos150 (cons () (cons -0.8660254037844001 ()))))) (do (shen.record-kl tan150 (cons defun (cons tan150 (cons () (cons -0.5773502691905 ()))))) (do (shen.record-kl cos210 (cons defun (cons cos210 (cons () (cons -0.8660254037844001 ()))))) (do (shen.record-kl tan210 (cons defun (cons tan210 (cons () (cons 0.5773502691905 ()))))) (do (shen.record-kl sin225 (cons defun (cons sin225 (cons () (cons -0.7071067811865 ()))))) (do (shen.record-kl cos225 (cons defun (cons cos225 (cons () (cons -0.7071067811865 ()))))) (do (shen.record-kl sin240 (cons defun (cons sin240 (cons () (cons -0.8660254037844001 ()))))) (do (shen.record-kl tan240 (cons defun (cons tan240 (cons () (cons 1.7320508075692 ()))))) (do (shen.record-kl sin300 (cons defun (cons sin300 (cons () (cons -0.8660254037844001 ()))))) (do (shen.record-kl tan300 (cons defun (cons tan300 (cons () (cons -1.7320508075692 ()))))) (do (shen.record-kl sin315 (cons defun (cons sin315 (cons () (cons -0.7071067811865 ()))))) (do (shen.record-kl cos315 (cons defun (cons cos315 (cons () (cons 0.7071067811865 ()))))) (do (shen.record-kl cos330 (cons defun (cons cos330 (cons () (cons 0.8660254037844001 ()))))) (do (shen.record-kl tan330 (cons defun (cons tan330 (cons () (cons -0.5773502691905 ()))))) (do (shen.record-kl coth (cons defun (cons coth (cons (cons (protect V584) (cons (protect V585) ())) (cons (cons let (cons (protect W586) (cons (cons e ()) (cons (cons let (cons (protect W587) (cons (cons expt (cons (protect W586) (cons (cons ~ (cons (cons * (cons 2 (cons (protect V584) ()))) ())) (cons (protect V585) ())))) (cons (cons / (cons (cons + (cons 1 (cons (protect W587) ()))) (cons (cons - (cons 1 (cons (protect W587) ()))) ()))) ())))) ())))) ()))))) (do (shen.record-kl sinh (cons defun (cons sinh (cons (cons (protect V590) (cons (protect V591) ())) (cons (cons let (cons (protect W592) (cons (cons e ()) (cons (cons let (cons (protect W593) (cons (cons expt (cons (protect W592) (cons (protect V590) (cons (protect V591) ())))) (cons (cons let (cons (protect W594) (cons (cons expt (cons (protect W592) (cons (cons ~ (cons (protect V590) ())) (cons (protect V591) ())))) (cons (cons let (cons (protect W595) (cons (cons - (cons (protect W593) (cons (protect W594) ()))) (cons (cons / (cons (protect W595) (cons 2 ()))) ())))) ())))) ())))) ())))) ()))))) (do (shen.record-kl cosh (cons defun (cons cosh (cons (cons (protect V598) (cons (protect V599) ())) (cons (cons let (cons (protect W600) (cons (cons e ()) (cons (cons let (cons (protect W601) (cons (cons expt (cons (protect W600) (cons (protect V598) (cons (protect V599) ())))) (cons (cons let (cons (protect W602) (cons (cons expt (cons (protect W600) (cons (cons ~ (cons (protect V598) ())) (cons (protect V599) ())))) (cons (cons let (cons (protect W603) (cons (cons + (cons (protect W601) (cons (protect W602) ()))) (cons (cons / (cons (protect W603) (cons 2 ()))) ())))) ())))) ())))) ())))) ()))))) (do (shen.record-kl tanh (cons defun (cons tanh (cons (cons (protect V606) (cons (protect V607) ())) (cons (cons / (cons (cons sinh (cons (protect V606) (cons (protect V607) ()))) (cons (cons cosh (cons (protect V606) (cons (protect V607) ()))) ()))) ()))))) (do (shen.record-kl sech (cons defun (cons sech (cons (cons (protect V610) (cons (protect V611) ())) (cons (cons / (cons 1 (cons (cons cosh (cons (protect V610) (cons (protect V611) ()))) ()))) ()))))) (do (shen.record-kl csch (cons defun (cons csch (cons (cons (protect V614) (cons (protect V615) ())) (cons (cons / (cons 1 (cons (cons sinh (cons (protect V614) (cons (protect V615) ()))) ()))) ()))))) (do (shen.record-kl power (cons defun (cons power (cons (cons (protect V620) (cons (protect V621) ())) (cons (cons cond (cons (cons (cons = (cons 0 (cons (protect V621) ()))) (cons 1 ())) (cons (cons true (cons (cons * (cons (protect V620) (cons (cons power (cons (protect V620) (cons (cons - (cons (protect V621) (cons 1 ()))) ()))) ()))) ())) ()))) ()))))) (do (shen.record-kl factorial (cons defun (cons factorial (cons (cons (protect V624) ()) (cons (cons cond (cons (cons (cons = (cons 0 (cons (protect V624) ()))) (cons 1 ())) (cons (cons true (cons (cons * (cons (protect V624) (cons (cons factorial (cons (cons - (cons (protect V624) (cons 1 ()))) ())) ()))) ())) ()))) ()))))) (do (shen.record-kl prime? (cons defun (cons prime? (cons (cons (protect V626) ()) (cons (cons cond (cons (cons (cons = (cons 2 (cons (protect V626) ()))) (cons true ())) (cons (cons (cons even? (cons (protect V626) ())) (cons false ())) (cons (cons true (cons (cons maths.prime-h (cons (protect V626) (cons (cons isqrt (cons (protect V626) ())) (cons 3 ())))) ())) ())))) ()))))) (do (shen.record-kl maths.prime-h (cons defun (cons maths.prime-h (cons (cons (protect V629) (cons (protect V630) (cons (protect V631) ()))) (cons (cons cond (cons (cons (cons > (cons (protect V631) (cons (protect V630) ()))) (cons true ())) (cons (cons (cons integer? (cons (cons / (cons (protect V629) (cons (protect V631) ()))) ())) (cons false ())) (cons (cons true (cons (cons maths.prime-h (cons (protect V629) (cons (protect V630) (cons (cons + (cons (protect V631) (cons 2 ()))) ())))) ())) ())))) ()))))) (do (shen.record-kl maths.sign (cons defun (cons maths.sign (cons (cons (protect V637) ()) (cons (cons cond (cons (cons (cons = (cons 0 (cons (protect V637) ()))) (cons 0 ())) (cons (cons (cons positive? (cons (protect V637) ())) (cons 1 ())) (cons (cons true (cons -1 ())) ())))) ()))))) (do (shen.record-kl log (cons defun (cons log (cons (cons (protect V639) (cons (protect V640) (cons (protect V641) ()))) (cons (cons / (cons (cons log10 (cons (protect V639) (cons (protect V641) ()))) (cons (cons log10 (cons (protect V640) (cons (protect V641) ()))) ()))) ()))))) (do (shen.record-kl loge (cons defun (cons loge (cons (cons (protect V645) (cons (protect V646) ())) (cons (cons log (cons (protect V645) (cons (cons e ()) (cons (protect V646) ())))) ()))))) (do (shen.record-kl log2 (cons defun (cons log2 (cons (cons (protect V649) (cons (protect V650) ())) (cons (cons log (cons (protect V649) (cons 2 (cons (protect V650) ())))) ()))))) (do (shen.record-kl log10 (cons defun (cons log10 (cons (cons (protect V653) (cons (protect V654) ())) (cons (cons if (cons (cons >= (cons (protect V653) (cons 1 ()))) (cons (cons maths.log10+ (cons (protect V653) (cons (protect V654) ()))) (cons (cons ~ (cons (cons maths.log10+ (cons (cons / (cons 1 (cons (protect V653) ()))) (cons (protect V654) ()))) ())) ())))) ()))))) (do (shen.record-kl maths.log10+ (cons defun (cons maths.log10+ (cons (cons (protect V657) (cons (protect V658) ())) (cons (cons cond (cons (cons (cons <= (cons (cons abs (cons (protect V657) ())) (cons (protect V658) ()))) (cons 0 ())) (cons (cons (cons >= (cons (protect V657) (cons 10 ()))) (cons (cons + (cons 1 (cons (cons maths.log10+ (cons (cons / (cons (protect V657) (cons 10 ()))) (cons (protect V658) ()))) ()))) ())) (cons (cons true (cons (cons * (cons 0.1 (cons (cons maths.log10+ (cons (cons power (cons (protect V657) (cons 10 ()))) (cons (cons * (cons 10 (cons (protect V658) ()))) ()))) ()))) ())) ())))) ()))))) (do (shen.record-kl r# (cons defun (cons r# (cons (cons (protect V667) (cons (protect V668) ())) (cons (cons cond (cons (cons (cons and (cons (cons integer? (cons (protect V667) ())) (cons (cons integer? (cons (protect V668) ())) ()))) (cons (cons let (cons (protect W669) (cons (cons absvector (cons 3 ())) (cons (cons let (cons (protect W670) (cons (cons address-> (cons (protect W669) (cons 0 (cons rational.print-rational ())))) (cons (cons let (cons (protect W671) (cons (cons address-> (cons (protect W669) (cons 1 (cons (protect V667) ())))) (cons (cons let (cons (protect W672) (cons (cons address-> (cons (protect W669) (cons 2 (cons (protect V668) ())))) (cons (protect W669) ())))) ())))) ())))) ())))) ())) (cons (cons true (cons (cons simple-error (cons (cons cn (cons "numerator " (cons (cons shen.app (cons (protect V667) (cons (cons cn (cons " and divisor " (cons (cons shen.app (cons (protect V668) (cons " must be integers -" (cons shen.s ())))) ()))) (cons shen.s ())))) ()))) ())) ())) ()))) ()))))) (do (shen.record-kl rational.print-rational (cons defun (cons rational.print-rational (cons (cons (protect V675) ()) (cons (cons shen.app (cons (cons <-address (cons (protect V675) (cons 1 ()))) (cons (cons cn (cons "/" (cons (cons shen.app (cons (cons <-address (cons (protect V675) (cons 2 ()))) (cons "" (cons shen.s ())))) ()))) (cons shen.s ())))) ()))))) (do (shen.record-kl rational? (cons defun (cons rational? (cons (cons (protect V677) ()) (cons (cons trap-error (cons (cons and (cons (cons absvector? (cons (protect V677) ())) (cons (cons and (cons (cons = (cons (cons <-address (cons (protect V677) (cons 0 ()))) (cons rational.print-rational ()))) (cons (cons and (cons (cons integer? (cons (cons <-address (cons (protect V677) (cons 1 ()))) ())) (cons (cons integer? (cons (cons <-address (cons (protect V677) (cons 2 ()))) ())) ()))) ()))) ()))) (cons (cons lambda (cons (protect Z678) (cons false ()))) ()))) ()))))) (do (shen.record-kl numerator (cons defun (cons numerator (cons (cons (protect V680) ()) (cons (cons <-address (cons (protect V680) (cons 1 ()))) ()))))) (do (shen.record-kl denominator (cons defun (cons denominator (cons (cons (protect V682) ()) (cons (cons <-address (cons (protect V682) (cons 2 ()))) ()))))) (do (shen.record-kl r-op1 (cons defun (cons r-op1 (cons (cons (protect V722) (cons (protect V723) ())) (cons (cons n->r (cons (cons (protect V722) (cons (cons r->n (cons (protect V723) ())) ())) ())) ()))))) (do (shen.record-kl r-op2 (cons defun (cons r-op2 (cons (cons (protect V726) (cons (protect V727) (cons (protect V728) ()))) (cons (cons n->r (cons (cons (cons (protect V726) (cons (cons r->n (cons (protect V727) ())) ())) (cons (cons r->n (cons (protect V728) ())) ())) ())) ()))))) (do (shen.record-kl r->n (cons defun (cons r->n (cons (cons (protect V732) ()) (cons (cons / (cons (cons numerator (cons (protect V732) ())) (cons (cons denominator (cons (protect V732) ())) ()))) ()))))) (do (shen.record-kl r->pair (cons defun (cons r->pair (cons (cons (protect V734) ()) (cons (cons @p (cons (cons numerator (cons (protect V734) ())) (cons (cons denominator (cons (protect V734) ())) ()))) ()))))) (do (shen.record-kl n->r (cons defun (cons n->r (cons (cons (protect V736) ()) (cons (cons let (cons (protect W737) (cons (cons maths.n->r (cons (protect V736) (cons 1 ()))) (cons (cons r# (cons (cons fst (cons (protect W737) ())) (cons (cons snd (cons (protect W737) ())) ()))) ())))) ()))))) (do (shen.record-kl r-reduce (cons defun (cons r-reduce (cons (cons (protect V739) ()) (cons (cons rational.r-reduce-help (cons (cons numerator (cons (protect V739) ())) (cons (cons denominator (cons (protect V739) ())) ()))) ()))))) (do (shen.record-kl rational.r-reduce-help (cons defun (cons rational.r-reduce-help (cons (cons (protect V741) (cons (protect V742) ())) (cons (cons let (cons (protect W743) (cons (cons lcd (cons (protect V741) (cons (protect V742) ()))) (cons (cons if (cons (cons = (cons (protect W743) (cons 1 ()))) (cons (cons r# (cons (protect V741) (cons (protect V742) ()))) (cons (cons rational.r-reduce-help (cons (cons / (cons (protect V741) (cons (protect W743) ()))) (cons (cons / (cons (protect V742) (cons (protect W743) ()))) ()))) ())))) ())))) ()))))) (do (shen.record-kl r= (cons defun (cons r= (cons (cons (protect V746) (cons (protect V747) ())) (cons (cons let (cons (protect W748) (cons (cons numerator (cons (protect V746) ())) (cons (cons let (cons (protect W749) (cons (cons denominator (cons (protect V746) ())) (cons (cons let (cons (protect W750) (cons (cons numerator (cons (protect V747) ())) (cons (cons let (cons (protect W751) (cons (cons denominator (cons (protect V747) ())) (cons (cons = (cons (cons * (cons (protect W748) (cons (protect W751) ()))) (cons (cons * (cons (protect W749) (cons (protect W750) ()))) ()))) ())))) ())))) ())))) ())))) ()))))) (do (shen.record-kl r< (cons defun (cons r< (cons (cons (protect V754) (cons (protect V755) ())) (cons (cons let (cons (protect W756) (cons (cons numerator (cons (protect V754) ())) (cons (cons let (cons (protect W757) (cons (cons denominator (cons (protect V754) ())) (cons (cons let (cons (protect W758) (cons (cons numerator (cons (protect V755) ())) (cons (cons let (cons (protect W759) (cons (cons denominator (cons (protect V755) ())) (cons (cons < (cons (cons * (cons (protect W756) (cons (protect W759) ()))) (cons (cons * (cons (protect W757) (cons (protect W758) ()))) ()))) ())))) ())))) ())))) ())))) ()))))) (do (shen.record-kl r> (cons defun (cons r> (cons (cons (protect V762) (cons (protect V763) ())) (cons (cons not (cons (cons or (cons (cons r= (cons (protect V762) (cons (protect V763) ()))) (cons (cons r< (cons (protect V762) (cons (protect V763) ()))) ()))) ())) ()))))) (do (shen.record-kl r>= (cons defun (cons r>= (cons (cons (protect V766) (cons (protect V767) ())) (cons (cons or (cons (cons r= (cons (protect V766) (cons (protect V767) ()))) (cons (cons r> (cons (protect V766) (cons (protect V767) ()))) ()))) ()))))) (do (shen.record-kl r<= (cons defun (cons r<= (cons (cons (protect V770) (cons (protect V771) ())) (cons (cons or (cons (cons r= (cons (protect V770) (cons (protect V771) ()))) (cons (cons r< (cons (protect V770) (cons (protect V771) ()))) ()))) ()))))) (do (shen.record-kl r+ (cons defun (cons r+ (cons (cons (protect V774) (cons (protect V775) ())) (cons (cons let (cons (protect W776) (cons (cons numerator (cons (protect V774) ())) (cons (cons let (cons (protect W777) (cons (cons denominator (cons (protect V774) ())) (cons (cons let (cons (protect W778) (cons (cons numerator (cons (protect V775) ())) (cons (cons let (cons (protect W779) (cons (cons denominator (cons (protect V775) ())) (cons (cons r# (cons (cons + (cons (cons * (cons (protect W776) (cons (protect W779) ()))) (cons (cons * (cons (protect W777) (cons (protect W778) ()))) ()))) (cons (cons * (cons (protect W777) (cons (protect W779) ()))) ()))) ())))) ())))) ())))) ())))) ()))))) (do (shen.record-kl r- (cons defun (cons r- (cons (cons (protect V782) (cons (protect V783) ())) (cons (cons let (cons (protect W784) (cons (cons numerator (cons (protect V782) ())) (cons (cons let (cons (protect W785) (cons (cons denominator (cons (protect V782) ())) (cons (cons let (cons (protect W786) (cons (cons numerator (cons (protect V783) ())) (cons (cons let (cons (protect W787) (cons (cons denominator (cons (protect V783) ())) (cons (cons r# (cons (cons - (cons (cons * (cons (protect W784) (cons (protect W787) ()))) (cons (cons * (cons (protect W785) (cons (protect W786) ()))) ()))) (cons (cons * (cons (protect W785) (cons (protect W787) ()))) ()))) ())))) ())))) ())))) ())))) ()))))) (do (shen.record-kl r* (cons defun (cons r* (cons (cons (protect V790) (cons (protect V791) ())) (cons (cons let (cons (protect W792) (cons (cons numerator (cons (protect V790) ())) (cons (cons let (cons (protect W793) (cons (cons denominator (cons (protect V790) ())) (cons (cons let (cons (protect W794) (cons (cons numerator (cons (protect V791) ())) (cons (cons let (cons (protect W795) (cons (cons denominator (cons (protect V791) ())) (cons (cons r# (cons (cons * (cons (protect W792) (cons (protect W794) ()))) (cons (cons * (cons (protect W793) (cons (protect W795) ()))) ()))) ())))) ())))) ())))) ())))) ()))))) (do (shen.record-kl +-inverse (cons defun (cons +-inverse (cons (cons (protect V798) ()) (cons (cons let (cons (protect W799) (cons (cons numerator (cons (protect V798) ())) (cons (cons let (cons (protect W800) (cons (cons denominator (cons (protect V798) ())) (cons (cons r# (cons (cons ~ (cons (protect W799) ())) (cons (protect W800) ()))) ())))) ())))) ()))))) (do (shen.record-kl *-inverse (cons defun (cons *-inverse (cons (cons (protect V802) ()) (cons (cons let (cons (protect W803) (cons (cons numerator (cons (protect V802) ())) (cons (cons let (cons (protect W804) (cons (cons denominator (cons (protect V802) ())) (cons (cons r# (cons (protect W804) (cons (protect W803) ()))) ())))) ())))) ()))))) (do (shen.record-kl r/ (cons defun (cons r/ (cons (cons (protect V806) (cons (protect V807) ())) (cons (cons r* (cons (protect V806) (cons (cons *-inverse (cons (protect V807) ())) ()))) ()))))) (do (shen.record-kl r-expt (cons defun (cons r-expt (cons (cons (protect V812) (cons (protect V813) ())) (cons (cons cond (cons (cons (cons natural? (cons (protect V813) ())) (cons (cons let (cons (protect W814) (cons (cons numerator (cons (protect V812) ())) (cons (cons let (cons (protect W815) (cons (cons denominator (cons (protect V812) ())) (cons (cons r# (cons (cons power (cons (protect W814) (cons (protect V813) ()))) (cons (cons power (cons (protect W815) (cons (protect V813) ()))) ()))) ())))) ())))) ())) (cons (cons (cons and (cons (cons integer? (cons (protect V813) ())) (cons (cons negative? (cons (protect V813) ())) ()))) (cons (cons let (cons (protect W816) (cons (cons numerator (cons (protect V812) ())) (cons (cons let (cons (protect W817) (cons (cons denominator (cons (protect V812) ())) (cons (cons r# (cons (cons power (cons (protect W817) (cons (cons ~ (cons (protect V813) ())) ()))) (cons (cons power (cons (protect W816) (cons (cons ~ (cons (protect V813) ())) ()))) ()))) ())))) ())))) ())) (cons (cons true (cons (cons simple-error (cons (cons cn (cons "cannot exponentiate a rational by a non-integer " (cons (cons shen.app (cons (protect V813) (cons " -" (cons shen.a ())))) ()))) ())) ())) ())))) ()))))) (do (shen.record-kl r-approx (cons defun (cons r-approx (cons (cons (protect V820) (cons (protect V821) ())) (cons (cons rational.approx-r-h (cons (cons r->n (cons (protect V820) ())) (cons (protect V821) (cons 0 ())))) ()))))) (do (shen.record-kl rational.approx-r-h (cons defun (cons rational.approx-r-h (cons (cons (protect V824) (cons (protect V825) (cons (protect V826) ()))) (cons (cons cond (cons (cons (cons > (cons (cons / (cons (protect V826) (cons (protect V825) ()))) (cons (protect V824) ()))) (cons (cons r# (cons (protect V826) (cons (protect V825) ()))) ())) (cons (cons true (cons (cons rational.approx-r-h (cons (protect V824) (cons (protect V825) (cons (cons + (cons (protect V826) (cons 1 ()))) ())))) ())) ()))) ()))))) (do (shen.record-kl c# (cons defun (cons c# (cons (cons (protect V836) (cons (protect V837) ())) (cons (cons cond (cons (cons (cons and (cons (cons number? (cons (protect V836) ())) (cons (cons number? (cons (protect V837) ())) ()))) (cons (cons let (cons (protect W838) (cons (cons absvector (cons 3 ())) (cons (cons let (cons (protect W839) (cons (cons address-> (cons (protect W838) (cons 0 (cons complex.print-complex ())))) (cons (cons let (cons (protect W840) (cons (cons address-> (cons (protect W838) (cons 1 (cons (protect V836) ())))) (cons (cons let (cons (protect W841) (cons (cons address-> (cons (protect W838) (cons 2 (cons (protect V837) ())))) (cons (protect W838) ())))) ())))) ())))) ())))) ())) (cons (cons true (cons (cons simple-error (cons (cons cn (cons "real " (cons (cons shen.app (cons (protect V836) (cons (cons cn (cons " and imaginary " (cons (cons shen.app (cons (protect V837) (cons " must be numbers -" (cons shen.a ())))) ()))) (cons shen.a ())))) ()))) ())) ())) ()))) ()))))) (do (shen.record-kl complex.print-complex (cons defun (cons complex.print-complex (cons (cons (protect V844) ()) (cons (cons shen.insert (cons (cons <-address (cons (protect V844) (cons 2 ()))) (cons (cons shen.insert (cons (cons <-address (cons (protect V844) (cons 1 ()))) (cons (cons shen.proc-nl (cons (cons cn (cons "(c" (cons "# ~A ~A)" ()))) ())) ()))) ()))) ()))))) (do (shen.record-kl complex? (cons defun (cons complex? (cons (cons (protect V846) ()) (cons (cons trap-error (cons (cons and (cons (cons absvector? (cons (protect V846) ())) (cons (cons and (cons (cons = (cons (cons <-address (cons (protect V846) (cons 0 ()))) (cons complex.print-complex ()))) (cons (cons and (cons (cons number? (cons (cons <-address (cons (protect V846) (cons 1 ()))) ())) (cons (cons number? (cons (cons <-address (cons (protect V846) (cons 2 ()))) ())) ()))) ()))) ()))) (cons (cons lambda (cons (protect Z847) (cons false ()))) ()))) ()))))) (do (shen.record-kl real (cons defun (cons real (cons (cons (protect V849) ()) (cons (cons <-address (cons (protect V849) (cons 1 ()))) ()))))) (do (shen.record-kl imaginary (cons defun (cons imaginary (cons (cons (protect V851) ()) (cons (cons <-address (cons (protect V851) (cons 2 ()))) ()))))) (do (shen.record-kl c+ (cons defun (cons c+ (cons (cons (protect V861) (cons (protect V862) ())) (cons (cons let (cons (protect W863) (cons (cons real (cons (protect V861) ())) (cons (cons let (cons (protect W864) (cons (cons imaginary (cons (protect V861) ())) (cons (cons let (cons (protect W865) (cons (cons real (cons (protect V862) ())) (cons (cons let (cons (protect W866) (cons (cons imaginary (cons (protect V862) ())) (cons (cons c# (cons (cons + (cons (protect W863) (cons (protect W865) ()))) (cons (cons + (cons (protect W864) (cons (protect W866) ()))) ()))) ())))) ())))) ())))) ())))) ()))))) (do (shen.record-kl c- (cons defun (cons c- (cons (cons (protect V869) (cons (protect V870) ())) (cons (cons let (cons (protect W871) (cons (cons real (cons (protect V869) ())) (cons (cons let (cons (protect W872) (cons (cons imaginary (cons (protect V869) ())) (cons (cons let (cons (protect W873) (cons (cons real (cons (protect V870) ())) (cons (cons let (cons (protect W874) (cons (cons imaginary (cons (protect V870) ())) (cons (cons c# (cons (cons - (cons (protect W871) (cons (protect W873) ()))) (cons (cons - (cons (protect W872) (cons (protect W874) ()))) ()))) ())))) ())))) ())))) ())))) ()))))) (do (shen.record-kl c* (cons defun (cons c* (cons (cons (protect V877) (cons (protect V878) ())) (cons (cons let (cons (protect W879) (cons (cons real (cons (protect V877) ())) (cons (cons let (cons (protect W880) (cons (cons imaginary (cons (protect V877) ())) (cons (cons let (cons (protect W881) (cons (cons real (cons (protect V878) ())) (cons (cons let (cons (protect W882) (cons (cons imaginary (cons (protect V878) ())) (cons (cons c# (cons (cons - (cons (cons * (cons (protect W879) (cons (protect W881) ()))) (cons (cons * (cons (protect W880) (cons (protect W882) ()))) ()))) (cons (cons + (cons (cons * (cons (protect W880) (cons (protect W881) ()))) (cons (cons * (cons (protect W879) (cons (protect W882) ()))) ()))) ()))) ())))) ())))) ())))) ())))) ()))))) (do (shen.record-kl c/ (cons defun (cons c/ (cons (cons (protect V885) (cons (protect V886) ())) (cons (cons let (cons (protect W887) (cons (cons real (cons (protect V885) ())) (cons (cons let (cons (protect W888) (cons (cons imaginary (cons (protect V885) ())) (cons (cons let (cons (protect W889) (cons (cons real (cons (protect V886) ())) (cons (cons let (cons (protect W890) (cons (cons imaginary (cons (protect V886) ())) (cons (cons c# (cons (cons / (cons (cons + (cons (cons * (cons (protect W887) (cons (protect W889) ()))) (cons (cons * (cons (protect W888) (cons (protect W890) ()))) ()))) (cons (cons + (cons (cons * (cons (protect W889) (cons (protect W889) ()))) (cons (cons * (cons (protect W890) (cons (protect W890) ()))) ()))) ()))) (cons (cons / (cons (cons - (cons (cons * (cons (protect W888) (cons (protect W889) ()))) (cons (cons * (cons (protect W887) (cons (protect W890) ()))) ()))) (cons (cons + (cons (cons * (cons (protect W889) (cons (protect W889) ()))) (cons (cons * (cons (protect W890) (cons (protect W890) ()))) ()))) ()))) ()))) ())))) ())))) ())))) ())))) ()))))) (do (shen.record-kl n# (cons defun (cons n# (cons (cons (protect V903) (cons (protect V904) ())) (cons (cons cond (cons (cons (cons and (cons (cons natural? (cons (protect V903) ())) (cons (cons and (cons (cons natural? (cons (protect V904) ())) (cons (cons > (cons (protect V904) (cons 0 ()))) ()))) ()))) (cons (cons let (cons (protect W905) (cons (cons absvector (cons 4 ())) (cons (cons let (cons (protect W906) (cons (cons address-> (cons (protect W905) (cons 0 (cons numerals.print-numeral ())))) (cons (cons let (cons (protect W907) (cons (cons address-> (cons (protect W905) (cons 1 (cons (cons (cons (cons fn (cons numerals.n->numeral ())) (cons (protect V903) ())) (cons (protect V904) ())) ())))) (cons (cons let (cons (protect W908) (cons (cons address-> (cons (protect W905) (cons 2 (cons (protect V904) ())))) (cons (cons let (cons (protect W909) (cons (cons address-> (cons (protect W905) (cons 3 (cons (protect V903) ())))) (cons (protect W905) ())))) ())))) ())))) ())))) ())))) ())) (cons (cons true (cons (cons simple-error (cons (cons cn (cons "N = " (cons (cons shen.app (cons (protect V903) (cons (cons cn (cons ", Radix = " (cons (cons shen.app (cons (protect V904) (cons "; N and Radix must be natural numbers where Radix > 0 -" (cons shen.a ())))) ()))) (cons shen.a ())))) ()))) ())) ())) ()))) ()))))) (do (shen.record-kl radix (cons defun (cons radix (cons (cons (protect V912) ()) (cons (cons <-address (cons (protect V912) (cons 2 ()))) ()))))) (do (shen.record-kl numerals.numerals (cons defun (cons numerals.numerals (cons (cons (protect V914) ()) (cons (cons <-address (cons (protect V914) (cons 1 ()))) ()))))) (do (shen.record-kl n#->n (cons defun (cons n#->n (cons (cons (protect V916) ()) (cons (cons <-address (cons (protect V916) (cons 3 ()))) ()))))) (do (shen.record-kl n#->ns (cons defun (cons n#->ns (cons (cons (protect V918) ()) (cons (cons <-address (cons (protect V918) (cons 1 ()))) ()))))) (do (shen.record-kl numerals.print-numeral (cons defun (cons numerals.print-numeral (cons (cons (protect V920) ()) (cons (cons let (cons (protect W921) (cons (cons radix (cons (protect V920) ())) (cons (cons let (cons (protect W922) (cons (cons numerals.numerals (cons (protect V920) ())) (cons (cons @s (cons (cons numerals.numeric->string (cons (protect W922) (cons (protect W921) ()))) (cons (cons @s (cons "#" (cons (cons str (cons (protect W921) ())) ()))) ()))) ())))) ())))) ()))))) (do (shen.record-kl numerals.numeric->string (cons defun (cons numerals.numeric->string (cons (cons (protect V926) (cons (protect V927) ())) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V926) ()))) (cons "" ())) (cons (cons (cons cons? (cons (protect V926) ())) (cons (cons let (cons (protect W928) (cons (cons if (cons (cons < (cons (cons hd (cons (protect V926) ())) (cons 10 ()))) (cons (cons str (cons (cons hd (cons (protect V926) ())) ())) (cons (cons if (cons (cons > (cons (protect V927) (cons 36 ()))) (cons (cons cn (cons (cons str (cons (cons hd (cons (protect V926) ())) ())) (cons " " ()))) (cons (cons n->string (cons (cons + (cons (cons hd (cons (protect V926) ())) (cons 55 ()))) ())) ())))) ())))) (cons (cons cn (cons (protect W928) (cons (cons numerals.numeric->string (cons (cons tl (cons (protect V926) ())) (cons (protect V927) ()))) ()))) ())))) ())) (cons (cons true (cons (cons shen.f-error (cons numerals.numeric->string ())) ())) ())))) ()))))) (do (shen.record-kl numeral? (cons defun (cons numeral? (cons (cons (protect V931) ()) (cons (cons and (cons (cons absvector? (cons (protect V931) ())) (cons (cons = (cons numerals.print-numeral (cons (cons <-address (cons (protect V931) (cons 0 ()))) ()))) ()))) ()))))) (do (shen.record-kl numerals.numeral-macro (cons defun (cons numerals.numeral-macro (cons (cons (protect V969) ()) (cons (cons cond (cons (cons (cons and (cons (cons cons? (cons (protect V969) ())) (cons (cons and (cons (cons = (cons n-op2 (cons (cons hd (cons (protect V969) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V969) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V969) ())) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V969) ())) ())) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V969) ())) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) ()))) (cons (cons cons (cons n-op2 (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V969) ())) ())) (cons (cons cons (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V969) ())) ())) ())) (cons (cons cons (cons (cons hd (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V969) ())) ())) ())) ())) (cons (cons cons (cons (cons cons (cons radix (cons (cons cons (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V969) ())) ())) ())) (cons () ()))) ()))) (cons () ()))) ()))) ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V969) ())) (cons (cons and (cons (cons = (cons n-op1 (cons (cons hd (cons (protect V969) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V969) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V969) ())) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V969) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) (cons (cons cons (cons n-op1 (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V969) ())) ())) (cons (cons cons (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V969) ())) ())) ())) (cons (cons cons (cons (cons cons (cons radix (cons (cons tl (cons (cons tl (cons (protect V969) ())) ())) ()))) (cons () ()))) ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V969) ())) (cons (cons and (cons (cons = (cons n+ (cons (cons hd (cons (protect V969) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V969) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V969) ())) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V969) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) (cons (cons cons (cons n+ (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V969) ())) ())) (cons (cons cons (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V969) ())) ())) ())) (cons (cons cons (cons (cons cons (cons radix (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V969) ())) ())) (cons () ()))) ()))) (cons () ()))) ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V969) ())) (cons (cons and (cons (cons = (cons n- (cons (cons hd (cons (protect V969) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V969) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V969) ())) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V969) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) (cons (cons cons (cons n- (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V969) ())) ())) (cons (cons cons (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V969) ())) ())) ())) (cons (cons cons (cons (cons cons (cons radix (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V969) ())) ())) (cons () ()))) ()))) (cons () ()))) ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V969) ())) (cons (cons and (cons (cons = (cons n* (cons (cons hd (cons (protect V969) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V969) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V969) ())) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V969) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) (cons (cons cons (cons n* (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V969) ())) ())) (cons (cons cons (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V969) ())) ())) ())) (cons (cons cons (cons (cons cons (cons radix (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V969) ())) ())) (cons () ()))) ()))) (cons () ()))) ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V969) ())) (cons (cons and (cons (cons = (cons n/ (cons (cons hd (cons (protect V969) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V969) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V969) ())) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V969) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) (cons (cons cons (cons n/ (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V969) ())) ())) (cons (cons cons (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V969) ())) ())) ())) (cons (cons cons (cons (cons cons (cons radix (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V969) ())) ())) (cons () ()))) ()))) (cons () ()))) ()))) ()))) ()))) ())) (cons (cons true (cons (protect V969) ())) ())))))))) ()))))) (do (shen.record-kl n-op2 (cons defun (cons n-op2 (cons (cons (protect V971) (cons (protect V972) (cons (protect V973) (cons (protect V974) ())))) (cons (cons n# (cons (cons (cons (protect V971) (cons (cons n#->n (cons (protect V972) ())) ())) (cons (cons n#->n (cons (protect V973) ())) ())) (cons (protect V974) ()))) ()))))) (do (shen.record-kl n-op1 (cons defun (cons n-op1 (cons (cons (protect V979) (cons (protect V980) (cons (protect V981) ()))) (cons (cons n# (cons (cons (protect V979) (cons (cons n#->n (cons (protect V980) ())) ())) (cons (protect V981) ()))) ()))))) (do (shen.record-kl n+ (cons defun (cons n+ (cons (cons (protect V987) (cons (protect V988) (cons (protect V989) ()))) (cons (cons n-op2 (cons (cons lambda (cons (protect Z990) (cons (cons lambda (cons (protect Z991) (cons (cons + (cons (protect Z990) (cons (protect Z991) ()))) ()))) ()))) (cons (protect V987) (cons (protect V988) (cons (protect V989) ()))))) ()))))) (do (shen.record-kl n* (cons defun (cons n* (cons (cons (protect V997) (cons (protect V998) (cons (protect V999) ()))) (cons (cons n-op2 (cons (cons lambda (cons (protect Z1000) (cons (cons lambda (cons (protect Z1001) (cons (cons * (cons (protect Z1000) (cons (protect Z1001) ()))) ()))) ()))) (cons (protect V997) (cons (protect V998) (cons (protect V999) ()))))) ()))))) (do (shen.record-kl n- (cons defun (cons n- (cons (cons (protect V1007) (cons (protect V1008) (cons (protect V1009) ()))) (cons (cons n-op2 (cons (cons lambda (cons (protect Z1010) (cons (cons lambda (cons (protect Z1011) (cons (cons - (cons (protect Z1010) (cons (protect Z1011) ()))) ()))) ()))) (cons (protect V1007) (cons (protect V1008) (cons (protect V1009) ()))))) ()))))) (do (shen.record-kl n/ (cons defun (cons n/ (cons (cons (protect V1017) (cons (protect V1018) (cons (protect V1019) ()))) (cons (cons n-op2 (cons (cons lambda (cons (protect Z1020) (cons (cons lambda (cons (protect Z1021) (cons (cons / (cons (protect Z1020) (cons (protect Z1021) ()))) ()))) ()))) (cons (protect V1017) (cons (protect V1018) (cons (protect V1019) ()))))) ()))))) (do (shen.record-kl binary (cons defun (cons binary (cons (cons (protect V1025) ()) (cons (cons n# (cons (protect V1025) (cons 2 ()))) ()))))) (do (shen.record-kl hex (cons defun (cons hex (cons (cons (protect V1027) ()) (cons (cons n# (cons (protect V1027) (cons 16 ()))) ()))))) (do (shen.record-kl octal (cons defun (cons octal (cons (cons (protect V1029) ()) (cons (cons n# (cons (protect V1029) (cons 8 ()))) ()))))) (do (shen.record-kl duodecimal (cons defun (cons duodecimal (cons (cons (protect V1031) ()) (cons (cons n# (cons (protect V1031) (cons 12 ()))) ()))))) (do (shen.record-kl numerals.n->numeral (cons defun (cons numerals.n->numeral (cons (cons (protect V1033) (cons (protect V1034) ())) (cons (cons cond (cons (cons (cons > (cons (protect V1034) (cons (protect V1033) ()))) (cons (cons cons (cons (protect V1033) (cons () ()))) ())) (cons (cons true (cons (cons let (cons (protect W1035) (cons (cons numerals.largest-expt (cons (protect V1033) (cons (protect V1034) (cons 0 ())))) (cons (cons let (cons (protect W1036) (cons (cons power (cons (protect V1034) (cons (protect W1035) ()))) (cons (cons let (cons (protect W1037) (cons (cons div (cons (protect V1033) (cons (protect W1036) ()))) (cons (cons let (cons (protect W1038) (cons (cons cons (cons (protect W1037) (cons (cons numerals.n-zeros (cons (protect W1035) ())) ()))) (cons (cons let (cons (protect W1039) (cons (cons - (cons (protect V1033) (cons (cons * (cons (protect W1037) (cons (protect W1036) ()))) ()))) (cons (cons numerals.add (cons (protect W1038) (cons (cons numerals.n->numeral (cons (protect W1039) (cons (protect V1034) ()))) (cons (protect V1034) ())))) ())))) ())))) ())))) ())))) ())))) ())) ()))) ()))))) (do (shen.record-kl numerals.largest-expt (cons defun (cons numerals.largest-expt (cons (cons (protect V1042) (cons (protect V1043) (cons (protect V1044) ()))) (cons (cons cond (cons (cons (cons > (cons (cons power (cons (protect V1043) (cons (protect V1044) ()))) (cons (protect V1042) ()))) (cons (cons - (cons (protect V1044) (cons 1 ()))) ())) (cons (cons true (cons (cons numerals.largest-expt (cons (protect V1042) (cons (protect V1043) (cons (cons + (cons (protect V1044) (cons 1 ()))) ())))) ())) ()))) ()))))) (do (shen.record-kl numerals.n-zeros (cons defun (cons numerals.n-zeros (cons (cons (protect V1048) ()) (cons (cons cond (cons (cons (cons = (cons 0 (cons (protect V1048) ()))) (cons () ())) (cons (cons true (cons (cons cons (cons 0 (cons (cons numerals.n-zeros (cons (cons - (cons (protect V1048) (cons 1 ()))) ())) ()))) ())) ()))) ()))))) (do (shen.record-kl numerals.add (cons defun (cons numerals.add (cons (cons (protect V1050) (cons (protect V1051) (cons (protect V1052) ()))) (cons (cons reverse (cons (cons numerals.add-h (cons (cons reverse (cons (protect V1050) ())) (cons (cons reverse (cons (protect V1051) ())) (cons (protect V1052) (cons 0 ()))))) ())) ()))))) (do (shen.record-kl numerals.add-h (cons defun (cons numerals.add-h (cons (cons (protect V1060) (cons (protect V1061) (cons (protect V1062) (cons (protect V1063) ())))) (cons (cons cond (cons (cons (cons and (cons (cons = (cons () (cons (protect V1060) ()))) (cons (cons and (cons (cons = (cons () (cons (protect V1061) ()))) (cons (cons = (cons 0 (cons (protect V1063) ()))) ()))) ()))) (cons () ())) (cons (cons (cons and (cons (cons = (cons () (cons (protect V1060) ()))) (cons (cons = (cons () (cons (protect V1061) ()))) ()))) (cons (cons cons (cons (protect V1063) (cons () ()))) ())) (cons (cons (cons = (cons () (cons (protect V1060) ()))) (cons (cons numerals.add-h (cons (cons cons (cons 0 (cons () ()))) (cons (protect V1061) (cons (protect V1062) (cons (protect V1063) ()))))) ())) (cons (cons (cons = (cons () (cons (protect V1061) ()))) (cons (cons numerals.add-h (cons (protect V1060) (cons (cons cons (cons 0 (cons () ()))) (cons (protect V1062) (cons (protect V1063) ()))))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V1060) ())) (cons (cons cons? (cons (protect V1061) ())) ()))) (cons (cons let (cons (protect W1064) (cons (cons + (cons (cons hd (cons (protect V1060) ())) (cons (cons + (cons (cons hd (cons (protect V1061) ())) (cons (protect V1063) ()))) ()))) (cons (cons if (cons (cons < (cons (protect W1064) (cons (protect V1062) ()))) (cons (cons cons (cons (protect W1064) (cons (cons numerals.add-h (cons (cons tl (cons (protect V1060) ())) (cons (cons tl (cons (protect V1061) ())) (cons (protect V1062) (cons 0 ()))))) ()))) (cons (cons cons (cons (cons - (cons (protect V1062) (cons (protect W1064) ()))) (cons (cons numerals.add-h (cons (cons tl (cons (protect V1060) ())) (cons (cons tl (cons (protect V1061) ())) (cons (protect V1062) (cons 1 ()))))) ()))) ())))) ())))) ())) (cons (cons true (cons (cons shen.f-error (cons numerals.add-h ())) ())) ()))))))) ()))))) (do (shen.record-kl assoc-if (cons defun (cons assoc-if (cons (cons (protect V1175) (cons (protect V1176) ())) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V1176) ()))) (cons () ())) (cons (cons (cons and (cons (cons cons? (cons (protect V1176) ())) (cons (cons and (cons (cons cons? (cons (cons hd (cons (protect V1176) ())) ())) (cons (cons (protect V1175) (cons (cons hd (cons (cons hd (cons (protect V1176) ())) ())) ())) ()))) ()))) (cons (cons hd (cons (protect V1176) ())) ())) (cons (cons (cons cons? (cons (protect V1176) ())) (cons (cons assoc-if (cons (protect V1175) (cons (cons tl (cons (protect V1176) ())) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons assoc-if ())) ())) ()))))) ()))))) (do (shen.record-kl assoc-if-not (cons defun (cons assoc-if-not (cons (cons (protect V1184) (cons (protect V1185) ())) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V1185) ()))) (cons () ())) (cons (cons (cons and (cons (cons cons? (cons (protect V1185) ())) (cons (cons and (cons (cons cons? (cons (cons hd (cons (protect V1185) ())) ())) (cons (cons not (cons (cons (protect V1184) (cons (cons hd (cons (cons hd (cons (protect V1185) ())) ())) ())) ())) ()))) ()))) (cons (cons hd (cons (protect V1185) ())) ())) (cons (cons (cons cons? (cons (protect V1185) ())) (cons (cons assoc-if (cons (protect V1184) (cons (cons tl (cons (protect V1185) ())) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons assoc-if-not ())) ())) ()))))) ()))))) (do (shen.record-kl drop (cons defun (cons drop (cons (cons (protect V1190) (cons (protect V1191) ())) (cons (cons cond (cons (cons (cons = (cons 0 (cons (protect V1190) ()))) (cons (protect V1191) ())) (cons (cons (cons cons? (cons (protect V1191) ())) (cons (cons drop (cons (cons - (cons (protect V1190) (cons 1 ()))) (cons (cons tl (cons (protect V1191) ())) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons drop ())) ())) ())))) ()))))) (do (shen.record-kl drop-last (cons defun (cons drop-last (cons (cons (protect V1194) (cons (protect V1195) ())) (cons (cons reverse (cons (cons drop (cons (protect V1194) (cons (cons reverse (cons (protect V1195) ())) ()))) ())) ()))))) (do (shen.record-kl index (cons defun (cons index (cons (cons (protect V1198) (cons (protect V1199) ())) (cons (cons list.index-h (cons (protect V1198) (cons (protect V1199) (cons 1 ())))) ()))))) (do (shen.record-kl list.index-h (cons defun (cons list.index-h (cons (cons (protect V1211) (cons (protect V1212) (cons (protect V1213) ()))) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V1212) ()))) (cons -1 ())) (cons (cons (cons and (cons (cons cons? (cons (protect V1212) ())) (cons (cons = (cons (protect V1211) (cons (cons hd (cons (protect V1212) ())) ()))) ()))) (cons (protect V1213) ())) (cons (cons (cons cons? (cons (protect V1212) ())) (cons (cons list.index-h (cons (protect V1211) (cons (cons tl (cons (protect V1212) ())) (cons (cons + (cons (protect V1213) (cons 1 ()))) ())))) ())) (cons (cons true (cons (cons shen.f-error (cons list.index-h ())) ())) ()))))) ()))))) (do (shen.record-kl index-last (cons defun (cons index-last (cons (cons (protect V1217) (cons (protect V1218) ())) (cons (cons let (cons (protect W1219) (cons (cons length (cons (protect V1218) ())) (cons (cons let (cons (protect W1220) (cons (cons index (cons (protect V1217) (cons (cons reverse (cons (protect V1218) ())) ()))) (cons (cons if (cons (cons = (cons (protect W1220) (cons -1 ()))) (cons (protect W1220) (cons (cons + (cons (cons - (cons (protect W1219) (cons (protect W1220) ()))) (cons 1 ()))) ())))) ())))) ())))) ()))))) (do (shen.record-kl insert (cons defun (cons insert (cons (cons (protect V1225) (cons (protect V1226) (cons (protect V1227) ()))) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V1227) ()))) (cons (cons simple-error (cons (cons cn (cons "cannot insert " (cons (cons shen.app (cons (protect V1226) (cons " into list: index out of range -" (cons shen.s ())))) ()))) ())) ())) (cons (cons (cons = (cons 1 (cons (protect V1225) ()))) (cons (cons cons (cons (protect V1226) (cons (protect V1227) ()))) ())) (cons (cons (cons cons? (cons (protect V1227) ())) (cons (cons cons (cons (cons hd (cons (protect V1227) ())) (cons (cons insert (cons (cons - (cons (protect V1225) (cons 1 ()))) (cons (protect V1226) (cons (cons tl (cons (protect V1227) ())) ())))) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons insert ())) ())) ()))))) ()))))) (do (shen.record-kl remove-duplicates (cons defun (cons remove-duplicates (cons (cons (protect V1231) ()) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V1231) ()))) (cons () ())) (cons (cons (cons and (cons (cons cons? (cons (protect V1231) ())) (cons (cons element? (cons (cons hd (cons (protect V1231) ())) (cons (cons tl (cons (protect V1231) ())) ()))) ()))) (cons (cons remove-duplicates (cons (cons tl (cons (protect V1231) ())) ())) ())) (cons (cons (cons cons? (cons (protect V1231) ())) (cons (cons cons (cons (cons hd (cons (protect V1231) ())) (cons (cons remove-duplicates (cons (cons tl (cons (protect V1231) ())) ())) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons remove-duplicates ())) ())) ()))))) ()))))) (do (shen.record-kl trim-left-if (cons defun (cons trim-left-if (cons (cons (protect V1237) (cons (protect V1238) ())) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V1238) ()))) (cons () ())) (cons (cons (cons and (cons (cons cons? (cons (protect V1238) ())) (cons (cons (protect V1237) (cons (cons hd (cons (protect V1238) ())) ())) ()))) (cons (cons trim-left-if (cons (protect V1237) (cons (cons tl (cons (protect V1238) ())) ()))) ())) (cons (cons true (cons (protect V1238) ())) ())))) ()))))) (do (shen.record-kl trim-right-if (cons defun (cons trim-right-if (cons (cons (protect V1241) (cons (protect V1242) ())) (cons (cons reverse (cons (cons trim-left-if (cons (protect V1241) (cons (cons reverse (cons (protect V1242) ())) ()))) ())) ()))))) (do (shen.record-kl trim-if (cons defun (cons trim-if (cons (cons (protect V1245) (cons (protect V1246) ())) (cons (cons trim-right-if (cons (protect V1245) (cons (cons trim-left-if (cons (protect V1245) (cons (protect V1246) ()))) ()))) ()))))) (do (shen.record-kl trim-left (cons defun (cons trim-left (cons (cons (protect V1253) (cons (protect V1254) ())) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V1254) ()))) (cons () ())) (cons (cons (cons and (cons (cons cons? (cons (protect V1254) ())) (cons (cons element? (cons (cons hd (cons (protect V1254) ())) (cons (protect V1253) ()))) ()))) (cons (cons trim-left (cons (protect V1253) (cons (cons tl (cons (protect V1254) ())) ()))) ())) (cons (cons true (cons (protect V1254) ())) ())))) ()))))) (do (shen.record-kl trim-right (cons defun (cons trim-right (cons (cons (protect V1257) (cons (protect V1258) ())) (cons (cons reverse (cons (cons trim-left (cons (protect V1257) (cons (cons reverse (cons (protect V1258) ())) ()))) ())) ()))))) (do (shen.record-kl trim (cons defun (cons trim (cons (cons (protect V1261) (cons (protect V1262) ())) (cons (cons trim-right (cons (protect V1261) (cons (cons trim-left (cons (protect V1261) (cons (protect V1262) ()))) ()))) ()))))) (do (shen.record-kl prefix? (cons defun (cons prefix? (cons (cons (protect V1272) (cons (protect V1273) ())) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V1272) ()))) (cons true ())) (cons (cons (cons and (cons (cons cons? (cons (protect V1272) ())) (cons (cons and (cons (cons cons? (cons (protect V1273) ())) (cons (cons = (cons (cons hd (cons (protect V1272) ())) (cons (cons hd (cons (protect V1273) ())) ()))) ()))) ()))) (cons (cons prefix? (cons (cons tl (cons (protect V1272) ())) (cons (cons tl (cons (protect V1273) ())) ()))) ())) (cons (cons true (cons false ())) ())))) ()))))) (do (shen.record-kl infix? (cons defun (cons infix? (cons (cons (protect V1280) (cons (protect V1281) ())) (cons (cons cond (cons (cons (cons prefix? (cons (protect V1280) (cons (protect V1281) ()))) (cons true ())) (cons (cons (cons = (cons () (cons (protect V1281) ()))) (cons false ())) (cons (cons (cons cons? (cons (protect V1281) ())) (cons (cons infix? (cons (protect V1280) (cons (cons tl (cons (protect V1281) ())) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons infix? ())) ())) ()))))) ()))))) (do (shen.record-kl suffix? (cons defun (cons suffix? (cons (cons (protect V1284) (cons (protect V1285) ())) (cons (cons prefix? (cons (cons reverse (cons (protect V1284) ())) (cons (cons reverse (cons (protect V1285) ())) ()))) ()))))) (do (shen.record-kl subset? (cons defun (cons subset? (cons (cons (protect V1294) (cons (protect V1295) ())) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V1294) ()))) (cons true ())) (cons (cons (cons and (cons (cons cons? (cons (protect V1294) ())) (cons (cons element? (cons (cons hd (cons (protect V1294) ())) (cons (protect V1295) ()))) ()))) (cons (cons subset? (cons (cons tl (cons (protect V1294) ())) (cons (protect V1295) ()))) ())) (cons (cons true (cons false ())) ())))) ()))))) (do (shen.record-kl set=? (cons defun (cons set=? (cons (cons (protect V1298) (cons (protect V1299) ())) (cons (cons and (cons (cons subset? (cons (protect V1298) (cons (protect V1299) ()))) (cons (cons subset? (cons (protect V1299) (cons (protect V1298) ()))) ()))) ()))))) (do (shen.record-kl set? (cons defun (cons set? (cons (cons (protect V1304) ()) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V1304) ()))) (cons true ())) (cons (cons (cons and (cons (cons cons? (cons (protect V1304) ())) (cons (cons element? (cons (cons hd (cons (protect V1304) ())) (cons (cons tl (cons (protect V1304) ())) ()))) ()))) (cons false ())) (cons (cons (cons cons? (cons (protect V1304) ())) (cons (cons set? (cons (cons tl (cons (protect V1304) ())) ())) ())) (cons (cons true (cons (cons shen.f-error (cons set? ())) ())) ()))))) ()))))) (do (shen.record-kl n-times (cons defun (cons n-times (cons (cons (protect V1306) (cons (protect V1307) ())) (cons (cons list.n-times-h (cons (protect V1307) (cons (protect V1306) (cons () ())))) ()))))) (do (shen.record-kl list.n-times-h (cons defun (cons list.n-times-h (cons (cons (protect V1310) (cons (protect V1311) (cons (protect V1312) ()))) (cons (cons cond (cons (cons (cons = (cons 0 (cons (protect V1310) ()))) (cons (protect V1312) ())) (cons (cons true (cons (cons list.n-times-h (cons (cons - (cons (protect V1310) (cons 1 ()))) (cons (protect V1311) (cons (cons cons (cons (protect V1311) (cons (protect V1312) ()))) ())))) ())) ()))) ()))))) (do (shen.record-kl subbag? (cons defun (cons subbag? (cons (cons (protect V1316) (cons (protect V1317) ())) (cons (cons every? (cons (cons lambda (cons (protect Z1318) (cons (cons = (cons (cons count (cons (protect Z1318) (cons (protect V1316) ()))) (cons (cons count (cons (protect Z1318) (cons (protect V1317) ()))) ()))) ()))) (cons (protect V1316) ()))) ()))))) (do (shen.record-kl bag=? (cons defun (cons bag=? (cons (cons (protect V1321) (cons (protect V1322) ())) (cons (cons and (cons (cons subbag? (cons (protect V1321) (cons (protect V1322) ()))) (cons (cons subbag? (cons (protect V1322) (cons (protect V1321) ()))) ()))) ()))))) (do (shen.record-kl mapc (cons defun (cons mapc (cons (cons (protect V1327) (cons (protect V1328) ())) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V1328) ()))) (cons () ())) (cons (cons (cons cons? (cons (protect V1328) ())) (cons (cons mapc (cons (cons do (cons (cons (protect V1327) (cons (cons hd (cons (protect V1328) ())) ())) (cons (protect V1327) ()))) (cons (cons tl (cons (protect V1328) ())) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons mapc ())) ())) ())))) ()))))) (do (shen.record-kl permute (cons defun (cons permute (cons (cons (protect V1331) ()) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V1331) ()))) (cons (cons cons (cons () (cons () ()))) ())) (cons (cons true (cons (cons mapcan (cons (cons lambda (cons (protect Z1332) (cons (cons map (cons (cons lambda (cons (protect Z1333) (cons (cons cons (cons (protect Z1332) (cons (protect Z1333) ()))) ()))) (cons (cons permute (cons (cons remove (cons (protect Z1332) (cons (protect V1331) ()))) ())) ()))) ()))) (cons (protect V1331) ()))) ())) ()))) ()))))) (do (shen.record-kl count-if (cons defun (cons count-if (cons (cons (protect V1335) (cons (protect V1336) ())) (cons (cons length (cons (cons mapcan (cons (cons lambda (cons (protect Z1337) (cons (cons if (cons (cons (protect V1335) (cons (protect Z1337) ())) (cons (cons cons (cons (protect Z1337) (cons () ()))) (cons () ())))) ()))) (cons (protect V1336) ()))) ())) ()))))) (do (shen.record-kl count (cons defun (cons count (cons (cons (protect V1341) (cons (protect V1342) ())) (cons (cons count-if (cons (cons lambda (cons (protect Z1343) (cons (cons = (cons (protect V1341) (cons (protect Z1343) ()))) ()))) (cons (protect V1342) ()))) ()))))) (do (shen.record-kl some? (cons defun (cons some? (cons (cons (protect V1351) (cons (protect V1352) ())) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V1352) ()))) (cons false ())) (cons (cons (cons and (cons (cons cons? (cons (protect V1352) ())) (cons (cons (protect V1351) (cons (cons hd (cons (protect V1352) ())) ())) ()))) (cons true ())) (cons (cons (cons cons? (cons (protect V1352) ())) (cons (cons some? (cons (protect V1351) (cons (cons tl (cons (protect V1352) ())) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons some? ())) ())) ()))))) ()))))) (do (shen.record-kl every? (cons defun (cons every? (cons (cons (protect V1361) (cons (protect V1362) ())) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V1362) ()))) (cons true ())) (cons (cons (cons and (cons (cons cons? (cons (protect V1362) ())) (cons (cons (protect V1361) (cons (cons hd (cons (protect V1362) ())) ())) ()))) (cons (cons every? (cons (protect V1361) (cons (cons tl (cons (protect V1362) ())) ()))) ())) (cons (cons true (cons false ())) ())))) ()))))) (do (shen.record-kl sort (cons defun (cons sort (cons (cons (protect V1369) (cons (protect V1370) ())) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V1370) ()))) (cons () ())) (cons (cons (cons and (cons (cons cons? (cons (protect V1370) ())) (cons (cons = (cons () (cons (cons tl (cons (protect V1370) ())) ()))) ()))) (cons (protect V1370) ())) (cons (cons (cons cons? (cons (protect V1370) ())) (cons (cons let (cons (protect W1371) (cons (cons mapcan (cons (cons lambda (cons (protect Z1372) (cons (cons if (cons (cons (cons (protect V1369) (cons (protect Z1372) ())) (cons (cons hd (cons (protect V1370) ())) ())) (cons (cons cons (cons (protect Z1372) (cons () ()))) (cons () ())))) ()))) (cons (cons tl (cons (protect V1370) ())) ()))) (cons (cons let (cons (protect W1373) (cons (cons mapcan (cons (cons lambda (cons (protect Z1374) (cons (cons if (cons (cons not (cons (cons (cons (protect V1369) (cons (protect Z1374) ())) (cons (cons hd (cons (protect V1370) ())) ())) ())) (cons (cons cons (cons (protect Z1374) (cons () ()))) (cons () ())))) ()))) (cons (cons tl (cons (protect V1370) ())) ()))) (cons (cons append (cons (cons sort (cons (protect V1369) (cons (protect W1371) ()))) (cons (cons append (cons (cons cons (cons (cons hd (cons (protect V1370) ())) (cons () ()))) (cons (cons sort (cons (protect V1369) (cons (protect W1373) ()))) ()))) ()))) ())))) ())))) ())) (cons (cons true (cons (cons shen.f-error (cons sort ())) ())) ()))))) ()))))) (do (shen.record-kl find (cons defun (cons find (cons (cons (protect V1382) (cons (protect V1383) ())) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V1383) ()))) (cons (cons simple-error (cons "find has found no element -" ())) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V1383) ())) (cons (cons (protect V1382) (cons (cons hd (cons (protect V1383) ())) ())) ()))) (cons (cons hd (cons (protect V1383) ())) ())) (cons (cons (cons cons? (cons (protect V1383) ())) (cons (cons find (cons (protect V1382) (cons (cons tl (cons (protect V1383) ())) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons find ())) ())) ()))))) ()))))) (do (shen.record-kl foldr (cons defun (cons foldr (cons (cons (protect V1388) (cons (protect V1389) (cons (protect V1390) ()))) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V1390) ()))) (cons (protect V1389) ())) (cons (cons (cons cons? (cons (protect V1390) ())) (cons (cons foldr (cons (protect V1388) (cons (cons (cons (protect V1388) (cons (cons hd (cons (protect V1390) ())) ())) (cons (protect V1389) ())) (cons (cons tl (cons (protect V1390) ())) ())))) ())) (cons (cons true (cons (cons shen.f-error (cons foldr ())) ())) ())))) ()))))) (do (shen.record-kl foldl (cons defun (cons foldl (cons (cons (protect V1396) (cons (protect V1397) (cons (protect V1398) ()))) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V1398) ()))) (cons (protect V1397) ())) (cons (cons (cons cons? (cons (protect V1398) ())) (cons (cons foldl (cons (protect V1396) (cons (cons (cons (protect V1396) (cons (protect V1397) ())) (cons (cons hd (cons (protect V1398) ())) ())) (cons (cons tl (cons (protect V1398) ())) ())))) ())) (cons (cons true (cons (cons shen.f-error (cons foldl ())) ())) ())))) ()))))) (do (shen.record-kl mapf (cons defun (cons mapf (cons (cons (protect V1406) (cons (protect V1407) (cons (protect V1408) ()))) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V1407) ()))) (cons () ())) (cons (cons (cons cons? (cons (protect V1407) ())) (cons (cons (cons (protect V1408) (cons (cons (protect V1406) (cons (cons hd (cons (protect V1407) ())) ())) ())) (cons (cons mapf (cons (protect V1406) (cons (cons tl (cons (protect V1407) ())) (cons (protect V1408) ())))) ())) ())) (cons (cons true (cons (cons shen.f-error (cons mapf ())) ())) ())))) ()))))) (do (shen.record-kl filter (cons defun (cons filter (cons (cons (protect V1414) (cons (protect V1415) ())) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V1415) ()))) (cons () ())) (cons (cons (cons cons? (cons (protect V1415) ())) (cons (cons if (cons (cons (protect V1414) (cons (cons hd (cons (protect V1415) ())) ())) (cons (cons cons (cons (cons hd (cons (protect V1415) ())) (cons (cons filter (cons (protect V1414) (cons (cons tl (cons (protect V1415) ())) ()))) ()))) (cons (cons filter (cons (protect V1414) (cons (cons tl (cons (protect V1415) ())) ()))) ())))) ())) (cons (cons true (cons (cons shen.f-error (cons filter ())) ())) ())))) ()))))) (do (shen.record-kl remove-if (cons defun (cons remove-if (cons (cons (protect V1420) (cons (protect V1421) ())) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V1421) ()))) (cons () ())) (cons (cons (cons cons? (cons (protect V1421) ())) (cons (cons if (cons (cons (protect V1420) (cons (cons hd (cons (protect V1421) ())) ())) (cons (cons remove-if (cons (protect V1420) (cons (cons tl (cons (protect V1421) ())) ()))) (cons (cons cons (cons (cons hd (cons (protect V1421) ())) (cons (cons remove-if (cons (protect V1420) (cons (cons tl (cons (protect V1421) ())) ()))) ()))) ())))) ())) (cons (cons true (cons (cons shen.f-error (cons remove-if ())) ())) ())))) ()))))) (do (shen.record-kl list.reduce (cons defun (cons list.reduce (cons (cons (protect V1424) (cons (protect V1425) (cons (protect V1426) ()))) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V1426) ()))) (cons (protect V1425) ())) (cons (cons (cons cons? (cons (protect V1426) ())) (cons (cons list.reduce (cons (protect V1424) (cons (cons (cons (protect V1424) (cons (protect V1425) ())) (cons (cons hd (cons (protect V1426) ())) ())) (cons (cons tl (cons (protect V1426) ())) ())))) ())) (cons (cons true (cons (cons shen.f-error (cons list.reduce ())) ())) ())))) ()))))) (do (shen.record-kl take (cons defun (cons take (cons (cons (protect V1434) (cons (protect V1435) ())) (cons (cons cond (cons (cons (cons = (cons 0 (cons (protect V1434) ()))) (cons () ())) (cons (cons (cons = (cons () (cons (protect V1435) ()))) (cons () ())) (cons (cons (cons cons? (cons (protect V1435) ())) (cons (cons cons (cons (cons hd (cons (protect V1435) ())) (cons (cons take (cons (cons - (cons (protect V1434) (cons 1 ()))) (cons (cons tl (cons (protect V1435) ())) ()))) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons take ())) ())) ()))))) ()))))) (do (shen.record-kl take-last (cons defun (cons take-last (cons (cons (protect V1438) (cons (protect V1439) ())) (cons (cons reverse (cons (cons take (cons (protect V1438) (cons (cons reverse (cons (protect V1439) ())) ()))) ())) ()))))) (do (shen.record-kl cartprod (cons defun (cons cartprod (cons (cons (protect V1444) (cons (protect V1445) ())) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V1444) ()))) (cons () ())) (cons (cons (cons cons? (cons (protect V1444) ())) (cons (cons append (cons (cons map (cons (cons lambda (cons (protect Z1446) (cons (cons cons (cons (cons hd (cons (protect V1444) ())) (cons (cons cons (cons (protect Z1446) (cons () ()))) ()))) ()))) (cons (protect V1445) ()))) (cons (cons cartprod (cons (cons tl (cons (protect V1444) ())) (cons (protect V1445) ()))) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons cartprod ())) ())) ())))) ()))))) (do (shen.record-kl powerset (cons defun (cons powerset (cons (cons (protect V1449) ()) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V1449) ()))) (cons (cons cons (cons () (cons () ()))) ())) (cons (cons (cons cons? (cons (protect V1449) ())) (cons (cons let (cons (protect W1450) (cons (cons powerset (cons (cons tl (cons (protect V1449) ())) ())) (cons (cons append (cons (protect W1450) (cons (cons map (cons (cons lambda (cons (protect Z1451) (cons (cons cons (cons (cons hd (cons (protect V1449) ())) (cons (protect Z1451) ()))) ()))) (cons (protect W1450) ()))) ()))) ())))) ())) (cons (cons true (cons (cons shen.f-error (cons powerset ())) ())) ())))) ()))))) (do (shen.record-kl partition (cons defun (cons partition (cons (cons (protect V1459) (cons (protect V1460) ())) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V1460) ()))) (cons () ())) (cons (cons (cons cons? (cons (protect V1460) ())) (cons (cons let (cons (protect W1461) (cons (cons mapcan (cons (cons lambda (cons (protect Z1462) (cons (cons if (cons (cons (cons (protect V1459) (cons (cons hd (cons (protect V1460) ())) ())) (cons (protect Z1462) ())) (cons (cons cons (cons (protect Z1462) (cons () ()))) (cons () ())))) ()))) (cons (protect V1460) ()))) (cons (cons let (cons (protect W1463) (cons (cons difference (cons (protect V1460) (cons (protect W1461) ()))) (cons (cons cons (cons (protect W1461) (cons (cons partition (cons (protect V1459) (cons (protect W1463) ()))) ()))) ())))) ())))) ())) (cons (cons true (cons (cons simple-error (cons "partition equires a list" ())) ())) ())))) ()))))) (do (shen.record-kl transitive-closure (cons defun (cons transitive-closure (cons (cons (protect V1466) ()) (cons (cons let (cons (protect W1467) (cons (cons list.transitive-pass (cons (protect V1466) (cons (protect V1466) ()))) (cons (cons if (cons (cons = (cons (protect W1467) (cons (protect V1466) ()))) (cons (protect W1467) (cons (cons list.transitive-pass (cons (protect W1467) (cons (protect W1467) ()))) ())))) ())))) ()))))) (do (shen.record-kl list.transitive-pass (cons defun (cons list.transitive-pass (cons (cons (protect V1469) (cons (protect V1470) ())) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V1469) ()))) (cons (protect V1470) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V1469) ())) (cons (cons tuple? (cons (cons hd (cons (protect V1469) ())) ())) ()))) (cons (cons let (cons (protect W1471) (cons (cons list.find-trans (cons (cons fst (cons (cons hd (cons (protect V1469) ())) ())) (cons (cons snd (cons (cons hd (cons (protect V1469) ())) ())) (cons (protect V1470) ())))) (cons (cons union (cons (protect W1471) (cons (cons list.transitive-pass (cons (cons tl (cons (protect V1469) ())) (cons (protect V1470) ()))) ()))) ())))) ())) (cons (cons true (cons (cons shen.f-error (cons list.transitive-pass ())) ())) ())))) ()))))) (do (shen.record-kl list.find-trans (cons defun (cons list.find-trans (cons (cons (protect V1481) (cons (protect V1482) (cons (protect V1483) ()))) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V1483) ()))) (cons () ())) (cons (cons (cons and (cons (cons cons? (cons (protect V1483) ())) (cons (cons and (cons (cons tuple? (cons (cons hd (cons (protect V1483) ())) ())) (cons (cons = (cons (protect V1482) (cons (cons fst (cons (cons hd (cons (protect V1483) ())) ())) ()))) ()))) ()))) (cons (cons cons (cons (cons @p (cons (protect V1481) (cons (cons snd (cons (cons hd (cons (protect V1483) ())) ())) ()))) (cons (cons list.find-trans (cons (protect V1481) (cons (cons fst (cons (cons hd (cons (protect V1483) ())) ())) (cons (cons tl (cons (protect V1483) ())) ())))) ()))) ())) (cons (cons (cons cons? (cons (protect V1483) ())) (cons (cons list.find-trans (cons (protect V1481) (cons (protect V1482) (cons (cons tl (cons (protect V1483) ())) ())))) ())) (cons (cons true (cons (cons shen.f-error (cons list.find-trans ())) ())) ()))))) ()))))) (do (shen.record-kl x->ascii (cons defun (cons x->ascii (cons (cons (protect V1488) ()) (cons (cons map (cons (cons lambda (cons (protect Z1489) (cons (cons string->n (cons (protect Z1489) ())) ()))) (cons (cons explode (cons (protect V1488) ())) ()))) ()))))) (do (shen.record-kl splice (cons defun (cons splice (cons (cons (protect V1491) (cons (protect V1492) (cons (protect V1493) ()))) (cons (cons cond (cons (cons (cons = (cons 1 (cons (protect V1491) ()))) (cons (cons append (cons (protect V1492) (cons (protect V1493) ()))) ())) (cons (cons (cons cons? (cons (protect V1493) ())) (cons (cons cons (cons (cons hd (cons (protect V1493) ())) (cons (cons splice (cons (cons - (cons (protect V1491) (cons 1 ()))) (cons (protect V1492) (cons (cons tl (cons (protect V1493) ())) ())))) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons splice ())) ())) ())))) ()))))) (do (shen.record-kl string-macros (cons defun (cons string-macros (cons (cons (protect V1497) ()) (cons (cons cond (cons (cons (cons and (cons (cons cons? (cons (protect V1497) ())) (cons (cons and (cons (cons = (cons s-op1 (cons (cons hd (cons (protect V1497) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V1497) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V1497) ())) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V1497) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) (cons (cons cons (cons s-op1 (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V1497) ())) ())) (cons (cons cons (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V1497) ())) ())) ())) (cons (cons cons (cons (cons cons (cons /. (cons (cons cons (cons (protect X) (cons (cons cons (cons (protect X) (cons () ()))) ()))) ()))) (cons () ()))) ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V1497) ())) (cons (cons and (cons (cons = (cons s-op2 (cons (cons hd (cons (protect V1497) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V1497) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V1497) ())) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V1497) ())) ())) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V1497) ())) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) ()))) (cons (cons cons (cons s-op2 (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V1497) ())) ())) (cons (cons cons (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V1497) ())) ())) ())) (cons (cons cons (cons (cons hd (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V1497) ())) ())) ())) ())) (cons (cons cons (cons (cons cons (cons /. (cons (cons cons (cons (protect X) (cons (cons cons (cons (protect X) (cons () ()))) ()))) ()))) (cons () ()))) ()))) ()))) ()))) ()))) ())) (cons (cons true (cons (protect V1497) ())) ())))) ()))))) (do (shen.record-kl string->list (cons defun (cons string->list (cons (cons (protect V1587) ()) (cons (cons cond (cons (cons (cons = (cons "" (cons (protect V1587) ()))) (cons () ())) (cons (cons true (cons (cons string.s->l-h (cons (protect V1587) (cons 1 (cons (cons pos (cons (protect V1587) (cons 0 ()))) (cons () ()))))) ())) ()))) ()))))) (do (shen.record-kl string.s->l-h (cons defun (cons string.s->l-h (cons (cons (protect V1589) (cons (protect V1590) (cons (protect V1591) (cons (protect V1592) ())))) (cons (cons cond (cons (cons (cons = (cons "" (cons (protect V1591) ()))) (cons (cons reverse (cons (protect V1592) ())) ())) (cons (cons true (cons (cons string.s->l-h (cons (protect V1589) (cons (cons + (cons (protect V1590) (cons 1 ()))) (cons (cons trap-error (cons (cons pos (cons (protect V1589) (cons (protect V1590) ()))) (cons (cons lambda (cons (protect Z1593) (cons "" ()))) ()))) (cons (cons cons (cons (protect V1591) (cons (protect V1592) ()))) ()))))) ())) ()))) ()))))) (do (shen.record-kl list->string (cons defun (cons list->string (cons (cons (protect V1598) ()) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V1598) ()))) (cons "" ())) (cons (cons (cons cons? (cons (protect V1598) ())) (cons (cons cn (cons (cons hd (cons (protect V1598) ())) (cons (cons list->string (cons (cons tl (cons (protect V1598) ())) ())) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons list->string ())) ())) ())))) ()))))) (do (shen.record-kl s-op1 (cons defun (cons s-op1 (cons (cons (protect V1600) (cons (protect V1601) (cons (protect V1602) ()))) (cons (cons (protect V1602) (cons (cons (protect V1600) (cons (cons string->list (cons (protect V1601) ())) ())) ())) ()))))) (do (shen.record-kl s-op2 (cons defun (cons s-op2 (cons (cons (protect V1606) (cons (protect V1607) (cons (protect V1608) (cons (protect V1609) ())))) (cons (cons (protect V1609) (cons (cons (cons (protect V1606) (cons (cons string->list (cons (protect V1607) ())) ())) (cons (cons string->list (cons (protect V1608) ())) ())) ())) ()))))) (do (shen.record-kl string.count (cons defun (cons string.count (cons (cons (protect V1619) (cons (protect V1620) ())) (cons (cons cond (cons (cons (cons = (cons "" (cons (protect V1620) ()))) (cons 0 ())) (cons (cons (cons and (cons (cons shen.+string? (cons (protect V1620) ())) (cons (cons = (cons (protect V1619) (cons (cons hdstr (cons (protect V1620) ())) ()))) ()))) (cons (cons + (cons 1 (cons (cons string.count (cons (cons hdstr (cons (protect V1620) ())) (cons (cons tlstr (cons (protect V1620) ())) ()))) ()))) ())) (cons (cons (cons shen.+string? (cons (protect V1620) ())) (cons (cons string.count (cons (protect V1619) (cons (cons tlstr (cons (protect V1620) ())) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons string.count ())) ())) ()))))) ()))))) (do (shen.record-kl string.reverse (cons defun (cons string.reverse (cons (cons (protect V1625) ()) (cons (cons s-op1 (cons (cons lambda (cons (protect Z1626) (cons (cons reverse (cons (protect Z1626) ())) ()))) (cons (protect V1625) (cons (cons lambda (cons (protect Z1627) (cons (cons list->string (cons (protect Z1627) ())) ()))) ())))) ()))))) (do (shen.record-kl string.element? (cons defun (cons string.element? (cons (cons (protect V1629) (cons (protect V1630) ())) (cons (cons s-op1 (cons (cons lambda (cons (protect Z1631) (cons (cons element? (cons (protect V1629) (cons (protect Z1631) ()))) ()))) (cons (protect V1630) (cons (cons lambda (cons (protect Z1632) (cons (protect Z1632) ()))) ())))) ()))))) (do (shen.record-kl string.prefix? (cons defun (cons string.prefix? (cons (cons (protect V1637) (cons (protect V1638) ())) (cons (cons s-op2 (cons (cons lambda (cons (protect Z1639) (cons (cons lambda (cons (protect Z1640) (cons (cons prefix? (cons (protect Z1639) (cons (protect Z1640) ()))) ()))) ()))) (cons (protect V1637) (cons (protect V1638) (cons (cons lambda (cons (protect Z1641) (cons (protect Z1641) ()))) ()))))) ()))))) (do (shen.record-kl string.infix? (cons defun (cons string.infix? (cons (cons (protect V1646) (cons (protect V1647) ())) (cons (cons s-op2 (cons (cons lambda (cons (protect Z1648) (cons (cons lambda (cons (protect Z1649) (cons (cons infix? (cons (protect Z1648) (cons (protect Z1649) ()))) ()))) ()))) (cons (protect V1646) (cons (protect V1647) (cons (cons lambda (cons (protect Z1650) (cons (protect Z1650) ()))) ()))))) ()))))) (do (shen.record-kl string.suffix? (cons defun (cons string.suffix? (cons (cons (protect V1655) (cons (protect V1656) ())) (cons (cons s-op2 (cons (cons lambda (cons (protect Z1657) (cons (cons lambda (cons (protect Z1658) (cons (cons suffix? (cons (protect Z1657) (cons (protect Z1658) ()))) ()))) ()))) (cons (protect V1655) (cons (protect V1656) (cons (cons lambda (cons (protect Z1659) (cons (protect Z1659) ()))) ()))))) ()))))) (do (shen.record-kl string.subset? (cons defun (cons string.subset? (cons (cons (protect V1664) (cons (protect V1665) ())) (cons (cons s-op2 (cons (cons lambda (cons (protect Z1666) (cons (cons lambda (cons (protect Z1667) (cons (cons subset? (cons (protect Z1666) (cons (protect Z1667) ()))) ()))) ()))) (cons (protect V1664) (cons (protect V1665) (cons (cons lambda (cons (protect Z1668) (cons (protect Z1668) ()))) ()))))) ()))))) (do (shen.record-kl string.set=? (cons defun (cons string.set=? (cons (cons (protect V1673) (cons (protect V1674) ())) (cons (cons s-op2 (cons (cons lambda (cons (protect Z1675) (cons (cons lambda (cons (protect Z1676) (cons (cons set=? (cons (protect Z1675) (cons (protect Z1676) ()))) ()))) ()))) (cons (protect V1673) (cons (protect V1674) (cons (cons lambda (cons (protect Z1677) (cons (protect Z1677) ()))) ()))))) ()))))) (do (shen.record-kl string.set? (cons defun (cons string.set? (cons (cons (protect V1681) ()) (cons (cons s-op1 (cons (cons lambda (cons (protect Z1682) (cons (cons set? (cons (protect Z1682) ())) ()))) (cons (protect V1681) (cons (cons lambda (cons (protect Z1683) (cons (protect Z1683) ()))) ())))) ()))))) (do (shen.record-kl file-extension (cons defun (cons file-extension (cons (cons (protect V1685) (cons (protect V1686) ())) (cons (cons cn (cons (cons strip-extension (cons (protect V1685) ())) (cons (protect V1686) ()))) ()))))) (do (shen.record-kl strip-extension (cons defun (cons strip-extension (cons (cons (protect V1691) ()) (cons (cons cond (cons (cons (cons = (cons "" (cons (protect V1691) ()))) (cons "" ())) (cons (cons (cons and (cons (cons shen.+string? (cons (protect V1691) ())) (cons (cons = (cons "." (cons (cons hdstr (cons (protect V1691) ())) ()))) ()))) (cons "" ())) (cons (cons (cons shen.+string? (cons (protect V1691) ())) (cons (cons @s (cons (cons hdstr (cons (protect V1691) ())) (cons (cons strip-extension (cons (cons tlstr (cons (protect V1691) ())) ())) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons strip-extension ())) ())) ()))))) ()))))) (do (shen.record-kl string.length (cons defun (cons string.length (cons (cons (protect V1694) ()) (cons (cons s-op1 (cons (cons lambda (cons (protect Z1695) (cons (cons length (cons (protect Z1695) ())) ()))) (cons (protect V1694) (cons (cons lambda (cons (protect Z1696) (cons (protect Z1696) ()))) ())))) ()))))) (do (shen.record-kl string.trim (cons defun (cons string.trim (cons (cons (protect V1700) (cons (protect V1701) ())) (cons (cons s-op1 (cons (cons lambda (cons (protect Z1702) (cons (cons trim (cons (protect V1700) (cons (protect Z1702) ()))) ()))) (cons (protect V1701) (cons (cons lambda (cons (protect Z1703) (cons (cons list->string (cons (protect Z1703) ())) ()))) ())))) ()))))) (do (shen.record-kl string.trim-if (cons defun (cons string.trim-if (cons (cons (protect V1708) (cons (protect V1709) ())) (cons (cons s-op1 (cons (cons lambda (cons (protect Z1710) (cons (cons trim-if (cons (protect V1708) (cons (protect Z1710) ()))) ()))) (cons (protect V1709) (cons (cons lambda (cons (protect Z1711) (cons (cons list->string (cons (protect Z1711) ())) ()))) ())))) ()))))) (do (shen.record-kl string.trim-right-if (cons defun (cons string.trim-right-if (cons (cons (protect V1716) (cons (protect V1717) ())) (cons (cons s-op1 (cons (cons lambda (cons (protect Z1718) (cons (cons trim-right-if (cons (protect V1716) (cons (protect Z1718) ()))) ()))) (cons (protect V1717) (cons (cons lambda (cons (protect Z1719) (cons (cons list->string (cons (protect Z1719) ())) ()))) ())))) ()))))) (do (shen.record-kl string.trim-left-if (cons defun (cons string.trim-left-if (cons (cons (protect V1724) (cons (protect V1725) ())) (cons (cons s-op1 (cons (cons lambda (cons (protect Z1726) (cons (cons trim-left-if (cons (protect V1724) (cons (protect Z1726) ()))) ()))) (cons (protect V1725) (cons (cons lambda (cons (protect Z1727) (cons (cons list->string (cons (protect Z1727) ())) ()))) ())))) ()))))) (do (shen.record-kl string.trim-right (cons defun (cons string.trim-right (cons (cons (protect V1732) (cons (protect V1733) ())) (cons (cons s-op1 (cons (cons lambda (cons (protect Z1734) (cons (cons trim-right (cons (protect V1732) (cons (protect Z1734) ()))) ()))) (cons (protect V1733) (cons (cons lambda (cons (protect Z1735) (cons (cons list->string (cons (protect Z1735) ())) ()))) ())))) ()))))) (do (shen.record-kl string.trim-left (cons defun (cons string.trim-left (cons (cons (protect V1740) (cons (protect V1741) ())) (cons (cons s-op1 (cons (cons lambda (cons (protect Z1742) (cons (cons trim-left (cons (protect V1740) (cons (protect Z1742) ()))) ()))) (cons (protect V1741) (cons (cons lambda (cons (protect Z1743) (cons (cons list->string (cons (protect Z1743) ())) ()))) ())))) ()))))) (do (shen.record-kl string.some? (cons defun (cons string.some? (cons (cons (protect V1748) (cons (protect V1749) ())) (cons (cons cond (cons (cons (cons = (cons "" (cons (protect V1749) ()))) (cons false ())) (cons (cons (cons shen.+string? (cons (protect V1749) ())) (cons (cons or (cons (cons (protect V1748) (cons (cons hdstr (cons (protect V1749) ())) ())) (cons (cons string.some? (cons (protect V1748) (cons (cons tlstr (cons (protect V1749) ())) ()))) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons string.some? ())) ())) ())))) ()))))) (do (shen.record-kl string.every? (cons defun (cons string.every? (cons (cons (protect V1754) (cons (protect V1755) ())) (cons (cons cond (cons (cons (cons = (cons "" (cons (protect V1755) ()))) (cons true ())) (cons (cons (cons shen.+string? (cons (protect V1755) ())) (cons (cons and (cons (cons (protect V1754) (cons (cons hdstr (cons (protect V1755) ())) ())) (cons (cons string.every? (cons (protect V1754) (cons (cons tlstr (cons (protect V1755) ())) ()))) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons string.every? ())) ())) ())))) ()))))) (do (shen.record-kl string.difference (cons defun (cons string.difference (cons (cons (protect V1761) (cons (protect V1762) ())) (cons (cons s-op2 (cons (cons lambda (cons (protect Z1763) (cons (cons lambda (cons (protect Z1764) (cons (cons difference (cons (protect Z1763) (cons (protect Z1764) ()))) ()))) ()))) (cons (protect V1761) (cons (protect V1762) (cons (cons lambda (cons (protect Z1765) (cons (cons list->string (cons (protect Z1765) ())) ()))) ()))))) ()))))) (do (shen.record-kl string.intersection (cons defun (cons string.intersection (cons (cons (protect V1771) (cons (protect V1772) ())) (cons (cons s-op2 (cons (cons lambda (cons (protect Z1773) (cons (cons lambda (cons (protect Z1774) (cons (cons intersection (cons (protect Z1773) (cons (protect Z1774) ()))) ()))) ()))) (cons (protect V1771) (cons (protect V1772) (cons (cons lambda (cons (protect Z1775) (cons (cons list->string (cons (protect Z1775) ())) ()))) ()))))) ()))))) (do (shen.record-kl string.nth (cons defun (cons string.nth (cons (cons (protect V1778) (cons (protect V1779) ())) (cons (cons pos (cons (protect V1779) (cons (cons + (cons (protect V1778) (cons 1 ()))) ()))) ()))))) (do (shen.record-kl whitespace? (cons defun (cons whitespace? (cons (cons (protect V1784) ()) (cons (cons cond (cons (cons (cons shen.+string? (cons (protect V1784) ())) (cons (cons let (cons (protect W1785) (cons (cons string->n (cons (cons hdstr (cons (protect V1784) ())) ())) (cons (cons element? (cons (protect W1785) (cons (cons cons (cons 9 (cons (cons cons (cons 10 (cons (cons cons (cons 13 (cons (cons cons (cons 32 (cons () ()))) ()))) ()))) ()))) ()))) ())))) ())) (cons (cons true (cons (cons shen.f-error (cons whitespace? ())) ())) ()))) ()))))) (do (shen.record-kl uppercase? (cons defun (cons uppercase? (cons (cons (protect V1789) ()) (cons (cons cond (cons (cons (cons shen.+string? (cons (protect V1789) ())) (cons (cons let (cons (protect W1790) (cons (cons string->n (cons (cons hdstr (cons (protect V1789) ())) ())) (cons (cons and (cons (cons > (cons (protect W1790) (cons 64 ()))) (cons (cons < (cons (protect W1790) (cons 91 ()))) ()))) ())))) ())) (cons (cons true (cons (cons shen.f-error (cons uppercase? ())) ())) ()))) ()))))) (do (shen.record-kl lowercase? (cons defun (cons lowercase? (cons (cons (protect V1794) ()) (cons (cons cond (cons (cons (cons shen.+string? (cons (protect V1794) ())) (cons (cons let (cons (protect W1795) (cons (cons string->n (cons (cons hdstr (cons (protect V1794) ())) ())) (cons (cons and (cons (cons > (cons (protect W1795) (cons 96 ()))) (cons (cons < (cons (protect W1795) (cons 123 ()))) ()))) ())))) ())) (cons (cons true (cons (cons shen.f-error (cons lowercase? ())) ())) ()))) ()))))) (do (shen.record-kl digit? (cons defun (cons digit? (cons (cons (protect V1799) ()) (cons (cons cond (cons (cons (cons shen.+string? (cons (protect V1799) ())) (cons (cons let (cons (protect W1800) (cons (cons string->n (cons (cons hdstr (cons (protect V1799) ())) ())) (cons (cons and (cons (cons > (cons (protect W1800) (cons 47 ()))) (cons (cons < (cons (protect W1800) (cons 58 ()))) ()))) ())))) ())) (cons (cons true (cons (cons shen.f-error (cons digit? ())) ())) ()))) ()))))) (do (shen.record-kl alpha? (cons defun (cons alpha? (cons (cons (protect V1806) ()) (cons (cons cond (cons (cons (cons shen.+string? (cons (protect V1806) ())) (cons (cons let (cons (protect W1807) (cons (cons string->n (cons (cons hdstr (cons (protect V1806) ())) ())) (cons (cons or (cons (cons and (cons (cons > (cons (protect W1807) (cons 64 ()))) (cons (cons < (cons (protect W1807) (cons 91 ()))) ()))) (cons (cons and (cons (cons > (cons (protect W1807) (cons 96 ()))) (cons (cons < (cons (protect W1807) (cons 123 ()))) ()))) ()))) ())))) ())) (cons (cons true (cons false ())) ()))) ()))))) (do (shen.record-kl alphanum? (cons defun (cons alphanum? (cons (cons (protect V1813) ()) (cons (cons cond (cons (cons (cons shen.+string? (cons (protect V1813) ())) (cons (cons let (cons (protect W1814) (cons (cons string->n (cons (cons hdstr (cons (protect V1813) ())) ())) (cons (cons or (cons (cons and (cons (cons > (cons (protect W1814) (cons 64 ()))) (cons (cons < (cons (protect W1814) (cons 91 ()))) ()))) (cons (cons or (cons (cons and (cons (cons > (cons (protect W1814) (cons 96 ()))) (cons (cons < (cons (protect W1814) (cons 123 ()))) ()))) (cons (cons and (cons (cons > (cons (protect W1814) (cons 47 ()))) (cons (cons < (cons (protect W1814) (cons 58 ()))) ()))) ()))) ()))) ())))) ())) (cons (cons true (cons false ())) ()))) ()))))) (do (shen.record-kl tokenise (cons defun (cons tokenise (cons (cons (protect V1816) (cons (protect V1817) ())) (cons (cons string.tokenise-h (cons (protect V1816) (cons (protect V1817) (cons "" ())))) ()))))) (do (shen.record-kl string.tokenise-h (cons defun (cons string.tokenise-h (cons (cons (protect V1822) (cons (protect V1823) (cons (protect V1824) ()))) (cons (cons cond (cons (cons (cons = (cons "" (cons (protect V1823) ()))) (cons (cons cons (cons (protect V1824) (cons () ()))) ())) (cons (cons (cons and (cons (cons shen.+string? (cons (protect V1823) ())) (cons (cons (protect V1822) (cons (cons hdstr (cons (protect V1823) ())) ())) ()))) (cons (cons cons (cons (protect V1824) (cons (cons string.tokenise-h (cons (protect V1822) (cons (cons tlstr (cons (protect V1823) ())) (cons "" ())))) ()))) ())) (cons (cons (cons shen.+string? (cons (protect V1823) ())) (cons (cons string.tokenise-h (cons (protect V1822) (cons (cons tlstr (cons (protect V1823) ())) (cons (cons @s (cons (protect V1824) (cons (cons hdstr (cons (protect V1823) ())) ()))) ())))) ())) (cons (cons true (cons (cons shen.f-error (cons string.tokenise-h ())) ())) ()))))) ()))))) (do (shen.record-kl uppercase (cons defun (cons uppercase (cons (cons (protect V1828) ()) (cons (cons cond (cons (cons (cons shen.+string? (cons (protect V1828) ())) (cons (cons if (cons (cons lowercase? (cons (cons hdstr (cons (protect V1828) ())) ())) (cons (cons @s (cons (cons n->string (cons (cons - (cons (cons string->n (cons (cons hdstr (cons (protect V1828) ())) ())) (cons 32 ()))) ())) (cons (cons tlstr (cons (protect V1828) ())) ()))) (cons (protect V1828) ())))) ())) (cons (cons true (cons (cons shen.f-error (cons uppercase ())) ())) ()))) ()))))) (do (shen.record-kl lowercase (cons defun (cons lowercase (cons (cons (protect V1830) ()) (cons (cons cond (cons (cons (cons shen.+string? (cons (protect V1830) ())) (cons (cons if (cons (cons uppercase? (cons (cons hdstr (cons (protect V1830) ())) ())) (cons (cons @s (cons (cons n->string (cons (cons + (cons (cons string->n (cons (cons hdstr (cons (protect V1830) ())) ())) (cons 32 ()))) ())) (cons (cons tlstr (cons (protect V1830) ())) ()))) (cons (protect V1830) ())))) ())) (cons (cons true (cons (cons shen.f-error (cons lowercase ())) ())) ()))) ()))))) (do (shen.record-kl string.map (cons defun (cons string.map (cons (cons (protect V1834) (cons (protect V1835) ())) (cons (cons cond (cons (cons (cons = (cons "" (cons (protect V1835) ()))) (cons "" ())) (cons (cons (cons shen.+string? (cons (protect V1835) ())) (cons (cons @s (cons (cons (protect V1834) (cons (cons hdstr (cons (protect V1835) ())) ())) (cons (cons string.map (cons (protect V1834) (cons (cons tlstr (cons (protect V1835) ())) ()))) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons string.map ())) ())) ())))) ()))))) (do (shen.record-kl spell-number (cons defun (cons spell-number (cons (cons (protect V1839) ()) (cons (cons cond (cons (cons (cons = (cons 0 (cons (protect V1839) ()))) (cons "zero" ())) (cons (cons true (cons (cons string.scale (cons (cons map (cons (cons lambda (cons (protect Z1840) (cons (cons string.digits (cons (protect Z1840) ())) ()))) (cons (cons string.triples (cons (cons explode (cons (protect V1839) ())) ())) ()))) ())) ())) ()))) ()))))) (do (shen.record-kl string.digit (cons defun (cons string.digit (cons (cons (protect V1842) ()) (cons (cons cond (cons (cons (cons = (cons "0" (cons (protect V1842) ()))) (cons "" ())) (cons (cons (cons = (cons "1" (cons (protect V1842) ()))) (cons "one" ())) (cons (cons (cons = (cons "2" (cons (protect V1842) ()))) (cons "two" ())) (cons (cons (cons = (cons "3" (cons (protect V1842) ()))) (cons "three" ())) (cons (cons (cons = (cons "4" (cons (protect V1842) ()))) (cons "four" ())) (cons (cons (cons = (cons "5" (cons (protect V1842) ()))) (cons "five" ())) (cons (cons (cons = (cons "6" (cons (protect V1842) ()))) (cons "six" ())) (cons (cons (cons = (cons "7" (cons (protect V1842) ()))) (cons "seven" ())) (cons (cons (cons = (cons "8" (cons (protect V1842) ()))) (cons "eight" ())) (cons (cons (cons = (cons "9" (cons (protect V1842) ()))) (cons "nine" ())) (cons (cons true (cons (cons shen.f-error (cons string.digit ())) ())) ())))))))))))) ()))))) (do (shen.record-kl string.triples (cons defun (cons string.triples (cons (cons (protect V1844) ()) (cons (cons string.triples-h (cons (cons reverse (cons (protect V1844) ())) (cons () ()))) ()))))) (do (shen.record-kl string.triples-h (cons defun (cons string.triples-h (cons (cons (protect V1846) (cons (protect V1847) ())) (cons (cons cond (cons (cons (cons and (cons (cons cons? (cons (protect V1846) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V1846) ())) ())) (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V1846) ())) ())) ())) ()))) ()))) (cons (cons string.triples-h (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V1846) ())) ())) ())) (cons (cons cons (cons (cons reverse (cons (cons cons (cons (cons hd (cons (protect V1846) ())) (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V1846) ())) ())) (cons (cons cons (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V1846) ())) ())) ())) (cons () ()))) ()))) ()))) ())) (cons (protect V1847) ()))) ()))) ())) (cons (cons true (cons (cons cons (cons (cons reverse (cons (protect V1846) ())) (cons (protect V1847) ()))) ())) ()))) ()))))) (do (shen.record-kl string.digits (cons defun (cons string.digits (cons (cons (protect V1850) ()) (cons (cons cond (cons (cons (cons and (cons (cons cons? (cons (protect V1850) ())) (cons (cons and (cons (cons = (cons "0" (cons (cons hd (cons (protect V1850) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V1850) ())) ())) (cons (cons and (cons (cons = (cons "0" (cons (cons hd (cons (cons tl (cons (protect V1850) ())) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V1850) ())) ())) ())) (cons (cons and (cons (cons = (cons "0" (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V1850) ())) ())) ())) ()))) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V1850) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) ()))) ()))) (cons "" ())) (cons (cons (cons and (cons (cons cons? (cons (protect V1850) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V1850) ())) ())) (cons (cons and (cons (cons = (cons "0" (cons (cons hd (cons (cons tl (cons (protect V1850) ())) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V1850) ())) ())) ())) (cons (cons and (cons (cons = (cons "0" (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V1850) ())) ())) ())) ()))) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V1850) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) ()))) (cons (cons @s (cons (cons string.digit (cons (cons hd (cons (protect V1850) ())) ())) (cons (cons @s (cons " " (cons "hundred" ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V1850) ())) (cons (cons and (cons (cons = (cons "0" (cons (cons hd (cons (protect V1850) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V1850) ())) ())) (cons (cons and (cons (cons = (cons "0" (cons (cons hd (cons (cons tl (cons (protect V1850) ())) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V1850) ())) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V1850) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) ()))) (cons (cons @s (cons "a" (cons (cons @s (cons "n" (cons (cons @s (cons "d" (cons (cons @s (cons " " (cons (cons string.digit (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V1850) ())) ())) ())) ())) ()))) ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V1850) ())) (cons (cons and (cons (cons = (cons "0" (cons (cons hd (cons (protect V1850) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V1850) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V1850) ())) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V1850) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) (cons (cons @s (cons "a" (cons (cons @s (cons "n" (cons (cons @s (cons "d" (cons (cons @s (cons " " (cons (cons string.tens (cons (cons hd (cons (cons tl (cons (protect V1850) ())) ())) (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V1850) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V1850) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V1850) ())) ())) (cons (cons and (cons (cons = (cons "0" (cons (cons hd (cons (cons tl (cons (protect V1850) ())) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V1850) ())) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V1850) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) (cons (cons @s (cons (cons string.digit (cons (cons hd (cons (protect V1850) ())) ())) (cons (cons @s (cons " " (cons (cons @s (cons "h" (cons (cons @s (cons "u" (cons (cons @s (cons "n" (cons (cons @s (cons "d" (cons (cons @s (cons "r" (cons (cons @s (cons "e" (cons (cons @s (cons "d" (cons (cons @s (cons " " (cons (cons @s (cons "a" (cons (cons @s (cons "n" (cons (cons @s (cons "d" (cons (cons @s (cons " " (cons (cons string.digit (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V1850) ())) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V1850) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V1850) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V1850) ())) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V1850) ())) ())) ())) ()))) ()))) ()))) ()))) (cons (cons @s (cons (cons string.digit (cons (cons hd (cons (protect V1850) ())) ())) (cons (cons @s (cons " " (cons (cons @s (cons "h" (cons (cons @s (cons "u" (cons (cons @s (cons "n" (cons (cons @s (cons "d" (cons (cons @s (cons "r" (cons (cons @s (cons "e" (cons (cons @s (cons "d" (cons (cons @s (cons " " (cons (cons @s (cons "a" (cons (cons @s (cons "n" (cons (cons @s (cons "d" (cons (cons @s (cons " " (cons (cons string.tens (cons (cons hd (cons (cons tl (cons (protect V1850) ())) ())) (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V1850) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V1850) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V1850) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (protect V1850) ())) ())) ()))) ()))) ()))) (cons (cons string.tens (cons (cons hd (cons (protect V1850) ())) (cons (cons hd (cons (cons tl (cons (protect V1850) ())) ())) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V1850) ())) (cons (cons = (cons () (cons (cons tl (cons (protect V1850) ())) ()))) ()))) (cons (cons string.digit (cons (cons hd (cons (protect V1850) ())) ())) ())) (cons (cons (cons = (cons () (cons (protect V1850) ()))) (cons "" ())) (cons (cons true (cons (cons shen.f-error (cons string.digits ())) ())) ()))))))))))) ()))))) (do (shen.record-kl string.tens (cons defun (cons string.tens (cons (cons (protect V1852) (cons (protect V1853) ())) (cons (cons cond (cons (cons (cons = (cons "1" (cons (protect V1852) ()))) (cons (cons if (cons (cons = (cons (protect V1853) (cons "0" ()))) (cons "ten" (cons (cons if (cons (cons = (cons (protect V1853) (cons "1" ()))) (cons "eleven" (cons (cons if (cons (cons = (cons (protect V1853) (cons "2" ()))) (cons "twelve" (cons (cons if (cons (cons = (cons (protect V1853) (cons "3" ()))) (cons "thirteen" (cons (cons if (cons (cons = (cons (protect V1853) (cons "4" ()))) (cons "fourteen" (cons (cons if (cons (cons = (cons (protect V1853) (cons "5" ()))) (cons "fifteen" (cons (cons if (cons (cons = (cons (protect V1853) (cons "6" ()))) (cons "sixteen" (cons (cons if (cons (cons = (cons (protect V1853) (cons "7" ()))) (cons "seventeen" (cons (cons if (cons (cons = (cons (protect V1853) (cons "8" ()))) (cons "eighteen" (cons (cons if (cons (cons = (cons (protect V1853) (cons "9" ()))) (cons "nineteen" (cons (cons simple-error (cons "error: cases exhausted" ())) ())))) ())))) ())))) ())))) ())))) ())))) ())))) ())))) ())))) ())))) ())) (cons (cons (cons = (cons "2" (cons (protect V1852) ()))) (cons (cons @s (cons "t" (cons (cons @s (cons "w" (cons (cons @s (cons "e" (cons (cons @s (cons "n" (cons (cons @s (cons "t" (cons (cons @s (cons "y" (cons (cons @s (cons " " (cons (cons string.digit (cons (protect V1853) ())) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ())) (cons (cons (cons = (cons "3" (cons (protect V1852) ()))) (cons (cons @s (cons "t" (cons (cons @s (cons "h" (cons (cons @s (cons "i" (cons (cons @s (cons "r" (cons (cons @s (cons "t" (cons (cons @s (cons "y" (cons (cons @s (cons " " (cons (cons string.digit (cons (protect V1853) ())) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ())) (cons (cons (cons = (cons "4" (cons (protect V1852) ()))) (cons (cons @s (cons "f" (cons (cons @s (cons "o" (cons (cons @s (cons "r" (cons (cons @s (cons "t" (cons (cons @s (cons "y" (cons (cons @s (cons " " (cons (cons string.digit (cons (protect V1853) ())) ()))) ()))) ()))) ()))) ()))) ()))) ())) (cons (cons (cons = (cons "5" (cons (protect V1852) ()))) (cons (cons @s (cons "f" (cons (cons @s (cons "i" (cons (cons @s (cons "f" (cons (cons @s (cons "t" (cons (cons @s (cons "y" (cons (cons @s (cons " " (cons (cons string.digit (cons (protect V1853) ())) ()))) ()))) ()))) ()))) ()))) ()))) ())) (cons (cons (cons = (cons "6" (cons (protect V1852) ()))) (cons (cons @s (cons "s" (cons (cons @s (cons "i" (cons (cons @s (cons "x" (cons (cons @s (cons "t" (cons (cons @s (cons "y" (cons (cons @s (cons " " (cons (cons string.digit (cons (protect V1853) ())) ()))) ()))) ()))) ()))) ()))) ()))) ())) (cons (cons (cons = (cons "7" (cons (protect V1852) ()))) (cons (cons @s (cons "s" (cons (cons @s (cons "e" (cons (cons @s (cons "v" (cons (cons @s (cons "e" (cons (cons @s (cons "n" (cons (cons @s (cons "t" (cons (cons @s (cons "y" (cons (cons @s (cons " " (cons (cons string.digit (cons (protect V1853) ())) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ())) (cons (cons (cons = (cons "8" (cons (protect V1852) ()))) (cons (cons @s (cons "e" (cons (cons @s (cons "i" (cons (cons @s (cons "g" (cons (cons @s (cons "h" (cons (cons @s (cons "t" (cons (cons @s (cons "y" (cons (cons @s (cons " " (cons (cons string.digit (cons (protect V1853) ())) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ())) (cons (cons (cons = (cons "9" (cons (protect V1852) ()))) (cons (cons @s (cons "n" (cons (cons @s (cons "i" (cons (cons @s (cons "n" (cons (cons @s (cons "e" (cons (cons @s (cons "t" (cons (cons @s (cons "y" (cons (cons @s (cons " " (cons (cons string.digit (cons (protect V1853) ())) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons string.tens ())) ())) ()))))))))))) ()))))) (do (shen.record-kl string.scale (cons defun (cons string.scale (cons (cons (protect V1856) ()) (cons (cons cond (cons (cons (cons and (cons (cons cons? (cons (protect V1856) ())) (cons (cons = (cons () (cons (cons tl (cons (protect V1856) ())) ()))) ()))) (cons (cons hd (cons (protect V1856) ())) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V1856) ())) (cons (cons = (cons "" (cons (cons hd (cons (protect V1856) ())) ()))) ()))) (cons (cons string.scale (cons (cons tl (cons (protect V1856) ())) ())) ())) (cons (cons (cons cons? (cons (protect V1856) ())) (cons (cons @s (cons (cons hd (cons (protect V1856) ())) (cons (cons @s (cons (cons string.units (cons (cons length (cons (protect V1856) ())) ())) (cons (cons string.scale (cons (cons tl (cons (protect V1856) ())) ())) ()))) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons string.scale ())) ())) ()))))) ()))))) (do (shen.record-kl string.units (cons defun (cons string.units (cons (cons (protect V1860) ()) (cons (cons cond (cons (cons (cons = (cons 2 (cons (protect V1860) ()))) (cons " thousand " ())) (cons (cons (cons = (cons 3 (cons (protect V1860) ()))) (cons " million " ())) (cons (cons (cons = (cons 4 (cons (protect V1860) ()))) (cons " billion " ())) (cons (cons (cons = (cons 5 (cons (protect V1860) ()))) (cons " trillion " ())) (cons (cons true (cons (cons simple-error (cons "this number has a magnitude beyond our text representation" ())) ())) ())))))) ()))))) (do (shen.record-kl string>? (cons defun (cons string>? (cons (cons (protect V1866) (cons (protect V1867) ())) (cons (cons cond (cons (cons (cons = (cons "" (cons (protect V1866) ()))) (cons false ())) (cons (cons (cons = (cons "" (cons (protect V1867) ()))) (cons true ())) (cons (cons (cons and (cons (cons shen.+string? (cons (protect V1866) ())) (cons (cons shen.+string? (cons (protect V1867) ())) ()))) (cons (cons let (cons (protect W1868) (cons (cons string->n (cons (cons hdstr (cons (protect V1866) ())) ())) (cons (cons let (cons (protect W1869) (cons (cons string->n (cons (cons hdstr (cons (protect V1867) ())) ())) (cons (cons if (cons (cons > (cons (protect W1868) (cons (protect W1869) ()))) (cons true (cons (cons if (cons (cons < (cons (protect W1868) (cons (protect W1869) ()))) (cons false (cons (cons string>? (cons (cons tlstr (cons (protect V1866) ())) (cons (cons tlstr (cons (protect V1867) ())) ()))) ())))) ())))) ())))) ())))) ())) (cons (cons true (cons (cons shen.f-error (cons string>? ())) ())) ()))))) ()))))) (do (shen.record-kl stringn (cons (cons hdstr (cons (protect V1876) ())) ())) (cons (cons let (cons (protect W1879) (cons (cons string->n (cons (cons hdstr (cons (protect V1877) ())) ())) (cons (cons if (cons (cons < (cons (protect W1878) (cons (protect W1879) ()))) (cons true (cons (cons if (cons (cons > (cons (protect W1878) (cons (protect W1879) ()))) (cons false (cons (cons string=? (cons defun (cons string>=? (cons (cons (protect V1882) (cons (protect V1883) ())) (cons (cons or (cons (cons = (cons (protect V1882) (cons (protect V1883) ()))) (cons (cons string>? (cons (protect V1882) (cons (protect V1883) ()))) ()))) ()))))) (do (shen.record-kl string<=? (cons defun (cons string<=? (cons (cons (protect V1886) (cons (protect V1887) ())) (cons (cons or (cons (cons = (cons (protect V1886) (cons (protect V1887) ()))) (cons (cons stringstrings (cons (protect W1900) (cons () ()))) (cons (cons let (cons (protect W1902) (cons (cons compile (cons (cons fn (cons string. ())) (cons (protect W1901) ()))) (cons (cons let (cons (protect W1903) (cons (cons file-extension (cons (protect V1898) (cons (protect V1899) ()))) (cons (cons let (cons (protect W1904) (cons (cons write-to-file (cons (protect W1903) (cons (protect W1902) ()))) (cons (protect W1903) ())))) ())))) ())))) ())))) ())))) ()))))) (do (shen.record-kl string.bytes->strings (cons defun (cons string.bytes->strings (cons (cons (protect V1907) (cons (protect V1908) ())) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V1907) ()))) (cons (cons reverse (cons (protect V1908) ())) ())) (cons (cons (cons cons? (cons (protect V1907) ())) (cons (cons string.bytes->strings (cons (cons tl (cons (protect V1907) ())) (cons (cons cons (cons (cons n->string (cons (cons hd (cons (protect V1907) ())) ())) (cons (protect V1908) ()))) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons string.bytes->strings ())) ())) ())))) ()))))) (do (shen.record-kl render (cons defun (cons render (cons (cons (protect V1911) ()) (cons (cons compile (cons (cons fn (cons string. ())) (cons (cons string->list (cons (protect V1911) ())) ()))) ()))))) (do (shen.record-kl string.rendered? (cons defun (cons string.rendered? (cons (cons (protect V1917) ()) (cons (cons cond (cons (cons (cons = (cons "" (cons (protect V1917) ()))) (cons true ())) (cons (cons (cons and (cons (cons shen.+string? (cons (protect V1917) ())) (cons (cons = (cons "{" (cons (cons hdstr (cons (protect V1917) ())) ()))) ()))) (cons false ())) (cons (cons (cons shen.+string? (cons (protect V1917) ())) (cons (cons string.rendered? (cons (cons tlstr (cons (protect V1917) ())) ())) ())) (cons (cons true (cons (cons shen.f-error (cons string.rendered? ())) ())) ()))))) ()))))) (do (shen.record-kl string. (cons defun (cons string. (cons (cons (protect V1924) ()) (cons (cons let (cons (protect W1925) (cons (cons if (cons (cons shen.hds=? (cons (protect V1924) (cons "{" ()))) (cons (cons let (cons (protect W1926) (cons (cons tail (cons (protect V1924) ())) (cons (cons let (cons (protect W1927) (cons (cons (cons fn (cons string. ())) (cons (protect W1926) ())) (cons (cons if (cons (cons shen.parse-failure? (cons (protect W1927) ())) (cons (cons shen.parse-failure ()) (cons (cons let (cons (protect W1928) (cons (cons shen.<-out (cons (protect W1927) ())) (cons (cons let (cons (protect W1929) (cons (cons shen.in-> (cons (protect W1927) ())) (cons (cons let (cons (protect W1930) (cons (cons (cons fn (cons string. ())) (cons (protect W1929) ())) (cons (cons if (cons (cons shen.parse-failure? (cons (protect W1930) ())) (cons (cons shen.parse-failure ()) (cons (cons let (cons (protect W1931) (cons (cons shen.in-> (cons (protect W1930) ())) (cons (cons let (cons (protect W1932) (cons (cons (cons fn (cons string. ())) (cons (protect W1931) ())) (cons (cons if (cons (cons shen.parse-failure? (cons (protect W1932) ())) (cons (cons shen.parse-failure ()) (cons (cons let (cons (protect W1933) (cons (cons shen.<-out (cons (protect W1932) ())) (cons (cons let (cons (protect W1934) (cons (cons shen.in-> (cons (protect W1932) ())) (cons (cons if (cons (cons shen.hds=? (cons (protect W1934) (cons "}" ()))) (cons (cons let (cons (protect W1935) (cons (cons tail (cons (protect W1934) ())) (cons (cons let (cons (protect W1936) (cons (cons (cons fn (cons string. ())) (cons (protect W1935) ())) (cons (cons if (cons (cons shen.parse-failure? (cons (protect W1936) ())) (cons (cons shen.parse-failure ()) (cons (cons let (cons (protect W1937) (cons (cons shen.<-out (cons (protect W1936) ())) (cons (cons let (cons (protect W1938) (cons (cons shen.in-> (cons (protect W1936) ())) (cons (cons shen.comb (cons (protect W1938) (cons (cons cn (cons (cons string.recapply (cons (cons fn (cons (cons intern (cons (protect W1928) ())) ())) (cons (protect W1933) ()))) (cons (protect W1937) ()))) ()))) ())))) ())))) ())))) ())))) ())))) (cons (cons shen.parse-failure ()) ())))) ())))) ())))) ())))) ())))) ())))) ())))) ())))) ())))) ())))) ())))) ())))) ())))) (cons (cons shen.parse-failure ()) ())))) (cons (cons if (cons (cons shen.parse-failure? (cons (protect W1925) ())) (cons (cons let (cons (protect W1939) (cons (cons if (cons (cons shen.hds=? (cons (protect V1924) (cons "{" ()))) (cons (cons let (cons (protect W1940) (cons (cons tail (cons (protect V1924) ())) (cons (cons let (cons (protect W1941) (cons (cons (cons fn (cons string. ())) (cons (protect W1940) ())) (cons (cons if (cons (cons shen.parse-failure? (cons (protect W1941) ())) (cons (cons shen.parse-failure ()) (cons (cons let (cons (protect W1942) (cons (cons shen.<-out (cons (protect W1941) ())) (cons (cons let (cons (protect W1943) (cons (cons shen.in-> (cons (protect W1941) ())) (cons (cons if (cons (cons shen.hds=? (cons (protect W1943) (cons "}" ()))) (cons (cons let (cons (protect W1944) (cons (cons tail (cons (protect W1943) ())) (cons (cons let (cons (protect W1945) (cons (cons (cons fn (cons string. ())) (cons (protect W1944) ())) (cons (cons if (cons (cons shen.parse-failure? (cons (protect W1945) ())) (cons (cons shen.parse-failure ()) (cons (cons let (cons (protect W1946) (cons (cons shen.<-out (cons (protect W1945) ())) (cons (cons let (cons (protect W1947) (cons (cons shen.in-> (cons (protect W1945) ())) (cons (cons shen.comb (cons (protect W1947) (cons (cons cn (cons (cons (cons intern (cons (protect W1942) ())) ()) (cons (protect W1946) ()))) ()))) ())))) ())))) ())))) ())))) ())))) (cons (cons shen.parse-failure ()) ())))) ())))) ())))) ())))) ())))) ())))) (cons (cons shen.parse-failure ()) ())))) (cons (cons if (cons (cons shen.parse-failure? (cons (protect W1939) ())) (cons (cons let (cons (protect W1948) (cons (cons let (cons (protect W1949) (cons (cons (cons fn (cons string. ())) (cons (protect V1924) ())) (cons (cons if (cons (cons shen.parse-failure? (cons (protect W1949) ())) (cons (cons shen.parse-failure ()) (cons (cons let (cons (protect W1950) (cons (cons shen.<-out (cons (protect W1949) ())) (cons (cons let (cons (protect W1951) (cons (cons shen.in-> (cons (protect W1949) ())) (cons (cons let (cons (protect W1952) (cons (cons (cons fn (cons string. ())) (cons (protect W1951) ())) (cons (cons if (cons (cons shen.parse-failure? (cons (protect W1952) ())) (cons (cons shen.parse-failure ()) (cons (cons let (cons (protect W1953) (cons (cons shen.<-out (cons (protect W1952) ())) (cons (cons let (cons (protect W1954) (cons (cons shen.in-> (cons (protect W1952) ())) (cons (cons shen.comb (cons (protect W1954) (cons (cons cn (cons (protect W1950) (cons (protect W1953) ()))) ()))) ())))) ())))) ())))) ())))) ())))) ())))) ())))) ())))) (cons (cons if (cons (cons shen.parse-failure? (cons (protect W1948) ())) (cons (cons let (cons (protect W1955) (cons (cons let (cons (protect W1956) (cons (cons (cons (protect V1924) ())) (cons (cons if (cons (cons shen.parse-failure? (cons (protect W1956) ())) (cons (cons shen.parse-failure ()) (cons (cons let (cons (protect W1957) (cons (cons shen.in-> (cons (protect W1956) ())) (cons (cons shen.comb (cons (protect W1957) (cons "" ()))) ())))) ())))) ())))) (cons (cons if (cons (cons shen.parse-failure? (cons (protect W1955) ())) (cons (cons shen.parse-failure ()) (cons (protect W1955) ())))) ())))) (cons (protect W1948) ())))) ())))) (cons (protect W1939) ())))) ())))) (cons (protect W1925) ())))) ())))) ()))))) (do (shen.record-kl string. (cons defun (cons string. (cons (cons (protect V1961) ()) (cons (cons let (cons (protect W1962) (cons (cons if (cons (cons cons? (cons (protect V1961) ())) (cons (cons let (cons (protect W1963) (cons (cons head (cons (protect V1961) ())) (cons (cons let (cons (protect W1964) (cons (cons tail (cons (protect V1961) ())) (cons (cons if (cons (cons and (cons (cons not (cons (cons = (cons (protect W1963) (cons "}" ()))) ())) (cons (cons not (cons (cons = (cons (protect W1963) (cons "\" ()))) ())) ()))) (cons (cons shen.comb (cons (protect W1964) (cons (protect W1963) ()))) (cons (cons shen.parse-failure ()) ())))) ())))) ())))) (cons (cons shen.parse-failure ()) ())))) (cons (cons if (cons (cons shen.parse-failure? (cons (protect W1962) ())) (cons (cons shen.parse-failure ()) (cons (protect W1962) ())))) ())))) ()))))) (do (shen.record-kl string.recapply (cons defun (cons string.recapply (cons (cons (protect V1966) (cons (protect V1967) ())) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V1967) ()))) (cons (protect V1966) ())) (cons (cons (cons cons? (cons (protect V1967) ())) (cons (cons string.recapply (cons (cons (protect V1966) (cons (cons hd (cons (protect V1967) ())) ())) (cons (cons tl (cons (protect V1967) ())) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons string.recapply ())) ())) ())))) ()))))) (do (shen.record-kl string. (cons defun (cons string. (cons (cons (protect V1972) ()) (cons (cons let (cons (protect W1973) (cons (cons let (cons (protect W1974) (cons (cons (cons fn (cons string. ())) (cons (protect V1972) ())) (cons (cons if (cons (cons shen.parse-failure? (cons (protect W1974) ())) (cons (cons shen.parse-failure ()) (cons (cons let (cons (protect W1975) (cons (cons shen.<-out (cons (protect W1974) ())) (cons (cons let (cons (protect W1976) (cons (cons shen.in-> (cons (protect W1974) ())) (cons (cons if (cons (cons shen.hds=? (cons (protect W1976) (cons "\" ()))) (cons (cons let (cons (protect W1977) (cons (cons tail (cons (protect W1976) ())) (cons (cons let (cons (protect W1978) (cons (cons (cons fn (cons string. ())) (cons (protect W1977) ())) (cons (cons if (cons (cons shen.parse-failure? (cons (protect W1978) ())) (cons (cons shen.parse-failure ()) (cons (cons let (cons (protect W1979) (cons (cons shen.<-out (cons (protect W1978) ())) (cons (cons let (cons (protect W1980) (cons (cons shen.in-> (cons (protect W1978) ())) (cons (cons shen.comb (cons (protect W1980) (cons (cons cons (cons (protect W1975) (cons (protect W1979) ()))) ()))) ())))) ())))) ())))) ())))) ())))) (cons (cons shen.parse-failure ()) ())))) ())))) ())))) ())))) ())))) (cons (cons if (cons (cons shen.parse-failure? (cons (protect W1973) ())) (cons (cons let (cons (protect W1981) (cons (cons let (cons (protect W1982) (cons (cons (cons fn (cons string. ())) (cons (protect V1972) ())) (cons (cons if (cons (cons shen.parse-failure? (cons (protect W1982) ())) (cons (cons shen.parse-failure ()) (cons (cons let (cons (protect W1983) (cons (cons shen.<-out (cons (protect W1982) ())) (cons (cons let (cons (protect W1984) (cons (cons shen.in-> (cons (protect W1982) ())) (cons (cons shen.comb (cons (protect W1984) (cons (cons cons (cons (protect W1983) (cons () ()))) ()))) ())))) ())))) ())))) ())))) (cons (cons if (cons (cons shen.parse-failure? (cons (protect W1981) ())) (cons (cons shen.parse-failure ()) (cons (protect W1981) ())))) ())))) (cons (protect W1973) ())))) ())))) ()))))) (do (shen.record-kl string. (cons defun (cons string. (cons (cons (protect V1987) ()) (cons (cons let (cons (protect W1988) (cons (cons let (cons (protect W1989) (cons (cons string. (cons (protect V1987) ())) (cons (cons if (cons (cons shen.parse-failure? (cons (protect W1989) ())) (cons (cons shen.parse-failure ()) (cons (cons let (cons (protect W1990) (cons (cons shen.<-out (cons (protect W1989) ())) (cons (cons let (cons (protect W1991) (cons (cons shen.in-> (cons (protect W1989) ())) (cons (cons shen.comb (cons (protect W1991) (cons (protect W1990) ()))) ())))) ())))) ())))) ())))) (cons (cons if (cons (cons shen.parse-failure? (cons (protect W1988) ())) (cons (cons shen.parse-failure ()) (cons (protect W1988) ())))) ())))) ()))))) (do (shen.record-kl string. (cons defun (cons string. (cons (cons (protect V1995) ()) (cons (cons let (cons (protect W1996) (cons (cons if (cons (cons cons? (cons (protect V1995) ())) (cons (cons let (cons (protect W1997) (cons (cons head (cons (protect V1995) ())) (cons (cons let (cons (protect W1998) (cons (cons tail (cons (protect V1995) ())) (cons (cons if (cons (cons and (cons (cons not (cons (cons = (cons (protect W1997) (cons "}" ()))) ())) (cons (cons not (cons (cons = (cons (protect W1997) (cons "\" ()))) ())) ()))) (cons (cons shen.comb (cons (protect W1998) (cons (protect W1997) ()))) (cons (cons shen.parse-failure ()) ())))) ())))) ())))) (cons (cons shen.parse-failure ()) ())))) (cons (cons if (cons (cons shen.parse-failure? (cons (protect W1996) ())) (cons (cons shen.parse-failure ()) (cons (protect W1996) ())))) ())))) ()))))) (do (shen.record-kl string. (cons defun (cons string. (cons (cons (protect V2002) ()) (cons (cons let (cons (protect W2003) (cons (cons if (cons (cons cons? (cons (protect V2002) ())) (cons (cons let (cons (protect W2004) (cons (cons head (cons (protect V2002) ())) (cons (cons let (cons (protect W2005) (cons (cons tail (cons (protect V2002) ())) (cons (cons if (cons (cons whitespace? (cons (protect W2004) ())) (cons (cons shen.comb (cons (protect W2005) (cons string.skip ()))) (cons (cons shen.parse-failure ()) ())))) ())))) ())))) (cons (cons shen.parse-failure ()) ())))) (cons (cons if (cons (cons shen.parse-failure? (cons (protect W2003) ())) (cons (cons shen.parse-failure ()) (cons (protect W2003) ())))) ())))) ()))))) (do (shen.record-kl string. (cons defun (cons string. (cons (cons (protect V2008) ()) (cons (cons let (cons (protect W2009) (cons (cons let (cons (protect W2010) (cons (cons (cons fn (cons string. ())) (cons (protect V2008) ())) (cons (cons if (cons (cons shen.parse-failure? (cons (protect W2010) ())) (cons (cons shen.parse-failure ()) (cons (cons let (cons (protect W2011) (cons (cons shen.<-out (cons (protect W2010) ())) (cons (cons let (cons (protect W2012) (cons (cons shen.in-> (cons (protect W2010) ())) (cons (cons let (cons (protect W2013) (cons (cons (cons fn (cons string. ())) (cons (protect W2012) ())) (cons (cons if (cons (cons shen.parse-failure? (cons (protect W2013) ())) (cons (cons shen.parse-failure ()) (cons (cons let (cons (protect W2014) (cons (cons shen.<-out (cons (protect W2013) ())) (cons (cons let (cons (protect W2015) (cons (cons shen.in-> (cons (protect W2013) ())) (cons (cons shen.comb (cons (protect W2015) (cons (cons cn (cons (protect W2011) (cons (protect W2014) ()))) ()))) ())))) ())))) ())))) ())))) ())))) ())))) ())))) ())))) (cons (cons if (cons (cons shen.parse-failure? (cons (protect W2009) ())) (cons (cons let (cons (protect W2016) (cons (cons let (cons (protect W2017) (cons (cons (cons (protect V2008) ())) (cons (cons if (cons (cons shen.parse-failure? (cons (protect W2017) ())) (cons (cons shen.parse-failure ()) (cons (cons let (cons (protect W2018) (cons (cons shen.in-> (cons (protect W2017) ())) (cons (cons shen.comb (cons (protect W2018) (cons "" ()))) ())))) ())))) ())))) (cons (cons if (cons (cons shen.parse-failure? (cons (protect W2016) ())) (cons (cons shen.parse-failure ()) (cons (protect W2016) ())))) ())))) (cons (protect W2009) ())))) ())))) ()))))) (do (shen.record-kl string. (cons defun (cons string. (cons (cons (protect V2022) ()) (cons (cons let (cons (protect W2023) (cons (cons if (cons (cons cons? (cons (protect V2022) ())) (cons (cons let (cons (protect W2024) (cons (cons head (cons (protect V2022) ())) (cons (cons let (cons (protect W2025) (cons (cons tail (cons (protect V2022) ())) (cons (cons if (cons (cons and (cons (cons not (cons (cons = (cons (protect W2024) (cons "}" ()))) ())) (cons (cons and (cons (cons not (cons (cons = (cons (protect W2024) (cons "\" ()))) ())) (cons (cons not (cons (cons whitespace? (cons (protect W2024) ())) ())) ()))) ()))) (cons (cons shen.comb (cons (protect W2025) (cons (protect W2024) ()))) (cons (cons shen.parse-failure ()) ())))) ())))) ())))) (cons (cons shen.parse-failure ()) ())))) (cons (cons if (cons (cons shen.parse-failure? (cons (protect W2023) ())) (cons (cons shen.parse-failure ()) (cons (protect W2023) ())))) ())))) ()))))) (do (shen.record-kl vector.vector-macros (cons defun (cons vector.vector-macros (cons (cons (protect V2049) ()) (cons (cons cond (cons (cons (cons and (cons (cons cons? (cons (protect V2049) ())) (cons (cons and (cons (cons = (cons := (cons (cons hd (cons (protect V2049) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V2049) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) (cons (cons vector.<-array (cons (cons hd (cons (cons tl (cons (protect V2049) ())) ())) (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V2049) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V2049) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) (cons (cons and (cons (cons = (cons := (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) ())) (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) (cons (cons vector.key (cons (cons hd (cons (protect V2049) ())) (cons (cons hd (cons (cons tl (cons (protect V2049) ())) ())) (cons (cons vector.array-> (cons (cons hd (cons (protect V2049) ())) (cons (cons hd (cons (cons tl (cons (protect V2049) ())) ())) (cons (cons vector.<-array (cons (cons hd (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) ())) (cons (cons hd (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) ())) ())) ()))) ())))) (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) ())) ())) ()))))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V2049) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V2049) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) (cons (cons and (cons (cons = (cons := (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) ()))) (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) ())) ()))) ()))) ()))) ()))) (cons (cons vector.key (cons (cons hd (cons (protect V2049) ())) (cons (cons hd (cons (cons tl (cons (protect V2049) ())) ())) (cons (cons vector.array-> (cons (cons hd (cons (protect V2049) ())) (cons (cons hd (cons (cons tl (cons (protect V2049) ())) ())) (cons (cons hd (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) ())) ())))) (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) ())) ()))))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V2049) ())) (cons (cons and (cons (cons = (cons vector.array-> (cons (cons hd (cons (protect V2049) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V2049) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) ()))) (cons (cons vector.array-> (cons (cons hd (cons (cons tl (cons (protect V2049) ())) ())) (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) (cons (cons hd (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) ())) ())))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V2049) ())) (cons (cons and (cons (cons = (cons array (cons (cons hd (cons (protect V2049) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V2049) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ()))) ()))) ()))) ()))) (cons (cons vector.build-array (cons (cons hd (cons (cons tl (cons (protect V2049) ())) ())) ())) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V2049) ())) (cons (cons and (cons (cons = (cons populate (cons (cons hd (cons (protect V2049) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V2049) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) (cons (cons and (cons (cons cons? (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) ())) (cons (cons and (cons (cons = (cons cons (cons (cons hd (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) ())) ())) ())) (cons (cons and (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) ())) ())) ())) ()))) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) (cons (cons vector.unfold-populate (cons (cons hd (cons (cons tl (cons (protect V2049) ())) ())) (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V2049) ())) (cons (cons and (cons (cons = (cons vector->list (cons (cons hd (cons (protect V2049) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V2049) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ()))) ()))) ()))) ()))) (cons (cons cons (cons vector->list (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V2049) ())) ())) (cons (cons cons (cons () (cons () ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V2049) ())) (cons (cons and (cons (cons = (cons v-op1 (cons (cons hd (cons (protect V2049) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V2049) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) (cons (cons cons (cons v-op1 (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V2049) ())) ())) (cons (cons cons (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) (cons (cons cons (cons () (cons () ()))) ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V2049) ())) (cons (cons and (cons (cons = (cons v-op2 (cons (cons hd (cons (protect V2049) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V2049) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) ()))) (cons (cons cons (cons v-op2 (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V2049) ())) ())) (cons (cons cons (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) (cons (cons cons (cons (cons hd (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V2049) ())) ())) ())) ())) (cons (cons cons (cons () (cons () ()))) ()))) ()))) ()))) ()))) ())) (cons (cons true (cons (protect V2049) ())) ()))))))))))) ()))))) (do (shen.record-kl vector.key (cons defun (cons vector.key (cons (cons (protect V2065) (cons (protect V2066) (cons (protect V2067) (cons (protect V2068) ())))) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V2068) ()))) (cons (protect V2067) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V2068) ())) (cons (cons and (cons (cons = (cons error (cons (cons hd (cons (protect V2068) ())) ()))) (cons (cons = (cons () (cons (cons tl (cons (protect V2068) ())) ()))) ()))) ()))) (cons (protect V2067) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V2068) ())) (cons (cons and (cons (cons = (cons ignore (cons (cons hd (cons (protect V2068) ())) ()))) (cons (cons = (cons () (cons (cons tl (cons (protect V2068) ())) ()))) ()))) ()))) (cons (cons cons (cons trap-error (cons (cons cons (cons (protect V2067) (cons (cons cons (cons (cons cons (cons /. (cons (cons cons (cons (cons newv ()) (cons (cons cons (cons (protect V2065) (cons () ()))) ()))) ()))) (cons () ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V2068) ())) (cons (cons and (cons (cons = (cons insert (cons (cons hd (cons (protect V2068) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V2068) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (protect V2068) ())) ())) ()))) ()))) ()))) ()))) (cons (cons cons (cons trap-error (cons (cons cons (cons (protect V2067) (cons (cons cons (cons (cons cons (cons /. (cons (cons cons (cons (cons newv ()) (cons (cons cons (cons (cons cons (cons (protect V2065) (cons (cons cons (cons (protect V2066) (cons (cons cons (cons := (cons (cons tl (cons (protect V2068) ())) ()))) ()))) ()))) (cons () ()))) ()))) ()))) (cons () ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V2068) ())) (cons (cons and (cons (cons = (cons overwrite (cons (cons hd (cons (protect V2068) ())) ()))) (cons (cons = (cons () (cons (cons tl (cons (protect V2068) ())) ()))) ()))) ()))) (cons (cons cons (cons trap-error (cons (cons cons (cons (protect V2067) (cons (cons cons (cons (cons cons (cons /. (cons (cons cons (cons (cons newv ()) (cons (cons cons (cons (cons cons (cons depopulate (cons (cons cons (cons (protect V2065) (cons (cons cons (cons (protect V2066) (cons () ()))) ()))) ()))) (cons () ()))) ()))) ()))) (cons () ()))) ()))) ()))) ())) (cons (cons true (cons (cons simple-error (cons (cons cn (cons "key not recognised " (cons (cons shen.app (cons (protect V2068) (cons " -" (cons shen.a ())))) ()))) ())) ())) ()))))))) ()))))) (do (shen.record-kl vector.build-array (cons defun (cons vector.build-array (cons (cons (protect V2073) ()) (cons (cons cond (cons (cons (cons and (cons (cons cons? (cons (protect V2073) ())) (cons (cons and (cons (cons = (cons cons (cons (cons hd (cons (protect V2073) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V2073) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V2073) ())) ())) ())) (cons (cons and (cons (cons = (cons () (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V2073) ())) ())) ())) ()))) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V2073) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) ()))) (cons (cons cons (cons vector (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V2073) ())) ())) (cons () ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V2073) ())) (cons (cons and (cons (cons = (cons cons (cons (cons hd (cons (protect V2073) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V2073) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V2073) ())) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V2073) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) (cons (cons let (cons (protect W2074) (cons (cons newv ()) (cons (cons let (cons (protect W2075) (cons (cons newv ()) (cons (cons cons (cons let (cons (cons cons (cons (protect W2075) (cons (cons cons (cons (cons cons (cons vector (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V2073) ())) ())) (cons () ()))) ()))) (cons (cons cons (cons (cons cons (cons for (cons (cons cons (cons (protect W2074) (cons (cons cons (cons = (cons (cons cons (cons 1 (cons (cons cons (cons (cons cons (cons <= (cons (cons cons (cons (protect W2074) (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V2073) ())) ())) (cons () ()))) ()))) ()))) (cons (cons cons (cons (cons cons (cons vector-> (cons (cons cons (cons (protect W2075) (cons (cons cons (cons (protect W2074) (cons (cons cons (cons (cons vector.build-array (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V2073) ())) ())) ())) ())) (cons () ()))) ()))) ()))) ()))) (cons () ()))) ()))) ()))) ()))) ()))) ()))) (cons () ()))) ()))) ()))) ()))) ())))) ())))) ())) (cons (cons true (cons (cons simple-error (cons (cons cn (cons "array cannot macro expand the dimensional argument " (cons (cons shen.app (cons (protect V2073) (cons " -" (cons shen.r ())))) ()))) ())) ())) ())))) ()))))) (do (shen.record-kl depopulate (cons defun (cons depopulate (cons (cons (protect V2079) (cons (protect V2080) ())) (cons (cons cond (cons (cons (cons and (cons (cons cons? (cons (protect V2080) ())) (cons (cons = (cons () (cons (cons tl (cons (protect V2080) ())) ()))) ()))) (cons (cons address-> (cons (protect V2079) (cons (cons hd (cons (protect V2080) ())) (cons (cons fail ()) ())))) ())) (cons (cons (cons cons? (cons (protect V2080) ())) (cons (cons do (cons (cons depopulate (cons (cons <-vector (cons (protect V2079) (cons (cons hd (cons (protect V2080) ())) ()))) (cons (cons tl (cons (protect V2080) ())) ()))) (cons (protect V2079) ()))) ())) (cons (cons true (cons (cons simple-error (cons (cons cn (cons "depopulate cannot use the dimensional argument " (cons (cons shen.app (cons (protect V2080) (cons " -" (cons shen.s ())))) ()))) ())) ())) ())))) ()))))) (do (shen.record-kl populated? (cons defun (cons populated? (cons (cons (protect V2083) (cons (protect V2084) ())) (cons (cons cond (cons (cons (cons and (cons (cons cons? (cons (protect V2084) ())) (cons (cons = (cons () (cons (cons tl (cons (protect V2084) ())) ()))) ()))) (cons (cons not (cons (cons = (cons (cons <-address (cons (protect V2083) (cons (cons hd (cons (protect V2084) ())) ()))) (cons (cons fail ()) ()))) ())) ())) (cons (cons (cons cons? (cons (protect V2084) ())) (cons (cons populated? (cons (cons <-address (cons (protect V2083) (cons (cons hd (cons (protect V2084) ())) ()))) (cons (cons tl (cons (protect V2084) ())) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons populated? ())) ())) ())))) ()))))) (do (shen.record-kl vector.unfold-populate (cons defun (cons vector.unfold-populate (cons (cons (protect V2087) (cons (protect V2088) ())) (cons (cons cond (cons (cons (cons and (cons (cons cons? (cons (protect V2088) ())) (cons (cons and (cons (cons = (cons cons (cons (cons hd (cons (protect V2088) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V2088) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V2088) ())) ())) ())) (cons (cons and (cons (cons = (cons () (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V2088) ())) ())) ())) ()))) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V2088) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) ()))) (cons (cons cons (cons populate (cons (cons cons (cons (protect V2087) (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V2088) ())) ())) (cons () ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V2088) ())) (cons (cons and (cons (cons = (cons cons (cons (cons hd (cons (protect V2088) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V2088) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V2088) ())) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V2088) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) (cons (cons cons (cons populate (cons (cons cons (cons (cons cons (cons /. (cons (cons cons (cons (cons newv ()) (cons (cons cons (cons (cons vector.unfold-populate (cons (protect V2087) (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V2088) ())) ())) ())) ()))) (cons () ()))) ()))) ()))) (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V2088) ())) ())) (cons () ()))) ()))) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons vector.unfold-populate ())) ())) ())))) ()))))) (do (shen.record-kl populate (cons defun (cons populate (cons (cons (protect V2094) (cons (protect V2095) ())) (cons (cons let (cons (protect W2096) (cons (cons absvector (cons (cons + (cons (protect V2095) (cons 1 ()))) ())) (cons (cons let (cons (protect W2097) (cons (cons address-> (cons (protect W2096) (cons 0 (cons (protect V2095) ())))) (cons (cons for (cons 1 (cons (cons lambda (cons (protect Z2098) (cons (cons <= (cons (protect Z2098) (cons (protect V2095) ()))) ()))) (cons (cons lambda (cons (protect Z2099) (cons (cons address-> (cons (protect W2096) (cons (protect Z2099) (cons (cons (protect V2094) (cons (protect Z2099) ())) ())))) ()))) (cons (cons lambda (cons (protect Z2100) (cons (cons + (cons 1 (cons (protect Z2100) ()))) ()))) (cons (cons lambda (cons (protect Z2101) (cons (cons lambda (cons (protect Z2102) (cons (cons do (cons (protect Z2101) (cons (protect Z2102) ()))) ()))) ()))) ())))))) ())))) ())))) ()))))) (do (shen.record-kl vector.<-array (cons defun (cons vector.<-array (cons (cons (protect V2107) (cons (protect V2108) ())) (cons (cons cond (cons (cons (cons and (cons (cons cons? (cons (protect V2108) ())) (cons (cons and (cons (cons = (cons cons (cons (cons hd (cons (protect V2108) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V2108) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V2108) ())) ())) ())) (cons (cons and (cons (cons = (cons () (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V2108) ())) ())) ())) ()))) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V2108) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) ()))) (cons (cons cons (cons <-vector (cons (cons cons (cons (protect V2107) (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V2108) ())) ())) (cons () ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V2108) ())) (cons (cons and (cons (cons = (cons cons (cons (cons hd (cons (protect V2108) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V2108) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V2108) ())) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V2108) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) (cons (cons vector.<-array (cons (cons cons (cons <-vector (cons (cons cons (cons (protect V2107) (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V2108) ())) ())) (cons () ()))) ()))) ()))) (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V2108) ())) ())) ())) ()))) ())) (cons (cons true (cons (cons simple-error (cons (cons cn (cons "cannot macro expand the dimensional argument " (cons (cons shen.app (cons (protect V2108) (cons " -" (cons shen.r ())))) ()))) ())) ())) ())))) ()))))) (do (shen.record-kl vector.array-> (cons defun (cons vector.array-> (cons (cons (protect V2111) (cons (protect V2112) (cons (protect V2113) ()))) (cons (cons cond (cons (cons (cons and (cons (cons cons? (cons (protect V2112) ())) (cons (cons and (cons (cons = (cons cons (cons (cons hd (cons (protect V2112) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V2112) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V2112) ())) ())) ())) (cons (cons and (cons (cons = (cons () (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V2112) ())) ())) ())) ()))) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V2112) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) ()))) (cons (cons cons (cons vector-> (cons (cons cons (cons (protect V2111) (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V2112) ())) ())) (cons (cons cons (cons (protect V2113) (cons () ()))) ()))) ()))) ()))) ())) (cons (cons true (cons (cons let (cons (protect W2114) (cons (cons newv ()) (cons (cons cons (cons let (cons (cons cons (cons (protect W2114) (cons (cons cons (cons (protect V2111) (cons (cons cons (cons (cons vector.unfold-vector-assignment (cons (protect W2114) (cons (protect W2114) (cons (protect V2112) (cons (protect V2113) ()))))) (cons () ()))) ()))) ()))) ()))) ())))) ())) ()))) ()))))) (do (shen.record-kl vector.unfold-vector-assignment (cons defun (cons vector.unfold-vector-assignment (cons (cons (protect V2124) (cons (protect V2125) (cons (protect V2126) (cons (protect V2127) ())))) (cons (cons cond (cons (cons (cons and (cons (cons cons? (cons (protect V2126) ())) (cons (cons and (cons (cons = (cons cons (cons (cons hd (cons (protect V2126) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V2126) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V2126) ())) ())) ())) (cons (cons and (cons (cons = (cons () (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V2126) ())) ())) ())) ()))) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V2126) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) ()))) (cons (cons let (cons (protect W2128) (cons (cons newv ()) (cons (cons cons (cons let (cons (cons cons (cons (protect W2128) (cons (cons cons (cons (cons cons (cons vector-> (cons (cons cons (cons (protect V2125) (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V2126) ())) ())) (cons (cons cons (cons (protect V2127) (cons () ()))) ()))) ()))) ()))) (cons (cons cons (cons (protect V2124) (cons () ()))) ()))) ()))) ()))) ())))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V2126) ())) (cons (cons and (cons (cons = (cons cons (cons (cons hd (cons (protect V2126) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V2126) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V2126) ())) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V2126) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) (cons (cons let (cons (protect W2129) (cons (cons newv ()) (cons (cons cons (cons let (cons (cons cons (cons (protect W2129) (cons (cons cons (cons (cons cons (cons <-vector (cons (cons cons (cons (protect V2125) (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V2126) ())) ())) (cons () ()))) ()))) ()))) (cons (cons cons (cons (cons vector.unfold-vector-assignment (cons (protect V2124) (cons (protect W2129) (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V2126) ())) ())) ())) (cons (protect V2127) ()))))) (cons () ()))) ()))) ()))) ()))) ())))) ())) (cons (cons true (cons (cons simple-error (cons (cons cn (cons "cannot macro expand the dimensional argument " (cons (cons shen.app (cons (protect V2126) (cons " -" (cons shen.r ())))) ()))) ())) ())) ())))) ()))))) (do (shen.record-kl compress (cons defun (cons compress (cons (cons (protect V2168) ()) (cons (cons list->vector (cons (cons vector->list (cons (protect V2168) (cons () ()))) ())) ()))))) (do (shen.record-kl vector.copy (cons defun (cons vector.copy (cons (cons (protect V2174) ()) (cons (cons let (cons (protect W2175) (cons (cons limit (cons (protect V2174) ())) (cons (cons let (cons (protect W2176) (cons (cons vector (cons (protect W2175) ())) (cons (cons for (cons 1 (cons (cons lambda (cons (protect Z2177) (cons (cons <= (cons (protect Z2177) (cons (protect W2175) ()))) ()))) (cons (cons lambda (cons (protect Z2178) (cons (cons trap-error (cons (cons vector-> (cons (protect W2176) (cons (protect Z2178) (cons (cons <-vector (cons (protect V2174) (cons (protect Z2178) ()))) ())))) (cons (cons lambda (cons (protect Z2179) (cons (cons depopulate (cons (protect W2176) (cons (cons cons (cons (protect Z2178) (cons () ()))) ()))) ()))) ()))) ()))) (cons (cons lambda (cons (protect Z2180) (cons (cons + (cons 1 (cons (protect Z2180) ()))) ()))) (cons (cons lambda (cons (protect Z2181) (cons (cons lambda (cons (protect Z2182) (cons (cons do (cons (protect Z2181) (cons (protect Z2182) ()))) ()))) ()))) ())))))) ())))) ())))) ()))))) (do (shen.record-kl vector.reverse (cons defun (cons vector.reverse (cons (cons (protect V2187) ()) (cons (cons let (cons (protect W2188) (cons (cons limit (cons (protect V2187) ())) (cons (cons let (cons (protect W2189) (cons (cons vector (cons (protect W2188) ())) (cons (cons let (cons (protect W2190) (cons (cons for (cons (protect W2188) (cons (cons lambda (cons (protect Z2191) (cons (cons > (cons (protect Z2191) (cons 0 ()))) ()))) (cons (cons lambda (cons (protect Z2192) (cons (cons trap-error (cons (cons vector-> (cons (protect W2189) (cons (protect Z2192) (cons (cons <-vector (cons (protect V2187) (cons (cons + (cons 1 (cons (cons - (cons (protect W2188) (cons (protect Z2192) ()))) ()))) ()))) ())))) (cons (cons lambda (cons (protect Z2193) (cons (cons depopulate (cons (protect W2189) (cons (cons cons (cons (protect Z2192) (cons () ()))) ()))) ()))) ()))) ()))) (cons (cons lambda (cons (protect Z2194) (cons (cons - (cons (protect Z2194) (cons 1 ()))) ()))) (cons (cons lambda (cons (protect Z2195) (cons (cons lambda (cons (protect Z2196) (cons (cons do (cons (protect Z2195) (cons (protect Z2196) ()))) ()))) ()))) ())))))) (cons (protect W2189) ())))) ())))) ())))) ()))))) (do (shen.record-kl vector.append (cons defun (cons vector.append (cons (cons (protect V2206) (cons (protect V2207) ())) (cons (cons let (cons (protect W2208) (cons (cons limit (cons (protect V2206) ())) (cons (cons let (cons (protect W2209) (cons (cons limit (cons (protect V2207) ())) (cons (cons let (cons (protect W2210) (cons (cons + (cons (protect W2208) (cons (protect W2209) ()))) (cons (cons let (cons (protect W2211) (cons (cons vector (cons (protect W2210) ())) (cons (cons let (cons (protect W2212) (cons (cons for (cons 1 (cons (cons lambda (cons (protect Z2213) (cons (cons <= (cons (protect Z2213) (cons (protect W2208) ()))) ()))) (cons (cons lambda (cons (protect Z2214) (cons (cons trap-error (cons (cons vector-> (cons (protect W2211) (cons (protect Z2214) (cons (cons <-vector (cons (protect V2206) (cons (protect Z2214) ()))) ())))) (cons (cons lambda (cons (protect Z2215) (cons (cons depopulate (cons (protect W2211) (cons (cons cons (cons (protect Z2214) (cons () ()))) ()))) ()))) ()))) ()))) (cons (cons lambda (cons (protect Z2216) (cons (cons + (cons 1 (cons (protect Z2216) ()))) ()))) (cons (cons lambda (cons (protect Z2217) (cons (cons lambda (cons (protect Z2218) (cons (cons do (cons (protect Z2217) (cons (protect Z2218) ()))) ()))) ()))) ())))))) (cons (cons let (cons (protect W2219) (cons (cons for (cons (cons + (cons (protect W2208) (cons 1 ()))) (cons (cons lambda (cons (protect Z2220) (cons (cons <= (cons (protect Z2220) (cons (protect W2210) ()))) ()))) (cons (cons lambda (cons (protect Z2221) (cons (cons trap-error (cons (cons vector-> (cons (protect W2211) (cons (protect Z2221) (cons (cons <-vector (cons (protect V2207) (cons (protect Z2221) ()))) ())))) (cons (cons lambda (cons (protect Z2222) (cons (cons depopulate (cons (protect W2211) (cons (cons cons (cons (protect Z2221) (cons () ()))) ()))) ()))) ()))) ()))) (cons (cons lambda (cons (protect Z2223) (cons (cons + (cons 1 (cons (protect Z2223) ()))) ()))) (cons (cons lambda (cons (protect Z2224) (cons (cons lambda (cons (protect Z2225) (cons (cons do (cons (protect Z2224) (cons (protect Z2225) ()))) ()))) ()))) ())))))) (cons (protect W2211) ())))) ())))) ())))) ())))) ())))) ())))) ()))))) (do (shen.record-kl vector.dfilter (cons defun (cons vector.dfilter (cons (cons (protect V2231) (cons (protect V2232) ())) (cons (cons let (cons (protect W2233) (cons (cons limit (cons (protect V2232) ())) (cons (cons let (cons (protect W2234) (cons (cons for (cons 1 (cons (cons lambda (cons (protect Z2235) (cons (cons <= (cons (protect Z2235) (cons (protect W2233) ()))) ()))) (cons (cons lambda (cons (protect Z2236) (cons (cons if (cons (cons and (cons (cons populated? (cons (protect V2232) (cons (cons cons (cons (protect Z2236) (cons () ()))) ()))) (cons (cons (protect V2231) (cons (cons <-vector (cons (protect V2232) (cons (protect Z2236) ()))) ())) ()))) (cons (cons vector-> (cons (protect V2232) (cons (protect Z2236) (cons (cons <-vector (cons (protect V2232) (cons (protect Z2236) ()))) ())))) (cons (cons depopulate (cons (protect V2232) (cons (cons cons (cons (protect Z2236) (cons () ()))) ()))) ())))) ()))) (cons (cons lambda (cons (protect Z2237) (cons (cons + (cons 1 (cons (protect Z2237) ()))) ()))) (cons (cons lambda (cons (protect Z2238) (cons (cons lambda (cons (protect Z2239) (cons (cons do (cons (protect Z2238) (cons (protect Z2239) ()))) ()))) ()))) ())))))) (cons (protect V2232) ())))) ())))) ()))))) (do (shen.record-kl vector.element? (cons defun (cons vector.element? (cons (cons (protect V2243) (cons (protect V2244) ())) (cons (cons let (cons (protect W2245) (cons (cons limit (cons (protect V2244) ())) (cons (cons let (cons (protect W2246) (cons (cons maths.lazyfor-or (cons 1 (cons (cons lambda (cons (protect Z2247) (cons (cons <= (cons (protect Z2247) (cons (protect W2245) ()))) ()))) (cons (cons lambda (cons (protect Z2248) (cons (cons if (cons (cons populated? (cons (protect V2244) (cons (cons cons (cons (protect Z2248) (cons () ()))) ()))) (cons (cons = (cons (protect V2243) (cons (cons <-vector (cons (protect V2244) (cons (protect Z2248) ()))) ()))) (cons false ())))) ()))) (cons (cons lambda (cons (protect Z2249) (cons (cons + (cons 1 (cons (protect Z2249) ()))) ()))) ()))))) (cons (protect W2246) ())))) ())))) ()))))) (do (shen.record-kl vector.map (cons defun (cons vector.map (cons (cons (protect V2256) (cons (protect V2257) ())) (cons (cons let (cons (protect W2258) (cons (cons limit (cons (protect V2257) ())) (cons (cons let (cons (protect W2259) (cons (cons vector (cons (protect W2258) ())) (cons (cons let (cons (protect W2260) (cons (cons for (cons 1 (cons (cons lambda (cons (protect Z2261) (cons (cons <= (cons (protect Z2261) (cons (protect W2258) ()))) ()))) (cons (cons lambda (cons (protect Z2262) (cons (cons if (cons (cons populated? (cons (protect V2257) (cons (cons cons (cons (protect Z2262) (cons () ()))) ()))) (cons (cons vector-> (cons (protect W2259) (cons (protect Z2262) (cons (cons (protect V2256) (cons (cons <-vector (cons (protect V2257) (cons (protect Z2262) ()))) ())) ())))) (cons (cons trap-error (cons (cons vector-> (cons (protect W2259) (cons (protect Z2262) (cons (cons <-vector (cons (protect W2259) (cons (protect Z2262) ()))) ())))) (cons (cons lambda (cons (protect Z2263) (cons (cons depopulate (cons (protect W2259) (cons (cons cons (cons (protect Z2262) (cons () ()))) ()))) ()))) ()))) ())))) ()))) (cons (cons lambda (cons (protect Z2264) (cons (cons + (cons 1 (cons (protect Z2264) ()))) ()))) (cons (cons lambda (cons (protect Z2265) (cons (cons lambda (cons (protect Z2266) (cons (cons do (cons (protect Z2265) (cons (protect Z2266) ()))) ()))) ()))) ())))))) (cons (protect W2259) ())))) ())))) ())))) ()))))) (do (shen.record-kl vector.dmap (cons defun (cons vector.dmap (cons (cons (protect V2273) (cons (protect V2274) ())) (cons (cons let (cons (protect W2275) (cons (cons limit (cons (protect V2274) ())) (cons (cons let (cons (protect W2276) (cons (cons for (cons 1 (cons (cons lambda (cons (protect Z2277) (cons (cons <= (cons (protect Z2277) (cons (protect W2275) ()))) ()))) (cons (cons lambda (cons (protect Z2278) (cons (cons if (cons (cons populated? (cons (protect V2274) (cons (cons cons (cons (protect Z2278) (cons () ()))) ()))) (cons (cons vector-> (cons (protect V2274) (cons (protect Z2278) (cons (cons (protect V2273) (cons (cons <-vector (cons (protect V2274) (cons (protect Z2278) ()))) ())) ())))) (cons (cons trap-error (cons (cons vector-> (cons (protect V2274) (cons (protect Z2278) (cons (cons <-vector (cons (protect V2274) (cons (protect Z2278) ()))) ())))) (cons (cons lambda (cons (protect Z2279) (cons (cons depopulate (cons (protect V2274) (cons (cons cons (cons (protect Z2278) (cons () ()))) ()))) ()))) ()))) ())))) ()))) (cons (cons lambda (cons (protect Z2280) (cons (cons + (cons 1 (cons (protect Z2280) ()))) ()))) (cons (cons lambda (cons (protect Z2281) (cons (cons lambda (cons (protect Z2282) (cons (cons do (cons (protect Z2281) (cons (protect Z2282) ()))) ()))) ()))) ())))))) (cons (protect V2274) ())))) ())))) ()))))) (do (shen.record-kl vector.every? (cons defun (cons vector.every? (cons (cons (protect V2286) (cons (protect V2287) ())) (cons (cons let (cons (protect W2288) (cons (cons limit (cons (protect V2287) ())) (cons (cons let (cons (protect W2289) (cons (cons maths.lazyfor-and (cons 1 (cons (cons lambda (cons (protect Z2290) (cons (cons <= (cons (protect Z2290) (cons (protect W2288) ()))) ()))) (cons (cons lambda (cons (protect Z2291) (cons (cons if (cons (cons populated? (cons (protect V2287) (cons (cons cons (cons (protect Z2291) (cons () ()))) ()))) (cons (cons (protect V2286) (cons (cons <-vector (cons (protect V2287) (cons (protect Z2291) ()))) ())) (cons true ())))) ()))) (cons (cons lambda (cons (protect Z2292) (cons (cons + (cons 1 (cons (protect Z2292) ()))) ()))) ()))))) (cons (protect W2289) ())))) ())))) ()))))) (do (shen.record-kl vector.some? (cons defun (cons vector.some? (cons (cons (protect V2296) (cons (protect V2297) ())) (cons (cons let (cons (protect W2298) (cons (cons limit (cons (protect V2297) ())) (cons (cons let (cons (protect W2299) (cons (cons maths.lazyfor-or (cons 1 (cons (cons lambda (cons (protect Z2300) (cons (cons <= (cons (protect Z2300) (cons (protect W2298) ()))) ()))) (cons (cons lambda (cons (protect Z2301) (cons (cons if (cons (cons populated? (cons (protect V2297) (cons (cons cons (cons (protect Z2301) (cons () ()))) ()))) (cons (cons (protect V2296) (cons (cons <-vector (cons (protect V2297) (cons (protect Z2301) ()))) ())) (cons false ())))) ()))) (cons (cons lambda (cons (protect Z2302) (cons (cons + (cons 1 (cons (protect Z2302) ()))) ()))) ()))))) (cons (protect W2299) ())))) ())))) ()))))) (do (shen.record-kl vector->list (cons defun (cons vector->list (cons (cons (protect V2308) (cons (protect V2309) ())) (cons (cons for (cons 1 (cons (cons lambda (cons (protect Z2310) (cons (cons <= (cons (protect Z2310) (cons (cons limit (cons (protect V2308) ())) ()))) ()))) (cons (cons lambda (cons (protect Z2311) (cons (cons if (cons (cons populated? (cons (protect V2308) (cons (cons cons (cons (protect Z2311) (cons () ()))) ()))) (cons (cons cons (cons (cons <-vector (cons (protect V2308) (cons (protect Z2311) ()))) (cons () ()))) (cons (protect V2309) ())))) ()))) (cons (cons lambda (cons (protect Z2312) (cons (cons + (cons 1 (cons (protect Z2312) ()))) ()))) (cons (cons lambda (cons (protect Z2313) (cons (cons lambda (cons (protect Z2314) (cons (cons append (cons (protect Z2313) (cons (protect Z2314) ()))) ()))) ()))) ())))))) ()))))) (do (shen.record-kl list->vector (cons defun (cons list->vector (cons (cons (protect V2317) ()) (cons (cons vector.list->vector-h (cons (protect V2317) (cons 1 (cons (cons vector (cons (cons length (cons (protect V2317) ())) ())) ())))) ()))))) (do (shen.record-kl vector.list->vector-h (cons defun (cons vector.list->vector-h (cons (cons (protect V2321) (cons (protect V2322) (cons (protect V2323) ()))) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V2321) ()))) (cons (protect V2323) ())) (cons (cons (cons cons? (cons (protect V2321) ())) (cons (cons vector.list->vector-h (cons (cons tl (cons (protect V2321) ())) (cons (cons + (cons (protect V2322) (cons 1 ()))) (cons (cons vector-> (cons (protect V2323) (cons (protect V2322) (cons (cons hd (cons (protect V2321) ())) ())))) ())))) ())) (cons (cons true (cons (cons shen.f-error (cons vector.list->vector-h ())) ())) ())))) ()))))) (do (shen.record-kl vacant? (cons defun (cons vacant? (cons (cons (protect V2328) ()) (cons (cons maths.lazyfor-and (cons 1 (cons (cons lambda (cons (protect Z2329) (cons (cons <= (cons (protect Z2329) (cons (cons limit (cons (protect V2328) ())) ()))) ()))) (cons (cons lambda (cons (protect Z2330) (cons (cons not (cons (cons populated? (cons (protect V2328) (cons (cons cons (cons (protect Z2330) (cons () ()))) ()))) ())) ()))) (cons (cons lambda (cons (protect Z2331) (cons (cons + (cons 1 (cons (protect Z2331) ()))) ()))) ()))))) ()))))) (do (shen.record-kl dense? (cons defun (cons dense? (cons (cons (protect V2334) ()) (cons (cons maths.lazyfor-and (cons 1 (cons (cons lambda (cons (protect Z2335) (cons (cons <= (cons (protect Z2335) (cons (cons limit (cons (protect V2334) ())) ()))) ()))) (cons (cons lambda (cons (protect Z2336) (cons (cons populated? (cons (protect V2334) (cons (cons cons (cons (protect Z2336) (cons () ()))) ()))) ()))) (cons (cons lambda (cons (protect Z2337) (cons (cons + (cons 1 (cons (protect Z2337) ()))) ()))) ()))))) ()))))) (do (shen.record-kl porous? (cons defun (cons porous? (cons (cons (protect V2340) ()) (cons (cons maths.lazyfor-or (cons 1 (cons (cons lambda (cons (protect Z2341) (cons (cons <= (cons (protect Z2341) (cons (cons limit (cons (protect V2340) ())) ()))) ()))) (cons (cons lambda (cons (protect Z2342) (cons (cons not (cons (cons populated? (cons (protect V2340) (cons (cons cons (cons (protect Z2342) (cons () ()))) ()))) ())) ()))) (cons (cons lambda (cons (protect Z2343) (cons (cons + (cons 1 (cons (protect Z2343) ()))) ()))) ()))))) ()))))) (do (shen.record-kl sparse? (cons defun (cons sparse? (cons (cons (protect V2348) ()) (cons (cons let (cons (protect W2349) (cons (cons limit (cons (protect V2348) ())) (cons (cons let (cons (protect W2350) (cons (cons for (cons 1 (cons (cons lambda (cons (protect Z2351) (cons (cons <= (cons (protect Z2351) (cons (cons limit (cons (protect V2348) ())) ()))) ()))) (cons (cons lambda (cons (protect Z2352) (cons (cons if (cons (cons populated? (cons (protect V2348) (cons (cons cons (cons (protect Z2352) (cons () ()))) ()))) (cons 1 (cons 0 ())))) ()))) (cons (cons lambda (cons (protect Z2353) (cons (cons + (cons 1 (cons (protect Z2353) ()))) ()))) (cons (cons lambda (cons (protect Z2354) (cons (cons lambda (cons (protect Z2355) (cons (cons + (cons (protect Z2354) (cons (protect Z2355) ()))) ()))) ()))) ())))))) (cons (cons let (cons (protect W2356) (cons (cons - (cons (protect W2349) (cons (protect W2350) ()))) (cons (cons > (cons (protect W2356) (cons (protect W2350) ()))) ())))) ())))) ())))) ()))))) (do (shen.record-kl v-op1 (cons defun (cons v-op1 (cons (cons (protect V2358) (cons (protect V2359) (cons (protect V2360) ()))) (cons (cons list->vector (cons (cons (protect V2358) (cons (cons vector->list (cons (protect V2359) (cons (protect V2360) ()))) ())) ())) ()))))) (do (shen.record-kl v-op2 (cons defun (cons v-op2 (cons (cons (protect V2364) (cons (protect V2365) (cons (protect V2366) (cons (protect V2367) ())))) (cons (cons list->vector (cons (cons (cons (protect V2364) (cons (cons vector->list (cons (protect V2365) (cons (protect V2367) ()))) ())) (cons (cons vector->list (cons (protect V2366) (cons (protect V2367) ()))) ())) ())) ()))))) (do (shen.record-kl print.pprint-macro (cons defun (cons print.pprint-macro (cons (cons (protect V2453) ()) (cons (cons cond (cons (cons (cons and (cons (cons cons? (cons (protect V2453) ())) (cons (cons and (cons (cons = (cons pprint (cons (cons hd (cons (protect V2453) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V2453) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (protect V2453) ())) ())) ()))) ()))) ()))) ()))) (cons (cons cons (cons pprint (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V2453) ())) ())) (cons (cons cons (cons (cons cons (cons stoutput (cons () ()))) (cons () ()))) ()))) ()))) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V2453) ())) (cons (cons and (cons (cons = (cons pps (cons (cons hd (cons (protect V2453) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V2453) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (protect V2453) ())) ())) ()))) ()))) ()))) ()))) (cons (cons cons (cons pps (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V2453) ())) ())) (cons (cons cons (cons (cons cons (cons stoutput (cons () ()))) (cons () ()))) ()))) ()))) ())) (cons (cons true (cons (protect V2453) ())) ())))) ()))))) (do (shen.record-kl linelength (cons defun (cons linelength (cons () (cons (cons value (cons print.*linelength* ())) ()))))) (do (shen.record-kl indentation (cons defun (cons indentation (cons () (cons (cons value (cons print.*indentation* ())) ()))))) (do (shen.record-kl set-linelength (cons defun (cons set-linelength (cons (cons (protect V2455) ()) (cons (cons cond (cons (cons (cons and (cons (cons positive? (cons (protect V2455) ())) (cons (cons integer? (cons (protect V2455) ())) ()))) (cons (cons set (cons print.*linelength* (cons (protect V2455) ()))) ())) (cons (cons true (cons (cons simple-error (cons "line length must be a positive integer -" ())) ())) ()))) ()))))) (do (shen.record-kl set-indentation (cons defun (cons set-indentation (cons (cons (protect V2457) ()) (cons (cons cond (cons (cons (cons and (cons (cons positive? (cons (protect V2457) ())) (cons (cons integer? (cons (protect V2457) ())) ()))) (cons (cons set (cons print.*indentation* (cons (protect V2457) ()))) ())) (cons (cons true (cons (cons simple-error (cons "indentation must be a positive integer -" ())) ())) ()))) ()))))) (do (shen.record-kl pps (cons defun (cons pps (cons (cons (protect V2459) (cons (protect V2460) ())) (cons (cons let (cons (protect W2461) (cons (cons ps (cons (protect V2459) ())) (cons (cons let (cons (protect W2462) (cons (cons shen.app (cons (protect W2461) (cons "" (cons shen.r ())))) (cons (cons let (cons (protect W2463) (cons (cons pretty-string (cons (protect W2462) ())) (cons (cons let (cons (protect W2464) (cons (cons pr (cons (protect W2463) (cons (protect V2460) ()))) (cons (cons let (cons (protect W2465) (cons (cons nl (cons 1 ())) (cons (protect V2459) ())))) ())))) ())))) ())))) ())))) ()))))) (do (shen.record-kl pprint (cons defun (cons pprint (cons (cons (protect V2468) (cons (protect V2469) ())) (cons (cons let (cons (protect W2470) (cons (cons shen.app (cons (protect V2468) (cons "" (cons shen.s ())))) (cons (cons let (cons (protect W2471) (cons (cons pretty-string (cons (protect W2470) ())) (cons (cons let (cons (protect W2472) (cons (cons pr (cons (protect W2471) (cons (protect V2469) ()))) (cons (cons let (cons (protect W2473) (cons (cons nl (cons 1 ())) (cons (protect V2468) ())))) ())))) ())))) ())))) ()))))) (do (shen.record-kl pretty-string (cons defun (cons pretty-string (cons (cons (protect V2476) ()) (cons (cons print.pretty-string-h (cons (protect V2476) (cons 0 (cons 0 ())))) ()))))) (do (shen.record-kl print.pretty-string-h (cons defun (cons print.pretty-string-h (cons (cons (protect V2482) (cons (protect V2483) (cons (protect V2484) ()))) (cons (cons cond (cons (cons (cons = (cons "" (cons (protect V2482) ()))) (cons "" ())) (cons (cons (cons and (cons (cons shen.+string? (cons (protect V2482) ())) (cons (cons = (cons "[" (cons (cons hdstr (cons (protect V2482) ())) ()))) ()))) (cons (cons @s (cons (cons print.indent (cons (protect V2483) ())) (cons (cons @s (cons "[" (cons (cons print.pretty-string-h (cons (cons tlstr (cons (protect V2482) ())) (cons (cons + (cons (protect V2483) (cons 1 ()))) (cons 0 ())))) ()))) ()))) ())) (cons (cons (cons and (cons (cons shen.+string? (cons (protect V2482) ())) (cons (cons = (cons "(" (cons (cons hdstr (cons (protect V2482) ())) ()))) ()))) (cons (cons @s (cons (cons print.indent (cons (protect V2483) ())) (cons (cons @s (cons "(" (cons (cons print.pretty-string-h (cons (cons tlstr (cons (protect V2482) ())) (cons (cons + (cons (protect V2483) (cons 1 ()))) (cons 0 ())))) ()))) ()))) ())) (cons (cons (cons and (cons (cons shen.+string? (cons (protect V2482) ())) (cons (cons = (cons "]" (cons (cons hdstr (cons (protect V2482) ())) ()))) ()))) (cons (cons @s (cons "]" (cons (cons print.pretty-string-h (cons (cons tlstr (cons (protect V2482) ())) (cons (cons - (cons (protect V2483) (cons 1 ()))) (cons 0 ())))) ()))) ())) (cons (cons (cons and (cons (cons shen.+string? (cons (protect V2482) ())) (cons (cons = (cons ")" (cons (cons hdstr (cons (protect V2482) ())) ()))) ()))) (cons (cons @s (cons ")" (cons (cons print.pretty-string-h (cons (cons tlstr (cons (protect V2482) ())) (cons (cons - (cons (protect V2483) (cons 1 ()))) (cons 0 ())))) ()))) ())) (cons (cons (cons and (cons (cons shen.+string? (cons (protect V2482) ())) (cons (cons and (cons (cons = (cons " " (cons (cons hdstr (cons (protect V2482) ())) ()))) (cons (cons > (cons (protect V2484) (cons (cons linelength ()) ()))) ()))) ()))) (cons (cons @s (cons (cons print.indent (cons (protect V2483) ())) (cons (cons print.pretty-string-h (cons (cons tlstr (cons (protect V2482) ())) (cons (protect V2483) (cons 0 ())))) ()))) ())) (cons (cons (cons shen.+string? (cons (protect V2482) ())) (cons (cons @s (cons (cons hdstr (cons (protect V2482) ())) (cons (cons print.pretty-string-h (cons (cons tlstr (cons (protect V2482) ())) (cons (protect V2483) (cons (cons + (cons (protect V2484) (cons 1 ()))) ())))) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons print.pretty-string-h ())) ())) ()))))))))) ()))))) (do (shen.record-kl print.indent (cons defun (cons print.indent (cons (cons (protect V2488) ()) (cons (cons cond (cons (cons (cons = (cons 0 (cons (protect V2488) ()))) (cons "" ())) (cons (cons true (cons (cons @s (cons " -" (cons (cons print.indent-h (cons (protect V2488) ())) ()))) ())) ()))) ()))))) (do (shen.record-kl print.indent-h (cons defun (cons print.indent-h (cons (cons (protect V2490) ()) (cons (cons cond (cons (cons (cons = (cons 0 (cons (protect V2490) ()))) (cons "" ())) (cons (cons true (cons (cons cn (cons (cons print.n-space (cons (cons indentation ()) ())) (cons (cons print.indent-h (cons (cons - (cons (protect V2490) (cons 1 ()))) ())) ()))) ())) ()))) ()))))) (do (shen.record-kl print.n-space (cons defun (cons print.n-space (cons (cons (protect V2492) ()) (cons (cons cond (cons (cons (cons = (cons 0 (cons (protect V2492) ()))) (cons "" ())) (cons (cons true (cons (cons cn (cons " " (cons (cons print.n-space (cons (cons - (cons (protect V2492) (cons 1 ()))) ())) ()))) ())) ()))) ()))))) (do (shen.record-kl delete-file (cons defun (cons delete-file (cons (cons (protect V2495) ()) (cons (cons if (cons (cons = (cons (cons language ()) (cons "Common Lisp" ()))) (cons (cons (cons fn (cons lisp.delete-file ())) (cons (protect V2495) ())) (cons (cons close (cons (cons open (cons (protect V2495) (cons out ()))) ())) ())))) ()))))) (do (shen.record-kl file.file-macro (cons defun (cons file.file-macro (cons (cons (protect V2523) ()) (cons (cons cond (cons (cons (cons and (cons (cons cons? (cons (protect V2523) ())) (cons (cons and (cons (cons = (cons errout (cons (cons hd (cons (protect V2523) ())) ()))) (cons (cons and (cons (cons cons? (cons (cons tl (cons (protect V2523) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (protect V2523) ())) ())) ())) (cons (cons and (cons (cons cons? (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V2523) ())) ())) ())) ())) (cons (cons = (cons () (cons (cons tl (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V2523) ())) ())) ())) ())) ()))) ()))) ()))) ()))) ()))) ()))) (cons (cons let (cons (protect W2524) (cons (cons newv ()) (cons (cons let (cons (protect W2525) (cons (cons newv ()) (cons (cons let (cons (protect W2526) (cons (cons newv ()) (cons (cons let (cons (protect W2527) (cons (cons newv ()) (cons (cons let (cons (protect W2528) (cons (cons newv ()) (cons (cons cons (cons trap-error (cons (cons cons (cons (cons hd (cons (cons tl (cons (protect V2523) ())) ())) (cons (cons cons (cons (cons cons (cons /. (cons (cons cons (cons (protect W2528) (cons (cons cons (cons (cons cons (cons let (cons (cons cons (cons (protect W2524) (cons (cons cons (cons (cons cons (cons error-to-string (cons (cons cons (cons (protect W2528) (cons () ()))) ()))) (cons (cons cons (cons (protect W2525) (cons (cons cons (cons (cons cons (cons trap-error (cons (cons cons (cons (cons cons (cons reopen (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V2523) ())) ())) ())) ()))) (cons (cons cons (cons (cons cons (cons /. (cons (cons cons (cons (protect W2528) (cons (cons cons (cons (cons cons (cons open (cons (cons cons (cons (cons hd (cons (cons tl (cons (cons tl (cons (cons tl (cons (protect V2523) ())) ())) ())) ())) (cons (cons cons (cons out (cons () ()))) ()))) ()))) (cons () ()))) ()))) ()))) (cons () ()))) ()))) ()))) (cons (cons cons (cons (protect W2526) (cons (cons cons (cons (cons cons (cons pr (cons (cons cons (cons (protect W2524) (cons (cons cons (cons (protect W2525) (cons () ()))) ()))) ()))) (cons (cons cons (cons (protect W2527) (cons (cons cons (cons (cons cons (cons close (cons (cons cons (cons (protect W2525) (cons () ()))) ()))) (cons (cons cons (cons (cons hd (cons (cons tl (cons (cons tl (cons (protect V2523) ())) ())) ())) (cons () ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) ()))) (cons () ()))) ()))) ()))) (cons () ()))) ()))) ()))) ())))) ())))) ())))) ())))) ())))) ())) (cons (cons true (cons (protect V2523) ())) ()))) ()))))) (do (shen.record-kl append-files (cons defun (cons append-files (cons (cons (protect V2530) (cons (protect V2531) ())) (cons (cons let (cons (protect W2532) (cons (cons append-files-with-open-stream (cons (protect V2530) (cons (protect V2531) ()))) (cons (cons let (cons (protect W2533) (cons (cons close (cons (protect W2532) ())) (cons (protect V2531) ())))) ())))) ()))))) (do (shen.record-kl append-files-with-open-stream (cons defun (cons append-files-with-open-stream (cons (cons (protect V2536) (cons (protect V2537) ())) (cons (cons cond (cons (cons (cons element? (cons (protect V2537) (cons (protect V2536) ()))) (cons (cons simple-error (cons (cons cn (cons "cannot read and write to " (cons (cons shen.app (cons (protect V2537) (cons " at the same time -" (cons shen.a ())))) ()))) ())) ())) (cons (cons true (cons (cons let (cons (protect W2538) (cons (cons open (cons (protect V2537) (cons out ()))) (cons (cons let (cons (protect W2539) (cons (cons mapc (cons (cons lambda (cons (protect Z2540) (cons (cons file.read&write (cons (cons open (cons (protect Z2540) (cons in ()))) (cons (protect W2538) ()))) ()))) (cons (protect V2536) ()))) (cons (protect W2538) ())))) ())))) ())) ()))) ()))))) (do (shen.record-kl file.read&write (cons defun (cons file.read&write (cons (cons (protect V2543) (cons (protect V2544) ())) (cons (cons file.read&write-h (cons (cons read-byte (cons (protect V2543) ())) (cons (protect V2543) (cons (protect V2544) ())))) ()))))) (do (shen.record-kl file.read&write-h (cons defun (cons file.read&write-h (cons (cons (protect V2547) (cons (protect V2548) (cons (protect V2549) ()))) (cons (cons cond (cons (cons (cons = (cons -1 (cons (protect V2547) ()))) (cons -1 ())) (cons (cons true (cons (cons file.read&write-h (cons (cons read-byte (cons (protect V2548) ())) (cons (protect V2548) (cons (cons do (cons (cons write-byte (cons (protect V2547) (cons (protect V2549) ()))) (cons (protect V2549) ()))) ())))) ())) ()))) ()))))) (do (shen.record-kl reopen (cons defun (cons reopen (cons (cons (protect V2553) ()) (cons (cons let (cons (protect W2554) (cons (cons read-file-as-bytelist (cons (protect V2553) ())) (cons (cons let (cons (protect W2555) (cons (cons open (cons (protect V2553) (cons out ()))) (cons (cons let (cons (protect W2556) (cons (cons mapc (cons (cons lambda (cons (protect Z2557) (cons (cons write-byte (cons (protect Z2557) (cons (protect W2555) ()))) ()))) (cons (protect W2554) ()))) (cons (protect W2555) ())))) ())))) ())))) ()))))) (do (shen.record-kl copy-file (cons defun (cons copy-file (cons (cons (protect V2559) (cons (protect V2560) ())) (cons (cons append-files (cons (cons cons (cons (protect V2559) (cons () ()))) (cons (protect V2560) ()))) ()))))) (do (shen.record-kl copy-file-with-open-stream (cons defun (cons copy-file-with-open-stream (cons (cons (protect V2563) (cons (protect V2564) ())) (cons (cons append-files-with-open-stream (cons (cons cons (cons (protect V2563) (cons () ()))) (cons (protect V2564) ()))) ()))))) (do (shen.record-kl file-exists? (cons defun (cons file-exists? (cons (cons (protect V2567) ()) (cons (cons trap-error (cons (cons do (cons (cons close (cons (cons open (cons (protect V2567) (cons in ()))) ())) (cons true ()))) (cons (cons lambda (cons (protect Z2568) (cons false ()))) ()))) ()))))) (do (shen.record-kl file-size (cons defun (cons file-size (cons (cons (protect V2570) ()) (cons (cons let (cons (protect W2571) (cons (cons open (cons (protect V2570) (cons in ()))) (cons (cons let (cons (protect W2572) (cons (cons file.file-size-loop (cons (protect W2571) (cons 0 (cons (cons read-byte (cons (protect W2571) ())) ())))) (cons (cons let (cons (protect W2573) (cons (cons close (cons (protect W2571) ())) (cons (protect W2572) ())))) ())))) ())))) ()))))) (do (shen.record-kl file.file-size-loop (cons defun (cons file.file-size-loop (cons (cons (protect V2579) (cons (protect V2580) (cons (protect V2581) ()))) (cons (cons cond (cons (cons (cons = (cons -1 (cons (protect V2581) ()))) (cons (protect V2580) ())) (cons (cons true (cons (cons file.file-size-loop (cons (protect V2579) (cons (cons + (cons 1 (cons (protect V2580) ()))) (cons (cons read-byte (cons (protect V2579) ())) ())))) ())) ()))) ()))))) (do (shen.record-kl ascii (cons defun (cons ascii (cons (cons (protect V2585) (cons (protect V2586) (cons (protect V2587) ()))) (cons (cons let (cons (protect W2588) (cons (cons read-file-as-bytelist (cons (protect V2587) ())) (cons (cons file.scan-bytes (cons (protect V2585) (cons (protect V2586) (cons (protect W2588) (cons "" ()))))) ())))) ()))))) (do (shen.record-kl file.scan-bytes (cons defun (cons file.scan-bytes (cons (cons (protect V2594) (cons (protect V2595) (cons (protect V2596) (cons (protect V2597) ())))) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V2596) ()))) (cons (protect V2597) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V2596) ())) (cons (cons and (cons (cons >= (cons (cons hd (cons (protect V2596) ())) (cons (protect V2594) ()))) (cons (cons <= (cons (cons hd (cons (protect V2596) ())) (cons (protect V2595) ()))) ()))) ()))) (cons (cons file.scan-bytes (cons (protect V2594) (cons (protect V2595) (cons (cons tl (cons (protect V2596) ())) (cons (cons cn (cons (protect V2597) (cons (cons n->string (cons (cons hd (cons (protect V2596) ())) ())) ()))) ()))))) ())) (cons (cons (cons cons? (cons (protect V2596) ())) (cons (cons simple-error (cons (cons cn (cons "character has code " (cons (cons shen.app (cons (cons hd (cons (protect V2596) ())) (cons (cons cn (cons ": parsed to here - -" (cons (cons shen.app (cons (protect V2597) (cons "" (cons shen.a ())))) ()))) (cons shen.a ())))) ()))) ())) ())) (cons (cons true (cons (cons shen.f-error (cons file.scan-bytes ())) ())) ()))))) ()))))) (do (shen.record-kl pairoff (cons defun (cons pairoff (cons (cons (protect V2616) (cons (protect V2617) ())) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V2616) ()))) (cons () ())) (cons (cons (cons = (cons () (cons (protect V2617) ()))) (cons () ())) (cons (cons (cons and (cons (cons cons? (cons (protect V2616) ())) (cons (cons cons? (cons (protect V2617) ())) ()))) (cons (cons cons (cons (cons @p (cons (cons hd (cons (protect V2616) ())) (cons (cons hd (cons (protect V2617) ())) ()))) (cons (cons pairoff (cons (cons tl (cons (protect V2616) ())) (cons (cons tl (cons (protect V2617) ())) ()))) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons pairoff ())) ())) ()))))) ()))))) (do (shen.record-kl assocp (cons defun (cons assocp (cons (cons (protect V2627) (cons (protect V2628) ())) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V2628) ()))) (cons (cons simple-error (cons "pair not found -" ())) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V2628) ())) (cons (cons and (cons (cons tuple? (cons (cons hd (cons (protect V2628) ())) ())) (cons (cons = (cons (protect V2627) (cons (cons fst (cons (cons hd (cons (protect V2628) ())) ())) ()))) ()))) ()))) (cons (cons hd (cons (protect V2628) ())) ())) (cons (cons (cons cons? (cons (protect V2628) ())) (cons (cons assocp (cons (protect V2627) (cons (cons tl (cons (protect V2628) ())) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons assocp ())) ())) ()))))) ()))))) (do (shen.record-kl cartprodp (cons defun (cons cartprodp (cons (cons (protect V2633) (cons (protect V2634) ())) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V2633) ()))) (cons () ())) (cons (cons (cons cons? (cons (protect V2633) ())) (cons (cons append (cons (cons map (cons (cons lambda (cons (protect Z2635) (cons (cons @p (cons (cons hd (cons (protect V2633) ())) (cons (protect Z2635) ()))) ()))) (cons (protect V2634) ()))) (cons (cons cartprodp (cons (cons tl (cons (protect V2633) ())) (cons (protect V2634) ()))) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons cartprodp ())) ())) ())))) ()))))) (do (shen.record-kl assocp-if (cons defun (cons assocp-if (cons (cons (protect V2643) (cons (protect V2644) ())) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V2644) ()))) (cons (cons simple-error (cons "pair not found -" ())) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V2644) ())) (cons (cons and (cons (cons tuple? (cons (cons hd (cons (protect V2644) ())) ())) (cons (cons (protect V2643) (cons (cons fst (cons (cons hd (cons (protect V2644) ())) ())) ())) ()))) ()))) (cons (cons hd (cons (protect V2644) ())) ())) (cons (cons (cons cons? (cons (protect V2644) ())) (cons (cons assocp-if (cons (protect V2643) (cons (cons tl (cons (protect V2644) ())) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons assocp-if ())) ())) ()))))) ()))))) (shen.record-kl assocp-if-not (cons defun (cons assocp-if-not (cons (cons (protect V2652) (cons (protect V2653) ())) (cons (cons cond (cons (cons (cons = (cons () (cons (protect V2653) ()))) (cons (cons simple-error (cons "pair not found -" ())) ())) (cons (cons (cons and (cons (cons cons? (cons (protect V2653) ())) (cons (cons and (cons (cons tuple? (cons (cons hd (cons (protect V2653) ())) ())) (cons (cons not (cons (cons (protect V2652) (cons (cons fst (cons (cons hd (cons (protect V2653) ())) ())) ())) ())) ()))) ()))) (cons (cons hd (cons (protect V2653) ())) ())) (cons (cons (cons cons? (cons (protect V2653) ())) (cons (cons assocp-if-not (cons (protect V2652) (cons (cons tl (cons (protect V2653) ())) ()))) ())) (cons (cons true (cons (cons shen.f-error (cons assocp-if-not ())) ())) ()))))) ())))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) - -(defun stlib.initialise-final () (do (let External (external stlib) (let ExternalF (filter (lambda X (> (arity X) -1)) External) (let SystemfResult (map (lambda Y2657 (systemf Y2657)) ExternalF) ok))) (do (preclude-all-but ()) (do (set shen.*userdefs* ()) (do (cd "") (tc -)))))) - -(defun stlib.initialise () (do (stlib.initialise-environment) (do (stlib.initialise-arities) (do (stlib.initialise-macros) (do (stlib.initialise-synonyms) (do (stlib.initialise-datatypes) (do (stlib.initialise-types) (do (stlib.initialise-sources) (stlib.initialise-final))))))))) - diff --git a/lib/StLib/Calendar/date.shen b/lib/StLib/Calendar/date.shen new file mode 100644 index 0000000..60c6963 --- /dev/null +++ b/lib/StLib/Calendar/date.shen @@ -0,0 +1,160 @@ +\\ Copyright (c) 2016, Mark Tarver + +(package calendar [now internal-date unix gmt] + +(datatype globals + + _______________ + (value *gmt*) : (symbol * number * number * number);) + +(define gmt + {symbol --> number --> number --> number --> (symbol * number * number * number)} + Plus/Minus Hours Minutes Seconds + -> (set *gmt* (@p Plus/Minus Hours Minutes Seconds)) + where (validate-gmt? Plus/Minus Hours Minutes Seconds) + _ _ _ _ -> (error "error in GMT setting~%")) + +(define validate-gmt? + {symbol --> number --> number --> number --> boolean} + Plus/Minus Hours Minutes Seconds + -> (cases (not (element? Plus/Minus [+ -])) false + (not (and (integer? Hours) (integer? Minutes) (integer? Seconds))) false + (= Hours 12) (and (= Minutes 0) (= Seconds 0)) + (and (>= Hours 0) + (<= Hours 11) + (>= Minutes 0) + (<= Minutes 59) + (>= Seconds 0) + (<= Seconds 59)) true + true false)) + +(gmt + 0 0 0) + +(define now + {number --> string} + Days -> (internal-date->string (internal-date Days))) + +(define internal-date + {number --> (list number)} + Days -> (let UnixDate (+ (* 24 3600 Days) + (get-time unix) + (gmt-time (value *gmt*))) + (if (> 0 UnixDate) + (error "cannot regress date before 1970~%") + (internal-date-h + UnixDate + (- 0 (* 24 3600)) + 1970 + year + []))) where (integer? Days) + _ -> (error "internal-date requires an integer~%")) + +(define gmt-time + {(symbol * number * number * number) --> number} + (@p - Hours Minutes Seconds) -> (- 0 (+ (* 3600 Hours) (* 60 Minutes) Seconds)) + (@p + Hours Minutes Seconds) -> (+ (* 3600 Hours) (* 60 Minutes) Seconds)) + +(define internal-date-h + {number --> number --> number --> symbol --> (list number) --> (list number)} + Now Now Count _ Date -> [Count | Date] + Now Then Count Interval Date + -> (let Then' (+ (seconds-in Count Interval Date) Then) + (if (> Then' Now) + (let NextInterval (next-interval Interval) + Start (start-interval NextInterval) + (internal-date-h Now Then Start NextInterval [Count | Date])) + (internal-date-h Now Then' (+ Count 1) Interval Date)))) + +(define start-interval + {symbol --> number} + month -> 1 + day -> 0 + hour -> 0 + minute -> 0 + second -> 0) + +(define seconds-in + {number --> symbol --> (list number) --> number} + Count year _ -> (if (leap? Count) + (* 366 24 3600) + (* 365 24 3600)) + 2 month [Year] -> (* 29 24 3600) where (leap? Year) + Count month _ -> (* (days-in-month Count) 24 3600) + _ day _ -> (* 24 3600) + _ hour _ -> 3600 + _ minute _ -> 60 + _ second _ -> 1) + +(define next-interval + {symbol --> symbol} + year -> month + month -> day + day -> hour + hour -> minute + minute -> second) + +(define days-in-month + {number --> number} + 1 -> 31 + 2 -> 28 + 3 -> 31 + 4 -> 30 + 5 -> 31 + 6 -> 30 + 7 -> 31 + 8 -> 31 + 9 -> 30 + 10 -> 31 + 11 -> 30 + 12 -> 31) + +(define leap? + {number --> boolean} + Year -> (cases (integer? (/ Year 400)) true + (integer? (/ Year 100)) false + (integer? (/ Year 4)) true + true false)) + +(define internal-date->string + {(list number) --> string} + [Seconds Minutes Hours Days Months Year] + -> (make-string "~A:~A:~A, ~A~A ~A, ~A ~A" + (pad Hours) (pad Minutes) (pad Seconds) + Days (postfix-day Days) (month Months) Year (gmt-string (value *gmt*)))) + +(define gmt-string + {(symbol * number * number * number) --> string} + (@p Plus/Minus Hours Minutes Seconds) + -> (make-string "~AGMT ~A:~A:~A" Plus/Minus (pad Hours) (pad Minutes) (pad Seconds))) + +(define pad + {number --> string} + N -> (make-string "~A" N) where (> N 9) + N -> (make-string "0~A" N)) + +(define postfix-day + {number --> string} + 1 -> "st" + 21 -> "st" + 31 -> "st" + 2 -> "nd" + 22 -> "nd" + 3 -> "rd" + 23 -> "rd" + _ -> "th") + +(define month + {number --> string} + 1 -> "January" + 2 -> "February" + 3 -> "March" + 4 -> "April" + 5 -> "May" + 6 -> "June" + 7 -> "July" + 8 -> "August" + 9 -> "September" + 10 -> "October" + 11 -> "November" + 12 -> "December")) + diff --git a/lib/StLib/Data/data.shen b/lib/StLib/Data/data.shen new file mode 100644 index 0000000..cfd3fc1 --- /dev/null +++ b/lib/StLib/Data/data.shen @@ -0,0 +1,26 @@ +(package file [read-data eval-data] + +(declare read-data [string --> [list unit]]) +(declare eval-data [string -->[list unit]]) + +(define read-data + File -> (let In (open File in) + (read-data-loop (trap-read In) In []))) + +(define read-data-loop + eof! In Acc -> (do (close In) (reverse Acc)) + Read In Acc -> (read-data-loop (trap-read In) In [Read | Acc])) + +(define trap-read + In -> (trap-error (read In) (/. E eof!))) + +(define eval-data + File -> (let In (open File in) + (eval-data-loop (trap-eval In) In []))) + +(define eval-data-loop + eof! In Acc -> (do (close In) (reverse Acc)) + Read In Acc -> (eval-data-loop (trap-eval In) In [Read | Acc])) + +(define trap-eval + In -> (trap-error (eval (read In)) (/. E eof!))) ) \ No newline at end of file diff --git a/lib/StLib/IO/delete-file.shen b/lib/StLib/IO/delete-file.shen new file mode 100644 index 0000000..e03b82c --- /dev/null +++ b/lib/StLib/IO/delete-file.shen @@ -0,0 +1,7 @@ +(define delete-file + {string --> (list A)} + File -> (cases (= (language) "Common Lisp") (lisp.delete-file File) + true (close (open File out)))) + +(declare delete-file [string --> [list A]]) + \ No newline at end of file diff --git a/lib/StLib/IO/files.shen b/lib/StLib/IO/files.shen new file mode 100644 index 0000000..0031f43 --- /dev/null +++ b/lib/StLib/IO/files.shen @@ -0,0 +1,83 @@ +(package file [append-files append-files-with-open-stream mapc + copy-file file-size reopen errout copy-file-with-open-stream + file-exists? newv ascii] + +(defmacro file-macro + [errout X Default ErrFile] -> (let Err (newv) + Open (newv) + Record (newv) + Close (newv) + E (newv) + [trap-error X [/. E [let Err [error-to-string E] + Open [trap-error [reopen ErrFile] [/. E [open ErrFile out]]] + Record [pr Err Open] + Close [close Open] + Default]]])) + +(define append-files + {(list string) --> string --> string} + Files File -> (let Stream (append-files-with-open-stream Files File) + Close (close Stream) + File)) + +(define append-files-with-open-stream + {(list string) --> string --> (stream out)} + Files File -> (error "cannot read and write to ~A at the same time~%" File) where (element? File Files) + Files File -> (let OutStream (open File out) + Write (mapc (/. F (read&write (open F in) OutStream)) Files) + OutStream)) + +(define read&write + {(stream in) --> (stream out) --> number} + In Out -> (read&write-h (read-byte In) In Out)) + +(define read&write-h + {number --> (stream in) --> (stream out) --> number} + -1 In Out -> -1 + Byte In Out -> (read&write-h (read-byte In) In (do (write-byte Byte Out) Out))) + +(define reopen + {string --> (stream out)} + File -> (let ByteList (read-file-as-bytelist File) + Open (open File out) + Write (mapc (/. Byte (write-byte Byte Open)) ByteList) + Open)) + +(define copy-file + {string --> string --> string} + InFile OutFile -> (append-files [InFile] OutFile)) + +(define copy-file-with-open-stream + {string --> string --> (stream out)} + InFile OutFile -> (append-files-with-open-stream [InFile] OutFile)) + +(define file-exists? + {string --> boolean} + File -> (trap-error (do (close (open File in)) true) (/. E false))) + +(define file-size + {string --> number} + File -> (let Stream (open File in) + Size (file-size-loop Stream 0 (read-byte Stream)) + Close (close Stream) + Size)) + +(define file-size-loop + {(stream in) --> number --> number --> number} + _ Size -1 -> Size + Stream Size _ -> (file-size-loop Stream (+ 1 Size) (read-byte Stream))) + +(define ascii + {number --> number --> string --> string} + Min Max File -> (let Bytes (read-file-as-bytelist File) + (scan-bytes Min Max Bytes ""))) + +(define scan-bytes + {number --> number --> (list number) --> string --> string} + Min Max [] S -> S + Min Max [N | Ns] S + -> (scan-bytes Min Max Ns (cn S (n->string N))) + where (and (>= N Min) (<= N Max)) + Min Max [N | _] S -> (error "character has code ~A: parsed to here~%~%~A" N S)) ) + + \ No newline at end of file diff --git a/lib/StLib/IO/prettyprint.shen b/lib/StLib/IO/prettyprint.shen new file mode 100644 index 0000000..df9f6be --- /dev/null +++ b/lib/StLib/IO/prettyprint.shen @@ -0,0 +1,83 @@ +(package print (append (external maths) + [pps pprint pretty-string linelength indentation set-linelength set-indentation]) + +(datatype print + + _______________________________ + (value *indentation*) : number; + + _______________________________ + (value *linelength*) : number;) + +(defmacro pprint-macro + [pprint X] -> [pprint X [stoutput]] + [pps F] -> [pps F [stoutput]]) + +(set *indentation* 1) +(set *linelength* 60) + +(define linelength + {--> number} + -> (value *linelength*)) + +(define indentation + {--> number} + -> (value *indentation*)) + +(define set-linelength + {number --> number} + N -> (set *linelength* N) where (and (positive? N) (integer? N)) + N -> (error "line length must be a positive integer~%")) + +(define set-indentation + {number --> number} + N -> (set *indentation* N) where (and (positive? N) (integer? N)) + N -> (error "indentation must be a positive integer~%")) + +(define pps + {symbol --> (stream out) --> symbol} + F Sink -> (let Code (ps F) + Ugly (make-string "~R" Code) + Pretty (pretty-string Ugly) + PrettyPrint (pr Pretty Sink) + NL (nl) + F)) + +(define pprint + {A --> (stream out) --> A} + X Stream -> (let Ugly (make-string "~S" X) + Pretty (pretty-string Ugly) + PrettyPrint (pr Pretty Stream) + NL (nl) + X)) + +(define pretty-string + {string --> string} + S -> (pretty-string-h S 0 0)) + +(define pretty-string-h + {string --> number --> number --> string} + "" _ _ -> "" + (@s "[" Ss) Depth Length -> (@s (indent Depth) "[" (pretty-string-h Ss (+ Depth 1) 0)) + (@s "(" Ss) Depth Length -> (@s (indent Depth) "(" (pretty-string-h Ss (+ Depth 1) 0)) + (@s "]" Ss) Depth Length -> (@s "]" (pretty-string-h Ss (- Depth 1) 0)) + (@s ")" Ss) Depth Length -> (@s ")" (pretty-string-h Ss (- Depth 1) 0)) + (@s " " Ss) Depth Length -> (@s (indent Depth) (pretty-string-h Ss Depth 0)) where (> Length (linelength)) + (@s S Ss) Depth Length -> (@s S (pretty-string-h Ss Depth (+ Length 1)))) + +(define indent + {number --> string} + 0 -> "" + N -> (@s "c#10;" (indent-h N))) + +(define indent-h + {number --> string} + 0 -> "" + N -> (cn (n-space (indentation)) (indent-h (- N 1)))) + + (define n-space + {number --> string} + 0 -> "" + N -> (cn " " (n-space (- N 1)))) + + (preclude [print])) \ No newline at end of file diff --git a/lib/StLib/Lists/lists.shen b/lib/StLib/Lists/lists.shen new file mode 100644 index 0000000..da4020c --- /dev/null +++ b/lib/StLib/Lists/lists.shen @@ -0,0 +1,267 @@ +(package list [prefix? suffix? subset? set=? set? permute nthhd + cartprod powerset subbag? bag=? n-times + trim-right trim-left trim trim-right-if trim-left-if + trim-if assoc-if assoc-if-not infix? count-if count + remove-duplicates foldr foldl find mapf remove-if + some? every? mapc filter transitive-closure x->ascii + take take-last drop drop-last index index-last insert + splice sort partition] + +(define assoc-if + {(A --> boolean) --> (list (list A)) --> (list A)} + _ [] -> [] + F [[X | Y] | _] -> [X | Y] where (F X) + F [_ | Y] -> (assoc-if F Y)) + +(define assoc-if-not + {(A --> boolean) --> (list (list A)) --> (list A)} + _ [] -> [] + F [[X | Y] | _] -> [X | Y] where (not (F X)) + F [_ | Y] -> (assoc-if F Y)) + +(define drop + {number --> (list A) --> (list A)} + 0 L -> L + N [_ | Y] -> (drop (- N 1) Y)) + +(define drop-last + {number --> (list A) --> (list A)} + N L -> (reverse (drop N (reverse L)))) + +(define index + {A --> (list A) --> number} + X L -> (index-h X L 1)) + +(define index-h + {A --> (list A) --> number --> number} + _ [] _ -> -1 + X [X | _] N -> N + X [_ | Y] N -> (index-h X Y (+ N 1))) + +(define index-last + {A --> (list A) --> number} + X L -> (let Len (length L) + N (index X (reverse L)) + (if (= N -1) N (+ (- Len N) 1)))) + +(define insert + {number --> A --> (list A) --> (list A)} + _ X [] -> (error "cannot insert ~S into list: index out of range~%" X) + 1 X L -> [X | L] + N X [Y | Z] -> [Y | (insert (- N 1) X Z)]) + +(define remove-duplicates + {(list A) --> (list A)} + [] -> [] + [X | Y] -> (remove-duplicates Y) where (element? X Y) + [X | Y] -> [X | (remove-duplicates Y)]) + +(define trim-left-if + {(A --> boolean) --> (list A) --> (list A)} + _ [] -> [] + P [X | Y] -> (trim-left-if P Y) where (P X) + _ L -> L) + +(define trim-right-if + {(A --> boolean) --> (list A) --> (list A)} + P L -> (reverse (trim-left-if P (reverse L)))) + +(define trim-if + {(A --> boolean) --> (list A) --> (list A)} + P L -> (trim-right-if P (trim-left-if P L))) + +(define trim-left + {(list A) --> (list A) --> (list A)} + _ [] -> [] + Trim [X | Y] -> (trim-left Trim Y) where (element? X Trim) + _ L -> L) + +(define trim-right + {(list A) --> (list A) --> (list A)} + Trim L -> (reverse (trim-left Trim (reverse L)))) + +(define trim + {(list A) --> (list A) --> (list A)} + Trim L -> (trim-right Trim (trim-left Trim L))) + +(define prefix? + {(list A) --> (list A) --> boolean} + [] _ -> true + [X | Y] [X | Z] -> (prefix? Y Z) + _ _ -> false) + +(define infix? + {(list A) --> (list A) --> boolean} + L1 L2 -> true where (prefix? L1 L2) + _ [] -> false + L1 [_ | Y] -> (infix? L1 Y)) + +(define suffix? + {(list A) --> (list A) --> boolean} + L1 L2 -> (prefix? (reverse L1) (reverse L2))) + +(define subset? + {(list A) --> (list A) --> boolean} + [] _ -> true + [X | Y] Z -> (subset? Y Z) where (element? X Z) + _ _ -> false) + +(define set=? + {(list A) --> (list A) --> boolean} + L1 L2 -> (and (subset? L1 L2) (subset? L2 L1))) + +(define set? + {(list A) --> boolean} + [] -> true + [X | Y] -> false where (element? X Y) + [_ | Y] -> (set? Y)) + +(define n-times + {A --> number --> (list A)} + X N -> (n-times-h N X [])) + +(define n-times-h + {number --> A --> (list A) --> (list A)} + 0 X L -> L + N X L -> (n-times-h (- N 1) X [X | L])) + +(define subbag? + {(list A) --> (list A) --> boolean} + L1 L2 -> (every? (/. Z (= (count Z L1) (count Z L2))) L1)) + +(define bag=? + {(list A) --> (list A) --> boolean} + L1 L2 -> (and (subbag? L1 L2) (subbag? L2 L1))) + +(define mapc + {(A --> B) --> (list A) --> (list C)} + _ [] -> [] + F [X | Y] -> (mapc (do (F X) F) Y)) + +(define permute + {(list A) --> (list (list A))} + [] -> [[]] + XS -> (mapcan (/. EL (map (/. P [EL | P]) + (permute (remove EL XS)))) + XS)) + +(define count-if + {(A --> boolean) --> (list A) --> number} + P L -> (length (mapcan (/. Z (if (P Z) [Z] [])) L))) + +(define count + {A --> (list A) --> number} + X L -> (count-if (= X) L)) + +(define some? + {(A --> boolean) --> (list A) --> boolean} + _ [] -> false + P [X | _] -> true where (P X) + P [_ | Y] -> (some? P Y)) + +(define every? + {(A --> boolean) --> (list A) --> boolean} + _ [] -> true + P [X | Y] -> (every? P Y) where (P X) + _ _ -> false) + +(define sort + {(A --> A --> boolean) --> (list A) --> (list A)} + _ [] -> [] + _ [X] -> [X] + R [X | Y] -> (let Less (mapcan (/. Z (if (R Z X) [Z] [])) Y) + More (mapcan (/. Z (if (not (R Z X)) [Z] [])) Y) + (append (sort R Less) [X] (sort R More)))) + +(define find + {(A --> boolean) --> (list A) --> A} + _ [] -> (error "find has found no element~%") + P [X | _] -> X where (P X) + P [_ | Y] -> (find P Y)) + +(define foldr + {(A --> B --> B) --> B --> (list A) --> B} + _ X [] -> X + F X [Y | Z] -> (foldr F (F Y X) Z)) + +(define foldl + {(A --> B --> A) --> A --> (list B) --> A} + _ X [] -> X + F X [Y | Z] -> (foldl F (F X Y) Z)) + +(define mapf + {(A --> B) --> (list A) --> (B --> (list C) --> (list C)) --> (list C)} + _ [] _ -> [] + F [X | Y] C -> (C (F X) (mapf F Y C))) + +(define filter + {(A --> boolean) --> (list A) --> (list A)} + _ [] -> [] + F [X | Y] -> (if (F X) [X | (filter F Y)] (filter F Y))) + +(define remove-if + {(A --> boolean) --> (list A) --> (list A)} + _ [] -> [] + F [X | Y] -> (if (F X) (remove-if F Y) [X | (remove-if F Y)])) + +(define reduce + {(A --> B --> A) --> A --> (list B) --> A} + F Z [] -> Z + F Z [X | Xs] -> (reduce F (F Z X) Xs)) + +(define take + {number --> (list A) --> (list A)} + 0 _ -> [] + _ [] -> [] + N [X | L] -> [X | (take (- N 1) L)]) + +(define take-last + {number --> (list A) --> (list A)} + N L -> (reverse (take N (reverse L)))) + +(define cartprod + {(list A) --> (list A) --> (list (list A))} + [] _ -> [] + [X | Y] Z -> (append (map (/. W [X W]) Z) (cartprod Y Z))) + +(define powerset + {(list A) --> (list (list A))} + [] -> [[]] + [X | Y] -> (let P (powerset Y) + (append P (map (/. Z [X | Z]) P)))) + +(define partition + {(A --> A --> boolean) --> (list A) --> (list (list A))} + _ [] -> [] + R [X | Y] -> (let EQ (mapcan (/. Z (if (R X Z) [Z] [])) [X | Y]) + Remainder (difference [X | Y] EQ) + [EQ | (partition R Remainder)]) + _ _ -> (simple-error "partition equires a list")) + +(define transitive-closure + {(list (A * A)) --> (list (A * A))} + L -> (let T (transitive-pass L L) + (if (= T L) + T + (transitive-pass T T)))) + +(define transitive-pass + {(list (A * A)) --> (list (A * A)) --> (list (A * A))} + [] All -> All + [(@p X Y) | L] All -> (let Trans (find-trans X Y All) + (union Trans (transitive-pass L All)))) + +(define find-trans + {A --> A --> (list (A * A)) --> (list (A * A))} + _ _ [] -> [] + X Y [(@p Y Z) | All] -> [(@p X Z) | (find-trans X Y All)] + X Y [_ | All] -> (find-trans X Y All)) + +(define x->ascii + {A --> (list number)} + X -> (map (fn string->n) (explode X))) + +(define splice + {number --> (list A) --> (list A) --> (list A)} + 1 L1 L2 -> (append L1 L2) + N L [X | Y] -> [X | (splice (- N 1) L Y)]) ) \ No newline at end of file diff --git a/lib/StLib/Lists/lists.shen.kl b/lib/StLib/Lists/lists.shen.kl new file mode 100644 index 0000000..ac35666 --- /dev/null +++ b/lib/StLib/Lists/lists.shen.kl @@ -0,0 +1,110 @@ +(defun assoc-if (V3391 V3392) (cond ((= () V3392) ()) ((and (and (cons? V3392) (cons? (hd V3392))) (V3391 (hd (hd V3392)))) (hd V3392)) ((cons? V3392) (assoc-if V3391 (tl V3392))) (true (shen.f_error assoc-if)))) + +(defun assoc-if-not (V3402 V3403) (cond ((= () V3403) ()) ((and (and (cons? V3403) (cons? (hd V3403))) (not (V3402 (hd (hd V3403))))) (hd V3403)) ((cons? V3403) (assoc-if V3402 (tl V3403))) (true (shen.f_error assoc-if-not)))) + +(defun drop (V3410 V3411) (cond ((= 0 V3410) V3411) ((cons? V3411) (drop (- V3410 1) (tl V3411))) (true (shen.f_error drop)))) + +(defun drop-last (V3414 V3415) (reverse (drop V3414 (reverse V3415)))) + +(defun index (V3418 V3419) (list.index-h V3418 V3419 1)) + +(defun list.index-h (V3434 V3435 V3436) (cond ((= () V3435) -1) ((and (cons? V3435) (= (hd V3435) V3434)) V3436) ((cons? V3435) (list.index-h V3434 (tl V3435) (+ V3436 1))) (true (shen.f_error list.index-h)))) + +(defun index-last (V3439 V3440) (let Len (length V3440) (let N (index V3439 (reverse V3440)) (if (= N -1) N (+ (- Len N) 1))))) + +(defun insert (V3446 V3447 V3448) (cond ((= () V3448) (simple-error (cn "cannot insert " (shen.app V3447 " into list: index out of range +" shen.s)))) ((= 1 V3446) (cons V3447 V3448)) ((cons? V3448) (cons (hd V3448) (insert (- V3446 1) V3447 (tl V3448)))) (true (shen.f_error insert)))) + +(defun remove-duplicates (V3450) (cond ((= () V3450) ()) ((and (cons? V3450) (element? (hd V3450) (tl V3450))) (remove-duplicates (tl V3450))) ((cons? V3450) (cons (hd V3450) (remove-duplicates (tl V3450)))) (true (shen.f_error remove-duplicates)))) + +(defun trim-left-if (V3459 V3460) (cond ((= () V3460) ()) ((and (cons? V3460) (V3459 (hd V3460))) (trim-left-if V3459 (tl V3460))) (true V3460))) + +(defun trim-right-if (V3463 V3464) (reverse (trim-left-if V3463 (reverse V3464)))) + +(defun trim-if (V3467 V3468) (trim-right-if V3467 (trim-left-if V3467 V3468))) + +(defun trim-left (V3477 V3478) (cond ((= () V3478) ()) ((and (cons? V3478) (element? (hd V3478) V3477)) (trim-left V3477 (tl V3478))) (true V3478))) + +(defun trim-right (V3481 V3482) (reverse (trim-left V3481 (reverse V3482)))) + +(defun trim (V3485 V3486) (trim-right V3485 (trim-left V3485 V3486))) + +(defun prefix? (V3500 V3501) (cond ((= () V3500) true) ((and (and (cons? V3500) (cons? V3501)) (= (hd V3501) (hd V3500))) (prefix? (tl V3500) (tl V3501))) (true false))) + +(defun infix? (V3510 V3511) (cond ((prefix? V3510 V3511) true) ((= () V3511) false) ((cons? V3511) (infix? V3510 (tl V3511))) (true (shen.f_error infix?)))) + +(defun suffix? (V3514 V3515) (prefix? (reverse V3514) (reverse V3515))) + +(defun subset? (V3528 V3529) (cond ((= () V3528) true) ((and (cons? V3528) (element? (hd V3528) V3529)) (subset? (tl V3528) V3529)) (true false))) + +(defun set=? (V3532 V3533) (and (subset? V3532 V3533) (subset? V3533 V3532))) + +(defun set? (V3539) (cond ((= () V3539) true) ((and (cons? V3539) (element? (hd V3539) (tl V3539))) false) ((cons? V3539) (set? (tl V3539))) (true (shen.f_error set?)))) + +(defun n-times (V3542 V3543) (list.n-times-h V3543 V3542 ())) + +(defun list.n-times-h (V3547 V3548 V3549) (cond ((= 0 V3547) V3549) (true (list.n-times-h (- V3547 1) V3548 (cons V3548 V3549))))) + +(defun subbag? (V3552 V3553) (every? (lambda Z (= (count Z V3552) (count Z V3553))) V3552)) + +(defun bag=? (V3556 V3557) (and (subbag? V3556 V3557) (subbag? V3557 V3556))) + +(defun mapc (V3562 V3563) (cond ((= () V3563) ()) ((cons? V3563) (mapc (do (V3562 (hd V3563)) V3562) (tl V3563))) (true (shen.f_error mapc)))) + +(defun permute (V3565) (cond ((= () V3565) (cons () ())) (true (mapcan (lambda EL (map (lambda P (cons EL P)) (permute (remove EL V3565)))) V3565)))) + +(defun partition (V3570 V3571) (cond ((= () V3571) ()) ((cons? V3571) (let EQ (mapcan (lambda Z (if (V3570 (hd V3571) Z) (cons Z ()) ())) V3571) (let Remainder (difference V3571 EQ) (cons EQ (partition V3570 Remainder))))) (true (shen.f_error partition)))) + +(defun count-if (V3574 V3575) (length (mapcan (lambda Z (if (V3574 Z) (cons Z ()) ())) V3575))) + +(defun count (V3578 V3579) (count-if (= V3578) V3579)) + +(defun some? (V3593 V3594) (cond ((= () V3594) false) ((and (cons? V3594) (V3593 (hd V3594))) true) ((cons? V3594) (some? V3593 (tl V3594))) (true (shen.f_error some?)))) + +(defun every? (V3607 V3608) (cond ((= () V3608) true) ((and (cons? V3608) (V3607 (hd V3608))) (every? V3607 (tl V3608))) (true false))) + +(defun sort (V3615 V3616) (cond ((= () V3616) ()) ((and (cons? V3616) (= () (tl V3616))) V3616) ((cons? V3616) (let Less (mapcan (lambda Z (if (V3615 Z (hd V3616)) (cons Z ()) ())) (tl V3616)) (let More (mapcan (lambda Z (if (not (V3615 Z (hd V3616))) (cons Z ()) ())) (tl V3616)) (append (sort V3615 Less) (append (cons (hd V3616) ()) (sort V3615 More)))))) (true (shen.f_error sort)))) + +(defun find (V3626 V3627) (cond ((= () V3627) (simple-error "find has found no element +")) ((and (cons? V3627) (V3626 (hd V3627))) (hd V3627)) ((cons? V3627) (find V3626 (tl V3627))) (true (shen.f_error find)))) + +(defun foldr (V3633 V3634 V3635) (cond ((= () V3635) V3634) ((cons? V3635) (foldr V3633 (V3633 (hd V3635) V3634) (tl V3635))) (true (shen.f_error foldr)))) + +(defun foldl (V3641 V3642 V3643) (cond ((= () V3643) V3642) ((cons? V3643) (foldl V3641 (V3641 V3642 (hd V3643)) (tl V3643))) (true (shen.f_error foldl)))) + +(defun mapf (V3651 V3652 V3653) (cond ((= () V3652) ()) ((cons? V3652) (V3653 (V3651 (hd V3652)) (mapf V3651 (tl V3652) V3653))) (true (shen.f_error mapf)))) + +(defun filter (V3658 V3659) (cond ((= () V3659) ()) ((cons? V3659) (if (V3658 (hd V3659)) (cons (hd V3659) (filter V3658 (tl V3659))) (filter V3658 (tl V3659)))) (true (shen.f_error filter)))) + +(defun remove-if (V3664 V3665) (cond ((= () V3665) ()) ((cons? V3665) (if (V3664 (hd V3665)) (remove-if V3664 (tl V3665)) (cons (hd V3665) (remove-if V3664 (tl V3665))))) (true (shen.f_error remove-if)))) + +(defun list.reduce (V3669 V3670 V3671) (cond ((= () V3671) V3670) ((cons? V3671) (list.reduce V3669 (V3669 V3670 (hd V3671)) (tl V3671))) (true (shen.f_error list.reduce)))) + +(defun take (V3678 V3679) (cond ((= 0 V3678) ()) ((= () V3679) ()) ((cons? V3679) (cons (hd V3679) (take (- V3678 1) (tl V3679)))) (true (shen.f_error take)))) + +(defun take-last (V3682 V3683) (reverse (take V3682 (reverse V3683)))) + +(defun cartprod (V3688 V3689) (cond ((= () V3688) ()) ((cons? V3688) (append (map (lambda W (cons (hd V3688) (cons W ()))) V3689) (cartprod (tl V3688) V3689))) (true (shen.f_error cartprod)))) + +(defun powerset (V3691) (cond ((= () V3691) (cons () ())) ((cons? V3691) (let P (powerset (tl V3691)) (append P (map (lambda Z (cons (hd V3691) Z)) P)))) (true (shen.f_error powerset)))) + +(defun transitive-closure (V3694 V3695) (let Table (list.transitivity-table V3694 V3695) (list.transitive-closure-loop Table))) + +(defun list.transitivity-table (V3698 V3699) (map (lambda X (@p open (cons X (list.xRy V3698 X V3699)))) V3699)) + +(defun list.xRy (V3703 V3704 V3705) (filter (lambda Y (V3703 V3704 Y)) V3705)) + +(defun list.transitive-closure-loop (V3707) (let NewTable (list.compute-closure V3707) (if (every? (function list.closed?) NewTable) (map (lambda V3380 (snd V3380)) NewTable) (list.transitive-closure-loop NewTable)))) + +(defun list.closed? (V3716) (cond ((and (tuple? V3716) (= list.closed (fst V3716))) true) (true false))) + +(defun list.compute-closure (V3718) (map (lambda Row (list.augment-row Row V3718)) V3718)) + +(defun list.augment-row (V3723 V3724) (cond ((and (tuple? V3723) (= list.closed (fst V3723))) V3723) ((and (and (tuple? V3723) (= open (fst V3723))) (cons? (snd V3723))) (let NewEntries (mapcan (lambda Entry (list.lookup Entry V3724)) (tl (snd V3723))) (let NewSet (remove-duplicates NewEntries) (if (empty? (difference NewSet (tl (snd V3723)))) (@p list.closed (snd V3723)) (@p open (cons (hd (snd V3723)) NewSet)))))) (true (shen.f_error list.augment-row)))) + +(defun list.lookup (V3736 V3737) (cond ((= () V3737) (cons V3736 ())) ((and (and (and (cons? V3737) (tuple? (hd V3737))) (cons? (snd (hd V3737)))) (= (hd (snd (hd V3737))) V3736)) (snd (hd V3737))) ((cons? V3737) (list.lookup V3736 (tl V3737))) (true (shen.f_error list.lookup)))) + +(defun x->ascii (V3739) (map (lambda V3381 (string->n V3381)) (explode V3739))) + +(defun splice (V3743 V3744 V3745) (cond ((= 1 V3743) (append V3744 V3745)) ((cons? V3745) (cons (hd V3745) (splice (- V3743 1) V3744 (tl V3745)))) (true (shen.f_error splice)))) + diff --git a/lib/StLib/Maths/complex.dtype b/lib/StLib/Maths/complex.dtype new file mode 100644 index 0000000..d16d3ba --- /dev/null +++ b/lib/StLib/Maths/complex.dtype @@ -0,0 +1,31 @@ +(package complex [c# complex? real imaginary complex] + +(define c# + R I -> (let C (absvector 3) + PrintF (address-> C 0 print-complex) + Rumerator (address-> C 1 R) + Ienominator (address-> C 2 I) + C) where (and (number? R) (number? I)) + R I -> (error "real ~A and imaginary ~A must be numbers~%" R I)) + +(define print-complex + C -> (make-string (cn "(c" "# ~A ~A)") (<-address C 1) (<-address C 2))) + +(define complex? + C -> (trap-error (and (absvector? C) + (= (<-address C 0) print-complex) + (number? (<-address C 1)) + (number? (<-address C 2))) (/. E false))) + +(define real + C -> (<-address C 1)) + +(define imaginary + C -> (<-address C 2)) + +(declare c# [number --> [number --> complex]]) +(declare complex? [A --> boolean]) +(declare real [complex --> number]) +(declare imaginary [complex --> number]) ) + + \ No newline at end of file diff --git a/lib/StLib/Maths/complex.shen b/lib/StLib/Maths/complex.shen new file mode 100644 index 0000000..37726b7 --- /dev/null +++ b/lib/StLib/Maths/complex.shen @@ -0,0 +1,38 @@ +(package complex (append [c+ c- c* c/] (external complex) (external maths)) + + (define c+ + {complex --> complex --> complex} + C1 C2 -> (let A (real C1) + B (imaginary C1) + C (real C2) + D (imaginary C2) + (c# (+ A C) (+ B D)))) + + (define c- + {complex --> complex --> complex} + C1 C2 -> (let A (real C1) + B (imaginary C1) + C (real C2) + D (imaginary C2) + (c# (- A C) (- B D)))) + + (define c* + {complex --> complex --> complex} + C1 C2 -> (let A (real C1) + B (imaginary C1) + C (real C2) + D (imaginary C2) + (c# (- (* A C) (* B D)) (+ (* B C) (* A D))))) + + (define c/ + {complex --> complex --> complex} + C1 C2 -> (let A (real C1) + B (imaginary C1) + C (real C2) + D (imaginary C2) + (c# (/ (+ (* A C) (* B D)) + (+ (* C C) (* D D))) + (/ (- (* B C) (* A D)) + (+ (* C C) (* D D)))))) + + ) \ No newline at end of file diff --git a/lib/StLib/Maths/macros.shen b/lib/StLib/Maths/macros.shen new file mode 100644 index 0000000..4cc0e0d --- /dev/null +++ b/lib/StLib/Maths/macros.shen @@ -0,0 +1,55 @@ +(package maths [expt =r gcd lcd isqrt sqrt nthrt floor ceiling round mod lcm random min max + reseed ~ positive? negative? natural? converge series odd? even? + cos sin tan radians pi e tan30 cos30 cos45 sin45 sqrt2 tan60 sin120 + tan120 sin135 cos135 cos150 tan150 cos210 tan210 sin225 cos225 sin240 + tan240 sin300 tan300 sin315 cos315 cos330 tan330 sinh cosh tanh sech + csch power factorial prime? unix div modf product summation set-tolerance tolerance + coth for sq cube newv abs approx log log2 loge log10 g to stop done] + +(defmacro maths-macro + [log10 N] -> [log10 N [tolerance]] + [log2 N] -> [log2 N [tolerance]] + [loge N] -> [loge N [tolerance]] + [log M N] -> [log M N [tolerance]] + [sin N] -> [sin N [tolerance]] + [tan N] -> [tan N [tolerance]] + [cos N] -> [cos N [tolerance]] + [tanh N] -> [tanh N [tolerance]] + [cosh N] -> [cosh N [tolerance]] + [sinh N] -> [sinh N [tolerance]] + [sech N] -> [sech N [tolerance]] + [csch N] -> [csch N [tolerance]] + [coth N] -> [coth N [tolerance]] + [nthrt N Root] -> [nthrt N Root [tolerance]] + [sqrt N] -> [sqrt N [tolerance]] + [expt M N] -> [expt M N [tolerance]] + [max W X Y | Z] -> [max W [max X Y | Z]] + [min W X Y | Z] -> [min W [min X Y | Z]] + [tolerance N] -> [tolerance=n N] + [for X = Val stop Stop | Options+Procedure] -> [upto Val Stop | (process-options X Options+Procedure)] + [for X = Val to N | Options+Procedure] -> [upto Val [< N] | (process-options X Options+Procedure)]) + +(define process-options + X O+P -> (append (step-option O+P) + (constructor-option O+P) + (end-option O+P) + (process X O+P))) + +(define step-option + [] -> [[+ 1]] + [step Step | _] -> [Step] + [_ | O+P] -> (step-option O+P)) + +(define constructor-option + [] -> [[fn do]] + [constructor C | _] -> [C] + [_ | O+P] -> (constructor-option O+P)) + +(define end-option + [] -> [done] + [end End | _] -> [End] + [_ | O+P] -> (end-option O+P)) + +(define process + X [Process] -> [[/. X Process]] + X [_ | O+P] -> (process X O+P))) \ No newline at end of file diff --git a/lib/StLib/Maths/maths.shen b/lib/StLib/Maths/maths.shen new file mode 100644 index 0000000..849a3d1 --- /dev/null +++ b/lib/StLib/Maths/maths.shen @@ -0,0 +1,542 @@ +(package maths [expt =r gcd lcd isqrt sqrt nthrt floor ceiling round mod lcm random min max + reseed ~ positive? negative? natural? converge series odd? even? + cos sin tan radians pi e tan30 cos30 cos45 sin45 sqrt2 tan60 sin120 + tan120 sin135 cos135 cos150 tan150 cos210 tan210 sin225 cos225 sin240 + tan240 sin300 tan300 sin315 cos315 cos330 tan330 sinh cosh tanh sech + csch power factorial prime? unix div modf product summation set-tolerance tolerance + coth for sq cube newv abs approx log log2 loge log10 g] + + + +(datatype maths + + _________________ + (value *seed*) : number; + + _______________________ + (value *tolerance*) : number;) + +(set *seed* 95795) +(set *tolerance* .0001) + +(define set-tolerance + {number --> number} + N -> (set *tolerance* N)) + +(define tolerance + {--> number} + -> (value *tolerance*)) + +(define sq + {number --> number} + X -> (* X X)) + +(define cube + {number --> number} + X -> (* X X X)) + +(define for + {number --> (number --> boolean) + --> (number --> A) --> (number --> number) + --> (A --> A --> A) --> A} + Count Continue? Loop Inc Acc -> (for-h (Inc Count) Continue? Loop Inc Acc (Loop Count))) + +(define for-h + {number --> (number --> boolean) + --> (number --> A) --> (number --> number) --> (A --> A --> A) --> A --> A} + Count Continue? _ _ _ Result -> Result where (not (Continue? Count)) + Count Continue? Loop Inc Acc Result + -> (for-h (Inc Count) Continue? Loop Inc Acc (Acc Result (Loop Count) ))) + +(define lazyfor-and + {number --> (number --> boolean) + --> (number --> boolean) --> (number --> number) --> boolean} + Count Continue? _ _ -> true where (not (Continue? Count)) + Count Continue? Loop Inc -> (lazyfor-and (Inc Count) Continue? Loop Inc) where (Loop Count) + _ _ _ _ -> false) + +(define lazyfor-or + {number --> (number --> boolean) + --> (number --> boolean) --> (number --> number) --> boolean} + Count Continue? Loop Inc -> false where (not (Continue? Count)) + Count _ Loop _ -> true where (Loop Count) + Count Continue? Loop Inc -> (lazyfor-or (Inc Count) Continue? Loop Inc)) + +(define max + {number --> number --> number} + M N -> N where (> N M) + M _ -> M) + +(define min + {number --> number --> number} + M N -> N where (< N M) + M _ -> M) + +(define expt + {number --> number --> number --> number} + M N Tolerance -> (cases (= N 0) 1 + (positive? N) (expt-h M (n->r N 1) Tolerance) + true (/ 1 (expt-h M (n->r (~ N) 1) Tolerance)))) + +(define n->r + {number --> number --> (number * number)} + N D -> (@p N D) where (integer? N) + N D -> (n->r (* N 10) (* D 10))) + +(define expt-h + {number --> (number * number) --> number --> number} + M (@p N D) Tolerance -> (power (nthrt M D Tolerance) N)) + +(define gcd + {number --> number --> number} + M N -> (if (and (integer? M) (integer? N)) + (let M* (abs M) + N* (abs N) + (if (> M* N*) + (gcd-help (- M* N*) N*) + (gcd-help M* (- N* M*)))) + (error "gcd expects integer inputs"))) + +(define gcd-help + {number --> number --> number} + M N -> (if (> M N) + (gcd-loop M N N) + (gcd-loop M N M))) + +(define gcd-loop + {number --> number --> number --> number} + _ _ 1 -> 1 + M N Divisor -> Divisor where (and (integer? (/ M Divisor)) (integer? (/ N Divisor))) + M N Divisor -> (gcd-loop M N (- Divisor 1))) + +(define lcd + {number --> number --> number} + M N -> 2 where (and (even? M) (even? N)) + M N -> (lcd-loop M N (if (> M N) N M) 3)) + +(define lcd-loop + {number --> number --> number --> number --> number} + _ _ Max Divisor -> 1 where (> Divisor Max) + M N _ Divisor -> Divisor where (and (integer? (/ M Divisor)) (integer? (/ N Divisor))) + M N Max Divisor -> (lcd-loop M N Max (+ 2 Divisor))) + +(define isqrt + {number --> number} + N -> (isqrt-loop N 0)) + +(define isqrt-loop + {number --> number --> number} + N Sqrt -> Sqrt where (= (* Sqrt Sqrt) N) + N Sqrt -> (- Sqrt 1) where (> (* Sqrt Sqrt) N) + N Sqrt -> (isqrt-loop N (+ Sqrt 1))) + +(define div + {number --> number --> number} + N D -> (floor (/ N D))) + +(define modf + {number --> (number * number)} + N -> (let Floor (floor N) (@p Floor (- N Floor)))) + +(define floor + {number --> number} + N -> (~ (ceiling (~ N))) where (negative? N) + N -> (rounding-loop floor N 15 0)) + +(define rounding-loop + {symbol --> number --> number --> number --> number} + _ N 0 N -> N + K N 0 Guess -> (cases (= K floor) (- Guess 1) + (= K ceiling) Guess + (= K round) (let Up (- Guess N) + Down (- N (- Guess 1)) + (if (> Up Down) + (- Guess 1) + Guess))) where (> Guess N) + K N Exponent Guess -> (rounding-loop K N Exponent + (+ Guess (power 10 Exponent))) where (> N Guess) + K N Exponent Guess -> (rounding-loop K N (- Exponent 1) (- Guess (power 10 Exponent)))) + +(define float->pair + {number --> (number * number)} + N -> (let Floor (floor N) (@p Floor (- N Floor)))) + +(define ceiling + {number --> number} + N -> (~ (floor (~ N))) where (negative? N) + N -> (rounding-loop ceiling N 15 0)) + +(define round + {number --> number} + N -> (~ (round (~ N))) where (negative? N) + N -> (rounding-loop round N 15 0)) + +(define mod + {number --> number --> number} + X Y -> (let Div (/ X Y) + FloorDiv (floor Div) + (if (and (integer? X) (integer? Y)) + (round (* Y (- Div FloorDiv))) + (* Y (- Div FloorDiv))))) + +(define lcm + {(list number) --> number} + L -> (let Greatest (greatest L) + (lcm-h Greatest Greatest L))) + +(define greatest + {(list number) --> number} + [N] -> N + [M N | Ns] -> (greatest [M | Ns]) where (> M N) + [_ N | Ns] -> (greatest [N | Ns])) + +(define lcm-h + {number --> number --> (list number) --> number} + LCM Greatest L -> LCM where (lcm? LCM L) + LCM Greatest L -> (lcm-h (+ LCM Greatest) Greatest L)) + +(define lcm? + {number --> (list number) --> boolean} + _ [] -> true + LCM [N | Ns] -> (and (integer? (/ LCM N)) (lcm? LCM Ns))) + +(define random + {number --> number --> number} + Lower Upper -> (let Random (bbs (value *seed*)) + NewSeed (set *seed* Random) + Min (min Lower Upper) + (+ Min (mod NewSeed (abs (+ 1 (- Upper Lower))))))) + +(define min + {number --> number --> number} + X Y -> Y where (> X Y) + X _ -> X) + +(define reseed + {--> number} + -> (set *seed* (get-time unix))) + +(define bbs + {number --> number} + Xn -> (let M (* 1201 1213) + (mod (* Xn Xn) M))) + +(define ~ + {number --> number} + N -> (- 0 N)) + +(define positive? + {number --> boolean} + N -> (> N 0)) + +(define negative? + {number --> boolean} + N -> (< N 0)) + +(define natural? + {number --> boolean} + 0 -> true + N -> (and (integer? N) (positive? N))) + +(define converge + {A --> (A --> A) --> (A --> A --> boolean) --> A} + X F R -> (converge-help F (F X) X R)) + +(define converge-help + {(A --> A) --> A --> A --> (A --> A --> boolean) --> A} + _ New Old R -> New where (R Old New) + F New _ R -> (converge-help F (F New) New R)) + +(define nthrt + {number --> number --> number --> number} + A Root Tolerance -> (converge A (/. Xk (compute-nthrt A Xk Root Tolerance)) (approx Tolerance)) where (positive? A) + A _ _ -> (error "nthrt: negA must be a positive numberneg%" A)) + +(define sqrt + {number --> number --> number} + N Tolerance -> (nthrt N 2 Tolerance)) + +(define compute-nthrt + {number --> number --> number --> number --> number} + A Xk N Tolerance -> (let Reciprocal (/ 1 N) + N-1Xk (* (- N 1) Xk) + Xk (expt Xk (- N 1) Tolerance) + A/Xk (/ A Xk) + Add (+ N-1Xk A/Xk) + (* Reciprocal Add))) + +(define approx + {number --> (number --> number --> boolean)} + N -> (/. X Y (let Z (- X Y) (>= N (abs Z))))) + +(define abs + {number --> number} + N -> (if (>= N 0) N (- 0 N))) + +(define series + {number --> (number --> number) --> number --> (number --> number --> number) --> number} + Start TermF Tolerance Op -> (series-h (+ Start 1) Tolerance TermF (TermF Start) Op)) + +(define series-h + {number --> number --> (number --> number) --> number --> (number --> number --> number) --> number} + Count Tolerance TermF SoFar Op + -> (let Next (Op (TermF Count) SoFar) + (if (<= (abs (- SoFar Next)) Tolerance) + Next + (series-h (+ Count 1) + Tolerance + TermF + Next + Op)))) + +(define product + {number --> (number --> number) --> number --> number} + Start TermF Tolerance -> (series Start TermF Tolerance (fn *))) + +(define summation + {number --> (number --> number) --> number --> number} + Start TermF Tolerance -> (series Start TermF Tolerance (fn +))) + +(define odd? + {number --> boolean} + N -> (and (integer? N) (not (integer? (/ N 2))))) + +(define even? + {number --> boolean} + N -> (and (integer? N) (integer? (/ N 2)))) + +(define compute-sine + {number --> number --> number} + X N -> (let N*2+1 (+ (* 2 N) 1) + Numerator (* (power -1 N) (power X N*2+1)) + Denominator (factorial N*2+1) + (/ Numerator Denominator))) + +(define compute-cos + {number --> number --> number} + X N -> (let N*2 (* 2 N) + Numerator (* (power -1 N) (power X N*2)) + Denominator (factorial N*2) + (/ Numerator Denominator))) + +(define cos + {number --> number --> number} + Degrees Tolerance -> (let Radians (radians Degrees) + (summation 0 (compute-cos Radians) Tolerance))) + +(define sin + {number --> number --> number} + Degrees Tolerance -> (let Radians (radians Degrees) + (summation 0 (compute-sine Radians) Tolerance))) + +(define tan + {number --> number --> number} + Degrees Tolerance -> (/ (sin Degrees Tolerance) (cos Degrees Tolerance))) + +(define radians + {number --> number} + Degrees -> (* (/ Degrees 180) (pi))) + +(define g + {--> number} + -> 1.6180339887498) + +(define pi + {--> number} + -> 3.1415926535897) + +(define e + {--> number} + -> 2.7182818284590) + +(define tan30 + {--> number} + -> 0.5773502691896) + +(define cos30 + {--> number} + -> 0.8660254037844) + +(define cos45 + {--> number} + -> 0.70710678118651) + +(define sin45 + {--> number} + -> 0.7071067811865) + +(define sqrt2 + {--> number} + -> 1.4142135623731) + +(define tan60 + {--> number} + -> 1.7320508075692) + +(define sin60 + {--> number} + -> 0.8660254037844) + +(define sin120 + {--> number} + -> 0.8660254037844) + +(define tan120 +{--> number} + -> -1.7320508075692) + +(define sin135 +{--> number} + -> 0.7071067811865) + +(define cos135 +{--> number} + -> -0.7071067811865) + +(define cos150 +{--> number} + -> -0.8660254037844) + +(define tan150 +{--> number} + -> -0.5773502691905) + +(define cos210 + {--> number} + -> -0.8660254037844) + +(define tan210 +{--> number} + -> 0.5773502691905) + +(define sin225 +{--> number} + -> -0.7071067811865) + +(define cos225 +{--> number} + -> -0.7071067811865) + +(define sin240 +{--> number} + -> -0.8660254037844) + +(define tan240 +{--> number} + -> 1.7320508075692) + +(define sin300 +{--> number} + -> -0.8660254037844) + +(define tan300 +{--> number} + -> -1.7320508075692) + +(define sin315 +{--> number} + -> -0.7071067811865) + +(define cos315 +{--> number} + -> 0.7071067811865) + +(define cos330 +{--> number} + -> 0.8660254037844) + +(define tan330 +{--> number} + -> -0.5773502691905) + +(define coth + {number --> number --> number} + N Tolerance -> (let E (e) + E-2N (expt E (~ (* 2 N)) Tolerance) + (/ (+ 1 E-2N) (- 1 E-2N)))) + +(define sinh + {number --> number --> number} + N Tolerance -> (let E (e) + EN (expt E N Tolerance) + E-N (expt E (~ N) Tolerance) + Diff (- EN E-N) + (/ Diff 2))) + +(define cosh + {number --> number --> number} + N Tolerance -> (let E (e) + EN (expt E N Tolerance) + E-N (expt E (~ N) Tolerance) + Sum (+ EN E-N) + (/ Sum 2))) + +(define tanh + {number --> number --> number} + N Tolerance -> (/ (sinh N Tolerance) (cosh N Tolerance))) + +(define sech + {number --> number --> number} + N Tolerance -> (/ 1 (cosh N Tolerance))) + +(define csch + {number --> number --> number} + N Tolerance -> (/ 1 (sinh N Tolerance))) + +(define power + {number --> number --> number} + _ 0 -> 1 + N M -> (* N (power N (- M 1)))) + +(define factorial + {number --> number} + 0 -> 1 + N -> (* N (factorial (- N 1)))) + +(define prime? + {number --> boolean} + 2 -> true + N -> false where (even? N) + N -> (prime-h N (isqrt N) 3)) + +(define prime-h + {number --> number --> number --> boolean} + _ Sqrt Div -> true where (> Div Sqrt) + N Sqrt Div -> false where (integer? (/ N Div)) + N Sqrt Div -> (prime-h N Sqrt (+ Div 2))) + +(define sign + {number --> number} + 0 -> 0 + N -> 1 where (positive? N) + _ -> -1) + +(define log + {number --> number --> number --> number} + N Base Tolerance -> (/ (log10 N Tolerance) (log10 Base Tolerance))) + +(define loge + {number --> number --> number} + N Tolerance -> (log N (e) Tolerance)) + +(define log2 + {number --> number --> number} + N Tolerance -> (log N 2 Tolerance)) + +(define log10 + {number --> number --> number} + N Tolerance -> (if (>= N 1) + (log10+ N Tolerance) + (~ (log10+ (/ 1 N) Tolerance)))) + +(define log10+ + {number --> number --> number} + Zero Tolerance -> 0 where (<= (abs Zero) Tolerance) + N Tolerance -> (+ 1 (log10+ (/ N 10) Tolerance)) where (>= N 10) + N Tolerance -> (* 0.1 (log10+ (power N 10) (* 10 Tolerance)))) + +(define upto + {A --> (A --> boolean) --> (A --> A) + --> (B --> C --> C) --> C --> (A --> B) --> C} + N Stop? _ _ End _ -> End where (Stop? N) + N Stop? Step Constructor End F -> (Constructor (F N) (upto (Step N) Stop? Step Constructor End F))) ) \ No newline at end of file diff --git a/lib/StLib/Maths/numerals.dtype b/lib/StLib/Maths/numerals.dtype new file mode 100644 index 0000000..5d8f9dd --- /dev/null +++ b/lib/StLib/Maths/numerals.dtype @@ -0,0 +1,47 @@ +(package numerals (append (external maths) [numeral? numeral radix n#->ns n# n#->n]) + + (define n# + N Radix -> (let Vector (absvector 4) + PrintV (address-> Vector 0 print-numeral) + NumbersV (address-> Vector 1 (n->numeral N Radix)) + BaseV (address-> Vector 2 Radix) + NV (address-> Vector 3 N) + Vector) where (and (natural? N) (natural? Radix) (> Radix 0)) + N Radix -> (error "N = ~A, Radix = ~A; N and Radix must be natural numbers where Radix > 0~%" + N Radix)) + + (define radix + Numeral -> (<-address Numeral 2)) + + (define numerals + Numeral -> (<-address Numeral 1)) + + (define n#->n + Numeral -> (<-address Numeral 3)) + + (declare radix [numeral --> number]) + (declare n#->ns [numeral --> [list number]]) + (declare n#->n [numeral --> number]) + (declare n# [number --> [number --> numeral]]) + (declare numeral? [A --> boolean]) + + (define n#->ns + Numeral -> (<-address Numeral 1)) + + (define print-numeral + Numeral -> (let Base (radix Numeral) + Ns (numerals Numeral) + (@s (numeric->string Ns Base) "#" (str Base)))) + + (define numeric->string + {(list number) --> number --> string} + [] _ -> "" + [N | Ns] Base -> (let Char (cases (< N 10) (str N) + (> Base 36) (cn (str N) " ") + true (n->string (+ N 55))) + (cn Char (numeric->string Ns Base)))) + + (define numeral? + Num -> (and (absvector? Num) (= print-numeral (<-address Num 0)))) + + ) \ No newline at end of file diff --git a/lib/StLib/Maths/numerals.shen b/lib/StLib/Maths/numerals.shen new file mode 100644 index 0000000..92d89cf --- /dev/null +++ b/lib/StLib/Maths/numerals.shen @@ -0,0 +1,91 @@ +(package numerals [hex octal duodecimal binary + n-op2 n-op1 n+ n- n* n/ + | (append (external numerals) (external maths))] + +(defmacro numeral-macro + [n-op2 Op M N] -> [n-op2 Op M N [radix M]] + [n-op1 Op M] -> [n-op1 Op M [radix M]] + [n+ M N] -> [n+ M N [radix M]] + [n- M N] -> [n- M N [radix M]] + [n* M N] -> [n* M N [radix M]] + [n/ M N] -> [n/ M N [radix M]]) + +(define n-op2 + {(number --> number --> number) --> numeral --> numeral --> number --> numeral} + Op M N Base -> (n# (Op (n#->n M) (n#->n N)) Base)) + +(define n-op1 + {(number --> number) --> numeral --> number --> numeral} + Op M Base -> (n# (Op (n#->n M)) Base)) + +(define n+ + {numeral --> numeral --> number --> numeral} + M N Base -> (n-op2 (fn +) M N Base)) + +(define n* + {numeral --> numeral --> number --> numeral} + M N Base -> (n-op2 (fn *) M N Base)) + +(define n- + {numeral --> numeral --> number --> numeral} + M N Base -> (n-op2 (fn -) M N Base)) + +(define n/ + {numeral --> numeral --> number --> numeral} + M N Base -> (n-op2 (fn /) M N Base)) + +(define binary + {number --> numeral} + N -> (n# N 2)) + +(define hex + {number --> numeral} + N -> (n# N 16)) + +(define octal + {number --> numeral} + N -> (n# N 8)) + +(define duodecimal + {number --> numeral} + N -> (n# N 12)) + +(define n->numeral + {number --> number --> (list number)} + N Base -> [N] where (> Base N) + N Base -> (let E (largest-expt N Base 0) + Unit (power Base E) + D (div N Unit) + Numeral [D | (n-zeros E)] + Remainder (- N (* D Unit)) + (add Numeral (n->numeral Remainder Base) Base))) + +(define largest-expt + {number --> number --> number --> number} + N Base Expt -> (- Expt 1) where (> (power Base Expt) N) + N Base Expt -> (largest-expt N Base (+ Expt 1))) + +(define n-zeros + {number --> (list number)} + 0 -> [] + N -> [0 | (n-zeros (- N 1))]) + +(define add + {(list number) --> (list number) --> number --> (list number)} + L1 L2 Base -> (reverse (add-h (reverse L1) (reverse L2) Base 0))) + +(define add-h + {(list number) --> (list number) --> number --> number --> (list number)} + [] [] _ 0 -> [] + [] [] _ Carry -> [Carry] + [] L2 Base Carry -> (add-h [0] L2 Base Carry) + L1 [] Base Carry -> (add-h L1 [0] Base Carry) + [N1 | L1] [N2 | L2] Base Carry -> (let M (+ N1 N2 Carry) + (if (< M Base) + [M | (add-h L1 L2 Base 0)] + [(- Base M) | (add-h L1 L2 Base 1)]))) + + ) + + + \ No newline at end of file diff --git a/lib/StLib/Maths/r.shen b/lib/StLib/Maths/r.shen new file mode 100644 index 0000000..70266a1 --- /dev/null +++ b/lib/StLib/Maths/r.shen @@ -0,0 +1,6 @@ +(package rational (append [r-reduce r= r< r> r>= r<= r+ r- r* r/ r-expr +-inverse *-inverse + r-expt r->n r->pair n->r maths.n->r r-approx maths.lcd-loop + r-op1 r-op2] + (external maths)) + + a) \ No newline at end of file diff --git a/lib/StLib/Maths/rationals.dtype b/lib/StLib/Maths/rationals.dtype new file mode 100644 index 0000000..5d81aac --- /dev/null +++ b/lib/StLib/Maths/rationals.dtype @@ -0,0 +1,31 @@ +(package rational [r# rational? rational numerator denominator] + +(define r# + N D -> (let V (absvector 3) + PrintF (address-> V 0 print-rational) + Numerator (address-> V 1 N) + Denominator (address-> V 2 D) + V) where (and (integer? N) (integer? D)) + N D -> (error "numerator ~S and divisor ~S must be integers~%" N D)) + +(define print-rational + V -> (make-string "~S/~S" (<-address V 1) (<-address V 2))) + +(define rational? + R -> (trap-error (and (absvector? R) + (= (<-address R 0) print-rational) + (integer? (<-address R 1)) + (integer? (<-address R 2))) (/. E false))) + +(define numerator + V -> (<-address V 1)) + +(define denominator + V -> (<-address V 2)) + +(declare r# [number --> [number --> rational]]) +(declare rational? [A --> boolean]) +(declare numerator [rational --> number]) +(declare denominator [rational --> number]) ) + + \ No newline at end of file diff --git a/lib/StLib/Maths/rationals.shen b/lib/StLib/Maths/rationals.shen new file mode 100644 index 0000000..7e00b01 --- /dev/null +++ b/lib/StLib/Maths/rationals.shen @@ -0,0 +1,126 @@ +(package rational (append [r-reduce r= r< r> r>= r<= r+ r- r* r/ r-expr +-inverse *-inverse + r-expt r->n r->pair n->r maths.n->r r-approx maths.lcd-loop + r-op1 r-op2] + (external rational) + (external maths)) + +(define r-op1 + {(number --> number) --> rational --> rational} + F R -> (n->r (F (r->n R)))) + +(define r-op2 + {(number --> number --> number) --> rational --> rational --> rational} + F R1 R2 -> (n->r (F (r->n R1) (r->n R2)))) + +(define r->n + {rational --> number} + R -> (/ (numerator R) (denominator R))) + +(define r->pair + {rational --> (number * number)} + R -> (@p (numerator R) (denominator R))) + +(define n->r + {number --> rational} + N -> (let Pair (maths.n->r N 1) + (r# (fst Pair) (snd Pair)))) + +(define r-reduce + {rational --> rational} + R -> (r-reduce-help (numerator R) (denominator R))) + +(define r-reduce-help + {number --> number --> rational} + N D -> (let LCD (lcd N D) + (if (= LCD 1) + (r# N D) + (r-reduce-help (/ N LCD) (/ D LCD))))) + +(define r= + {rational --> rational --> boolean} + R1 R2 -> (let A (numerator R1) + B (denominator R1) + C (numerator R2) + D (denominator R2) + (= (* A D) (* B C)))) + +(define r< + {rational --> rational --> boolean} + R1 R2 -> (let A (numerator R1) + B (denominator R1) + C (numerator R2) + D (denominator R2) + (< (* A D) (* B C)))) + +(define r> + {rational --> rational --> boolean} + R1 R2 -> (not (or (r= R1 R2) (r< R1 R2)))) + +(define r>= + {rational --> rational --> boolean} + R1 R2 -> (or (r= R1 R2) (r> R1 R2))) + +(define r<= + {rational --> rational --> boolean} + R1 R2 -> (or (r= R1 R2) (r< R1 R2))) + +(define r+ + {rational --> rational --> rational} + R1 R2 -> (let A (numerator R1) + B (denominator R1) + C (numerator R2) + D (denominator R2) + (r# (+ (* A D) (* B C)) (* B D)))) + +(define r- + {rational --> rational --> rational} + R1 R2 -> (let A (numerator R1) + B (denominator R1) + C (numerator R2) + D (denominator R2) + (r# (- (* A D) (* B C)) (* B D)))) + +(define r* + {rational --> rational --> rational} + R1 R2 -> (let A (numerator R1) + B (denominator R1) + C (numerator R2) + D (denominator R2) + (r# (* A C) (* B D)))) + +(define +-inverse + {rational --> rational} + R -> (let A (numerator R) + B (denominator R) + (r# (~ A) B))) + +(define *-inverse + {rational --> rational} + R -> (let A (numerator R) + B (denominator R) + (r# B A))) + +(define r/ + {rational --> rational --> rational} + R1 R2 -> (r* R1 (*-inverse R2))) + +(define r-expt + {rational --> number --> rational} + R N -> (let A (numerator R) + B (denominator R) + (r# (power A N) (power B N))) where (natural? N) + R N -> (let A (numerator R) + B (denominator R) + (r# (power B (~ N)) (power A (~ N)))) where (and (integer? N) (negative? N)) + _ N -> (error "cannot exponentiate a rational by a non-integer ~A~%" N)) + +(define r-approx + {rational --> number --> rational} + R D -> (approx-r-h (r->n R) D 0)) + +(define approx-r-h + {number --> number --> number --> rational} + Value D N -> (r# N D) where (> (/ N D) Value) + Value D N -> (approx-r-h Value D (+ N 1))) + + ) \ No newline at end of file diff --git a/lib/StLib/PROVENANCE.md b/lib/StLib/PROVENANCE.md new file mode 100644 index 0000000..2b9ef28 --- /dev/null +++ b/lib/StLib/PROVENANCE.md @@ -0,0 +1,55 @@ +# Provenance of the vendored standard-library sources (lib/StLib) + +These are the **Shen sources** of the Shen standard library for the S41.2 +(2026-07-11 refresh) kernel. Tarver's refresh no longer ships the standard +library as a precompiled `stlib.kl`; it ships these sources, which the SBCL +reference distribution loads into the image at install time via `install.shen`. +shen-lua does the equivalent at boot — see `boot.lua` `load_stdlib` and +`klambda/PROVENANCE.md`. + +## Canonical source + +- **Mirror**: `pyrex41/shen-upstream` — the designated mirror of Mark Tarver's + shenlanguage.org uploads (private repo; formerly `pyrex41/shen-s41.1`, old + URLs redirect). + - Tag: `s41.2-pristine-20260711` + - Commit: `11fc51bdf53a4dcb505adeec6ec8352754cbe50f` +- **Upstream origin** (what the mirror imported): Mark Tarver's `S41.2.zip`. + - URL: https://www.shenlanguage.org/Download/S41.2.zip + - Last-Modified: 2026-07-11 + - Zip SHA-256: `51becbfd60fa8c93c3f8ae5b20b948eaa84c4b1d14ad2f5d2a056002a53ee836` + +Every file here is vendored **byte-identical** to `Lib/StLib/` in the mirror at +that tag (28 files, verified with `cmp`). + +## How shen-lua loads these + +`boot.lua` `load_stdlib()` runs upstream's own `install.shen` — its file order, +its `factorise` toggles, its `(package stlib …)` + `(map (fn systemf) …)` +externals block — with two mechanical rewrites: + +1. The relative `(load "Sub/file.shen")` paths are made absolute against this + directory, so no process `chdir` is needed. +2. The `(tc +)` toggles are neutralised to `(tc -)`: the stdlib is loaded + **without typechecking**. This matches the pre-refresh behaviour (the old + precompiled `stlib.kl` registered no stdlib type signatures either — its + `stlib.initialise` was never called), it is much faster, and it keeps the + native typecheck drivers deferred at boot. Functions are still fully defined + and **arity-registered** (via the kernel's `define`/`update-lambda-table` + path), which is what makes `(fn filter)` and a bare top-level `(filter …)` + resolve — the very thing raw `stlib.kl` defuns did *not* do. + +The load runs at every boot (after kernel init), for the CLI, the port spec +suite, and the kernel certification alike. `SHEN_NO_STDLIB=1` skips it (a +kernel-only embed); `SHEN_STDLIB_DIR` overrides this location. In the +single-file bundle these sources are embedded and materialised to a temp dir at +boot (see `build/make-bundle.lua`). + +## Not typechecked here + +Because the stdlib is loaded with `(tc -)`, stdlib functions carry no +registered type signatures — a `tc +` program that calls, say, `filter` will +not see `filter`'s type. This is unchanged from the pre-refresh port. Loading +the stdlib under `tc +` (upstream's default) would register the signatures but +is markedly slower and eagerly initialises the native typecheck drivers; if a +typed stdlib is wanted, that is a deliberate future option, not the default. diff --git a/lib/StLib/README.txt b/lib/StLib/README.txt new file mode 100644 index 0000000..a133f38 --- /dev/null +++ b/lib/StLib/README.txt @@ -0,0 +1 @@ +to install the standard library, cd in Shen to this directory and enter install.shen \ No newline at end of file diff --git a/lib/StLib/Strings/macros.shen b/lib/StLib/Strings/macros.shen new file mode 100644 index 0000000..e00e9e7 --- /dev/null +++ b/lib/StLib/Strings/macros.shen @@ -0,0 +1,3 @@ +(defmacro string-macros + [s-op1 F S] -> [s-op1 F S [/. (protect X) (protect X)]] + [s-op2 F S1 S2] -> [s-op2 F S1 S2 [/. (protect X) (protect X)]]) diff --git a/lib/StLib/Strings/regex.shen b/lib/StLib/Strings/regex.shen new file mode 100644 index 0000000..375e668 --- /dev/null +++ b/lib/StLib/Strings/regex.shen @@ -0,0 +1,286 @@ + +(package regexp [] + +(datatype re-state + String : string; + Index : number; + Matches : [number]; + ========================================== + (@p (@p String Index) Matches) : re-state; + + Simple-state : string; + ======================= + Simple-state : re-state; + + _________________ + false : re-state;) + +(datatype re-next + + Re-string : string; + =================== + Re-string : re-next; + + ______________ + eos : re-next;) + +\\ re-state holds the state and match data of regular expressions + +(define new-state + {re-state --> re-state} + (@p (@p String Index) Matches) -> (@p (@p String Index) Matches) + String -> (@p (@p String 0) []) where (string? String)) + +(define state + {re-state --> (string * number)} + (@p (@p String Index) Matches) -> (@p String Index) + String -> (@p String 0) where (string? String)) + +(define index + {re-state --> number} + X -> (snd (state X))) + +(define matches + {re-state --> [number]} + (@p (@p String Index) Matches) -> Matches + String -> [] where (string? String)) + +(define next + {re-state --> re-next} + (@p (@p String Index) Matches) -> (trap-error (pos String Index) (/. X eos)) + String -> (next (new-state String)) where (string? String) + What -> (print (make-string "what the ~S" What))) + +(define increment + {re-state --> re-state} + (@p (@p String Index) Matches) -> (@p (@p String (+ 1 Index)) Matches) + String -> (increment (new-state String)) where (string? String)) + +(define match-strings + {re-state --> [string]} + false -> [] + String -> [] where (string? String) + (@p (@p S I) [A B|MS]) -> [(substr S A B)|(match-strings (@p (@p S I) MS))]) + +(define starting-at + {re-state --> number --> re-state} + (@p (@p String _) Matches) Index -> (@p (@p String Index) Matches) + String Index -> (starting-at (new-state String) Index) where (string? String)) + +(define successful? + {re-state --> boolean} + false -> false + _ -> true) + +\******************************************************************************* + * compilation of a regular expression from a string representation + *\ +(define re-or + \* Create a disjunction of regular expressions *\ + [] -> (lambda _ false) + [R|Rs] -> (lambda State + (let Result ((re R) State) + (if (successful? Result) + Result + ((re-or Rs) State))))) + +(define re-and + \* Create a conjunction of regular expressions *\ + [] -> (lambda X X) + [R|Rs] -> (lambda State + (let Result ((re R) State) + (if (successful? Result) + ((re-and Rs) Result) + false)))) + +(define re-repeat + \* Repeatedly apply a regular expression until it fails *\ + R -> (let RC (re R) + (lambda State + (let Result (RC State) + (if (successful? Result) + ((re-repeat RC) Result) + State))))) + +(define with-match + \* Wrap a regular expression into a match. *\ + E -> (lambda State + (let Beg (index State) + Result ((re E) State) + (if (successful? Result) + (@p (state Result) [(index Result) Beg|(matches Result)]) + false)))) + +(define re-repeat-lazy + R1 [] -> (lambda State State) + R1 R2 -> (let RC1 (re R1) + RC2 (re R2) + (lambda State + (let Result1 (RC2 State) + (if (successful? Result1) + Result1 + (let Result2 (RC1 State) + (if (successful? Result2) + ((re-repeat-lazy R1 R2) Result2) + false))))))) + +(define compile-1 + \* Condense (...|...) and [...] control constructs *\ + [] -> [] + ["("|Rs] -> (let Inside (take-while (complement (= ")")) Rs) + Leftover (tl (drop-while (complement (= ")")) Rs)) + Split (remove ["|"] (partition-with (= "|") Inside)) + (cons (with-match + (re-or (map (/. X (re-and (compile-2 (compile-1 X)))) + Split))) + (compile-1 Leftover))) + ["["|Rs] -> (let Inside (take-while (complement (= "]")) Rs) + Leftover (tl (drop-while (complement (= "]")) Rs)) + (cons (re-or Inside) (compile-1 Leftover))) + [R|Rs] -> (cons R (compile-1 Rs))) + +(define compile-2 + \* Handle + and * control constructs *\ + [] -> [] + [R "+" "?" |Rs] -> (cons R (compile-2 [R "*" "?"|Rs])) + [R "+"|Rs] -> (cons R (compile-2 [R "*"|Rs])) + [R1 "*" "?" R2|Rs] -> (cons (re-repeat-lazy R1 R2) (compile-2 Rs)) + [R1 "*" "?"|Rs] -> (cons (re-repeat-lazy R1 []) (compile-2 Rs)) + [R "*"|Rs] -> (cons (re-repeat R) (compile-2 Rs)) + [R|Rs] -> (cons R (compile-2 Rs))) + +(define parse + \* Convert a string regexp into a list of compiled regular expressions and strings *\ + {string --> (list A)} + "" -> [] + \* Character Classes *\ + (@s "\\d" Str) -> [(to-re re-digit?) |(parse Str)] + (@s "[:digit:]" Str) -> [(to-re re-digit?) |(parse Str)] + (@s "\\D" Str) -> [(to-re (complement re-digit?)) |(parse Str)] + (@s "\\s" Str) -> [(to-re re-space?) |(parse Str)] + (@s "[:space:]" Str) -> [(to-re re-space?) |(parse Str)] + (@s "\\S" Str) -> [(to-re (complement re-space?)) |(parse Str)] + (@s "\\a" Str) -> [(to-re re-alpha?) |(parse Str)] + (@s "[:alpha:]" Str) -> [(to-re re-alpha?) |(parse Str)] + (@s "\\A" Str) -> [(to-re (complement re-alpha?)) |(parse Str)] + (@s "\\w" Str) -> [(to-re re-word?) |(parse Str)] + (@s "[:word:]" Str) -> [(to-re re-word?) |(parse Str)] + (@s "\\W" Str) -> [(to-re (complement re-word?)) |(parse Str)] + \* Beginning and end markers *\ + \** (@s "^" Str) -> [beginning-of-string? | (parse Str)] **\ + (@s "$" Str) -> [end-of-string? | (parse Str)] + \* Control characters *\ + (@s "(" Str) -> ["("|(parse Str)] (@s ")" Str) -> [")"|(parse Str)] + (@s "[" Str) -> ["["|(parse Str)] (@s "]" Str) -> ["]"|(parse Str)] + (@s "+" Str) -> ["+"|(parse Str)] (@s "*" Str) -> ["*"|(parse Str)] + (@s "|" Str) -> ["|"|(parse Str)] (@s "?" Str) -> ["?"|(parse Str)] + \* Escape'd and Regular Characters *\ + (@s "\\" C Str) -> [(to-re (= C))|(parse Str)] + (@s C Str) -> [(to-re (= C))|(parse Str)]) + +(define to-re + \* Convert a boolean string matcher into a regular expression *\ + {(string --> boolean) --> regexp} + X -> (lambda S (let Next (next S) + (if (and (not (= eos Next)) (X Next)) + (increment S) false)))) + +(define beginning-of-string? + {re-state --> re-state} + S -> (if (= 0 (index S)) S false)) + +(define end-of-string? + {re-state --> re-state} + S -> (if (= eos (next S)) S false)) + +(define re-digit? + {string --> boolean} + X -> (element? X ["0" "1" "2" "3" "4" "5" "6" "7" "8" "9"])) + +(define re-alpha? + {string --> boolean} + X -> (element? X ["z" "y" "x" "w" "v" "u" "t" "s" "r" "q" "p" "o" "n" + "m" "l" "k" "j" "i" "h" "g" "f" "e" "d" "c" "b" "a" + "Z" "Y" "X" "W" "V" "U" "T" "S" "R" "Q" "P" "O" "N" + "M" "L" "K" "J" "I" "H" "G" "F" "E" "D" "C" "B" "A"])) + +(define re-word? + {string --> boolean} + X -> (or (re-digit? X) (re-alpha? X))) + +(define re-space? + {string --> boolean} + X -> (element? X [" " " " " +"])) + +\******************************************************************************* + * External functions + *\ +(define re + \* Compile a string or S-expr to a regular expression *\ + Str -> (re-and (compile-2 (compile-1 (parse Str)))) where (string? Str) + digit -> (to-re re-digit?) + space -> (to-re re-space?) + alpha -> (to-re re-alpha?) + word -> (to-re re-word?) + Sym -> (re-and (map (function re) (explode (str Sym)))) where (symbol? Sym) + [- A B] -> (re-range A B) + [| |RS] -> (re-or RS) + [bar! |RS] -> (re-or RS) + [: |RS] -> (re-and RS) + [m |RS] -> (re-match RS) + [+ R] -> (re [: R [* R]]) + [* R] -> (re-repeat R) + [+? A B] -> [: A (re-repeat-lazy A B)] + [+? A] -> [: A (re-repeat-lazy A [])] + [*? A B] -> (re-repeat-lazy A B) + [*? A] -> (re-repeat-lazy A []) + CS -> (re [:|CS]) where (cons? CS) + X -> X) + +(define re-search + \* Parse and search for a regular expression in a string. *\ + {string --> string --> match-data} + Re String -> (re-search-from Re String 0)) + +(define re-search-from + \* Parse and search for a regular expression in a string starting at arg3. *\ + {string --> string --> number --> string} + Re Str Ind -> (re-search- (with-match (re Re)) + (starting-at (new-state Str) Ind))) + +(define re-search- + \* Continue searching forward in for arg1 in arg2 until success or eos *\ + {regex --> re-state --> match-data} + Re State -> (let Try (Re State) + (if (= false Try) + (if (= eos (next State)) + false + (re-search- Re (increment State))) + Try))) + +(define do-matches + \* Call a function on every match of arg2 in arg3 *\ + {(match-data --> A) --> string --> string --> (list A)} + Fn Re Str -> (do-matches- Fn (with-match (re Re)) (new-state Str))) + +(define do-matches- + \* Call arg1 on the match data from every match of arg2 in arg3 *\ + {(match-data --> A) --> regexp --> re-state --> (list A)} + Fn Re State -> (let Try (Re State) + (if (= false Try) + (if (= eos (next State)) + [] + (do-matches- Fn Re (increment State))) + (cons (Fn Try) + (do-matches- Fn Re (@p (state Try) [])))))) + +(define replace-regexp + \* replace all matches of arg1 with arg2 in arg3 *\ + {string --> string --> string --> string} + Regexp Replace String -> + (reduce (/. Match Acc + (@s (substr Acc 0 (nth 2 Match)) + Replace + (substr Acc (nth 1 Match) (length-str Acc)))) + String (reverse (do-matches (function snd) Regexp String)))) ) \ No newline at end of file diff --git a/lib/StLib/Strings/smart.shen b/lib/StLib/Strings/smart.shen new file mode 100644 index 0000000..30b86f9 --- /dev/null +++ b/lib/StLib/Strings/smart.shen @@ -0,0 +1,60 @@ +(package string [render-file render string->list file-extension whitespace?] + +(declare render [string --> string]) +(declare render-file [string --> [string --> string]]) + +(define render-file + File Extension -> (let Bytes (read-file-as-bytelist File) + Strings (bytes->strings Bytes []) + Render (compile (fn ) Strings) + Out (file-extension File Extension) + Write (write-to-file Out Render) + Out)) + +(define bytes->strings + [] Strings -> (reverse Strings) + [Byte | Bytes] Strings -> (bytes->strings Bytes [(n->string Byte) | Strings])) + +(define render + String -> (compile (fn ) (string->list String))) + +(define rendered? + "" -> true + (@s "{" _) -> false + (@s _ S) -> (rendered? S)) + +(defcc + "{" "}" := (cn (recapply (fn (intern )) ) ); + "{" "}" := (cn ((intern )) ); + := (cn ); + := "";) + +(defcc + S := S where (and (not (= S "}")) (not (= S "\")));) + +(define recapply + X [] -> X + Fn [X | Y] -> (recapply (Fn X) Y)) + +(defcc + "\" := [ | ]; + := [];) + +(defcc + ;) + +(defcc + Char := Char where (and (not (= Char "}")) + (not (= Char "\")));) + +(defcc + W := skip where (whitespace? W);) + +(defcc + := (cn ); + := "";) + +(defcc + Char := Char where (and (not (= Char "}")) + (not (= Char "\")) + (not (whitespace? Char)));)) \ No newline at end of file diff --git a/lib/StLib/Strings/smartmem.shen b/lib/StLib/Strings/smartmem.shen new file mode 100644 index 0000000..69d9c9f --- /dev/null +++ b/lib/StLib/Strings/smartmem.shen @@ -0,0 +1,63 @@ +(package string [render-file render string->list file-extension whitespace?] + +(declare render [string --> string]) +(declare render-file [string --> [string --> string]]) + +(define render-file + File Extension -> (let Bytes (read-file-as-bytelist File) + Strings (bytes->strings Bytes []) + Render (compile (fn ) Strings) + Out (file-extension File Extension) + Write (write-to-file Out Render) + Out)) + +(define bytes->strings + [] Strings -> (reverse Strings) + [Byte | Bytes] Strings -> (bytes->strings Bytes [(n->string Byte) | Strings])) + +(define render + String -> (let L (string->list String) + (if (element? "{" L) + (compile (fn ) L) + String))) + +(define rendered? + "" -> true + (@s "{" _) -> false + (@s _ S) -> (rendered? S)) + +(defcc + "{" "}" := (cn (render (recapply (fn (intern )) )) ); + "{" "}" := (cn (render ((intern ))) ); + := (cn ); + := "";) + +(defcc + S := S where (and (not (= S "}")) (not (= S "\")));) + +(define recapply + X [] -> X + Fn [X | Y] -> (recapply (Fn X) Y)) + +(defcc + "\" := [ | ]; + := [];) + +(defcc + ;) + +(defcc + Char := Char where (and (not (= Char "}")) + (not (= Char "\")));) + +(defcc + W := skip where (whitespace? W);) + +(defcc + := (cn ); + := "";) + +(defcc + Char := Char where (and (not (= Char "}")) + (not (= Char "\")) + (not (whitespace? Char)));)) \ No newline at end of file diff --git a/lib/StLib/Strings/strings.shen b/lib/StLib/Strings/strings.shen new file mode 100644 index 0000000..957ede8 --- /dev/null +++ b/lib/StLib/Strings/strings.shen @@ -0,0 +1,300 @@ +(package string (append [s-op1 s-op2 string.reverse string.element? + string.infix? string.suffix? string.prefix? string.length string.difference + string.intersection string.nth whitespace? + lowercase? uppercase? digit? alpha? alphanum? + string.subset? string.set=? string.set? string.nth + string.trim string.trim-right string.trim-left + tokenise list->string string->list string.trim-left-if + string.trim-right-if string.trim-if uppercase lowercase + string.map file-extension strip-extension string.count + spell-number string>? string=? string<=? + string.some? string.every?] + (external list)) + +(define string->list + {string --> (list string)} + "" -> [] + S -> (s->l-h S 1 (pos S 0) [])) + +(define s->l-h + {string --> number --> string --> (list string) --> (list string)} + S N "" L -> (reverse L) + S N Char L -> (s->l-h S (+ N 1) (trap-error (pos S N) (/. E "")) [Char | L])) + +(define list->string + {(list string) --> string} + [] -> "" + [S | Ss] -> (cn S (list->string Ss))) + +(define s-op1 + {((list string) --> A) --> string --> (A --> B) --> B} + F S C -> (C (F (string->list S)))) + +(define s-op2 + {((list string) --> (list string) --> A) --> string --> string --> (A --> B) --> B} + F S1 S2 C -> (C (F (string->list S1) (string->list S2)))) + +(define string.count + {string --> string --> number} + _ "" -> 0 + S (@s S Ss) -> (+ 1 (string.count S Ss)) + S (@s _ Ss) -> (string.count S Ss)) + +(define string.reverse + {string --> string} + S -> (s-op1 (fn reverse) S (fn list->string))) + +(define string.element? + {string --> string --> boolean} + Char S -> (s-op1 (/. X (element? Char X)) S)) + +(define string.prefix? + {string --> string --> boolean} + S1 S2 -> (s-op2 (fn prefix?) S1 S2)) + +(define string.infix? + {string --> string --> boolean} + S1 S2 -> (s-op2 (fn infix?) S1 S2)) + +(define string.suffix? + {string --> string --> boolean} + S1 S2 -> (s-op2 (fn suffix?) S1 S2)) + +(define string.subset? + {string --> string --> boolean} + S1 S2 -> (s-op2 (fn subset?) S1 S2)) + +(define string.set=? + {string --> string --> boolean} + S1 S2 -> (s-op2 (fn set=?) S1 S2)) + +(define string.set? + {string --> boolean} + S -> (s-op1 (fn set?) S)) + +(define file-extension + {string --> string --> string} + Path Extension -> (cn (strip-extension Path) Extension)) + +(define strip-extension + {string --> string} + "" -> "" + (@s "." _) -> "" + (@s S Ss) -> (@s S (strip-extension Ss))) + +(define string.length + {string --> number} + S -> (s-op1 (fn length) S)) + +(define string.trim + {(list string) --> string --> string} + L S -> (s-op1 (trim L) S (fn list->string))) + +(define string.trim-if + {(string --> boolean) --> string --> string} + P S -> (s-op1 (trim-if P) S (fn list->string))) + +(define string.trim-right-if + {(string --> boolean) --> string --> string} + P S -> (s-op1 (trim-right-if P) S (fn list->string))) + +(define string.trim-left-if + {(string --> boolean) --> string --> string} + P S -> (s-op1 (trim-left-if P) S (fn list->string))) + +(define string.trim-right + {(list string) --> string --> string} + L S -> (s-op1 (trim-right L) S (fn list->string))) + +(define string.trim-left + {(list string) --> string --> string} + L S -> (s-op1 (trim-left L) S (fn list->string))) + +(define string.some? + {(string --> boolean) --> string --> boolean} + _ "" -> false + F (@s S Ss) -> (or (F S) (string.some? F Ss))) + +(define string.every? + {(string --> boolean) --> string --> boolean} + _ "" -> true + F (@s S Ss) -> (and (F S) (string.every? F Ss))) + +(define string.difference + {string --> string --> string} + S1 S2 -> (s-op2 (fn difference) S1 S2 (fn list->string))) + +(define string.intersection + {string --> string --> string} + S1 S2 -> (s-op2 (fn intersection) S1 S2 (fn list->string))) + +(define string.nth + {number --> string --> string} + N S -> (pos S (+ N 1))) + +(define whitespace? + {string --> boolean} + (@s S _) -> (let N (string->n S) + (element? N [9 10 13 32]))) + +(define uppercase? + {string --> boolean} + (@s S _) -> (let N (string->n S) + (and (> N 64) (< N 91)))) + +(define lowercase? + {string --> boolean} + (@s S _) -> (let N (string->n S) + (and (> N 96) (< N 123)))) + +(define digit? + {string --> boolean} + (@s S _) -> (let N (string->n S) + (and (> N 47) (< N 58)))) + +(define alpha? + {string --> boolean} + (@s S _) -> (let N (string->n S) + (or (and (> N 64) (< N 91)) + (and (> N 96) (< N 123)))) + _ -> false) + +(define alphanum? + {string --> boolean} + (@s S _) -> (let N (string->n S) + (or (and (> N 64) (< N 91)) + (and (> N 96) (< N 123)) + (and (> N 47) (< N 58)))) + _ -> false) + +(define tokenise + {(string --> boolean) --> string --> (list string)} + P S -> (tokenise-h P S "")) + +(define tokenise-h + {(string --> boolean) --> string --> string --> (list string)} + _ "" S -> [S] + P (@s S Ss) Token -> [Token | (tokenise-h P Ss "")] where (P S) + P (@s S Ss) Token -> (tokenise-h P Ss (@s Token S))) + +(define uppercase + {string --> string} + (@s S Ss) -> (if (lowercase? S) + (@s (n->string (- (string->n S) 32)) Ss) + (@s S Ss))) + +(define lowercase + {string --> string} + (@s S Ss) -> (if (uppercase? S) + (@s (n->string (+ (string->n S) 32)) Ss) + (@s S Ss))) + +(define string.map + {(string --> string) --> string --> string} + _ "" -> "" + F (@s S Ss) -> (@s (F S) (string.map F Ss))) + +(define spell-number + {number --> string} + 0 -> "zero" + N -> (scale (map (fn digits) (triples (explode N))))) + +(define digit + {string --> string} + "0" -> "" + "1" -> "one" + "2" -> "two" + "3" -> "three" + "4" -> "four" + "5" -> "five" + "6" -> "six" + "7" -> "seven" + "8" -> "eight" + "9" -> "nine") + +(define triples + {(list A) --> (list (list A))} + L -> (triples-h (reverse L) [])) + +(define triples-h + {(list A) --> (list (list A)) --> (list (list A))} + [W X Y | Z] Triples -> (triples-h Z [(reverse [W X Y]) | Triples]) + X Triples -> [(reverse X) | Triples]) + +(define digits + {(list string) --> string} + ["0" "0" "0"] -> "" + [N "0" "0"] -> (@s (digit N) " " "hundred") + ["0" "0" N] -> (@s "and" " " (digit N)) + ["0" N N'] -> (@s "and" " " (tens N N')) + [N "0" N'] -> (@s (digit N) " " "hundred" " " "and" " " (digit N')) + [N N' N''] -> (@s (digit N) " " "hundred" " " "and" " " (tens N' N'')) + [N N'] -> (tens N N') + [N] -> (digit N) + [] -> "") + +(define tens + {string --> string --> string} + "1" N -> (cases (= N "0") "ten" + (= N "1") "eleven" + (= N "2") "twelve" + (= N "3") "thirteen" + (= N "4") "fourteen" + (= N "5") "fifteen" + (= N "6") "sixteen" + (= N "7") "seventeen" + (= N "8") "eighteen" + (= N "9") "nineteen") + "2" N -> (@s "twenty" " " (digit N)) + "3" N -> (@s "thirty" " " (digit N)) + "4" N -> (@s "forty" " " (digit N)) + "5" N -> (@s "fifty" " " (digit N)) + "6" N -> (@s "sixty" " " (digit N)) + "7" N -> (@s "seventy" " " (digit N)) + "8" N -> (@s "eighty" " " (digit N)) + "9" N -> (@s "ninety" " " (digit N))) + +(define scale + {(list string) --> string} + [S] -> S + ["" | Ss] -> (scale Ss) + [S | Ss] -> (@s S (units (length [S | Ss])) (scale Ss))) + +(define units + {number --> string} + 2 -> " thousand " + 3 -> " million " + 4 -> " billion " + 5 -> " trillion " + _ -> (error "this number has a magnitude beyond our text representation")) + +(define string>? + {string --> string --> boolean} + "" _ -> false + _ "" -> true + (@s S Ss) (@s S* S*s) -> (let SN (string->n S) + S*N (string->n S*) + (cases (> SN S*N) true + (< SN S*N) false + true (string>? Ss S*s)))) + +(define string string --> boolean} + _ "" -> false + "" _ -> true + (@s S Ss) (@s S* S*s) -> (let SN (string->n S) + S*N (string->n S*) + (cases (< SN S*N) true + (> SN S*N) false + true (string=? + {string --> string --> boolean} + S S* -> (or (= S S*) (string>? S S*))) + +(define string<=? + {string --> string --> boolean} + S S* -> (or (= S S*) (string (let S1+S2 (concat S1 S2) + (if (symbol? S1+S2) + S1+S2 + (error "'~A' is not a symbol~%" S1+S2)))) + +(declare concat* [A --> [B --> symbol]]) ) + diff --git a/lib/StLib/Symbols/symbols2.shen b/lib/StLib/Symbols/symbols2.shen new file mode 100644 index 0000000..a880070 --- /dev/null +++ b/lib/StLib/Symbols/symbols2.shen @@ -0,0 +1,9 @@ +(package symbol [newv | (external symbol)] + +(define newv + {--> symbol} + -> (gensym (protect X))) + + + + ) diff --git a/lib/StLib/Tuples/tuples.shen b/lib/StLib/Tuples/tuples.shen new file mode 100644 index 0000000..a9c77e1 --- /dev/null +++ b/lib/StLib/Tuples/tuples.shen @@ -0,0 +1,30 @@ +(package tuple [pairoff assocp cartprodp assocp-if assocp-if-not] + + (define pairoff + {(list A) --> (list B) --> (list (A * B))} + [] _ -> [] + _ [] -> [] + [X | Y] [W | Z] -> [(@p X W) | (pairoff Y Z)]) + + (define assocp + {A --> (list (A * B)) --> (A * B)} + _ [] -> (error "pair not found~%") + X [(@p X Y) | _] -> (@p X Y) + X [_ | Pairs] -> (assocp X Pairs)) + + (define cartprodp + {(list A) --> (list B) --> (list (A * B))} + [] _ -> [] + [X | Y] Z -> (append (map (/. W (@p X W)) Z) (cartprodp Y Z))) + + (define assocp-if + {(A --> boolean) --> (list (A * B)) --> (A * B)} + _ [] -> (error "pair not found~%") + F? [(@p X Y) | _] -> (@p X Y) where (F? X) + F? [_ | Pairs] -> (assocp-if F? Pairs)) + + (define assocp-if-not + {(A --> boolean) --> (list (A * B)) --> (A * B)} + _ [] -> (error "pair not found~%") + F? [(@p X Y) | _] -> (@p X Y) where (not (F? X)) + F? [_ | Pairs] -> (assocp-if-not F? Pairs)) ) \ No newline at end of file diff --git a/lib/StLib/Vectors/macros.shen b/lib/StLib/Vectors/macros.shen new file mode 100644 index 0000000..f057f0d --- /dev/null +++ b/lib/StLib/Vectors/macros.shen @@ -0,0 +1,26 @@ +(package vector [newv array for to] + +(defmacro vector-macros + + \\ read access + [:= V [cons I []]] -> [<-vector V I] + + [:= V [cons I Is]] -> [:= [<-vector V I] Is] + + \\ write access + [V [cons I []] := X] -> [vector-> V I X] + + [V [cons I Is] := X] -> (let V2 (newv) + [let V2 [<-vector V I] + [V2 Is := X]]) + \\ array construction + [array [cons Dim []]] -> [vector Dim] + [array [cons Dim Dims]] + -> (let V (newv) + N (newv) + [let V [vector Dim] + [do [for N = 1 to Dim + [vector-> V N [array Dims]]] + V]]))) + + \ No newline at end of file diff --git a/lib/StLib/install.shen b/lib/StLib/install.shen new file mode 100644 index 0000000..b993cca --- /dev/null +++ b/lib/StLib/install.shen @@ -0,0 +1,51 @@ + +(load "Symbols/symbols1.shen") +(tc +) +(load "Symbols/symbols2.shen") +(tc -) +(factorise +) +(load "Maths/macros.shen") +(factorise -) +(tc +) +(load "Maths/maths.shen") +(tc -) +(load "Maths/rationals.dtype") +(tc +) +(load "Maths/rationals.shen") +(tc -) +(load "Maths/complex.dtype") +(tc +) +(load "Maths/complex.shen") +(tc -) +(load "Maths/numerals.dtype") +(tc +) +(load "Maths/numerals.shen") +(load "Lists/lists.shen") +(load "Strings/macros.shen") +(load "Strings/strings.shen") +(tc -) +(load "Strings/smart.shen") +(factorise +) +(load "Vectors/macros.shen") +(factorise -) +(tc +) +(load "IO/prettyprint.shen") +(tc -) +(load "IO/delete-file.shen") +(tc +) +(load "IO/files.shen") +(load "Tuples/tuples.shen") +(tc -) +(load "package-stlib.shen") + +\\ all external functions of the standard library are declared as system functions +(let External (external stlib) + ExternalF (filter (/. X (> (arity X) -1)) External) + Systemf (map (fn systemf) ExternalF) + ok) + +(preclude-all-but []) +(set shen.*userdefs* []) +(cd "") +(tc -) + diff --git a/lib/StLib/package-stlib.shen b/lib/StLib/package-stlib.shen new file mode 100644 index 0000000..4980a48 --- /dev/null +++ b/lib/StLib/package-stlib.shen @@ -0,0 +1,4 @@ +(package stlib (mapcan (fn external) + [list string maths vector symbol + tuple file print]) + void) \ No newline at end of file diff --git a/scripts/run-tests.lua b/scripts/run-tests.lua index edb6eb3..0ac5a36 100644 --- a/scripts/run-tests.lua +++ b/scripts/run-tests.lua @@ -38,6 +38,7 @@ local specs = { "test/primitives_spec.lua", "test/reader_spec.lua", "test/repl_spec.lua", + "test/stdlib_spec.lua", "test/tailcall_spec.lua", "test/typecheck_api_spec.lua", "test/typecheck_lazy_spec.lua", diff --git a/test/library_spec.lua b/test/library_spec.lua index 90c8588..00e20b8 100644 --- a/test/library_spec.lua +++ b/test/library_spec.lua @@ -3,13 +3,13 @@ -- -- This is NOT the canonical kernel certification suite (run-kernel-tests.lua). -- --- NB on scope: a handful of list functions present in some Shen distributions --- (filter/take/drop/fold-*) are NOT defined in the kernel this port loads — --- calling them raises "fn: is undefined". We therefore cover the set --- the port actually provides (map / reverse / append / element? / length / --- head / tail / sum / remove / occurrences / reverse-involution / cons?/empty?) --- and assert that the genuinely-absent ones report a clean catchable error --- rather than crashing — that absence is itself a documented port fact. +-- NB on scope: the standard library is loaded at boot from the S-lineage +-- lib/StLib Shen sources (see boot.lua load_stdlib), so list functions like +-- filter / take / drop are present and covered here alongside the kernel-core +-- functions (map / reverse / append / element? / length / head / tail / sum / +-- remove / occurrences / cons? / empty?). See also test/stdlib_spec.lua for +-- the (fn filter) / bare-(filter …) regression that motivated loading stdlib +-- from source. -- -- luajit test/library_spec.lua local shen = require("shen") @@ -106,15 +106,17 @@ checkeq("(lib-spec-sumlist [1 2 3 4 5])", "15") checkeq("(lib-spec-sumlist [])", "0") -- --------------------------------------------------------------------------- --- DOCUMENTED ABSENCE: filter/take/drop are not provided by the loaded kernel; --- calling them raises a clean catchable error rather than crashing the process. --- (If a future kernel revision adds them, flip these to behavior assertions.) +-- stdlib higher-order + list functions. These come from the S-lineage +-- lib/StLib sources (Lists/lists.shen etc.), loaded through the kernel's own +-- define pipeline at boot (see boot.lua load_stdlib). Before the stdlib was +-- loaded from source, filter/take/drop were absent and this block asserted a +-- clean "undefined" error; now they are present and we assert behaviour. -- --------------------------------------------------------------------------- shen.eval("(define lib-spec-gt1 X -> (> X 1))") -check(trap("(filter lib-spec-gt1 [1 2 3])"):find("filter is undefined", 1, true) ~= nil, - "absent stdlib filter reports a clean 'undefined' error (not a crash)") -check(trap("(take 2 [1 2 3])"):find("take is undefined", 1, true) ~= nil, - "absent stdlib take reports a clean 'undefined' error (not a crash)") +checkeq("(filter lib-spec-gt1 [1 2 3])", "(2 3)") +checkeq("(filter (/. X (> X 2)) [1 2 3 4 5])", "(3 4 5)") +checkeq("(take 2 [1 2 3])", "(1 2)") +checkeq("(drop 2 [1 2 3])", "(3)") io.write(string.format("library_spec: %d pass, %d fail\n", npass, nfail)) os.exit(nfail == 0 and 0 or 1) diff --git a/test/stdlib_spec.lua b/test/stdlib_spec.lua new file mode 100644 index 0000000..368f89b --- /dev/null +++ b/test/stdlib_spec.lua @@ -0,0 +1,53 @@ +-- test/stdlib_spec.lua — regression for loading the standard library from its +-- S-lineage Shen sources (lib/StLib) instead of a precompiled stlib.kl. +-- +-- The motivating bug: the pre-refresh port booted klambda/stlib.kl as raw KL +-- defuns, which put functions in F but NEVER registered their `arity` property +-- or shen.*lambdatable* entry (stlib.initialise was never called). So a bare +-- top-level `(filter ...)` or a first-class `(fn filter)` — both of which +-- resolve through the lambda table — died with "fn: filter is undefined", +-- even though the function existed. Loading the stdlib through the kernel's own +-- (load)/define pipeline (boot.lua load_stdlib) registers the arity + lambda +-- entry, so these now work. This spec locks that behaviour in. +-- +-- luajit test/stdlib_spec.lua +local shen = require("shen") +shen.boot{ quiet = true } +local R = require("runtime") + +local npass, nfail = 0, 0 +local function check(cond, name) + if cond then npass = npass + 1 + else nfail = nfail + 1; io.write("FAIL: ", name, "\n") end +end +local function evs(src) return R.to_str(shen.eval(src)) end +local function checkeq(src, want) + local ok, got = pcall(evs, src) + if not ok then nfail = nfail + 1; io.write("FAIL: ", src, " (raised: ", tostring(got), ")\n") + elseif got == want then npass = npass + 1 + else nfail = nfail + 1; io.write("FAIL: ", src, "\n want: ", want, "\n got: ", got, "\n") end +end + +-- ---- the exact regression: arity is registered, (fn ...) resolves ---------- +check(shen.call("arity", shen.sym("filter")) == 2, + "filter has a registered runtime arity (not -1)") + +-- bare top-level application (compiles through the (fn filter) lambda-table path) +checkeq("(filter (/. X (> X 2)) [1 2 3 4 5])", "(3 4 5)") + +-- first-class function reference: (fn filter) must resolve to a callable value, +-- not raise "fn: filter is undefined" +check((pcall(shen.eval, "(fn filter)")), "(fn filter) resolves to a value") +checkeq("(map (fn filter) [])", "()") -- map over [] just exercises (fn filter) eval + +-- higher-order use of a stdlib function passed by name +checkeq("((fn filter) (/. X (> X 0)) [-1 2 -3 4])", "(2 4)") + +-- ---- coverage across the stdlib modules the install loads ------------------ +checkeq("(take 2 [a b c d])", "(a b)") +checkeq("(drop 2 [a b c d])", "(c d)") +checkeq("(reverse (take 3 [1 2 3 4 5]))", "(3 2 1)") +checkeq("(map (/. X (* X X)) [1 2 3])", "(1 4 9)") -- kernel-core, sanity + +io.write(string.format("stdlib_spec: %d pass, %d fail\n", npass, nfail)) +os.exit(nfail == 0 and 0 or 1)