eliscript 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COPYING.RUNTIME +93 -0
- package/README.md +15 -3
- package/bin/eliscript-test +29 -0
- package/bootstrap/backends/README.md +5 -4
- package/bootstrap/backends/binary.eli +89 -22
- package/bootstrap/backends/capabilities.eli +9 -4
- package/bootstrap/backends/managed-layout.eli +93 -81
- package/bootstrap/backends/managed.eli +651 -125
- package/bootstrap/backends/native.eli +1791 -324
- package/bootstrap/backends/numeric.eli +71 -7
- package/bootstrap/backends/sha256.eli +165 -68
- package/bootstrap/backends/wasm.eli +461 -52
- package/bootstrap/compiler/analyzer.eli +692 -2
- package/bootstrap/compiler/compiler.eli +16 -3
- package/bootstrap/compiler/emitter.eli +80 -35
- package/bootstrap/compiler/project.eli +175 -1
- package/bootstrap/compiler/transient-analysis.eli +2 -2
- package/bootstrap/host/build.eli +1 -0
- package/bootstrap/host/build.mjs +1 -1
- package/bootstrap/host/build.mjs.map +1 -1
- package/bootstrap/host/bun.mjs +7 -9
- package/bootstrap/host/bun.mjs.map +1 -1
- package/bootstrap/host/check-cli-ground.eli +47 -5
- package/bootstrap/host/check-cli-ground.mjs +60 -19
- package/bootstrap/host/check-cli-ground.mjs.map +1 -1
- package/bootstrap/host/check-cli.mjs +41 -1
- package/bootstrap/host/check-cli.mjs.map +1 -1
- package/bootstrap/host/compiler-session.eli +136 -22
- package/bootstrap/host/eliscript-cli.mjs +1 -1
- package/bootstrap/host/eliscript-cli.mjs.map +1 -1
- package/bootstrap/host/evaluation-cli.eli +33 -1
- package/bootstrap/host/evaluation-cli.mjs +65 -28
- package/bootstrap/host/evaluation-cli.mjs.map +1 -1
- package/bootstrap/host/evaluation.eli +651 -42
- package/bootstrap/host/evaluation.mjs +884 -72
- package/bootstrap/host/evaluation.mjs.map +1 -1
- package/bootstrap/host/project-cli-ground.eli +6 -1
- package/bootstrap/host/project-cli-ground.mjs +33 -32
- package/bootstrap/host/project-cli-ground.mjs.map +1 -1
- package/bootstrap/host/project-cli.mjs +1 -1
- package/bootstrap/host/project-cli.mjs.map +1 -1
- package/bootstrap/host/project-ground.eli +266 -45
- package/bootstrap/host/project-ground.mjs +429 -159
- package/bootstrap/host/project-ground.mjs.map +1 -1
- package/bootstrap/host/project.mjs +30 -40
- package/bootstrap/host/project.mjs.map +1 -1
- package/bootstrap/host/test-cli.eli +379 -0
- package/bootstrap/host/test-cli.mjs +494 -0
- package/bootstrap/host/test-cli.mjs.map +1 -0
- package/browser/README.md +7 -0
- package/browser/host.mjs +21 -29
- package/browser/host.mjs.map +1 -1
- package/browser/worker.mjs +7 -9
- package/browser/worker.mjs.map +1 -1
- package/compiler/eliscript-analyzer.el +694 -0
- package/compiler/eliscript-cli.el +66 -22
- package/compiler/eliscript-emitter.el +67 -43
- package/compiler/eliscript-ir-emitter.el +71 -36
- package/compiler/eliscript-project.el +360 -80
- package/compiler/eliscript-transient-analysis.el +5 -5
- package/compiler/eliscript.el +6 -0
- package/dist/backends/binary.mjs +148 -26
- package/dist/backends/binary.mjs.map +1 -1
- package/dist/backends/capabilities.mjs +11 -4
- package/dist/backends/capabilities.mjs.map +1 -1
- package/dist/backends/elf.mjs +4 -4
- package/dist/backends/elf.mjs.map +1 -1
- package/dist/backends/managed-layout.mjs +53 -56
- package/dist/backends/managed-layout.mjs.map +1 -1
- package/dist/backends/managed.mjs +1116 -375
- package/dist/backends/managed.mjs.map +1 -1
- package/dist/backends/memory.mjs +24 -26
- package/dist/backends/memory.mjs.map +1 -1
- package/dist/backends/native.mjs +2529 -434
- package/dist/backends/native.mjs.map +1 -1
- package/dist/backends/numeric.mjs +140 -33
- package/dist/backends/numeric.mjs.map +1 -1
- package/dist/backends/optimize.mjs +2 -2
- package/dist/backends/optimize.mjs.map +1 -1
- package/dist/backends/regexp.mjs +33 -35
- package/dist/backends/regexp.mjs.map +1 -1
- package/dist/backends/sha256.mjs +159 -59
- package/dist/backends/sha256.mjs.map +1 -1
- package/dist/backends/wasm.mjs +609 -73
- package/dist/backends/wasm.mjs.map +1 -1
- package/dist/bootstrap/analyzer.mjs +1018 -2
- package/dist/bootstrap/analyzer.mjs.map +1 -1
- package/dist/bootstrap/compiler.mjs +30 -23
- package/dist/bootstrap/compiler.mjs.map +1 -1
- package/dist/bootstrap/emitter.mjs +206 -161
- package/dist/bootstrap/emitter.mjs.macro-origins.json +16 -16
- package/dist/bootstrap/emitter.mjs.map +1 -1
- package/dist/bootstrap/expander.mjs +27 -31
- package/dist/bootstrap/expander.mjs.map +1 -1
- package/dist/bootstrap/ir.mjs +22 -24
- package/dist/bootstrap/ir.mjs.map +1 -1
- package/dist/bootstrap/project.mjs +246 -1
- package/dist/bootstrap/project.mjs.map +1 -1
- package/dist/bootstrap/reader.mjs +2 -2
- package/dist/bootstrap/reader.mjs.map +1 -1
- package/dist/bootstrap/source-map.mjs +34 -48
- package/dist/bootstrap/source-map.mjs.map +1 -1
- package/dist/bootstrap/transient-analysis.mjs +2 -2
- package/dist/bootstrap/transient-analysis.mjs.map +1 -1
- package/dist/browser/compiler.js +106 -106
- package/dist/browser/host.mjs +21 -29
- package/dist/browser/loader.js +1 -1
- package/dist/browser/worker.mjs +95 -95
- package/dist/compiler-artifact.json +1 -1
- package/dist/host/compiler-session.mjs +405 -228
- package/dist/host/compiler-session.mjs.map +1 -1
- package/dist/host/compiler-tools.mjs +44 -46
- package/dist/host/compiler-tools.mjs.map +1 -1
- package/dist/literal-sources/runtime/core/array-map.eli +45 -0
- package/dist/literal-sources/runtime/core/collection-internals.eli +22 -2
- package/dist/literal-sources/runtime/core/collection.eli +282 -23
- package/dist/literal-sources/runtime/core/data-text.eli +196 -13
- package/dist/literal-sources/runtime/core/data.eli +1 -1
- package/dist/literal-sources/runtime/core/identifier.eli +1 -1
- package/dist/literal-sources/runtime/core/lazy-sequence.eli +822 -44
- package/dist/literal-sources/runtime/core/list.eli +1 -1
- package/dist/literal-sources/runtime/core/map.eli +1 -1
- package/dist/literal-sources/runtime/core/metadata-internals.eli +2 -2
- package/dist/literal-sources/runtime/core/metadata.eli +2 -2
- package/dist/literal-sources/{stdlib/core/object.eli → runtime/core/object-impl.eli} +6 -6
- package/dist/literal-sources/runtime/core/object.eli +1 -1
- package/dist/literal-sources/runtime/core/order.eli +3 -3
- package/dist/literal-sources/runtime/core/persistent-kind.eli +1 -1
- package/dist/literal-sources/{stdlib/core/protocol.eli → runtime/core/protocol-impl.eli} +2 -2
- package/dist/literal-sources/runtime/core/protocol.eli +5 -3
- package/dist/literal-sources/runtime/core/queue.eli +1 -1
- package/dist/literal-sources/runtime/core/record.eli +3 -3
- package/dist/literal-sources/runtime/core/regex.eli +2 -2
- package/dist/literal-sources/runtime/core/sequence.eli +1 -1
- package/dist/literal-sources/runtime/core/set-algebra.eli +1 -1
- package/dist/literal-sources/runtime/core/set.eli +1 -1
- package/dist/literal-sources/runtime/core/sorted.eli +4 -4
- package/dist/literal-sources/{stdlib/core/text.eli → runtime/core/text-impl.eli} +2 -2
- package/dist/literal-sources/runtime/core/text.eli +1 -1
- package/dist/literal-sources/runtime/core/transducer.eli +24 -2
- package/dist/literal-sources/runtime/core/transient.eli +7 -5
- package/dist/literal-sources/runtime/core/type.eli +1 -1
- package/dist/literal-sources/runtime/core/value-internals.eli +3 -3
- package/dist/literal-sources/runtime/core/value.eli +2 -2
- package/dist/literal-sources/runtime/core/vector.eli +5 -2
- package/dist/literal-sources/{stdlib → runtime/managed}/managed-literal-protocols.eli +100 -34
- package/dist/literal-sources/{stdlib → runtime/managed}/managed-literals.eli +406 -81
- package/{stdlib → dist/literal-sources/runtime/managed}/managed-queue-state.eli +1 -1
- package/{stdlib → dist/literal-sources/runtime/managed}/managed-sorted-state.eli +1 -1
- package/dist/literal-sources/runtime/managed/managed-transient-state.eli +1206 -0
- package/{stdlib → dist/literal-sources/runtime/managed}/managed-value-state.eli +30 -6
- package/dist/literal-sources/{stdlib → runtime/managed}/managed-vector-view-state.eli +1 -1
- package/dist/literal-sources/runtime/wire/http-rpc.eli +1 -1
- package/dist/literal-sources/runtime/wire/markdown.eli +1 -1
- package/dist/literal-sources/runtime/wire/schema.eli +1 -1
- package/dist/literal-sources/stdlib/bit.eli +89 -1
- package/dist/literal-sources/stdlib/data.eli +522 -0
- package/dist/literal-sources/stdlib/interop/object.eli +39 -0
- package/dist/literal-sources/stdlib/persistent-list.eli +60 -21
- package/dist/literal-sources/stdlib/persistent-map.eli +335 -324
- package/dist/literal-sources/stdlib/persistent-set.eli +8 -6
- package/dist/literal-sources/stdlib/persistent-vector.eli +18 -18
- package/dist/literal-sources/stdlib/protocol.eli +63 -0
- package/{stdlib/core → dist/literal-sources/stdlib}/set.eli +8 -8
- package/dist/literal-sources/stdlib/string.eli +362 -0
- package/dist/runtime/lisp/async-runtime.mjs +55 -59
- package/dist/runtime/lisp/async-runtime.mjs.map +1 -1
- package/dist/runtime/lisp/builtins.mjs +232 -280
- package/dist/runtime/lisp/builtins.mjs.map +1 -1
- package/dist/runtime/lisp/cli.mjs +159 -167
- package/dist/runtime/lisp/cli.mjs.map +1 -1
- package/dist/runtime/lisp/compiler.mjs +359 -419
- package/dist/runtime/lisp/compiler.mjs.map +1 -1
- package/dist/runtime/lisp/core.mjs +24 -24
- package/dist/runtime/lisp/core.mjs.map +1 -1
- package/dist/runtime/lisp/evaluator.mjs +315 -385
- package/dist/runtime/lisp/evaluator.mjs.map +1 -1
- package/dist/runtime/lisp/extensions.mjs +85 -103
- package/dist/runtime/lisp/extensions.mjs.map +1 -1
- package/dist/runtime/lisp/host-io.mjs +106 -122
- package/dist/runtime/lisp/host-io.mjs.map +1 -1
- package/dist/runtime/lisp/io-worker.mjs +117 -135
- package/dist/runtime/lisp/io-worker.mjs.map +1 -1
- package/dist/runtime/lisp/keymap.mjs +5 -5
- package/dist/runtime/lisp/keymap.mjs.map +1 -1
- package/dist/runtime/lisp/macros-forms.mjs +49 -51
- package/dist/runtime/lisp/macros-forms.mjs.map +1 -1
- package/dist/runtime/lisp/reader-format.mjs +31 -31
- package/dist/runtime/lisp/reader-format.mjs.map +1 -1
- package/dist/runtime/lisp/regexp-buffer.mjs +9 -9
- package/dist/runtime/lisp/regexp-buffer.mjs.map +1 -1
- package/dist/runtime/math.mjs +32 -38
- package/dist/runtime/math.mjs.map +1 -1
- package/dist/runtime/number-radix.mjs +5 -7
- package/dist/runtime/number-radix.mjs.map +1 -1
- package/dist/runtime/primitives.mjs +81 -46
- package/dist/runtime/primitives.mjs.macro-origins.json +294 -44
- package/dist/runtime/primitives.mjs.map +1 -1
- package/dist/runtime/unicode-case.mjs +6 -6
- package/dist/runtime/unicode-case.mjs.map +1 -1
- package/dist/runtime.eli +3068 -1882
- package/dist/stage3-release.json +1 -1
- package/dist/stdlib/async.mjs +1838 -0
- package/dist/stdlib/bit.mjs +116 -0
- package/dist/stdlib/collection.mjs +193 -0
- package/dist/stdlib/core.mjs +28 -0
- package/dist/stdlib/data-text.mjs +54 -0
- package/dist/stdlib/data.mjs +601 -0
- package/dist/stdlib/devtools.mjs +565 -0
- package/dist/stdlib/diff.mjs +180 -0
- package/dist/stdlib/fn.mjs +164 -0
- package/dist/stdlib/hierarchy.mjs +189 -0
- package/dist/stdlib/identifier.mjs +33 -0
- package/dist/stdlib/interop/js.mjs +706 -0
- package/dist/stdlib/interop/object.mjs +40 -0
- package/dist/stdlib/json.mjs +843 -0
- package/dist/stdlib/lazy-sequence.mjs +117 -0
- package/dist/stdlib/math.mjs +386 -0
- package/dist/stdlib/meta.mjs +21 -0
- package/dist/stdlib/multimethod.mjs +345 -0
- package/dist/stdlib/numeric.mjs +327 -0
- package/dist/stdlib/order.mjs +194 -0
- package/dist/stdlib/persistent-list.mjs +171 -0
- package/dist/stdlib/persistent-map.mjs +781 -0
- package/dist/stdlib/persistent-queue.mjs +44 -0
- package/dist/stdlib/persistent-set.mjs +225 -0
- package/dist/stdlib/persistent-vector.mjs +316 -0
- package/dist/stdlib/portable/data-text.mjs +1094 -0
- package/dist/stdlib/portable/data.mjs +62 -0
- package/dist/stdlib/portable/identifier.mjs +179 -0
- package/dist/stdlib/portable/metadata.mjs +63 -0
- package/dist/stdlib/portable/object.mjs +140 -0
- package/dist/stdlib/portable/sequence.mjs +142 -0
- package/dist/stdlib/portable/text.mjs +111 -0
- package/dist/stdlib/pprint.mjs +807 -0
- package/dist/stdlib/protocol.mjs +61 -0
- package/dist/stdlib/record.mjs +25 -0
- package/dist/stdlib/regex.mjs +115 -0
- package/dist/stdlib/result.mjs +198 -0
- package/dist/stdlib/schema.mjs +2828 -0
- package/dist/stdlib/seq.mjs +913 -0
- package/dist/stdlib/set.mjs +317 -0
- package/dist/stdlib/sorted.mjs +56 -0
- package/dist/stdlib/state.mjs +451 -0
- package/dist/stdlib/string.mjs +494 -0
- package/dist/stdlib/tap.mjs +187 -0
- package/dist/stdlib/test.mjs +669 -0
- package/dist/stdlib/time.mjs +522 -0
- package/dist/stdlib/transducer.mjs +85 -0
- package/dist/stdlib/transient.mjs +32 -0
- package/dist/stdlib/type.mjs +28 -0
- package/dist/stdlib/uuid.mjs +377 -0
- package/dist/stdlib/value.mjs +334 -0
- package/dist/stdlib/walk.mjs +243 -0
- package/dist/stdlib/wire/gepo.mjs +28 -0
- package/dist/stdlib/wire/mdp.mjs +13 -0
- package/dist/stdlib/wire/mds.mjs +10 -0
- package/dist/stdlib/zipper.mjs +1025 -0
- package/editor/README.md +15 -0
- package/editor/eliscript-data.el +221 -8
- package/editor/eliscript-mode.el +207 -48
- package/editor/eliscript-runtime.el +6 -3
- package/package.json +49 -15
- package/platform/README.md +6 -0
- package/platform/browser.mjs +10 -12
- package/platform/browser.mjs.map +1 -1
- package/runtime/README.md +12 -5
- package/runtime/core/array-map.eli +538 -0
- package/runtime/core/array-map.mjs +651 -0
- package/runtime/core/array-map.mjs.map +1 -0
- package/runtime/core/collection-internals.eli +85 -33
- package/runtime/core/collection-internals.mjs +245 -193
- package/runtime/core/collection-internals.mjs.map +1 -1
- package/runtime/core/collection.eli +105 -3
- package/runtime/core/collection.mjs +190 -53
- package/runtime/core/collection.mjs.map +1 -1
- package/runtime/core/data-text.eli +224 -16
- package/runtime/core/data-text.mjs +345 -83
- package/runtime/core/data-text.mjs.map +1 -1
- package/runtime/core/data.eli +50 -33
- package/runtime/core/data.mjs +72 -36
- package/runtime/core/data.mjs.map +1 -1
- package/runtime/core/identifier.mjs +15 -19
- package/runtime/core/identifier.mjs.map +1 -1
- package/runtime/core/lazy-sequence.eli +885 -15
- package/runtime/core/lazy-sequence.mjs +1265 -38
- package/runtime/core/lazy-sequence.mjs.map +1 -1
- package/runtime/core/map-internals.eli +209 -1
- package/runtime/core/map-internals.mjs +359 -71
- package/runtime/core/map-internals.mjs.map +1 -1
- package/runtime/core/map.eli +75 -7
- package/runtime/core/map.mjs +122 -47
- package/runtime/core/map.mjs.map +1 -1
- package/{stdlib/core/object.eli → runtime/core/object-impl.eli} +6 -6
- package/runtime/core/object-impl.mjs +5 -5
- package/runtime/core/object-impl.mjs.map +1 -1
- package/runtime/core/order.eli +15 -3
- package/runtime/core/order.mjs +23 -8
- package/runtime/core/order.mjs.map +1 -1
- package/runtime/core/persistent-kind.mjs +9 -13
- package/runtime/core/persistent-kind.mjs.map +1 -1
- package/runtime/core/protocol-error.mjs +9 -11
- package/runtime/core/protocol-error.mjs.map +1 -1
- package/{stdlib/core/protocol.eli → runtime/core/protocol-impl.eli} +2 -2
- package/runtime/core/protocol-impl.mjs +10 -10
- package/runtime/core/protocol-impl.mjs.map +1 -1
- package/runtime/core/queue.mjs +14 -16
- package/runtime/core/queue.mjs.map +1 -1
- package/runtime/core/record.eli +2 -2
- package/runtime/core/record.mjs +13 -17
- package/runtime/core/record.mjs.map +1 -1
- package/runtime/core/regex.mjs +18 -22
- package/runtime/core/regex.mjs.map +1 -1
- package/runtime/core/sequence.eli +33 -31
- package/runtime/core/sequence.mjs +60 -93
- package/runtime/core/sequence.mjs.map +1 -1
- package/runtime/core/set.eli +53 -27
- package/runtime/core/set.mjs +113 -82
- package/runtime/core/set.mjs.map +1 -1
- package/runtime/core/sorted.mjs +91 -108
- package/runtime/core/sorted.mjs.map +1 -1
- package/{stdlib/core/text.eli → runtime/core/text-impl.eli} +2 -2
- package/runtime/core/text-impl.mjs +1 -1
- package/runtime/core/text-impl.mjs.map +1 -1
- package/runtime/core/transducer.eli +24 -0
- package/runtime/core/transducer.mjs +27 -1
- package/runtime/core/transducer.mjs.map +1 -1
- package/runtime/core/transient-internals.eli +12 -4
- package/runtime/core/transient-internals.mjs +19 -6
- package/runtime/core/transient-internals.mjs.map +1 -1
- package/runtime/core/transient.eli +31 -0
- package/runtime/core/transient.mjs +33 -2
- package/runtime/core/transient.mjs.map +1 -1
- package/runtime/core/value-internals.mjs +29 -35
- package/runtime/core/value-internals.mjs.map +1 -1
- package/runtime/core/vector.eli +73 -20
- package/runtime/core/vector.mjs +159 -156
- package/runtime/core/vector.mjs.map +1 -1
- package/runtime/literals.eli +16 -9
- package/runtime/literals.mjs +25 -9
- package/runtime/literals.mjs.map +1 -1
- package/{stdlib → runtime/managed}/managed-literal-protocols.eli +100 -34
- package/{stdlib → runtime/managed}/managed-literals.eli +406 -81
- package/{dist/literal-sources/stdlib → runtime/managed}/managed-queue-state.eli +1 -1
- package/runtime/managed/managed-runtime-array-map.eli +45 -0
- package/{stdlib → runtime/managed}/managed-runtime-collection-internals.eli +22 -2
- package/{stdlib → runtime/managed}/managed-runtime-collection.eli +282 -23
- package/{stdlib → runtime/managed}/managed-runtime-data-text.eli +196 -13
- package/{stdlib → runtime/managed}/managed-runtime-data.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-identifier.eli +1 -1
- package/runtime/managed/managed-runtime-lazy-sequence.eli +935 -0
- package/{stdlib → runtime/managed}/managed-runtime-list.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-map.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-metadata-internals.eli +2 -2
- package/{stdlib → runtime/managed}/managed-runtime-metadata.eli +2 -2
- package/{stdlib → runtime/managed}/managed-runtime-object.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-order.eli +3 -3
- package/{stdlib → runtime/managed}/managed-runtime-persistent-kind.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-protocol.eli +5 -3
- package/{stdlib → runtime/managed}/managed-runtime-queue.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-record.eli +3 -3
- package/{stdlib → runtime/managed}/managed-runtime-regex.eli +2 -2
- package/{stdlib → runtime/managed}/managed-runtime-sequence.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-set-algebra.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-set.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-sorted.eli +4 -4
- package/{stdlib → runtime/managed}/managed-runtime-text.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-transducer.eli +24 -2
- package/{stdlib → runtime/managed}/managed-runtime-transient.eli +7 -5
- package/{stdlib → runtime/managed}/managed-runtime-type.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-value-internals.eli +3 -3
- package/{stdlib → runtime/managed}/managed-runtime-value.eli +2 -2
- package/{stdlib → runtime/managed}/managed-runtime-vector.eli +5 -2
- package/{dist/literal-sources/stdlib → runtime/managed}/managed-sorted-state.eli +1 -1
- package/runtime/managed/managed-transient-state.eli +1206 -0
- package/{dist/literal-sources/stdlib → runtime/managed}/managed-value-state.eli +30 -6
- package/{stdlib → runtime/managed}/managed-vector-view-state.eli +1 -1
- package/{stdlib → runtime/managed}/managed-wire-http-rpc.eli +1 -1
- package/{stdlib → runtime/managed}/managed-wire-markdown.eli +1 -1
- package/{stdlib → runtime/managed}/managed-wire-schema.eli +1 -1
- package/runtime/math.mjs +32 -38
- package/runtime/math.mjs.map +1 -1
- package/runtime/number-radix.mjs +5 -7
- package/runtime/number-radix.mjs.map +1 -1
- package/runtime/primitives.eli +19 -6
- package/runtime/primitives.mjs +81 -46
- package/runtime/primitives.mjs.map +1 -1
- package/runtime/source-mapping.mjs +17 -23
- package/runtime/source-mapping.mjs.map +1 -1
- package/runtime/testing/map.eli +70 -41
- package/runtime/testing/map.mjs +57 -34
- package/runtime/testing/map.mjs.map +1 -1
- package/runtime/unicode-case.mjs +6 -6
- package/runtime/unicode-case.mjs.map +1 -1
- package/runtime/wire/http-rpc.mjs +12 -18
- package/runtime/wire/http-rpc.mjs.map +1 -1
- package/runtime/wire/markdown.mjs +42 -42
- package/runtime/wire/markdown.mjs.map +1 -1
- package/runtime/wire/schema.mjs +13 -13
- package/runtime/wire/schema.mjs.map +1 -1
- package/runtime/worker-value-codec.mjs +5 -7
- package/runtime/worker-value-codec.mjs.map +1 -1
- package/runtime/worker-value-stream.mjs +128 -135
- package/runtime/worker-value-stream.mjs.map +1 -1
- package/runtime/worker.mjs +75 -89
- package/runtime/worker.mjs.map +1 -1
- package/stdlib/README.md +25 -18
- package/stdlib/async.eli +1245 -0
- package/stdlib/bit.eli +89 -1
- package/stdlib/bit.mjs +89 -2
- package/stdlib/bit.mjs.map +1 -1
- package/stdlib/{core/collection.eli → collection.eli} +39 -4
- package/stdlib/core.eli +956 -0
- package/stdlib/data-text.eli +62 -1091
- package/stdlib/data.eli +517 -37
- package/stdlib/devtools.eli +399 -0
- package/stdlib/diff.eli +134 -0
- package/stdlib/{function.eli → fn.eli} +1 -1
- package/stdlib/identifier.eli +21 -136
- package/stdlib/interop/object.eli +39 -0
- package/stdlib/{core/lazy-sequence.eli → lazy-sequence.eli} +28 -2
- package/stdlib/math.eli +267 -0
- package/stdlib/{core/metadata.eli → meta.eli} +2 -2
- package/stdlib/{core/order.eli → order.eli} +6 -6
- package/stdlib/persistent-list.eli +60 -21
- package/stdlib/persistent-map.eli +335 -324
- package/stdlib/persistent-set.eli +8 -6
- package/stdlib/persistent-vector.eli +18 -18
- package/stdlib/portable/data-text.eli +1092 -0
- package/stdlib/portable/data.eli +42 -0
- package/stdlib/portable/identifier.eli +147 -0
- package/stdlib/{metadata.eli → portable/metadata.eli} +5 -5
- package/stdlib/{object.eli → portable/object.eli} +1 -1
- package/stdlib/{sequence.eli → portable/sequence.eli} +1 -1
- package/stdlib/{text.eli → portable/text.eli} +1 -1
- package/stdlib/pprint.eli +588 -0
- package/stdlib/protocol.eli +63 -0
- package/stdlib/{core/record.eli → record.eli} +2 -2
- package/stdlib/regex.eli +70 -0
- package/stdlib/result.eli +53 -44
- package/stdlib/schema.eli +1886 -0
- package/stdlib/{core/seq.eli → seq.eli} +97 -90
- package/{dist/literal-sources/stdlib/core → stdlib}/set.eli +8 -8
- package/stdlib/{core/sorted.eli → sorted.eli} +2 -2
- package/stdlib/{state/atom.eli → state.eli} +137 -7
- package/stdlib/string.eli +362 -0
- package/stdlib/tap.eli +135 -0
- package/stdlib/test.eli +566 -0
- package/stdlib/time.eli +419 -0
- package/stdlib/{core/transducer.eli → transducer.eli} +4 -2
- package/stdlib/{core/transient.eli → transient.eli} +11 -5
- package/stdlib/{core/type.eli → type.eli} +2 -2
- package/stdlib/uuid.eli +288 -0
- package/stdlib/{core/walk.eli → walk.eli} +6 -6
- package/stdlib/{gepo.eli → wire/gepo.eli} +2 -2
- package/stdlib/{mdp.eli → wire/mdp.eli} +2 -2
- package/stdlib/{mds.eli → wire/mds.eli} +2 -2
- package/stdlib/{core/zipper.eli → zipper.eli} +179 -138
- package/tests/helpers/wasm-managed-math-node.mjs +495 -582
- package/tools/acceptance/check-ground.mjs +106 -132
- package/tools/acceptance/check.mjs +16 -16
- package/tools/acceptance/retained-performance-snapshot.mjs +265 -149
- package/tools/acceptance/retained-soak.mjs +5 -7
- package/tools/acceptance/retained-transient.mjs +5 -7
- package/tools/backends/build.mjs +373 -95
- package/tools/backends/compiler-bootstrap.mjs +271 -317
- package/tools/backends/compiler-browser.mjs +7 -9
- package/tools/backends/compiler-build.mjs +77 -97
- package/tools/backends/compiler-cli-ground.mjs +47 -47
- package/tools/backends/compiler-data-transport.mjs +27 -31
- package/tools/backends/compiler-host-iteration.mjs +13 -21
- package/tools/backends/compiler-host-record.mjs +28 -34
- package/tools/backends/compiler-metadata.mjs +145 -53
- package/tools/backends/compiler-package-ground.mjs +39 -47
- package/tools/backends/compiler-package-loader.mjs +164 -206
- package/tools/backends/compiler-session.mjs +432 -324
- package/tools/backends/compiler-worker.mjs +79 -89
- package/tools/backends/dist/bootstrap-js-stages.mjs +17 -19
- package/tools/backends/dist/bootstrap-js-stages.mjs.map +1 -1
- package/tools/backends/dist/managed-ir-inventory.mjs +1 -1
- package/tools/backends/dist/managed-ir-inventory.mjs.map +1 -1
- package/tools/backends/dist/release-cli.mjs +151 -22
- package/tools/backends/dist/release-cli.mjs.map +1 -1
- package/tools/backends/dist/run-artifact.mjs +54 -76
- package/tools/backends/dist/run-artifact.mjs.map +1 -1
- package/tools/backends/managed-foreign-binding.mjs +370 -114
- package/tools/backends/managed-host-ground.mjs +14 -17
- package/tools/backends/managed-host-lifecycle.mjs +42 -53
- package/tools/backends/managed-host-object-realm.mjs +121 -111
- package/tools/backends/managed-host-proxy.mjs +5 -7
- package/tools/backends/managed-host-runtime.mjs +6295 -4350
- package/tools/backends/managed-host.mjs +234 -188
- package/tools/backends/managed-layout.mjs +53 -56
- package/tools/backends/managed-module-graph-ground.mjs +488 -568
- package/tools/backends/managed-module-graph.mjs +62 -76
- package/tools/backends/managed-runtime-host-ground.mjs +352 -400
- package/tools/backends/managed-runtime.mjs +227 -266
- package/tools/backends/managed-source-view-ground.mjs +165 -161
- package/tools/backends/managed-source-view.mjs +415 -154
- package/tools/backends/native-managed-runtime.mjs +96 -138
- package/tools/backends/native-memory.mjs +1122 -742
- package/tools/backends/native-node-ffi.mjs +2439 -0
- package/tools/backends/native-node-memory.mjs +793 -383
- package/tools/backends/native-node-runner.mjs +1458 -579
- package/tools/backends/native-node-watchdog.mjs +12 -14
- package/tools/backends/native-node-worker.mjs +46 -50
- package/tools/backends/stage3-targets.mjs +2 -2
- package/tools/bootstrap-runtime.el +4 -4
- package/tools/collections/transient-builder-benchmark.mjs +17 -17
- package/tools/project/check-cli.eli +27 -3
- package/tools/project/project-cli.eli +1 -1
- package/tools/testing/maintained-suite-source.mjs +5 -7
- package/tools/testing/maintained-suite-source.mjs.map +1 -1
- package/dist/literal-sources/stdlib/core/data.eli +0 -306
- package/dist/literal-sources/stdlib/managed-transient-state.eli +0 -353
- package/stdlib/core/data-text.eli +0 -16
- package/stdlib/core/data.eli +0 -306
- package/stdlib/core/identifier.eli +0 -32
- package/stdlib/core/regex.eli +0 -17
- package/stdlib/deferred.eli +0 -70
- package/stdlib/managed-runtime-lazy-sequence.eli +0 -157
- package/stdlib/managed-transient-state.eli +0 -353
- /package/{stdlib → runtime/managed}/managed-protocol-error.eli +0 -0
- /package/{stdlib → runtime/managed}/managed-runtime-literals.eli +0 -0
- /package/{stdlib → runtime/managed}/managed-runtime-truth.eli +0 -0
- /package/{stdlib → runtime/managed}/managed-testing-value.eli +0 -0
|
@@ -0,0 +1,1025 @@
|
|
|
1
|
+
// Generated by Eliscript. Do not edit.
|
|
2
|
+
import { tdz as __eliscript_tdz_error, immutable as __eliscript_const_error } from "eliscript/runtime/errors.mjs";
|
|
3
|
+
var __eliscript_tdz_ready_0;
|
|
4
|
+
var __eliscript_tdz_ready_1;
|
|
5
|
+
var __eliscript_tdz_ready_2;
|
|
6
|
+
var __eliscript_tdz_ready_3;
|
|
7
|
+
var __eliscript_tdz_ready_4;
|
|
8
|
+
var __eliscript_tdz_ready_5;
|
|
9
|
+
var __eliscript_tdz_ready_6;
|
|
10
|
+
var __eliscript_tdz_ready_7;
|
|
11
|
+
var __eliscript_tdz_ready_8;
|
|
12
|
+
var __eliscript_tdz_ready_9;
|
|
13
|
+
var __eliscript_tdz_ready_10;
|
|
14
|
+
var __eliscript_tdz_ready_11;
|
|
15
|
+
var __eliscript_tdz_ready_13;
|
|
16
|
+
var __eliscript_tdz_ready_14;
|
|
17
|
+
var __eliscript_tdz_ready_15;
|
|
18
|
+
var __eliscript_tdz_ready_16;
|
|
19
|
+
var __eliscript_tdz_ready_17;
|
|
20
|
+
var __eliscript_tdz_ready_18;
|
|
21
|
+
var __eliscript_tdz_ready_19;
|
|
22
|
+
var __eliscript_tdz_ready_20;
|
|
23
|
+
var __eliscript_tdz_ready_21;
|
|
24
|
+
var __eliscript_tdz_ready_22;
|
|
25
|
+
var __eliscript_tdz_ready_23;
|
|
26
|
+
var __eliscript_tdz_ready_24;
|
|
27
|
+
var __eliscript_tdz_ready_29;
|
|
28
|
+
var __eliscript_tdz_ready_30;
|
|
29
|
+
import "eliscript/runtime/unicode-case.mjs";
|
|
30
|
+
import { __eliscript_to_number, __eliscript_numeric_decrement, __eliscript_numeric_relation, __eliscript_numeric_sub, __eliscript_numeric_mul, __eliscript_numeric_div, __eliscript_numeric_rem, __eliscript_numeric_and, __eliscript_numeric_or, __eliscript_numeric_xor, __eliscript_numeric_shl, __eliscript_numeric_shr, __eliscript_numeric_ushr, __eliscript_numeric_neg, __eliscript_numeric_int32, __eliscript_numeric_uint32, __eliscript_numeric_not } from "eliscript/runtime/prelude.mjs";
|
|
31
|
+
import { valueType as __eliscript_value_type } from "eliscript/runtime/primitives.mjs";
|
|
32
|
+
const __eliscript_truthy = (value) => value !== false && value != null;
|
|
33
|
+
|
|
34
|
+
import * as Collection from "../../runtime/core/collection.mjs";
|
|
35
|
+
import {EMPTY_LIST, first, persistentList, rest} from "../../runtime/core/list.mjs";
|
|
36
|
+
import {persistentHashMap} from "../../runtime/core/map.mjs";
|
|
37
|
+
import {meta, withMeta} from "../../runtime/core/metadata.mjs";
|
|
38
|
+
import {EMPTY_VECTOR, PersistentVector, isPersistentVector, persistentVector} from "../../runtime/core/vector.mjs";
|
|
39
|
+
const zipper_branch_key = "eliscript.zipper/branch";
|
|
40
|
+
__eliscript_tdz_ready_0 = true;
|
|
41
|
+
const zipper_children_key = "eliscript.zipper/children";
|
|
42
|
+
__eliscript_tdz_ready_1 = true;
|
|
43
|
+
const zipper_make_node_key = "eliscript.zipper/make-node";
|
|
44
|
+
__eliscript_tdz_ready_2 = true;
|
|
45
|
+
const zipper_end_path = "eliscript.zipper/end";
|
|
46
|
+
__eliscript_tdz_ready_3 = true;
|
|
47
|
+
const zipper_missing = ({});
|
|
48
|
+
__eliscript_tdz_ready_4 = true;
|
|
49
|
+
const zipper_lefts_index = 0;
|
|
50
|
+
__eliscript_tdz_ready_5 = true;
|
|
51
|
+
const zipper_rights_index = 1;
|
|
52
|
+
__eliscript_tdz_ready_6 = true;
|
|
53
|
+
const zipper_parent_path_index = 2;
|
|
54
|
+
__eliscript_tdz_ready_7 = true;
|
|
55
|
+
const zipper_parent_nodes_index = 3;
|
|
56
|
+
__eliscript_tdz_ready_8 = true;
|
|
57
|
+
const zipper_changed_index = 4;
|
|
58
|
+
__eliscript_tdz_ready_9 = true;
|
|
59
|
+
const zipper_single_parent_index = 5;
|
|
60
|
+
__eliscript_tdz_ready_10 = true;
|
|
61
|
+
const zipper_public_path_cache = new (globalThis.WeakMap)();
|
|
62
|
+
__eliscript_tdz_ready_11 = true;
|
|
63
|
+
const zipper_private_tuples = new (globalThis.WeakSet)();
|
|
64
|
+
const zipper_valid_configs = new (globalThis.WeakSet)();
|
|
65
|
+
__eliscript_tdz_ready_13 = true;
|
|
66
|
+
const zipper_config_callbacks = new (globalThis.WeakMap)();
|
|
67
|
+
__eliscript_tdz_ready_14 = true;
|
|
68
|
+
const zipper_freeze = Object.freeze;
|
|
69
|
+
__eliscript_tdz_ready_15 = true;
|
|
70
|
+
const zipper_is_array = Array.isArray;
|
|
71
|
+
__eliscript_tdz_ready_16 = true;
|
|
72
|
+
const zipper_is_integer = Number.isInteger;
|
|
73
|
+
__eliscript_tdz_ready_17 = true;
|
|
74
|
+
const zipper_get_proto = Object.getPrototypeOf;
|
|
75
|
+
__eliscript_tdz_ready_18 = true;
|
|
76
|
+
const zipper_identity = ((value) => {
|
|
77
|
+
return value;
|
|
78
|
+
});
|
|
79
|
+
__eliscript_tdz_ready_19 = true;
|
|
80
|
+
const zipper_raw_slot = (PersistentVector)["rawSlot"];
|
|
81
|
+
__eliscript_tdz_ready_20 = true;
|
|
82
|
+
const zipper_pair_with_meta = (PersistentVector)["pairWithMeta"];
|
|
83
|
+
__eliscript_tdz_ready_21 = true;
|
|
84
|
+
const zipper_single_vector = (PersistentVector)["single"];
|
|
85
|
+
__eliscript_tdz_ready_22 = true;
|
|
86
|
+
const zipper_vector_proto = (PersistentVector)["prototype"];
|
|
87
|
+
__eliscript_tdz_ready_23 = true;
|
|
88
|
+
const zipper_has_raw_slot = (__eliscript_value_type(zipper_raw_slot) === "function");
|
|
89
|
+
__eliscript_tdz_ready_24 = true;
|
|
90
|
+
const zipper_vector_state_key = ((syms) => {
|
|
91
|
+
if ((((syms) ?? []).length === 1)) {
|
|
92
|
+
{
|
|
93
|
+
let sym = (syms)[0];
|
|
94
|
+
let st = (EMPTY_VECTOR)[sym];
|
|
95
|
+
if ((!((st == null)) && (__eliscript_value_type(st) === "object") && __eliscript_truthy(Array.isArray((st)["tail"])))) {
|
|
96
|
+
return sym;
|
|
97
|
+
} else {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
} else {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
})(((__eliscript_value_type(Object.getOwnPropertySymbols) === "function") ? Object.getOwnPropertySymbols(EMPTY_VECTOR) : []));
|
|
105
|
+
const zipper_meta_read_key = ((zipper_vector_state_key === null) ? null : ((syms, found, idx) => {
|
|
106
|
+
while (((found === null) && __eliscript_numeric_relation("<", idx, ((syms) ?? []).length))) {
|
|
107
|
+
{
|
|
108
|
+
let sym = (syms)[idx];
|
|
109
|
+
let val = (zipper_vector_proto)[sym];
|
|
110
|
+
if (((__eliscript_value_type(val) === "function") && ((val)["name"] === "[eliscript.metadata.read]"))) {
|
|
111
|
+
((found = sym));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
((idx = (idx + 1)));
|
|
115
|
+
}
|
|
116
|
+
return found;
|
|
117
|
+
})(Object.getOwnPropertySymbols(zipper_vector_proto), null, 0));
|
|
118
|
+
const zipper_init_meta_read = ((zipper_meta_read_key === null) ? null : (zipper_vector_proto)[zipper_meta_read_key]);
|
|
119
|
+
const zipper_init_meta_call = ((zipper_init_meta_read === null) ? null : (zipper_init_meta_read)["call"]);
|
|
120
|
+
function zipper_walk_compact_path(start) {
|
|
121
|
+
{
|
|
122
|
+
let pending = [];
|
|
123
|
+
let cur = start;
|
|
124
|
+
let keep_going = true;
|
|
125
|
+
while (((keep_going === true) && !((cur === null)) && (Array.isArray(cur) === true) && ((cur)["length"] === 6) && ((cur)[5] === true))) {
|
|
126
|
+
{
|
|
127
|
+
let parents = (cur)[3];
|
|
128
|
+
if (((Array.isArray(parents) === true) && !(((parents)["length"] === 0)))) {
|
|
129
|
+
(pending)["push"]((parents)[0]);
|
|
130
|
+
((cur = (cur)[2]));
|
|
131
|
+
} else {
|
|
132
|
+
((keep_going = false));
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return [pending, cur];
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function zipper_fast_root(cur_node, cur_path, changed, single_vec, empty_vec, empty_list) {
|
|
140
|
+
{
|
|
141
|
+
let keep_going = true;
|
|
142
|
+
while (((keep_going === true) && !((cur_path === null)) && (Array.isArray(cur_path) === true) && ((cur_path)["length"] === 6) && ((cur_path)[5] === true))) {
|
|
143
|
+
{
|
|
144
|
+
let parents = (cur_path)[3];
|
|
145
|
+
if (((changed === true) || ((cur_path)[4] === true))) {
|
|
146
|
+
if ((((cur_path)[0] === empty_vec) && ((cur_path)[1] === empty_list) && (Array.isArray(parents) === true) && ((parents)["length"] === 2))) {
|
|
147
|
+
((cur_node = single_vec(cur_node)), (changed = true), (cur_path = (cur_path)[2]));
|
|
148
|
+
} else {
|
|
149
|
+
((keep_going = false));
|
|
150
|
+
}
|
|
151
|
+
} else {
|
|
152
|
+
if (((Array.isArray(parents) === true) && !(((parents)["length"] === 0)))) {
|
|
153
|
+
((cur_node = (parents)[0]), (cur_path = (cur_path)[2]));
|
|
154
|
+
} else {
|
|
155
|
+
((keep_going = false));
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return [cur_node, cur_path, changed];
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function zipper_private_array(...values) {
|
|
164
|
+
if (__eliscript_truthy((__eliscript_tdz_ready_24 === true ? zipper_has_raw_slot : __eliscript_tdz_error("zipper_has_raw_slot")))) {
|
|
165
|
+
return values;
|
|
166
|
+
} else {
|
|
167
|
+
return (__eliscript_tdz_ready_15 === true ? zipper_freeze : __eliscript_tdz_error("zipper_freeze"))(values);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
function zipper_require_function(value, label) {
|
|
171
|
+
if ((__eliscript_value_type(value) === "function")) {
|
|
172
|
+
return value;
|
|
173
|
+
} else {
|
|
174
|
+
return ((__eliscript_value_1) => { throw __eliscript_value_1; })(new (globalThis.TypeError)((String(label) + String(" must be a function"))));
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
function zipper_compact_array_QMARK_(value) {
|
|
178
|
+
if (__eliscript_truthy((__eliscript_tdz_ready_16 === true ? zipper_is_array : __eliscript_tdz_error("zipper_is_array"))(value))) {
|
|
179
|
+
if ((((value) ?? []).length === 6)) {
|
|
180
|
+
return ((value)[(__eliscript_tdz_ready_10 === true ? zipper_single_parent_index : __eliscript_tdz_error("zipper_single_parent_index"))] === true);
|
|
181
|
+
} else {
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
} else {
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
function zipper_slot(values, target_index) {
|
|
189
|
+
if (__eliscript_truthy(zipper_compact_array_QMARK_(values))) {
|
|
190
|
+
if (__eliscript_truthy((__eliscript_numeric_relation(">=", target_index, 0) ? __eliscript_numeric_relation("<", target_index, ((values) ?? []).length) : false))) {
|
|
191
|
+
return (values)[target_index];
|
|
192
|
+
} else {
|
|
193
|
+
return ((__eliscript_value_2) => { throw __eliscript_value_2; })(new (globalThis.TypeError)("invalid zipper internal slot"));
|
|
194
|
+
}
|
|
195
|
+
} else {
|
|
196
|
+
if (__eliscript_truthy(Collection.isVector(values))) {
|
|
197
|
+
if (__eliscript_truthy((__eliscript_truthy((__eliscript_tdz_ready_24 === true ? zipper_has_raw_slot : __eliscript_tdz_error("zipper_has_raw_slot"))) ? (((__eliscript_tdz_ready_18 === true ? zipper_get_proto : __eliscript_tdz_error("zipper_get_proto"))(values) === (__eliscript_tdz_ready_23 === true ? zipper_vector_proto : __eliscript_tdz_error("zipper_vector_proto"))) ? (__eliscript_numeric_relation("<=", (values)["count"], 32) ? (__eliscript_numeric_relation(">=", target_index, 0) ? __eliscript_numeric_relation("<", target_index, (values)["count"]) : false) : false) : false) : false))) {
|
|
198
|
+
return (__eliscript_tdz_ready_20 === true ? zipper_raw_slot : __eliscript_tdz_error("zipper_raw_slot"))(values, target_index);
|
|
199
|
+
} else {
|
|
200
|
+
{
|
|
201
|
+
let value = Collection.nth(values, target_index, (__eliscript_tdz_ready_4 === true ? zipper_missing : __eliscript_tdz_error("zipper_missing")));
|
|
202
|
+
if ((value === (__eliscript_tdz_ready_4 === true ? zipper_missing : __eliscript_tdz_error("zipper_missing")))) {
|
|
203
|
+
return ((__eliscript_value_3) => { throw __eliscript_value_3; })(new (globalThis.TypeError)("invalid zipper internal slot"));
|
|
204
|
+
} else {
|
|
205
|
+
return value;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
} else {
|
|
210
|
+
{
|
|
211
|
+
let index = 0;
|
|
212
|
+
let box = (__eliscript_tdz_ready_4 === true ? zipper_missing : __eliscript_tdz_error("zipper_missing"));
|
|
213
|
+
Collection.reduce(values, ((state, value) => {
|
|
214
|
+
if ((index === target_index)) {
|
|
215
|
+
((box = ({"value": value})));
|
|
216
|
+
return Collection.reduced(state);
|
|
217
|
+
} else {
|
|
218
|
+
((index = (index + 1)));
|
|
219
|
+
return state;
|
|
220
|
+
}
|
|
221
|
+
}), null);
|
|
222
|
+
if ((box === (__eliscript_tdz_ready_4 === true ? zipper_missing : __eliscript_tdz_error("zipper_missing")))) {
|
|
223
|
+
return ((__eliscript_value_4) => { throw __eliscript_value_4; })(new (globalThis.TypeError)("invalid zipper internal slot"));
|
|
224
|
+
} else {
|
|
225
|
+
return (box)["value"];
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
function zipper_path_value(location) {
|
|
232
|
+
return zipper_slot(location, 1);
|
|
233
|
+
}
|
|
234
|
+
function zipper_config_value(location, key) {
|
|
235
|
+
{
|
|
236
|
+
let configuration = meta(location);
|
|
237
|
+
let callbacks = (!((configuration == null)) ? ((__eliscript_tdz_ready_14 === true ? zipper_config_callbacks : __eliscript_tdz_error("zipper_config_callbacks")))["get"](configuration) : undefined);
|
|
238
|
+
if (!((callbacks === undefined))) {
|
|
239
|
+
return (callbacks)[key];
|
|
240
|
+
} else {
|
|
241
|
+
return Collection.get(configuration, key);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
function zipper_location(node_value, path_value, configuration) {
|
|
246
|
+
if (__eliscript_truthy((__eliscript_tdz_ready_24 === true ? zipper_has_raw_slot : __eliscript_tdz_error("zipper_has_raw_slot")))) {
|
|
247
|
+
return (__eliscript_tdz_ready_21 === true ? zipper_pair_with_meta : __eliscript_tdz_error("zipper_pair_with_meta"))(node_value, path_value, configuration);
|
|
248
|
+
} else {
|
|
249
|
+
return withMeta(persistentVector(node_value, path_value), configuration);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
function zipper_path(left_values, right_values, parent_path, parent_nodes, changed) {
|
|
253
|
+
return zipper_private_array(left_values, right_values, parent_path, parent_nodes, changed, true);
|
|
254
|
+
}
|
|
255
|
+
function zipper_path_assoc(path_value, target_index, value) {
|
|
256
|
+
if (__eliscript_truthy(zipper_compact_array_QMARK_(path_value))) {
|
|
257
|
+
if ((!__eliscript_truthy((__eliscript_truthy((__eliscript_tdz_ready_17 === true ? zipper_is_integer : __eliscript_tdz_error("zipper_is_integer"))(target_index)) ? (__eliscript_numeric_relation(">=", target_index, 0) ? __eliscript_numeric_relation("<=", target_index, 4) : false) : false)))) {
|
|
258
|
+
((__eliscript_value_5) => { throw __eliscript_value_5; })(new (globalThis.TypeError)("invalid zipper internal slot"));
|
|
259
|
+
}
|
|
260
|
+
return zipper_path(((target_index === 0) ? value : (path_value)[0]), ((target_index === 1) ? value : (path_value)[1]), ((target_index === 2) ? value : (path_value)[2]), ((target_index === 3) ? value : (path_value)[3]), ((target_index === 4) ? value : (path_value)[4]));
|
|
261
|
+
} else {
|
|
262
|
+
return Collection.assoc(path_value, target_index, value);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
function zipper_single_parent_QMARK_(path_value) {
|
|
266
|
+
if (__eliscript_truthy(zipper_compact_array_QMARK_(path_value))) {
|
|
267
|
+
return true;
|
|
268
|
+
} else {
|
|
269
|
+
if (__eliscript_truthy(Collection.isVector(path_value))) {
|
|
270
|
+
if ((Collection.count(path_value) === 6)) {
|
|
271
|
+
return (zipper_slot(path_value, (__eliscript_tdz_ready_10 === true ? zipper_single_parent_index : __eliscript_tdz_error("zipper_single_parent_index"))) === true);
|
|
272
|
+
} else {
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
} else {
|
|
276
|
+
return false;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
function zipper_parent_node(path_value) {
|
|
281
|
+
{
|
|
282
|
+
let parents = zipper_slot(path_value, (__eliscript_tdz_ready_8 === true ? zipper_parent_nodes_index : __eliscript_tdz_error("zipper_parent_nodes_index")));
|
|
283
|
+
if (__eliscript_truthy(zipper_single_parent_QMARK_(path_value))) {
|
|
284
|
+
if (__eliscript_truthy((__eliscript_tdz_ready_16 === true ? zipper_is_array : __eliscript_tdz_error("zipper_is_array"))(parents))) {
|
|
285
|
+
if (__eliscript_numeric_relation(">", ((parents) ?? []).length, 0)) {
|
|
286
|
+
return (parents)[0];
|
|
287
|
+
} else {
|
|
288
|
+
return ((__eliscript_value_6) => { throw __eliscript_value_6; })(new (globalThis.TypeError)("invalid zipper internal slot"));
|
|
289
|
+
}
|
|
290
|
+
} else {
|
|
291
|
+
return zipper_slot(parents, 0);
|
|
292
|
+
}
|
|
293
|
+
} else {
|
|
294
|
+
return zipper_slot(parents, __eliscript_numeric_decrement(Collection.count(parents)));
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
function zipper_materialize(values) {
|
|
299
|
+
if ((values == null)) {
|
|
300
|
+
return EMPTY_VECTOR;
|
|
301
|
+
} else {
|
|
302
|
+
if (__eliscript_truthy(Collection.isVector(values))) {
|
|
303
|
+
if ((meta(values) === null)) {
|
|
304
|
+
return values;
|
|
305
|
+
} else {
|
|
306
|
+
return Collection.reduce(values, ((result, value) => {
|
|
307
|
+
return Collection.conj(result, value);
|
|
308
|
+
}), EMPTY_VECTOR);
|
|
309
|
+
}
|
|
310
|
+
} else {
|
|
311
|
+
return Collection.reduce(values, ((result, value) => {
|
|
312
|
+
return Collection.conj(result, value);
|
|
313
|
+
}), EMPTY_VECTOR);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
function zipper_right_list(values, start_index) {
|
|
318
|
+
{
|
|
319
|
+
let count = Collection.count(values);
|
|
320
|
+
let result = EMPTY_LIST;
|
|
321
|
+
let index = __eliscript_numeric_decrement(count);
|
|
322
|
+
while (__eliscript_numeric_relation(">=", index, start_index)) {
|
|
323
|
+
((result = Collection.conj(result, zipper_slot(values, index))));
|
|
324
|
+
((index = __eliscript_numeric_decrement(index)));
|
|
325
|
+
}
|
|
326
|
+
return result;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
function zipper_vector_node(original, children_values) {
|
|
330
|
+
{
|
|
331
|
+
let m = meta(original);
|
|
332
|
+
if (__eliscript_truthy(((m === null) ? (__eliscript_truthy(Collection.isVector(children_values)) ? (meta(children_values) === null) : false) : false))) {
|
|
333
|
+
return children_values;
|
|
334
|
+
} else {
|
|
335
|
+
return withMeta(children_values, m);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
function zipper_list_node(original, children_values) {
|
|
340
|
+
{
|
|
341
|
+
let values = [];
|
|
342
|
+
Collection.reduce(children_values, ((result, value) => {
|
|
343
|
+
(result)["push"](value);
|
|
344
|
+
return result;
|
|
345
|
+
}), values);
|
|
346
|
+
return withMeta(persistentList(...(values ?? [])), meta(original));
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
const zipper_vector_config = ((cfg) => {
|
|
350
|
+
(zipper_valid_configs)["add"](cfg);
|
|
351
|
+
(zipper_config_callbacks)["set"](cfg, ({"eliscript.zipper/branch": Collection.isVector, "eliscript.zipper/children": zipper_identity, "eliscript.zipper/make-node": zipper_vector_node, "fastVector": true}));
|
|
352
|
+
return cfg;
|
|
353
|
+
})(persistentHashMap([zipper_branch_key, Collection.isVector], [zipper_children_key, zipper_identity], [zipper_make_node_key, zipper_vector_node]));
|
|
354
|
+
__eliscript_tdz_ready_29 = true;
|
|
355
|
+
function zipper_QMARK_(value) {
|
|
356
|
+
if (__eliscript_truthy((__eliscript_truthy(Collection.isVector(value)) ? (Collection.count(value) === 2) : false))) {
|
|
357
|
+
{
|
|
358
|
+
let configuration = meta(value);
|
|
359
|
+
if (__eliscript_truthy(((configuration === (__eliscript_tdz_ready_29 === true ? zipper_vector_config : __eliscript_tdz_error("zipper_vector_config"))) ? true : (!((configuration == null)) ? ((__eliscript_tdz_ready_13 === true ? zipper_valid_configs : __eliscript_tdz_error("zipper_valid_configs")))["has"](configuration) : false)))) {
|
|
360
|
+
return true;
|
|
361
|
+
} else {
|
|
362
|
+
{
|
|
363
|
+
let valid = ((__eliscript_value_7) => (__eliscript_truthy(__eliscript_value_7) ? ((__eliscript_value_type(Collection.get(configuration, (__eliscript_tdz_ready_0 === true ? zipper_branch_key : __eliscript_tdz_error("zipper_branch_key")))) === "function") && (__eliscript_value_type(Collection.get(configuration, (__eliscript_tdz_ready_1 === true ? zipper_children_key : __eliscript_tdz_error("zipper_children_key")))) === "function") && (__eliscript_value_type(Collection.get(configuration, (__eliscript_tdz_ready_2 === true ? zipper_make_node_key : __eliscript_tdz_error("zipper_make_node_key")))) === "function")) : __eliscript_value_7))(Collection.isMap(configuration));
|
|
364
|
+
if (__eliscript_truthy(valid)) {
|
|
365
|
+
((__eliscript_tdz_ready_13 === true ? zipper_valid_configs : __eliscript_tdz_error("zipper_valid_configs")))["add"](configuration);
|
|
366
|
+
}
|
|
367
|
+
return valid;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
} else {
|
|
372
|
+
return false;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
function zipper_mark_changed(path_value) {
|
|
376
|
+
if ((path_value === null)) {
|
|
377
|
+
return null;
|
|
378
|
+
} else {
|
|
379
|
+
return zipper_path_assoc(path_value, (__eliscript_tdz_ready_9 === true ? zipper_changed_index : __eliscript_tdz_error("zipper_changed_index")), true);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
function zipper_active_QMARK_(location) {
|
|
383
|
+
return (!(zipper_path_value(location) === (__eliscript_tdz_ready_3 === true ? zipper_end_path : __eliscript_tdz_error("zipper_end_path"))));
|
|
384
|
+
}
|
|
385
|
+
function zipper_require_location(location, label) {
|
|
386
|
+
if (__eliscript_truthy(zipper_QMARK_(location))) {
|
|
387
|
+
return location;
|
|
388
|
+
} else {
|
|
389
|
+
return ((__eliscript_value_8) => { throw __eliscript_value_8; })(new (globalThis.TypeError)((String(label) + String(" requires a zipper location"))));
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
function zipper_require_active_location(location, label) {
|
|
393
|
+
zipper_require_location(location, label);
|
|
394
|
+
if (__eliscript_truthy(zipper_active_QMARK_(location))) {
|
|
395
|
+
return location;
|
|
396
|
+
} else {
|
|
397
|
+
return ((__eliscript_value_9) => { throw __eliscript_value_9; })(new (globalThis.TypeError)((String(label) + String(" cannot modify the end location"))));
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
function node(location) {
|
|
401
|
+
zipper_require_location(location, "node");
|
|
402
|
+
return zipper_slot(location, 0);
|
|
403
|
+
}
|
|
404
|
+
function zipper_children_vector(location) {
|
|
405
|
+
return zipper_materialize((zipper_config_value(location, (__eliscript_tdz_ready_1 === true ? zipper_children_key : __eliscript_tdz_error("zipper_children_key"))))(node(location)));
|
|
406
|
+
}
|
|
407
|
+
function zipper_rebuild_children(left_values, node_value, right_values) {
|
|
408
|
+
if (__eliscript_truthy(((left_values === EMPTY_VECTOR) ? (right_values === EMPTY_LIST) : (__eliscript_truthy(Collection.isVector(left_values)) ? ((Collection.count(left_values) === 0) ? (__eliscript_truthy(Collection.isList(right_values)) ? (Collection.count(right_values) === 0) : false) : false) : false)))) {
|
|
409
|
+
if (__eliscript_truthy((__eliscript_tdz_ready_24 === true ? zipper_has_raw_slot : __eliscript_tdz_error("zipper_has_raw_slot")))) {
|
|
410
|
+
return (__eliscript_tdz_ready_22 === true ? zipper_single_vector : __eliscript_tdz_error("zipper_single_vector"))(node_value);
|
|
411
|
+
} else {
|
|
412
|
+
return persistentVector(node_value);
|
|
413
|
+
}
|
|
414
|
+
} else {
|
|
415
|
+
{
|
|
416
|
+
let result = Collection.reduce(left_values, ((values, value) => {
|
|
417
|
+
return Collection.conj(values, value);
|
|
418
|
+
}), EMPTY_VECTOR);
|
|
419
|
+
((result = Collection.conj(result, node_value)));
|
|
420
|
+
return Collection.reduce(right_values, ((values, value) => {
|
|
421
|
+
return Collection.conj(values, value);
|
|
422
|
+
}), result);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
function zipper(branch_predicate, child_reader, node_builder, root_node) {
|
|
427
|
+
zipper_require_function(branch_predicate, "zipper branch predicate");
|
|
428
|
+
zipper_require_function(child_reader, "zipper child reader");
|
|
429
|
+
zipper_require_function(node_builder, "zipper node builder");
|
|
430
|
+
if (__eliscript_truthy(((branch_predicate === Collection.isVector) ? ((child_reader === (__eliscript_tdz_ready_19 === true ? zipper_identity : __eliscript_tdz_error("zipper_identity"))) ? (node_builder === zipper_vector_node) : false) : false))) {
|
|
431
|
+
return zipper_location(root_node, null, (__eliscript_tdz_ready_29 === true ? zipper_vector_config : __eliscript_tdz_error("zipper_vector_config")));
|
|
432
|
+
} else {
|
|
433
|
+
{
|
|
434
|
+
let configuration = persistentHashMap([(__eliscript_tdz_ready_0 === true ? zipper_branch_key : __eliscript_tdz_error("zipper_branch_key")), branch_predicate], [(__eliscript_tdz_ready_1 === true ? zipper_children_key : __eliscript_tdz_error("zipper_children_key")), child_reader], [(__eliscript_tdz_ready_2 === true ? zipper_make_node_key : __eliscript_tdz_error("zipper_make_node_key")), node_builder]);
|
|
435
|
+
((__eliscript_tdz_ready_13 === true ? zipper_valid_configs : __eliscript_tdz_error("zipper_valid_configs")))["add"](configuration);
|
|
436
|
+
((__eliscript_tdz_ready_14 === true ? zipper_config_callbacks : __eliscript_tdz_error("zipper_config_callbacks")))["set"](configuration, ({"eliscript.zipper/branch": branch_predicate, "eliscript.zipper/children": child_reader, "eliscript.zipper/make-node": node_builder, "fastVector": false}));
|
|
437
|
+
return zipper_location(root_node, null, configuration);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
function vector_zipper(root_node) {
|
|
442
|
+
return zipper_location(root_node, null, (__eliscript_tdz_ready_29 === true ? zipper_vector_config : __eliscript_tdz_error("zipper_vector_config")));
|
|
443
|
+
}
|
|
444
|
+
function list_zipper(root_node) {
|
|
445
|
+
return zipper(Collection.isList, (__eliscript_tdz_ready_19 === true ? zipper_identity : __eliscript_tdz_error("zipper_identity")), zipper_list_node, root_node);
|
|
446
|
+
}
|
|
447
|
+
function end_QMARK_(location) {
|
|
448
|
+
zipper_require_location(location, "end?");
|
|
449
|
+
return (!__eliscript_truthy(zipper_active_QMARK_(location)));
|
|
450
|
+
}
|
|
451
|
+
function zipper_branch_value(location) {
|
|
452
|
+
if (__eliscript_truthy((zipper_config_value(location, (__eliscript_tdz_ready_0 === true ? zipper_branch_key : __eliscript_tdz_error("zipper_branch_key"))))(zipper_slot(location, 0)))) {
|
|
453
|
+
return true;
|
|
454
|
+
} else {
|
|
455
|
+
return false;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
function branch_QMARK_(location) {
|
|
459
|
+
zipper_require_location(location, "branch?");
|
|
460
|
+
if (__eliscript_truthy(zipper_active_QMARK_(location))) {
|
|
461
|
+
return zipper_branch_value(location);
|
|
462
|
+
} else {
|
|
463
|
+
return false;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
function children(location) {
|
|
467
|
+
zipper_require_active_location(location, "children");
|
|
468
|
+
if (__eliscript_truthy(branch_QMARK_(location))) {
|
|
469
|
+
return zipper_children_vector(location);
|
|
470
|
+
} else {
|
|
471
|
+
return ((__eliscript_value_10) => { throw __eliscript_value_10; })(new (globalThis.TypeError)("children requires a branch location"));
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
function make_node(location, node_value, children_values) {
|
|
475
|
+
zipper_require_active_location(location, "make-node");
|
|
476
|
+
return (zipper_config_value(location, (__eliscript_tdz_ready_2 === true ? zipper_make_node_key : __eliscript_tdz_error("zipper_make_node_key"))))(node_value, zipper_materialize(children_values));
|
|
477
|
+
}
|
|
478
|
+
function path(location) {
|
|
479
|
+
zipper_require_location(location, "path");
|
|
480
|
+
{
|
|
481
|
+
let path_value = zipper_path_value(location);
|
|
482
|
+
if (__eliscript_truthy(((path_value === null) ? true : (path_value === (__eliscript_tdz_ready_3 === true ? zipper_end_path : __eliscript_tdz_error("zipper_end_path")))))) {
|
|
483
|
+
return null;
|
|
484
|
+
} else {
|
|
485
|
+
if (!(__eliscript_truthy(zipper_single_parent_QMARK_(path_value)))) {
|
|
486
|
+
return zipper_slot(path_value, (__eliscript_tdz_ready_8 === true ? zipper_parent_nodes_index : __eliscript_tdz_error("zipper_parent_nodes_index")));
|
|
487
|
+
} else {
|
|
488
|
+
{
|
|
489
|
+
let holder = zipper_slot(path_value, (__eliscript_tdz_ready_8 === true ? zipper_parent_nodes_index : __eliscript_tdz_error("zipper_parent_nodes_index")));
|
|
490
|
+
if (__eliscript_truthy(((__eliscript_tdz_ready_11 === true ? zipper_public_path_cache : __eliscript_tdz_error("zipper_public_path_cache")))["has"](holder))) {
|
|
491
|
+
return ((__eliscript_tdz_ready_11 === true ? zipper_public_path_cache : __eliscript_tdz_error("zipper_public_path_cache")))["get"](holder);
|
|
492
|
+
} else {
|
|
493
|
+
{
|
|
494
|
+
let walked = zipper_walk_compact_path(path_value);
|
|
495
|
+
let pending = (walked)[0];
|
|
496
|
+
let current = (walked)[1];
|
|
497
|
+
let result = EMPTY_VECTOR;
|
|
498
|
+
let is_arr = (__eliscript_tdz_ready_16 === true ? zipper_is_array : __eliscript_tdz_error("zipper_is_array"));
|
|
499
|
+
let walking = true;
|
|
500
|
+
while ((__eliscript_truthy(walking) && !((current === null)))) {
|
|
501
|
+
if ((__eliscript_truthy(is_arr(current)) && ((current)["length"] === 6) && ((current)[5] === true))) {
|
|
502
|
+
{
|
|
503
|
+
let parents = (current)[3];
|
|
504
|
+
(pending)["push"]((__eliscript_truthy(is_arr(parents)) ? (!(((parents)["length"] === 0)) ? (parents)[0] : ((__eliscript_value_11) => { throw __eliscript_value_11; })(new (globalThis.TypeError)("invalid zipper internal slot"))) : zipper_slot(parents, 0)));
|
|
505
|
+
((current = (current)[2]));
|
|
506
|
+
}
|
|
507
|
+
} else {
|
|
508
|
+
if (__eliscript_truthy(zipper_single_parent_QMARK_(current))) {
|
|
509
|
+
(pending)["push"](zipper_parent_node(current));
|
|
510
|
+
((current = zipper_slot(current, (__eliscript_tdz_ready_7 === true ? zipper_parent_path_index : __eliscript_tdz_error("zipper_parent_path_index")))));
|
|
511
|
+
} else {
|
|
512
|
+
((walking = false));
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
if ((current === null)) {
|
|
517
|
+
if (__eliscript_truthy((__eliscript_tdz_ready_24 === true ? zipper_has_raw_slot : __eliscript_tdz_error("zipper_has_raw_slot")))) {
|
|
518
|
+
((result = (PersistentVector)["from"]((pending)["reverse"]())));
|
|
519
|
+
} else {
|
|
520
|
+
{
|
|
521
|
+
let index = ((pending) ?? []).length;
|
|
522
|
+
while (__eliscript_numeric_relation(">", index, 0)) {
|
|
523
|
+
((index = __eliscript_numeric_decrement(index)), (result = Collection.conj(result, (pending)[index])));
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
} else {
|
|
528
|
+
((result = zipper_materialize(zipper_slot(current, (__eliscript_tdz_ready_8 === true ? zipper_parent_nodes_index : __eliscript_tdz_error("zipper_parent_nodes_index"))))));
|
|
529
|
+
{
|
|
530
|
+
let index = ((pending) ?? []).length;
|
|
531
|
+
while (__eliscript_numeric_relation(">", index, 0)) {
|
|
532
|
+
((index = __eliscript_numeric_decrement(index)), (result = Collection.conj(result, (pending)[index])));
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
((__eliscript_tdz_ready_11 === true ? zipper_public_path_cache : __eliscript_tdz_error("zipper_public_path_cache")))["set"](holder, result);
|
|
537
|
+
return result;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
function lefts(location) {
|
|
546
|
+
zipper_require_location(location, "lefts");
|
|
547
|
+
{
|
|
548
|
+
let path_value = zipper_path_value(location);
|
|
549
|
+
if (((path_value === null) || (path_value === (__eliscript_tdz_ready_3 === true ? zipper_end_path : __eliscript_tdz_error("zipper_end_path"))))) {
|
|
550
|
+
return null;
|
|
551
|
+
} else {
|
|
552
|
+
return zipper_slot(path_value, (__eliscript_tdz_ready_5 === true ? zipper_lefts_index : __eliscript_tdz_error("zipper_lefts_index")));
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
function rights(location) {
|
|
557
|
+
zipper_require_location(location, "rights");
|
|
558
|
+
{
|
|
559
|
+
let path_value = zipper_path_value(location);
|
|
560
|
+
if (((path_value === null) || (path_value === (__eliscript_tdz_ready_3 === true ? zipper_end_path : __eliscript_tdz_error("zipper_end_path"))))) {
|
|
561
|
+
return null;
|
|
562
|
+
} else {
|
|
563
|
+
return zipper_slot(path_value, (__eliscript_tdz_ready_6 === true ? zipper_rights_index : __eliscript_tdz_error("zipper_rights_index")));
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
function down_slow(location) {
|
|
568
|
+
zipper_require_location(location, "down");
|
|
569
|
+
if (__eliscript_truthy((!(__eliscript_truthy(zipper_active_QMARK_(location))) ? true : (!__eliscript_truthy(zipper_branch_value(location)))))) {
|
|
570
|
+
return null;
|
|
571
|
+
} else {
|
|
572
|
+
{
|
|
573
|
+
let child_values = zipper_children_vector(location);
|
|
574
|
+
let child_count = Collection.count(child_values);
|
|
575
|
+
if ((child_count === 0)) {
|
|
576
|
+
return null;
|
|
577
|
+
} else {
|
|
578
|
+
{
|
|
579
|
+
let path_value = zipper_path_value(location);
|
|
580
|
+
let next_parent_nodes = zipper_private_array(node(location));
|
|
581
|
+
return zipper_location(zipper_slot(child_values, 0), zipper_path(EMPTY_VECTOR, (__eliscript_numeric_relation("<=", child_count, 1) ? EMPTY_LIST : zipper_right_list(child_values, 1)), path_value, next_parent_nodes, false), meta(location));
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
function down_raw_fallback(location) {
|
|
588
|
+
if ((__eliscript_truthy(zipper_has_raw_slot) && !((location == null)) && (Object.getPrototypeOf(location) === zipper_vector_proto) && ((location)["count"] === 2))) {
|
|
589
|
+
{
|
|
590
|
+
let configuration = meta(location);
|
|
591
|
+
if ((configuration === zipper_vector_config)) {
|
|
592
|
+
{
|
|
593
|
+
let path_value = zipper_raw_slot(location, 1);
|
|
594
|
+
if ((path_value === zipper_end_path)) {
|
|
595
|
+
return null;
|
|
596
|
+
} else {
|
|
597
|
+
{
|
|
598
|
+
let cur = zipper_raw_slot(location, 0);
|
|
599
|
+
if ((!((cur == null)) && (Object.getPrototypeOf(cur) === zipper_vector_proto) && (meta(cur) === null))) {
|
|
600
|
+
{
|
|
601
|
+
let child_count = (cur)["count"];
|
|
602
|
+
if ((child_count === 0)) {
|
|
603
|
+
return null;
|
|
604
|
+
} else {
|
|
605
|
+
if ((child_count === 1)) {
|
|
606
|
+
return zipper_pair_with_meta(zipper_raw_slot(cur, 0), [EMPTY_VECTOR, EMPTY_LIST, path_value, [cur, null], false, true], configuration);
|
|
607
|
+
} else {
|
|
608
|
+
return zipper_pair_with_meta((__eliscript_numeric_relation("<=", child_count, 32) ? zipper_raw_slot(cur, 0) : Collection.nth(cur, 0)), [EMPTY_VECTOR, zipper_right_list(cur, 1), path_value, [cur, null], false, true], configuration);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
} else {
|
|
613
|
+
return down_slow(location);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
} else {
|
|
619
|
+
return down_slow(location);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
} else {
|
|
623
|
+
return down_slow(location);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
const down = (((state_key, meta_key, vec_proto, init_meta, init_call, vec_config, end_path, pair_with_meta, empty_vec, empty_list) => {
|
|
627
|
+
if ((!((state_key === null)) && !((meta_key === null)))) {
|
|
628
|
+
return ((location) => {
|
|
629
|
+
if ((!((location == null)) && (Object.getPrototypeOf(location) === vec_proto) && ((vec_proto)[meta_key] === init_meta) && ((init_meta)["call"] === init_call))) {
|
|
630
|
+
{
|
|
631
|
+
let lstate = (location)[state_key];
|
|
632
|
+
if ((!((lstate === undefined)) && ((lstate)["count"] === 2))) {
|
|
633
|
+
{
|
|
634
|
+
let configuration = (lstate)["metadata"];
|
|
635
|
+
if ((configuration === vec_config)) {
|
|
636
|
+
{
|
|
637
|
+
let ltail = (lstate)["tail"];
|
|
638
|
+
let path_value = (ltail)[1];
|
|
639
|
+
if ((path_value === end_path)) {
|
|
640
|
+
return null;
|
|
641
|
+
} else {
|
|
642
|
+
{
|
|
643
|
+
let cur = (ltail)[0];
|
|
644
|
+
if ((!((cur == null)) && (Object.getPrototypeOf(cur) === vec_proto))) {
|
|
645
|
+
{
|
|
646
|
+
let nstate = (cur)[state_key];
|
|
647
|
+
if ((!((nstate === undefined)) && ((nstate)["metadata"] === null))) {
|
|
648
|
+
{
|
|
649
|
+
let child_count = (nstate)["count"];
|
|
650
|
+
if ((child_count === 0)) {
|
|
651
|
+
return null;
|
|
652
|
+
} else {
|
|
653
|
+
if ((child_count === 1)) {
|
|
654
|
+
return pair_with_meta(((nstate)["tail"])[0], [empty_vec, empty_list, path_value, [cur, null], false, true], configuration);
|
|
655
|
+
} else {
|
|
656
|
+
return pair_with_meta((__eliscript_numeric_relation("<=", child_count, 32) ? ((nstate)["tail"])[0] : Collection.nth(cur, 0)), [empty_vec, zipper_right_list(cur, 1), path_value, [cur, null], false, true], configuration);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
} else {
|
|
661
|
+
return down_slow(location);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
} else {
|
|
665
|
+
return down_slow(location);
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
} else {
|
|
671
|
+
return down_slow(location);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
} else {
|
|
675
|
+
return down_slow(location);
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
} else {
|
|
679
|
+
return down_raw_fallback(location);
|
|
680
|
+
}
|
|
681
|
+
});
|
|
682
|
+
} else {
|
|
683
|
+
return down_raw_fallback;
|
|
684
|
+
}
|
|
685
|
+
}))(zipper_vector_state_key, zipper_meta_read_key, zipper_vector_proto, zipper_init_meta_read, zipper_init_meta_call, zipper_vector_config, zipper_end_path, zipper_pair_with_meta, EMPTY_VECTOR, EMPTY_LIST);
|
|
686
|
+
__eliscript_tdz_ready_30 = true;
|
|
687
|
+
function up(location) {
|
|
688
|
+
zipper_require_location(location, "up");
|
|
689
|
+
{
|
|
690
|
+
let path_value = zipper_path_value(location);
|
|
691
|
+
if (((path_value === null) || (path_value === (__eliscript_tdz_ready_3 === true ? zipper_end_path : __eliscript_tdz_error("zipper_end_path"))))) {
|
|
692
|
+
return null;
|
|
693
|
+
} else {
|
|
694
|
+
{
|
|
695
|
+
let parent_path = zipper_slot(path_value, (__eliscript_tdz_ready_7 === true ? zipper_parent_path_index : __eliscript_tdz_error("zipper_parent_path_index")));
|
|
696
|
+
let parent_node = zipper_parent_node(path_value);
|
|
697
|
+
if (__eliscript_truthy(zipper_slot(path_value, (__eliscript_tdz_ready_9 === true ? zipper_changed_index : __eliscript_tdz_error("zipper_changed_index"))))) {
|
|
698
|
+
return zipper_location(make_node(location, parent_node, zipper_rebuild_children(zipper_slot(path_value, (__eliscript_tdz_ready_5 === true ? zipper_lefts_index : __eliscript_tdz_error("zipper_lefts_index"))), node(location), zipper_slot(path_value, (__eliscript_tdz_ready_6 === true ? zipper_rights_index : __eliscript_tdz_error("zipper_rights_index"))))), zipper_mark_changed(parent_path), meta(location));
|
|
699
|
+
} else {
|
|
700
|
+
return zipper_location(parent_node, parent_path, meta(location));
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
function right(location) {
|
|
707
|
+
zipper_require_location(location, "right");
|
|
708
|
+
{
|
|
709
|
+
let path_value = zipper_path_value(location);
|
|
710
|
+
if (((path_value === null) || (path_value === (__eliscript_tdz_ready_3 === true ? zipper_end_path : __eliscript_tdz_error("zipper_end_path"))))) {
|
|
711
|
+
return null;
|
|
712
|
+
} else {
|
|
713
|
+
{
|
|
714
|
+
let right_values = zipper_slot(path_value, (__eliscript_tdz_ready_6 === true ? zipper_rights_index : __eliscript_tdz_error("zipper_rights_index")));
|
|
715
|
+
if ((Collection.count(right_values) === 0)) {
|
|
716
|
+
return null;
|
|
717
|
+
} else {
|
|
718
|
+
return zipper_location(first(right_values), zipper_path_assoc(zipper_path_assoc(path_value, (__eliscript_tdz_ready_5 === true ? zipper_lefts_index : __eliscript_tdz_error("zipper_lefts_index")), Collection.conj(zipper_slot(path_value, (__eliscript_tdz_ready_5 === true ? zipper_lefts_index : __eliscript_tdz_error("zipper_lefts_index"))), node(location))), (__eliscript_tdz_ready_6 === true ? zipper_rights_index : __eliscript_tdz_error("zipper_rights_index")), rest(right_values)), meta(location));
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
function left(location) {
|
|
725
|
+
zipper_require_location(location, "left");
|
|
726
|
+
{
|
|
727
|
+
let path_value = zipper_path_value(location);
|
|
728
|
+
if (((path_value === null) || (path_value === (__eliscript_tdz_ready_3 === true ? zipper_end_path : __eliscript_tdz_error("zipper_end_path"))))) {
|
|
729
|
+
return null;
|
|
730
|
+
} else {
|
|
731
|
+
{
|
|
732
|
+
let left_values = zipper_slot(path_value, (__eliscript_tdz_ready_5 === true ? zipper_lefts_index : __eliscript_tdz_error("zipper_lefts_index")));
|
|
733
|
+
let left_count = Collection.count(left_values);
|
|
734
|
+
if ((left_count === 0)) {
|
|
735
|
+
return null;
|
|
736
|
+
} else {
|
|
737
|
+
return zipper_location(zipper_slot(left_values, __eliscript_numeric_decrement(left_count)), zipper_path_assoc(zipper_path_assoc(path_value, (__eliscript_tdz_ready_5 === true ? zipper_lefts_index : __eliscript_tdz_error("zipper_lefts_index")), Collection.pop(left_values)), (__eliscript_tdz_ready_6 === true ? zipper_rights_index : __eliscript_tdz_error("zipper_rights_index")), Collection.conj(zipper_slot(path_value, (__eliscript_tdz_ready_6 === true ? zipper_rights_index : __eliscript_tdz_error("zipper_rights_index"))), node(location))), meta(location));
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
function rightmost(location) {
|
|
744
|
+
zipper_require_location(location, "rightmost");
|
|
745
|
+
{
|
|
746
|
+
let path_value = zipper_path_value(location);
|
|
747
|
+
if (((path_value === null) || (path_value === (__eliscript_tdz_ready_3 === true ? zipper_end_path : __eliscript_tdz_error("zipper_end_path"))))) {
|
|
748
|
+
return location;
|
|
749
|
+
} else {
|
|
750
|
+
{
|
|
751
|
+
let right_values = zipper_materialize(zipper_slot(path_value, (__eliscript_tdz_ready_6 === true ? zipper_rights_index : __eliscript_tdz_error("zipper_rights_index"))));
|
|
752
|
+
let right_count = Collection.count(right_values);
|
|
753
|
+
if ((right_count === 0)) {
|
|
754
|
+
return location;
|
|
755
|
+
} else {
|
|
756
|
+
{
|
|
757
|
+
let next_lefts = Collection.conj(zipper_slot(path_value, (__eliscript_tdz_ready_5 === true ? zipper_lefts_index : __eliscript_tdz_error("zipper_lefts_index"))), node(location));
|
|
758
|
+
let index = 0;
|
|
759
|
+
while (__eliscript_numeric_relation("<", index, __eliscript_numeric_decrement(right_count))) {
|
|
760
|
+
((next_lefts = Collection.conj(next_lefts, zipper_slot(right_values, index))));
|
|
761
|
+
((index = (index + 1)));
|
|
762
|
+
}
|
|
763
|
+
return zipper_location(zipper_slot(right_values, __eliscript_numeric_decrement(right_count)), zipper_path_assoc(zipper_path_assoc(path_value, (__eliscript_tdz_ready_5 === true ? zipper_lefts_index : __eliscript_tdz_error("zipper_lefts_index")), next_lefts), (__eliscript_tdz_ready_6 === true ? zipper_rights_index : __eliscript_tdz_error("zipper_rights_index")), EMPTY_LIST), meta(location));
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
function leftmost(location) {
|
|
771
|
+
zipper_require_location(location, "leftmost");
|
|
772
|
+
{
|
|
773
|
+
let path_value = zipper_path_value(location);
|
|
774
|
+
if (((path_value === null) || (path_value === (__eliscript_tdz_ready_3 === true ? zipper_end_path : __eliscript_tdz_error("zipper_end_path"))))) {
|
|
775
|
+
return location;
|
|
776
|
+
} else {
|
|
777
|
+
{
|
|
778
|
+
let left_values = zipper_slot(path_value, (__eliscript_tdz_ready_5 === true ? zipper_lefts_index : __eliscript_tdz_error("zipper_lefts_index")));
|
|
779
|
+
let left_count = Collection.count(left_values);
|
|
780
|
+
if ((left_count === 0)) {
|
|
781
|
+
return location;
|
|
782
|
+
} else {
|
|
783
|
+
{
|
|
784
|
+
let next_rights = Collection.conj(zipper_slot(path_value, (__eliscript_tdz_ready_6 === true ? zipper_rights_index : __eliscript_tdz_error("zipper_rights_index"))), node(location));
|
|
785
|
+
let index = __eliscript_numeric_decrement(left_count);
|
|
786
|
+
while (__eliscript_numeric_relation(">", index, 0)) {
|
|
787
|
+
((next_rights = Collection.conj(next_rights, zipper_slot(left_values, index))));
|
|
788
|
+
((index = __eliscript_numeric_decrement(index)));
|
|
789
|
+
}
|
|
790
|
+
return zipper_location(zipper_slot(left_values, 0), zipper_path_assoc(zipper_path_assoc(path_value, (__eliscript_tdz_ready_5 === true ? zipper_lefts_index : __eliscript_tdz_error("zipper_lefts_index")), EMPTY_VECTOR), (__eliscript_tdz_ready_6 === true ? zipper_rights_index : __eliscript_tdz_error("zipper_rights_index")), next_rights), meta(location));
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
function root(location) {
|
|
798
|
+
zipper_require_location(location, "root");
|
|
799
|
+
{
|
|
800
|
+
let cur_path = zipper_path_value(location);
|
|
801
|
+
if ((cur_path === (__eliscript_tdz_ready_3 === true ? zipper_end_path : __eliscript_tdz_error("zipper_end_path")))) {
|
|
802
|
+
return zipper_slot(location, 0);
|
|
803
|
+
} else {
|
|
804
|
+
{
|
|
805
|
+
let configuration = meta(location);
|
|
806
|
+
let fast_vec = ((configuration === (__eliscript_tdz_ready_29 === true ? zipper_vector_config : __eliscript_tdz_error("zipper_vector_config"))) ? true : ((callbacks) => {
|
|
807
|
+
if (!((callbacks === undefined))) {
|
|
808
|
+
return (callbacks)["fastVector"];
|
|
809
|
+
} else {
|
|
810
|
+
return false;
|
|
811
|
+
}
|
|
812
|
+
})((!((configuration == null)) ? ((__eliscript_tdz_ready_14 === true ? zipper_config_callbacks : __eliscript_tdz_error("zipper_config_callbacks")))["get"](configuration) : undefined)));
|
|
813
|
+
let is_arr = (__eliscript_tdz_ready_16 === true ? zipper_is_array : __eliscript_tdz_error("zipper_is_array"));
|
|
814
|
+
let has_raw = (__eliscript_tdz_ready_24 === true ? zipper_has_raw_slot : __eliscript_tdz_error("zipper_has_raw_slot"));
|
|
815
|
+
let single_vec = (__eliscript_tdz_ready_22 === true ? zipper_single_vector : __eliscript_tdz_error("zipper_single_vector"));
|
|
816
|
+
let empty_vec = EMPTY_VECTOR;
|
|
817
|
+
let empty_list = EMPTY_LIST;
|
|
818
|
+
let no_proto_meta = (__eliscript_truthy(fast_vec) ? (meta(empty_vec) === null) : false);
|
|
819
|
+
let cur_node = zipper_slot(location, 0);
|
|
820
|
+
let changed = false;
|
|
821
|
+
if ((__eliscript_truthy(fast_vec) && __eliscript_truthy(has_raw) && __eliscript_truthy(no_proto_meta))) {
|
|
822
|
+
{
|
|
823
|
+
let step = zipper_fast_root(cur_node, cur_path, changed, single_vec, empty_vec, empty_list);
|
|
824
|
+
((cur_node = (step)[0]), (cur_path = (step)[1]), (changed = (step)[2]));
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
while (!((cur_path === null))) {
|
|
828
|
+
if ((__eliscript_truthy(fast_vec) && __eliscript_truthy(is_arr(cur_path)) && ((cur_path)["length"] === 6) && ((cur_path)[5] === true))) {
|
|
829
|
+
{
|
|
830
|
+
let parent_path = (cur_path)[2];
|
|
831
|
+
let parents = (cur_path)[3];
|
|
832
|
+
let parents_is_arr = is_arr(parents);
|
|
833
|
+
let parents_len = (__eliscript_truthy(parents_is_arr) ? (parents)["length"] : 0);
|
|
834
|
+
let parent_node = (__eliscript_truthy(parents_is_arr) ? (!((parents_len === 0)) ? (parents)[0] : ((__eliscript_value_12) => { throw __eliscript_value_12; })(new (globalThis.TypeError)("invalid zipper internal slot"))) : zipper_slot(parents, 0));
|
|
835
|
+
let step_changed = (__eliscript_truthy(changed) ? true : (cur_path)[4]);
|
|
836
|
+
if (__eliscript_truthy(step_changed)) {
|
|
837
|
+
{
|
|
838
|
+
let left_vals = (cur_path)[0];
|
|
839
|
+
let right_vals = (cur_path)[1];
|
|
840
|
+
let rebuilt = ((__eliscript_truthy(has_raw) && (left_vals === empty_vec) && (right_vals === empty_list)) ? single_vec(cur_node) : zipper_rebuild_children(left_vals, cur_node, right_vals));
|
|
841
|
+
let m = ((__eliscript_truthy(no_proto_meta) && (parents_len === 2)) ? null : meta(parent_node));
|
|
842
|
+
((cur_node = ((m === null) ? rebuilt : withMeta(rebuilt, m))), (changed = true));
|
|
843
|
+
}
|
|
844
|
+
} else {
|
|
845
|
+
((cur_node = parent_node));
|
|
846
|
+
}
|
|
847
|
+
((cur_path = parent_path));
|
|
848
|
+
}
|
|
849
|
+
} else {
|
|
850
|
+
{
|
|
851
|
+
let parent_path = zipper_slot(cur_path, (__eliscript_tdz_ready_7 === true ? zipper_parent_path_index : __eliscript_tdz_error("zipper_parent_path_index")));
|
|
852
|
+
let parent_node = zipper_parent_node(cur_path);
|
|
853
|
+
let step_changed = (__eliscript_truthy(changed) ? true : zipper_slot(cur_path, (__eliscript_tdz_ready_9 === true ? zipper_changed_index : __eliscript_tdz_error("zipper_changed_index"))));
|
|
854
|
+
if (__eliscript_truthy(step_changed)) {
|
|
855
|
+
((cur_node = make_node(location, parent_node, zipper_rebuild_children(zipper_slot(cur_path, (__eliscript_tdz_ready_5 === true ? zipper_lefts_index : __eliscript_tdz_error("zipper_lefts_index"))), cur_node, zipper_slot(cur_path, (__eliscript_tdz_ready_6 === true ? zipper_rights_index : __eliscript_tdz_error("zipper_rights_index")))))), (changed = true));
|
|
856
|
+
} else {
|
|
857
|
+
((cur_node = parent_node));
|
|
858
|
+
}
|
|
859
|
+
((cur_path = parent_path));
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
return cur_node;
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
function insert_left(location, item) {
|
|
869
|
+
zipper_require_active_location(location, "insert-left");
|
|
870
|
+
{
|
|
871
|
+
let path_value = zipper_path_value(location);
|
|
872
|
+
if ((path_value === null)) {
|
|
873
|
+
return ((__eliscript_value_13) => { throw __eliscript_value_13; })(new (globalThis.TypeError)("insert-left cannot insert at the root"));
|
|
874
|
+
} else {
|
|
875
|
+
return zipper_location(node(location), zipper_path_assoc(zipper_path_assoc(path_value, (__eliscript_tdz_ready_9 === true ? zipper_changed_index : __eliscript_tdz_error("zipper_changed_index")), true), (__eliscript_tdz_ready_5 === true ? zipper_lefts_index : __eliscript_tdz_error("zipper_lefts_index")), Collection.conj(zipper_slot(path_value, (__eliscript_tdz_ready_5 === true ? zipper_lefts_index : __eliscript_tdz_error("zipper_lefts_index"))), item)), meta(location));
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
function insert_right(location, item) {
|
|
880
|
+
zipper_require_active_location(location, "insert-right");
|
|
881
|
+
{
|
|
882
|
+
let path_value = zipper_path_value(location);
|
|
883
|
+
if ((path_value === null)) {
|
|
884
|
+
return ((__eliscript_value_14) => { throw __eliscript_value_14; })(new (globalThis.TypeError)("insert-right cannot insert at the root"));
|
|
885
|
+
} else {
|
|
886
|
+
return zipper_location(node(location), zipper_path_assoc(zipper_path_assoc(path_value, (__eliscript_tdz_ready_9 === true ? zipper_changed_index : __eliscript_tdz_error("zipper_changed_index")), true), (__eliscript_tdz_ready_6 === true ? zipper_rights_index : __eliscript_tdz_error("zipper_rights_index")), Collection.conj(zipper_slot(path_value, (__eliscript_tdz_ready_6 === true ? zipper_rights_index : __eliscript_tdz_error("zipper_rights_index"))), item)), meta(location));
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
function replace(location, replacement) {
|
|
891
|
+
zipper_require_active_location(location, "replace");
|
|
892
|
+
return zipper_location(replacement, zipper_mark_changed(zipper_path_value(location)), meta(location));
|
|
893
|
+
}
|
|
894
|
+
function edit(location, transform, ...arguments$) {
|
|
895
|
+
zipper_require_active_location(location, "edit");
|
|
896
|
+
zipper_require_function(transform, "edit transform");
|
|
897
|
+
if ((((arguments$) ?? []).length === 0)) {
|
|
898
|
+
return replace(location, transform(node(location)));
|
|
899
|
+
} else {
|
|
900
|
+
{
|
|
901
|
+
let argv = [node(location)];
|
|
902
|
+
let idx = 0;
|
|
903
|
+
while (__eliscript_numeric_relation("<", idx, ((arguments$) ?? []).length)) {
|
|
904
|
+
(argv)["push"]((arguments$)[idx]);
|
|
905
|
+
((idx = (idx + 1)));
|
|
906
|
+
}
|
|
907
|
+
return replace(location, transform(...(argv ?? [])));
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
function insert_child(location, item) {
|
|
912
|
+
zipper_require_active_location(location, "insert-child");
|
|
913
|
+
{
|
|
914
|
+
let next_children = Collection.reduce(children(location), ((result, value) => {
|
|
915
|
+
return Collection.conj(result, value);
|
|
916
|
+
}), persistentVector(item));
|
|
917
|
+
return replace(location, make_node(location, node(location), next_children));
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
function append_child(location, item) {
|
|
921
|
+
zipper_require_active_location(location, "append-child");
|
|
922
|
+
return replace(location, make_node(location, node(location), Collection.conj(children(location), item)));
|
|
923
|
+
}
|
|
924
|
+
function zipper_deepest_right(location) {
|
|
925
|
+
{
|
|
926
|
+
let current = location;
|
|
927
|
+
let searching = true;
|
|
928
|
+
while (__eliscript_truthy(searching)) {
|
|
929
|
+
{
|
|
930
|
+
let child = (__eliscript_truthy(branch_QMARK_(current)) ? (__eliscript_tdz_ready_30 === true ? down : __eliscript_tdz_error("down"))(current) : null);
|
|
931
|
+
if ((child === null)) {
|
|
932
|
+
((searching = false));
|
|
933
|
+
} else {
|
|
934
|
+
((current = rightmost(child)));
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
return current;
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
function remove(location) {
|
|
942
|
+
zipper_require_active_location(location, "remove");
|
|
943
|
+
{
|
|
944
|
+
let path_value = zipper_path_value(location);
|
|
945
|
+
if ((path_value === null)) {
|
|
946
|
+
return ((__eliscript_value_15) => { throw __eliscript_value_15; })(new (globalThis.TypeError)("remove cannot remove the root"));
|
|
947
|
+
} else {
|
|
948
|
+
{
|
|
949
|
+
let left_values = zipper_slot(path_value, (__eliscript_tdz_ready_5 === true ? zipper_lefts_index : __eliscript_tdz_error("zipper_lefts_index")));
|
|
950
|
+
let left_count = Collection.count(left_values);
|
|
951
|
+
if (__eliscript_numeric_relation(">", left_count, 0)) {
|
|
952
|
+
return zipper_deepest_right(zipper_location(zipper_slot(left_values, __eliscript_numeric_decrement(left_count)), zipper_path_assoc(zipper_path_assoc(path_value, (__eliscript_tdz_ready_5 === true ? zipper_lefts_index : __eliscript_tdz_error("zipper_lefts_index")), Collection.pop(left_values)), (__eliscript_tdz_ready_9 === true ? zipper_changed_index : __eliscript_tdz_error("zipper_changed_index")), true), meta(location)));
|
|
953
|
+
} else {
|
|
954
|
+
{
|
|
955
|
+
let parent_path = zipper_slot(path_value, (__eliscript_tdz_ready_7 === true ? zipper_parent_path_index : __eliscript_tdz_error("zipper_parent_path_index")));
|
|
956
|
+
let parent_node = zipper_parent_node(path_value);
|
|
957
|
+
return zipper_location(make_node(location, parent_node, zipper_slot(path_value, (__eliscript_tdz_ready_6 === true ? zipper_rights_index : __eliscript_tdz_error("zipper_rights_index")))), zipper_mark_changed(parent_path), meta(location));
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
function next(location) {
|
|
965
|
+
zipper_require_location(location, "next");
|
|
966
|
+
if (__eliscript_truthy(end_QMARK_(location))) {
|
|
967
|
+
return location;
|
|
968
|
+
} else {
|
|
969
|
+
{
|
|
970
|
+
let child = (__eliscript_truthy(branch_QMARK_(location)) ? (__eliscript_tdz_ready_30 === true ? down : __eliscript_tdz_error("down"))(location) : null);
|
|
971
|
+
if (!((child === null))) {
|
|
972
|
+
return child;
|
|
973
|
+
} else {
|
|
974
|
+
{
|
|
975
|
+
let sibling = right(location);
|
|
976
|
+
if (!((sibling === null))) {
|
|
977
|
+
return sibling;
|
|
978
|
+
} else {
|
|
979
|
+
{
|
|
980
|
+
let current = location;
|
|
981
|
+
let result = null;
|
|
982
|
+
let searching = true;
|
|
983
|
+
while (__eliscript_truthy(searching)) {
|
|
984
|
+
{
|
|
985
|
+
let parent = up(current);
|
|
986
|
+
if ((parent === null)) {
|
|
987
|
+
((result = zipper_location(node(current), (__eliscript_tdz_ready_3 === true ? zipper_end_path : __eliscript_tdz_error("zipper_end_path")), meta(location))));
|
|
988
|
+
((searching = false));
|
|
989
|
+
} else {
|
|
990
|
+
{
|
|
991
|
+
let parent_sibling = right(parent);
|
|
992
|
+
if ((parent_sibling === null)) {
|
|
993
|
+
((current = parent));
|
|
994
|
+
} else {
|
|
995
|
+
((result = parent_sibling), (searching = false));
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
return result;
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
function prev(location) {
|
|
1010
|
+
zipper_require_location(location, "prev");
|
|
1011
|
+
if (__eliscript_truthy(end_QMARK_(location))) {
|
|
1012
|
+
return zipper_deepest_right(zipper_location(node(location), null, meta(location)));
|
|
1013
|
+
} else {
|
|
1014
|
+
{
|
|
1015
|
+
let sibling = left(location);
|
|
1016
|
+
if ((sibling === null)) {
|
|
1017
|
+
return up(location);
|
|
1018
|
+
} else {
|
|
1019
|
+
return zipper_deepest_right(sibling);
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
export {append_child, branch_QMARK_, children, down, edit, end_QMARK_, insert_child, insert_left, insert_right, left, leftmost, lefts, list_zipper, make_node, next, node, path, prev, remove, replace, right, rightmost, rights, root, up, vector_zipper, zipper, zipper_QMARK_};
|
|
1025
|
+
//# sourceMappingURL=zipper.mjs.map
|