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
|
@@ -4,26 +4,80 @@ var __eliscript_tdz_ready_0;
|
|
|
4
4
|
var __eliscript_tdz_ready_1;
|
|
5
5
|
var __eliscript_tdz_ready_2;
|
|
6
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_12;
|
|
16
|
+
var __eliscript_tdz_ready_13;
|
|
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;
|
|
7
25
|
import "eliscript/runtime/unicode-case.mjs";
|
|
8
|
-
import
|
|
26
|
+
import "eliscript/runtime/math.mjs";
|
|
27
|
+
import { __eliscript_at, __eliscript_at_direct, __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";
|
|
9
28
|
const __eliscript_truthy = (value) => value !== false && value != null;
|
|
10
29
|
|
|
11
|
-
import {MemoizedSequenceView, memoizedSequenceView, seq} from "./collection.mjs";
|
|
12
|
-
import {memoizedSequenceStatus} from "./collection-internals.mjs";
|
|
30
|
+
import {IChunk, IChunkedSeq, MemoizedSequenceView, isChunkedSeq, memoizedSequenceView, seq} from "./collection.mjs";
|
|
31
|
+
import {CHUNKED_FIRST, CHUNKED_MORE, CHUNKED_NEXT, CHUNK_COUNT, CHUNK_DROP_FIRST, CHUNK_NTH, COLLECTION_COUNT, COLLECTION_NTH, COLLECTION_REDUCE, COLLECTION_SEQ, UNBOUNDED_SEQUENCE, dispatchChunkCount, dispatchChunkDropFirst, dispatchChunkNth, dispatchChunkedFirst, dispatchChunkedNext, isReducedValue, memoizedSequenceStatus, registerChunkedPrependHandler, registerChunkedSliceHandler, unreducedValue, validateCollectionCount} from "./collection-internals.mjs";
|
|
32
|
+
import {EMPTY_LIST} from "./list.mjs";
|
|
33
|
+
import {implementsProtocol} from "./protocol.mjs";
|
|
13
34
|
import {deduping, distincting, dropping, droppingWhile, filtering, interposing, keeping, keepingIndexed, mapcatting, mapping, mappingIndexed, partitioningAll, partitioningBy, removing, sequence, taking, takingNth, takingWhile} from "./transducer.mjs";
|
|
14
|
-
|
|
35
|
+
import {isTruthy} from "./truth.mjs";
|
|
36
|
+
const CHUNK_SIZE = 32;
|
|
15
37
|
__eliscript_tdz_ready_0 = true;
|
|
16
|
-
const
|
|
38
|
+
const typeof_value = (value) => typeof value;
|
|
17
39
|
__eliscript_tdz_ready_1 = true;
|
|
18
|
-
const
|
|
40
|
+
const instance_of_QMARK_ = (value, Constructor) => value instanceof Constructor;
|
|
19
41
|
__eliscript_tdz_ready_2 = true;
|
|
20
|
-
const
|
|
42
|
+
const host_apply = Reflect.apply;
|
|
21
43
|
__eliscript_tdz_ready_3 = true;
|
|
44
|
+
const no_arguments = Object.freeze([]);
|
|
45
|
+
__eliscript_tdz_ready_4 = true;
|
|
46
|
+
const iterator_symbol = (globalThis.Symbol)["iterator"];
|
|
47
|
+
__eliscript_tdz_ready_5 = true;
|
|
48
|
+
const lazy_cons_states = new (globalThis.WeakMap)();
|
|
49
|
+
__eliscript_tdz_ready_6 = true;
|
|
50
|
+
const array_chunk_states = new (globalThis.WeakMap)();
|
|
51
|
+
__eliscript_tdz_ready_7 = true;
|
|
52
|
+
const chunk_buffer_states = new (globalThis.WeakMap)();
|
|
53
|
+
__eliscript_tdz_ready_8 = true;
|
|
54
|
+
const chunked_cons_states = new (globalThis.WeakMap)();
|
|
55
|
+
__eliscript_tdz_ready_9 = true;
|
|
56
|
+
const lazy_chunked_states = new (globalThis.WeakMap)();
|
|
57
|
+
__eliscript_tdz_ready_10 = true;
|
|
58
|
+
const no_failure = globalThis.Symbol("eliscript.lazy-cons.no-failure");
|
|
59
|
+
__eliscript_tdz_ready_11 = true;
|
|
60
|
+
const NO_INITIAL = globalThis.Symbol("eliscript.lazy-chunk.no-initial");
|
|
61
|
+
__eliscript_tdz_ready_12 = true;
|
|
62
|
+
const ARRAY_CHUNK_TOKEN = globalThis.Symbol("eliscript.array-chunk.constructor");
|
|
63
|
+
__eliscript_tdz_ready_13 = true;
|
|
64
|
+
const ARRAY_CHUNK_MISSING = globalThis.Symbol("eliscript.array-chunk.missing");
|
|
65
|
+
const CHUNK_BUFFER_TOKEN = globalThis.Symbol("eliscript.chunk-buffer.constructor");
|
|
66
|
+
__eliscript_tdz_ready_15 = true;
|
|
67
|
+
const CHUNKED_CONS_TOKEN = globalThis.Symbol("eliscript.chunked-cons.constructor");
|
|
68
|
+
__eliscript_tdz_ready_16 = true;
|
|
69
|
+
const LAZY_CHUNKED_TOKEN = globalThis.Symbol("eliscript.lazy-chunked.constructor");
|
|
70
|
+
__eliscript_tdz_ready_17 = true;
|
|
71
|
+
const UNKNOWN_COUNT = globalThis.Symbol("eliscript.chunked.unknown-count");
|
|
72
|
+
__eliscript_tdz_ready_18 = true;
|
|
22
73
|
function fail(message) {
|
|
23
74
|
return ((__eliscript_value_1) => { throw __eliscript_value_1; })(new (globalThis.TypeError)(message));
|
|
24
75
|
}
|
|
76
|
+
function range_fail(message) {
|
|
77
|
+
return ((__eliscript_value_2) => { throw __eliscript_value_2; })(new (globalThis.RangeError)(message));
|
|
78
|
+
}
|
|
25
79
|
function callable_QMARK_(value) {
|
|
26
|
-
return ((
|
|
80
|
+
return ((__eliscript_tdz_ready_1 === true ? typeof_value : __eliscript_tdz_error("typeof_value"))(value) === "function");
|
|
27
81
|
}
|
|
28
82
|
function truth(value) {
|
|
29
83
|
return globalThis.Boolean(value);
|
|
@@ -41,41 +95,60 @@ function require_arity(actual, expected, name) {
|
|
|
41
95
|
return null;
|
|
42
96
|
}
|
|
43
97
|
}
|
|
98
|
+
function require_nonnegative(value, label) {
|
|
99
|
+
if ((!(__eliscript_truthy(Number.isSafeInteger(value)) && __eliscript_numeric_relation(">=", value, 0)))) {
|
|
100
|
+
fail((String(label) + String(" must be a non-negative safe integer")));
|
|
101
|
+
}
|
|
102
|
+
return value;
|
|
103
|
+
}
|
|
104
|
+
function require_finite(value, label) {
|
|
105
|
+
if ((!__eliscript_truthy(Number.isFinite(value)))) {
|
|
106
|
+
fail((String(label) + String(" must be a finite number")));
|
|
107
|
+
}
|
|
108
|
+
return value;
|
|
109
|
+
}
|
|
44
110
|
function method(implementation, name, arity) {
|
|
45
111
|
{
|
|
46
|
-
const
|
|
112
|
+
const __eliscript_value_3 = ((fn, name) => ({ [name](...args) { return fn(this, ...args); } })[name])(implementation, name);
|
|
47
113
|
{
|
|
48
|
-
let function$ =
|
|
114
|
+
let function$ = __eliscript_value_3;
|
|
49
115
|
Object.defineProperty(function$, "length", ({"value": arity, "configurable": true}));
|
|
50
116
|
return function$;
|
|
51
117
|
}
|
|
52
118
|
}
|
|
53
119
|
}
|
|
120
|
+
function getter(implementation, name) {
|
|
121
|
+
return ((fn, name) => Object.getOwnPropertyDescriptor({ get [name]() { return fn(this); } }, name).get)(implementation, name);
|
|
122
|
+
}
|
|
123
|
+
function install_method(target, key, name, arity, implementation) {
|
|
124
|
+
return Object.defineProperty(target, key, ({"value": method(implementation, name, arity), "writable": true, "configurable": true}));
|
|
125
|
+
}
|
|
126
|
+
function install_getter(target, key, name, implementation) {
|
|
127
|
+
return Object.defineProperty(target, key, ({"get": getter(implementation, (String("get ") + String(name))), "configurable": true}));
|
|
128
|
+
}
|
|
54
129
|
function sequence_iterator(value) {
|
|
55
130
|
{
|
|
56
131
|
let source = seq(value);
|
|
57
132
|
if ((source === null)) {
|
|
58
|
-
return __eliscript_at(([])[(
|
|
133
|
+
return __eliscript_at(([])[(__eliscript_tdz_ready_5 === true ? iterator_symbol : __eliscript_tdz_error("iterator_symbol"))], "call")([]);
|
|
59
134
|
} else {
|
|
60
|
-
return __eliscript_at((source)[(
|
|
135
|
+
return __eliscript_at((source)[(__eliscript_tdz_ready_5 === true ? iterator_symbol : __eliscript_tdz_error("iterator_symbol"))], "call")(source);
|
|
61
136
|
}
|
|
62
137
|
}
|
|
63
138
|
}
|
|
64
139
|
function realize_tail(state) {
|
|
65
|
-
if ((!((state)["failure"] === (
|
|
66
|
-
((
|
|
140
|
+
if ((!((state)["failure"] === (__eliscript_tdz_ready_11 === true ? no_failure : __eliscript_tdz_error("no_failure"))))) {
|
|
141
|
+
((__eliscript_value_4) => { throw __eliscript_value_4; })((state)["failure"]);
|
|
67
142
|
}
|
|
68
143
|
if ((!__eliscript_truthy((state)["tailStarted"]))) {
|
|
69
144
|
((state)["tailStarted"] = true);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
})();
|
|
145
|
+
try {
|
|
146
|
+
((state)["tail"] = ((state)["tailThunk"])());
|
|
147
|
+
((state)["tailThunk"] = null);
|
|
148
|
+
} catch (error) {
|
|
149
|
+
((state)["failure"] = error);
|
|
150
|
+
((__eliscript_value_5) => { throw __eliscript_value_5; })(error);
|
|
151
|
+
}
|
|
79
152
|
}
|
|
80
153
|
return (state)["tail"];
|
|
81
154
|
}
|
|
@@ -97,7 +170,7 @@ function cons_iterator(initial) {
|
|
|
97
170
|
if (!((state === null))) {
|
|
98
171
|
{
|
|
99
172
|
let tail = realize_tail(state);
|
|
100
|
-
let tail_state = ((
|
|
173
|
+
let tail_state = ((__eliscript_tdz_ready_6 === true ? lazy_cons_states : __eliscript_tdz_error("lazy_cons_states")))["get"](tail);
|
|
101
174
|
if (!((tail_state === undefined))) {
|
|
102
175
|
((state = tail_state), (head_pending = true));
|
|
103
176
|
} else {
|
|
@@ -130,13 +203,1091 @@ function cons_iterator(initial) {
|
|
|
130
203
|
}
|
|
131
204
|
return ({"value": value, "done": true});
|
|
132
205
|
}), "return", 1)});
|
|
133
|
-
((iterator)[(
|
|
206
|
+
((iterator)[(__eliscript_tdz_ready_5 === true ? iterator_symbol : __eliscript_tdz_error("iterator_symbol"))] = method(((self) => {
|
|
134
207
|
return self;
|
|
135
208
|
}), "[Symbol.iterator]", 0));
|
|
136
209
|
return iterator;
|
|
137
210
|
}
|
|
138
211
|
}
|
|
139
212
|
}
|
|
213
|
+
const ArrayChunk = ((init) => class ArrayChunk { constructor(token, array, off, end) { init(this, token, array, off, end); } })(((self, token, array, off, end) => {
|
|
214
|
+
if ((!(token === ARRAY_CHUNK_TOKEN))) {
|
|
215
|
+
fail("ArrayChunk values must be created with arrayChunk");
|
|
216
|
+
}
|
|
217
|
+
(array_chunk_states)["set"](self, Object.freeze(({"array": array, "off": off, "end": end, "count": __eliscript_numeric_sub(end, off)})));
|
|
218
|
+
return Object.freeze(self);
|
|
219
|
+
}));
|
|
220
|
+
__eliscript_tdz_ready_19 = true;
|
|
221
|
+
function chunk_state(chunk) {
|
|
222
|
+
return ((__eliscript_tdz_ready_7 === true ? array_chunk_states : __eliscript_tdz_error("array_chunk_states")))["get"](chunk);
|
|
223
|
+
}
|
|
224
|
+
function arrayChunk(array, off = null, end = null) {
|
|
225
|
+
if ((!__eliscript_truthy(Array.isArray(array)))) {
|
|
226
|
+
fail("arrayChunk expects a JavaScript Array");
|
|
227
|
+
}
|
|
228
|
+
{
|
|
229
|
+
let total = ((array) ?? []).length;
|
|
230
|
+
let start = ((off == null) ? 0 : validateCollectionCount(off));
|
|
231
|
+
let finish = ((end == null) ? total : validateCollectionCount(end));
|
|
232
|
+
if ((__eliscript_numeric_relation(">", start, finish) || __eliscript_numeric_relation(">", finish, total))) {
|
|
233
|
+
range_fail("arrayChunk bounds are outside array length");
|
|
234
|
+
}
|
|
235
|
+
{
|
|
236
|
+
let frozen_items = Object.freeze((array)["slice"]());
|
|
237
|
+
return new ((__eliscript_tdz_ready_19 === true ? ArrayChunk : __eliscript_tdz_error("ArrayChunk")))((__eliscript_tdz_ready_13 === true ? ARRAY_CHUNK_TOKEN : __eliscript_tdz_error("ARRAY_CHUNK_TOKEN")), frozen_items, start, finish);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
function array_chunk_owned(frozen_array, off, end) {
|
|
242
|
+
return new ((__eliscript_tdz_ready_19 === true ? ArrayChunk : __eliscript_tdz_error("ArrayChunk")))((__eliscript_tdz_ready_13 === true ? ARRAY_CHUNK_TOKEN : __eliscript_tdz_error("ARRAY_CHUNK_TOKEN")), frozen_array, off, end);
|
|
243
|
+
}
|
|
244
|
+
((cproto) => {
|
|
245
|
+
install_getter(cproto, "count", "count", ((self) => {
|
|
246
|
+
return (chunk_state(self))["count"];
|
|
247
|
+
}));
|
|
248
|
+
install_getter(cproto, "size", "size", ((self) => {
|
|
249
|
+
return (chunk_state(self))["count"];
|
|
250
|
+
}));
|
|
251
|
+
install_method(cproto, "chunkCount", "chunkCount", 0, ((self) => {
|
|
252
|
+
return (chunk_state(self))["count"];
|
|
253
|
+
}));
|
|
254
|
+
install_method(cproto, "chunkNth", "chunkNth", 1, ((self, index, ...args) => {
|
|
255
|
+
{
|
|
256
|
+
let state = chunk_state(self);
|
|
257
|
+
let count = (state)["count"];
|
|
258
|
+
let not_found = ((((args) ?? []).length === 0) ? ARRAY_CHUNK_MISSING : (args)[0]);
|
|
259
|
+
if ((__eliscript_truthy(Number.isInteger(index)) && __eliscript_numeric_relation(">=", index, 0) && __eliscript_numeric_relation("<", index, count))) {
|
|
260
|
+
return ((state)["array"])[((state)["off"] + index)];
|
|
261
|
+
} else {
|
|
262
|
+
if (!((not_found === ARRAY_CHUNK_MISSING))) {
|
|
263
|
+
return not_found;
|
|
264
|
+
} else {
|
|
265
|
+
return range_fail((String("chunk index ") + String(globalThis.String(index)) + String(" is outside [0, ") + String(count) + String(")")));
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}));
|
|
270
|
+
install_method(cproto, "dropFirst", "dropFirst", 0, ((self) => {
|
|
271
|
+
{
|
|
272
|
+
let state = chunk_state(self);
|
|
273
|
+
if (((state)["count"] === 0)) {
|
|
274
|
+
range_fail("cannot dropFirst on empty chunk");
|
|
275
|
+
}
|
|
276
|
+
return array_chunk_owned((state)["array"], ((state)["off"] + 1), (state)["end"]);
|
|
277
|
+
}
|
|
278
|
+
}));
|
|
279
|
+
install_method(cproto, CHUNK_COUNT, "[eliscript.chunk.count]", 0, ((self) => {
|
|
280
|
+
return (chunk_state(self))["count"];
|
|
281
|
+
}));
|
|
282
|
+
install_method(cproto, CHUNK_NTH, "[eliscript.chunk.nth]", 1, ((self, index, ...args) => {
|
|
283
|
+
return host_apply((cproto)["chunkNth"], self, ([index])["concat"](args));
|
|
284
|
+
}));
|
|
285
|
+
install_method(cproto, CHUNK_DROP_FIRST, "[eliscript.chunk.dropFirst]", 0, ((self) => {
|
|
286
|
+
return (self)["dropFirst"]();
|
|
287
|
+
}));
|
|
288
|
+
install_method(cproto, COLLECTION_COUNT, "[eliscript.collection.count]", 0, ((self) => {
|
|
289
|
+
return (chunk_state(self))["count"];
|
|
290
|
+
}));
|
|
291
|
+
install_method(cproto, COLLECTION_NTH, "[eliscript.collection.nth]", 1, ((self, index, ...args) => {
|
|
292
|
+
return host_apply((cproto)["chunkNth"], self, ([index])["concat"](args));
|
|
293
|
+
}));
|
|
294
|
+
install_method(cproto, iterator_symbol, "[Symbol.iterator]", 0, ((self) => {
|
|
295
|
+
{
|
|
296
|
+
let state = chunk_state(self);
|
|
297
|
+
let array = (state)["array"];
|
|
298
|
+
let end = (state)["end"];
|
|
299
|
+
let cursor = (state)["off"];
|
|
300
|
+
{
|
|
301
|
+
let iter = ({"next": method(((_self) => {
|
|
302
|
+
if (__eliscript_numeric_relation("<", cursor, end)) {
|
|
303
|
+
{
|
|
304
|
+
let value = (array)[cursor];
|
|
305
|
+
((cursor = (cursor + 1)));
|
|
306
|
+
return ({"value": value, "done": false});
|
|
307
|
+
}
|
|
308
|
+
} else {
|
|
309
|
+
return ({"value": undefined, "done": true});
|
|
310
|
+
}
|
|
311
|
+
}), "next", 0)});
|
|
312
|
+
((iter)[iterator_symbol] = method(((s) => {
|
|
313
|
+
return s;
|
|
314
|
+
}), "[Symbol.iterator]", 0));
|
|
315
|
+
return iter;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}));
|
|
319
|
+
return install_getter(cproto, (globalThis.Symbol)["toStringTag"], "[Symbol.toStringTag]", ((_self) => {
|
|
320
|
+
return "EliscriptArrayChunk";
|
|
321
|
+
}));
|
|
322
|
+
})((ArrayChunk)["prototype"]);
|
|
323
|
+
const ChunkBuffer = ((init) => class ChunkBuffer { constructor(token, capacity) { init(this, token, capacity); } })(((self, token, capacity) => {
|
|
324
|
+
if ((!(token === CHUNK_BUFFER_TOKEN))) {
|
|
325
|
+
fail("ChunkBuffer values must be created with chunkBuffer");
|
|
326
|
+
}
|
|
327
|
+
(chunk_buffer_states)["set"](self, ({"items": [], "capacity": capacity, "consumed": false}));
|
|
328
|
+
return Object.freeze(self);
|
|
329
|
+
}));
|
|
330
|
+
__eliscript_tdz_ready_20 = true;
|
|
331
|
+
function chunk_buffer_state(buffer) {
|
|
332
|
+
{
|
|
333
|
+
let state = ((__eliscript_tdz_ready_8 === true ? chunk_buffer_states : __eliscript_tdz_error("chunk_buffer_states")))["get"](buffer);
|
|
334
|
+
if ((state === undefined)) {
|
|
335
|
+
fail("expected an Eliscript ChunkBuffer");
|
|
336
|
+
}
|
|
337
|
+
return state;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
function active_buffer_state(buffer) {
|
|
341
|
+
{
|
|
342
|
+
let state = chunk_buffer_state(buffer);
|
|
343
|
+
if (__eliscript_truthy((state)["consumed"])) {
|
|
344
|
+
fail("ChunkBuffer has already been converted to an immutable chunk");
|
|
345
|
+
}
|
|
346
|
+
return state;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
function chunkBuffer(capacity = null) {
|
|
350
|
+
{
|
|
351
|
+
let limit = ((capacity == null) ? (__eliscript_tdz_ready_0 === true ? CHUNK_SIZE : __eliscript_tdz_error("CHUNK_SIZE")) : require_nonnegative(capacity, "chunkBuffer capacity"));
|
|
352
|
+
return new ((__eliscript_tdz_ready_20 === true ? ChunkBuffer : __eliscript_tdz_error("ChunkBuffer")))((__eliscript_tdz_ready_15 === true ? CHUNK_BUFFER_TOKEN : __eliscript_tdz_error("CHUNK_BUFFER_TOKEN")), limit);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
function chunkAppend(buffer, value) {
|
|
356
|
+
{
|
|
357
|
+
let state = active_buffer_state(buffer);
|
|
358
|
+
if (__eliscript_numeric_relation(">=", (((state)["items"]) ?? []).length, (state)["capacity"])) {
|
|
359
|
+
range_fail("ChunkBuffer capacity exceeded");
|
|
360
|
+
}
|
|
361
|
+
((state)["items"])["push"](value);
|
|
362
|
+
return buffer;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
function chunkFromBuffer(buffer) {
|
|
366
|
+
{
|
|
367
|
+
let state = active_buffer_state(buffer);
|
|
368
|
+
let items = (state)["items"];
|
|
369
|
+
let len = ((items) ?? []).length;
|
|
370
|
+
((state)["consumed"] = true);
|
|
371
|
+
((state)["items"] = null);
|
|
372
|
+
Object.freeze(items);
|
|
373
|
+
return array_chunk_owned(items, 0, len);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
((bproto) => {
|
|
377
|
+
install_getter(bproto, "count", "count", ((self) => {
|
|
378
|
+
{
|
|
379
|
+
let state = chunk_buffer_state(self);
|
|
380
|
+
if (__eliscript_truthy((state)["consumed"])) {
|
|
381
|
+
return 0;
|
|
382
|
+
} else {
|
|
383
|
+
return (((state)["items"]) ?? []).length;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}));
|
|
387
|
+
install_getter(bproto, "size", "size", ((self) => {
|
|
388
|
+
return (self)["count"];
|
|
389
|
+
}));
|
|
390
|
+
install_method(bproto, "add", "add", 1, ((self, value) => {
|
|
391
|
+
return chunkAppend(self, value);
|
|
392
|
+
}));
|
|
393
|
+
install_method(bproto, "chunk", "chunk", 0, ((self) => {
|
|
394
|
+
return chunkFromBuffer(self);
|
|
395
|
+
}));
|
|
396
|
+
return install_getter(bproto, (globalThis.Symbol)["toStringTag"], "[Symbol.toStringTag]", ((_self) => {
|
|
397
|
+
return "EliscriptChunkBuffer";
|
|
398
|
+
}));
|
|
399
|
+
})((ChunkBuffer)["prototype"]);
|
|
400
|
+
function chunk_count_of(chunk) {
|
|
401
|
+
{
|
|
402
|
+
let direct = (chunk)[CHUNK_COUNT];
|
|
403
|
+
if (__eliscript_truthy(callable_QMARK_(direct))) {
|
|
404
|
+
return (__eliscript_tdz_ready_3 === true ? host_apply : __eliscript_tdz_error("host_apply"))(direct, chunk, (__eliscript_tdz_ready_4 === true ? no_arguments : __eliscript_tdz_error("no_arguments")));
|
|
405
|
+
} else {
|
|
406
|
+
return dispatchChunkCount(chunk);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
function chunk_nth_of(chunk, index) {
|
|
411
|
+
{
|
|
412
|
+
let direct = (chunk)[CHUNK_NTH];
|
|
413
|
+
if (__eliscript_truthy(callable_QMARK_(direct))) {
|
|
414
|
+
return (__eliscript_tdz_ready_3 === true ? host_apply : __eliscript_tdz_error("host_apply"))(direct, chunk, [index]);
|
|
415
|
+
} else {
|
|
416
|
+
return dispatchChunkNth(chunk, index);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
function chunk_drop_first_of(chunk) {
|
|
421
|
+
{
|
|
422
|
+
let direct = (chunk)[CHUNK_DROP_FIRST];
|
|
423
|
+
if (__eliscript_truthy(callable_QMARK_(direct))) {
|
|
424
|
+
return (__eliscript_tdz_ready_3 === true ? host_apply : __eliscript_tdz_error("host_apply"))(direct, chunk, (__eliscript_tdz_ready_4 === true ? no_arguments : __eliscript_tdz_error("no_arguments")));
|
|
425
|
+
} else {
|
|
426
|
+
return dispatchChunkDropFirst(chunk);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
function resolve_lazy_chunk(lazy_seq) {
|
|
431
|
+
{
|
|
432
|
+
let state = ((__eliscript_tdz_ready_10 === true ? lazy_chunked_states : __eliscript_tdz_error("lazy_chunked_states")))["get"](lazy_seq);
|
|
433
|
+
if ((!((state)["failure"] === (__eliscript_tdz_ready_11 === true ? no_failure : __eliscript_tdz_error("no_failure"))))) {
|
|
434
|
+
((__eliscript_value_6) => { throw __eliscript_value_6; })((state)["failure"]);
|
|
435
|
+
}
|
|
436
|
+
if ((!__eliscript_truthy((state)["started"]))) {
|
|
437
|
+
((state)["started"] = true);
|
|
438
|
+
try {
|
|
439
|
+
{
|
|
440
|
+
let resolved = ((state)["thunk"])();
|
|
441
|
+
((state)["thunk"] = null);
|
|
442
|
+
while (__eliscript_truthy((__eliscript_tdz_ready_2 === true ? instance_of_QMARK_ : __eliscript_tdz_error("instance_of_QMARK_"))(resolved, (__eliscript_tdz_ready_22 === true ? LazyChunkedSeq : __eliscript_tdz_error("LazyChunkedSeq"))))) {
|
|
443
|
+
((resolved = resolve_lazy_chunk(resolved)));
|
|
444
|
+
}
|
|
445
|
+
((state)["value"] = resolved);
|
|
446
|
+
}
|
|
447
|
+
} catch (error) {
|
|
448
|
+
((state)["thunk"] = null);
|
|
449
|
+
((state)["failure"] = error);
|
|
450
|
+
((__eliscript_value_7) => { throw __eliscript_value_7; })(error);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
return (state)["value"];
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
function resolve_more_seq(state) {
|
|
457
|
+
if ((!((state)["failure"] === (__eliscript_tdz_ready_11 === true ? no_failure : __eliscript_tdz_error("no_failure"))))) {
|
|
458
|
+
((__eliscript_value_8) => { throw __eliscript_value_8; })((state)["failure"]);
|
|
459
|
+
}
|
|
460
|
+
if ((!__eliscript_truthy((state)["moreRealized"]))) {
|
|
461
|
+
((state)["moreRealized"] = true);
|
|
462
|
+
try {
|
|
463
|
+
{
|
|
464
|
+
let raw = (state)["more"];
|
|
465
|
+
((state)["more"] = null);
|
|
466
|
+
{
|
|
467
|
+
let next_val = (__eliscript_truthy(callable_QMARK_(raw)) ? raw() : raw);
|
|
468
|
+
while (__eliscript_truthy((__eliscript_tdz_ready_2 === true ? instance_of_QMARK_ : __eliscript_tdz_error("instance_of_QMARK_"))(next_val, (__eliscript_tdz_ready_22 === true ? LazyChunkedSeq : __eliscript_tdz_error("LazyChunkedSeq"))))) {
|
|
469
|
+
((next_val = resolve_lazy_chunk(next_val)));
|
|
470
|
+
}
|
|
471
|
+
((state)["cachedMore"] = ((next_val === null) ? null : next_val));
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
} catch (error) {
|
|
475
|
+
((state)["more"] = null);
|
|
476
|
+
((state)["failure"] = error);
|
|
477
|
+
((__eliscript_value_9) => { throw __eliscript_value_9; })(error);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
return (state)["cachedMore"];
|
|
481
|
+
}
|
|
482
|
+
function normalize_chunk_head(chunked_seq) {
|
|
483
|
+
if (__eliscript_truthy((__eliscript_tdz_ready_2 === true ? instance_of_QMARK_ : __eliscript_tdz_error("instance_of_QMARK_"))(chunked_seq, (__eliscript_tdz_ready_22 === true ? LazyChunkedSeq : __eliscript_tdz_error("LazyChunkedSeq"))))) {
|
|
484
|
+
return resolve_lazy_chunk(chunked_seq);
|
|
485
|
+
} else {
|
|
486
|
+
return chunked_seq;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
function chunked_first_of(chunked_seq) {
|
|
490
|
+
{
|
|
491
|
+
let curr = normalize_chunk_head(chunked_seq);
|
|
492
|
+
if ((curr === null)) {
|
|
493
|
+
return null;
|
|
494
|
+
} else {
|
|
495
|
+
{
|
|
496
|
+
let direct = (curr)[CHUNKED_FIRST];
|
|
497
|
+
if (__eliscript_truthy(callable_QMARK_(direct))) {
|
|
498
|
+
return (__eliscript_tdz_ready_3 === true ? host_apply : __eliscript_tdz_error("host_apply"))(direct, curr, (__eliscript_tdz_ready_4 === true ? no_arguments : __eliscript_tdz_error("no_arguments")));
|
|
499
|
+
} else {
|
|
500
|
+
return dispatchChunkedFirst(curr);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
function chunked_next_of(chunked_seq) {
|
|
507
|
+
{
|
|
508
|
+
let curr = normalize_chunk_head(chunked_seq);
|
|
509
|
+
if ((curr === null)) {
|
|
510
|
+
return null;
|
|
511
|
+
} else {
|
|
512
|
+
{
|
|
513
|
+
let direct = (curr)[CHUNKED_NEXT];
|
|
514
|
+
if (__eliscript_truthy(callable_QMARK_(direct))) {
|
|
515
|
+
return (__eliscript_tdz_ready_3 === true ? host_apply : __eliscript_tdz_error("host_apply"))(direct, curr, (__eliscript_tdz_ready_4 === true ? no_arguments : __eliscript_tdz_error("no_arguments")));
|
|
516
|
+
} else {
|
|
517
|
+
return dispatchChunkedNext(curr);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
function chunked_seq_iterator(initial_seq) {
|
|
524
|
+
{
|
|
525
|
+
let current = initial_seq;
|
|
526
|
+
let current_array = null;
|
|
527
|
+
let cursor = 0;
|
|
528
|
+
let limit = 0;
|
|
529
|
+
let current_chunk = null;
|
|
530
|
+
let tail_iterator = null;
|
|
531
|
+
let closed = false;
|
|
532
|
+
let close_fn = (() => {
|
|
533
|
+
((closed = true), (current = null), (current_array = null), (current_chunk = null));
|
|
534
|
+
if ((!((tail_iterator === null)) && __eliscript_truthy(callable_QMARK_((tail_iterator)["return"])))) {
|
|
535
|
+
(tail_iterator)["return"]();
|
|
536
|
+
}
|
|
537
|
+
return ((tail_iterator = null));
|
|
538
|
+
});
|
|
539
|
+
let iter = ({"next": (() => {
|
|
540
|
+
if (__eliscript_truthy(closed)) {
|
|
541
|
+
return ({"value": undefined, "done": true});
|
|
542
|
+
} else {
|
|
543
|
+
while ((__eliscript_numeric_relation(">=", cursor, limit) && (tail_iterator === null) && !((current === null)))) {
|
|
544
|
+
{
|
|
545
|
+
let resolved = normalize_chunk_head(current);
|
|
546
|
+
if ((resolved === null)) {
|
|
547
|
+
((current = null));
|
|
548
|
+
} else {
|
|
549
|
+
if (__eliscript_truthy(isChunkedSeq(resolved))) {
|
|
550
|
+
{
|
|
551
|
+
let chunk = chunked_first_of(resolved);
|
|
552
|
+
if (((chunk === null) || (chunk_count_of(chunk) === 0))) {
|
|
553
|
+
((current = chunked_next_of(resolved)));
|
|
554
|
+
} else {
|
|
555
|
+
{
|
|
556
|
+
let cstate = chunk_state(chunk);
|
|
557
|
+
if (!((cstate === undefined))) {
|
|
558
|
+
((current_array = (cstate)["array"]), (cursor = (cstate)["off"]), (limit = (cstate)["end"]), (current_chunk = null), (current = chunked_next_of(resolved)));
|
|
559
|
+
} else {
|
|
560
|
+
((current_array = null), (cursor = 0), (limit = chunk_count_of(chunk)), (current_chunk = chunk), (current = chunked_next_of(resolved)));
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
} else {
|
|
566
|
+
((tail_iterator = sequence_iterator(resolved)), (current = null));
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
if (__eliscript_numeric_relation("<", cursor, limit)) {
|
|
572
|
+
{
|
|
573
|
+
let val = (!((current_array === null)) ? (current_array)[cursor] : chunk_nth_of(current_chunk, cursor));
|
|
574
|
+
((cursor = (cursor + 1)));
|
|
575
|
+
return ({"value": val, "done": false});
|
|
576
|
+
}
|
|
577
|
+
} else {
|
|
578
|
+
if (!((tail_iterator === null))) {
|
|
579
|
+
{
|
|
580
|
+
let step = (tail_iterator)["next"]();
|
|
581
|
+
if (__eliscript_truthy(truth((step)["done"]))) {
|
|
582
|
+
((closed = true), (tail_iterator = null));
|
|
583
|
+
}
|
|
584
|
+
return step;
|
|
585
|
+
}
|
|
586
|
+
} else {
|
|
587
|
+
((closed = true));
|
|
588
|
+
return ({"value": undefined, "done": true});
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}), "return": ((...optional) => {
|
|
593
|
+
{
|
|
594
|
+
let value = ((((optional) ?? []).length === 0) ? undefined : (optional)[0]);
|
|
595
|
+
close_fn();
|
|
596
|
+
return ({"value": value, "done": true});
|
|
597
|
+
}
|
|
598
|
+
}), "throw": ((...optional) => {
|
|
599
|
+
{
|
|
600
|
+
let error = ((((optional) ?? []).length === 0) ? undefined : (optional)[0]);
|
|
601
|
+
close_fn();
|
|
602
|
+
return ((__eliscript_value_10) => { throw __eliscript_value_10; })(error);
|
|
603
|
+
}
|
|
604
|
+
})});
|
|
605
|
+
Object.defineProperty(iter, (__eliscript_tdz_ready_5 === true ? iterator_symbol : __eliscript_tdz_error("iterator_symbol")), ({"value": (() => {
|
|
606
|
+
return iter;
|
|
607
|
+
}), "writable": true, "configurable": true}));
|
|
608
|
+
return iter;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
function chunked_seq_count(start_seq) {
|
|
612
|
+
{
|
|
613
|
+
let total = 0;
|
|
614
|
+
let curr = normalize_chunk_head(start_seq);
|
|
615
|
+
while (!((curr === null))) {
|
|
616
|
+
if (__eliscript_truthy(isChunkedSeq(curr))) {
|
|
617
|
+
{
|
|
618
|
+
let chunk = chunked_first_of(curr);
|
|
619
|
+
if (!((chunk === null))) {
|
|
620
|
+
((total = (total + chunk_count_of(chunk))));
|
|
621
|
+
}
|
|
622
|
+
((curr = chunked_next_of(curr)));
|
|
623
|
+
}
|
|
624
|
+
} else {
|
|
625
|
+
{
|
|
626
|
+
let iter = sequence_iterator(curr);
|
|
627
|
+
let done = false;
|
|
628
|
+
while (!(__eliscript_truthy(done))) {
|
|
629
|
+
{
|
|
630
|
+
let step = (iter)["next"]();
|
|
631
|
+
if (__eliscript_truthy(truth((step)["done"]))) {
|
|
632
|
+
((done = true));
|
|
633
|
+
} else {
|
|
634
|
+
((total = (total + 1)));
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
((curr = null));
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
return total;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
function reduce_chunked_seq(start_seq, reducer, initial_args) {
|
|
646
|
+
if ((!__eliscript_truthy(callable_QMARK_(reducer)))) {
|
|
647
|
+
fail("collection reducer must be a function");
|
|
648
|
+
}
|
|
649
|
+
{
|
|
650
|
+
let acc = ((((initial_args) ?? []).length === 0) ? (__eliscript_tdz_ready_12 === true ? NO_INITIAL : __eliscript_tdz_error("NO_INITIAL")) : (initial_args)[0]);
|
|
651
|
+
let curr = normalize_chunk_head(start_seq);
|
|
652
|
+
let early = false;
|
|
653
|
+
while ((!((curr === null)) && !(__eliscript_truthy(early)))) {
|
|
654
|
+
if (__eliscript_truthy(isChunkedSeq(curr))) {
|
|
655
|
+
{
|
|
656
|
+
let chunk = chunked_first_of(curr);
|
|
657
|
+
if (!((chunk === null))) {
|
|
658
|
+
{
|
|
659
|
+
let cstate = chunk_state(chunk);
|
|
660
|
+
if (!((cstate === undefined))) {
|
|
661
|
+
{
|
|
662
|
+
let arr = (cstate)["array"];
|
|
663
|
+
let idx = (cstate)["off"];
|
|
664
|
+
let end = (cstate)["end"];
|
|
665
|
+
if ((__eliscript_numeric_relation("<", idx, end) && (acc === (__eliscript_tdz_ready_12 === true ? NO_INITIAL : __eliscript_tdz_error("NO_INITIAL"))))) {
|
|
666
|
+
((acc = (arr)[idx]), (idx = (idx + 1)));
|
|
667
|
+
}
|
|
668
|
+
while ((__eliscript_numeric_relation("<", idx, end) && !(__eliscript_truthy(early)))) {
|
|
669
|
+
((acc = reducer(acc, (arr)[idx])));
|
|
670
|
+
if (__eliscript_truthy(isReducedValue(acc))) {
|
|
671
|
+
((acc = unreducedValue(acc)), (early = true));
|
|
672
|
+
} else {
|
|
673
|
+
((idx = (idx + 1)));
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
} else {
|
|
678
|
+
{
|
|
679
|
+
let cnt = chunk_count_of(chunk);
|
|
680
|
+
let idx = 0;
|
|
681
|
+
if ((__eliscript_numeric_relation("<", idx, cnt) && (acc === (__eliscript_tdz_ready_12 === true ? NO_INITIAL : __eliscript_tdz_error("NO_INITIAL"))))) {
|
|
682
|
+
((acc = chunk_nth_of(chunk, 0)), (idx = 1));
|
|
683
|
+
}
|
|
684
|
+
while ((__eliscript_numeric_relation("<", idx, cnt) && !(__eliscript_truthy(early)))) {
|
|
685
|
+
((acc = reducer(acc, chunk_nth_of(chunk, idx))));
|
|
686
|
+
if (__eliscript_truthy(isReducedValue(acc))) {
|
|
687
|
+
((acc = unreducedValue(acc)), (early = true));
|
|
688
|
+
} else {
|
|
689
|
+
((idx = (idx + 1)));
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
if ((!__eliscript_truthy(early))) {
|
|
697
|
+
((curr = chunked_next_of(curr)));
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
} else {
|
|
701
|
+
{
|
|
702
|
+
let iter = sequence_iterator(curr);
|
|
703
|
+
let done = false;
|
|
704
|
+
while ((!(__eliscript_truthy(done)) && !(__eliscript_truthy(early)))) {
|
|
705
|
+
{
|
|
706
|
+
let step = (iter)["next"]();
|
|
707
|
+
if (__eliscript_truthy(truth((step)["done"]))) {
|
|
708
|
+
((done = true));
|
|
709
|
+
} else {
|
|
710
|
+
if ((acc === (__eliscript_tdz_ready_12 === true ? NO_INITIAL : __eliscript_tdz_error("NO_INITIAL")))) {
|
|
711
|
+
((acc = (step)["value"]));
|
|
712
|
+
} else {
|
|
713
|
+
((acc = reducer(acc, (step)["value"])));
|
|
714
|
+
if (__eliscript_truthy(isReducedValue(acc))) {
|
|
715
|
+
((acc = unreducedValue(acc)), (early = true));
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
((curr = null));
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
if ((acc === (__eliscript_tdz_ready_12 === true ? NO_INITIAL : __eliscript_tdz_error("NO_INITIAL")))) {
|
|
726
|
+
fail("cannot reduce an empty collection without an initial value");
|
|
727
|
+
}
|
|
728
|
+
return acc;
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
const ChunkedCons = ((init) => class ChunkedCons { constructor(token, chunk, more, countHint) { init(this, token, chunk, more, countHint); } })(((self, token, chunk, more, count_hint) => {
|
|
732
|
+
if ((!(token === CHUNKED_CONS_TOKEN))) {
|
|
733
|
+
fail("ChunkedCons values must be created with chunkedCons");
|
|
734
|
+
}
|
|
735
|
+
(chunked_cons_states)["set"](self, ({"chunk": chunk, "more": more, "countHint": count_hint, "moreRealized": false, "cachedMore": null, "failure": no_failure}));
|
|
736
|
+
return Object.freeze(self);
|
|
737
|
+
}));
|
|
738
|
+
__eliscript_tdz_ready_21 = true;
|
|
739
|
+
function make_chunked_cons(chunk, more, count_hint = null) {
|
|
740
|
+
{
|
|
741
|
+
let resolved_hint = ((count_hint == null) ? (__eliscript_tdz_ready_18 === true ? UNKNOWN_COUNT : __eliscript_tdz_error("UNKNOWN_COUNT")) : count_hint);
|
|
742
|
+
return new ((__eliscript_tdz_ready_21 === true ? ChunkedCons : __eliscript_tdz_error("ChunkedCons")))((__eliscript_tdz_ready_16 === true ? CHUNKED_CONS_TOKEN : __eliscript_tdz_error("CHUNKED_CONS_TOKEN")), chunk, more, resolved_hint);
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
function chunkedCons(chunk, more) {
|
|
746
|
+
if ((!(__eliscript_truthy((__eliscript_tdz_ready_2 === true ? instance_of_QMARK_ : __eliscript_tdz_error("instance_of_QMARK_"))(chunk, (__eliscript_tdz_ready_19 === true ? ArrayChunk : __eliscript_tdz_error("ArrayChunk")))) || __eliscript_truthy(implementsProtocol(IChunk, chunk))))) {
|
|
747
|
+
fail("chunkedCons expects an IChunk as its first argument");
|
|
748
|
+
}
|
|
749
|
+
if ((chunk_count_of(chunk) === 0)) {
|
|
750
|
+
if (__eliscript_truthy(callable_QMARK_(more))) {
|
|
751
|
+
return more();
|
|
752
|
+
} else {
|
|
753
|
+
if ((more === null)) {
|
|
754
|
+
return null;
|
|
755
|
+
} else {
|
|
756
|
+
return seq(more);
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
} else {
|
|
760
|
+
return make_chunked_cons(chunk, more, (__eliscript_tdz_ready_18 === true ? UNKNOWN_COUNT : __eliscript_tdz_error("UNKNOWN_COUNT")));
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
((ccproto) => {
|
|
764
|
+
install_method(ccproto, CHUNKED_FIRST, "[eliscript.chunked-seq.chunkedFirst]", 0, ((self) => {
|
|
765
|
+
return ((chunked_cons_states)["get"](self))["chunk"];
|
|
766
|
+
}));
|
|
767
|
+
install_method(ccproto, CHUNKED_NEXT, "[eliscript.chunked-seq.chunkedNext]", 0, ((self) => {
|
|
768
|
+
{
|
|
769
|
+
let next_val = resolve_more_seq((chunked_cons_states)["get"](self));
|
|
770
|
+
if ((next_val === null)) {
|
|
771
|
+
return null;
|
|
772
|
+
} else {
|
|
773
|
+
if ((__eliscript_truthy(instance_of_QMARK_(next_val, ChunkedCons)) || __eliscript_truthy(instance_of_QMARK_(next_val, (__eliscript_tdz_ready_22 === true ? LazyChunkedSeq : __eliscript_tdz_error("LazyChunkedSeq")))))) {
|
|
774
|
+
return next_val;
|
|
775
|
+
} else {
|
|
776
|
+
return seq(next_val);
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
}));
|
|
781
|
+
install_method(ccproto, CHUNKED_MORE, "[eliscript.chunked-seq.chunkedMore]", 0, ((self) => {
|
|
782
|
+
{
|
|
783
|
+
let next_val = __eliscript_at((self)[CHUNKED_NEXT], "call")(self);
|
|
784
|
+
if ((next_val === null)) {
|
|
785
|
+
return EMPTY_LIST;
|
|
786
|
+
} else {
|
|
787
|
+
return next_val;
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
}));
|
|
791
|
+
install_method(ccproto, COLLECTION_SEQ, "[eliscript.collection.seq]", 0, ((self) => {
|
|
792
|
+
return self;
|
|
793
|
+
}));
|
|
794
|
+
install_method(ccproto, COLLECTION_COUNT, "[eliscript.collection.count]", 0, ((self) => {
|
|
795
|
+
{
|
|
796
|
+
let state = (chunked_cons_states)["get"](self);
|
|
797
|
+
let hint = (state)["countHint"];
|
|
798
|
+
if ((hint === UNBOUNDED_SEQUENCE)) {
|
|
799
|
+
return range_fail("unbounded sequence does not have a finite count");
|
|
800
|
+
} else {
|
|
801
|
+
if (!((hint === UNKNOWN_COUNT))) {
|
|
802
|
+
return hint;
|
|
803
|
+
} else {
|
|
804
|
+
{
|
|
805
|
+
let computed = chunked_seq_count(self);
|
|
806
|
+
((state)["countHint"] = computed);
|
|
807
|
+
return computed;
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
}));
|
|
813
|
+
install_method(ccproto, COLLECTION_REDUCE, "[eliscript.collection.reduce]", 1, ((self, reducer, ...initial) => {
|
|
814
|
+
return reduce_chunked_seq(self, reducer, initial);
|
|
815
|
+
}));
|
|
816
|
+
install_method(ccproto, iterator_symbol, "[Symbol.iterator]", 0, ((self) => {
|
|
817
|
+
return chunked_seq_iterator(self);
|
|
818
|
+
}));
|
|
819
|
+
return install_getter(ccproto, (globalThis.Symbol)["toStringTag"], "[Symbol.toStringTag]", ((_self) => {
|
|
820
|
+
return "EliscriptChunkedCons";
|
|
821
|
+
}));
|
|
822
|
+
})((ChunkedCons)["prototype"]);
|
|
823
|
+
const LazyChunkedSeq = ((init) => class LazyChunkedSeq { constructor(token, thunk, countHint) { init(this, token, thunk, countHint); } })(((self, token, thunk, count_hint) => {
|
|
824
|
+
if ((!(token === LAZY_CHUNKED_TOKEN))) {
|
|
825
|
+
fail("LazyChunkedSeq values must be created with lazyChunkedSeq");
|
|
826
|
+
}
|
|
827
|
+
(lazy_chunked_states)["set"](self, ({"thunk": thunk, "countHint": count_hint, "started": false, "value": null, "failure": no_failure}));
|
|
828
|
+
return Object.freeze(self);
|
|
829
|
+
}));
|
|
830
|
+
__eliscript_tdz_ready_22 = true;
|
|
831
|
+
function make_lazy_chunked(thunk, count_hint = null) {
|
|
832
|
+
return new ((__eliscript_tdz_ready_22 === true ? LazyChunkedSeq : __eliscript_tdz_error("LazyChunkedSeq")))((__eliscript_tdz_ready_17 === true ? LAZY_CHUNKED_TOKEN : __eliscript_tdz_error("LAZY_CHUNKED_TOKEN")), thunk, ((count_hint == null) ? (__eliscript_tdz_ready_18 === true ? UNKNOWN_COUNT : __eliscript_tdz_error("UNKNOWN_COUNT")) : count_hint));
|
|
833
|
+
}
|
|
834
|
+
((lcproto) => {
|
|
835
|
+
install_method(lcproto, CHUNKED_FIRST, "[eliscript.chunked-seq.chunkedFirst]", 0, ((self) => {
|
|
836
|
+
{
|
|
837
|
+
let resolved = resolve_lazy_chunk(self);
|
|
838
|
+
if ((resolved === null)) {
|
|
839
|
+
return null;
|
|
840
|
+
} else {
|
|
841
|
+
return chunked_first_of(resolved);
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
}));
|
|
845
|
+
install_method(lcproto, CHUNKED_NEXT, "[eliscript.chunked-seq.chunkedNext]", 0, ((self) => {
|
|
846
|
+
{
|
|
847
|
+
let resolved = resolve_lazy_chunk(self);
|
|
848
|
+
if ((resolved === null)) {
|
|
849
|
+
return null;
|
|
850
|
+
} else {
|
|
851
|
+
return chunked_next_of(resolved);
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
}));
|
|
855
|
+
install_method(lcproto, CHUNKED_MORE, "[eliscript.chunked-seq.chunkedMore]", 0, ((self) => {
|
|
856
|
+
{
|
|
857
|
+
let next_val = __eliscript_at((self)[CHUNKED_NEXT], "call")(self);
|
|
858
|
+
if ((next_val === null)) {
|
|
859
|
+
return EMPTY_LIST;
|
|
860
|
+
} else {
|
|
861
|
+
return next_val;
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
}));
|
|
865
|
+
install_method(lcproto, COLLECTION_SEQ, "[eliscript.collection.seq]", 0, ((self) => {
|
|
866
|
+
{
|
|
867
|
+
let state = (lazy_chunked_states)["get"](self);
|
|
868
|
+
if (((state)["countHint"] === UNBOUNDED_SEQUENCE)) {
|
|
869
|
+
return self;
|
|
870
|
+
} else {
|
|
871
|
+
{
|
|
872
|
+
let resolved = resolve_lazy_chunk(self);
|
|
873
|
+
if ((resolved === null)) {
|
|
874
|
+
return null;
|
|
875
|
+
} else {
|
|
876
|
+
return self;
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
}));
|
|
882
|
+
install_method(lcproto, COLLECTION_COUNT, "[eliscript.collection.count]", 0, ((self) => {
|
|
883
|
+
{
|
|
884
|
+
let state = (lazy_chunked_states)["get"](self);
|
|
885
|
+
let hint = (state)["countHint"];
|
|
886
|
+
if ((hint === UNBOUNDED_SEQUENCE)) {
|
|
887
|
+
return range_fail("unbounded sequence does not have a finite count");
|
|
888
|
+
} else {
|
|
889
|
+
if (!((hint === UNKNOWN_COUNT))) {
|
|
890
|
+
return hint;
|
|
891
|
+
} else {
|
|
892
|
+
{
|
|
893
|
+
let computed = chunked_seq_count(self);
|
|
894
|
+
((state)["countHint"] = computed);
|
|
895
|
+
return computed;
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
}));
|
|
901
|
+
install_method(lcproto, COLLECTION_REDUCE, "[eliscript.collection.reduce]", 1, ((self, reducer, ...initial) => {
|
|
902
|
+
return reduce_chunked_seq(self, reducer, initial);
|
|
903
|
+
}));
|
|
904
|
+
install_method(lcproto, iterator_symbol, "[Symbol.iterator]", 0, ((self) => {
|
|
905
|
+
return chunked_seq_iterator(self);
|
|
906
|
+
}));
|
|
907
|
+
return install_getter(lcproto, (globalThis.Symbol)["toStringTag"], "[Symbol.toStringTag]", ((_self) => {
|
|
908
|
+
return "EliscriptLazyChunkedSeq";
|
|
909
|
+
}));
|
|
910
|
+
})((LazyChunkedSeq)["prototype"]);
|
|
911
|
+
function build_range_cons(start, step, total, offset) {
|
|
912
|
+
if ((!((total === UNBOUNDED_SEQUENCE)) && __eliscript_numeric_relation(">=", offset, total))) {
|
|
913
|
+
return null;
|
|
914
|
+
} else {
|
|
915
|
+
{
|
|
916
|
+
let remaining = ((total === UNBOUNDED_SEQUENCE) ? (__eliscript_tdz_ready_0 === true ? CHUNK_SIZE : __eliscript_tdz_error("CHUNK_SIZE")) : Math.min((__eliscript_tdz_ready_0 === true ? CHUNK_SIZE : __eliscript_tdz_error("CHUNK_SIZE")), __eliscript_numeric_sub(total, offset)));
|
|
917
|
+
let items = new (globalThis.Array)(remaining);
|
|
918
|
+
let i = 0;
|
|
919
|
+
while (__eliscript_numeric_relation("<", i, remaining)) {
|
|
920
|
+
((items)[i] = (start + __eliscript_numeric_mul((offset + i), step)));
|
|
921
|
+
((i = (i + 1)));
|
|
922
|
+
}
|
|
923
|
+
Object.freeze(items);
|
|
924
|
+
{
|
|
925
|
+
let next_offset = (offset + remaining);
|
|
926
|
+
let hint = ((total === UNBOUNDED_SEQUENCE) ? UNBOUNDED_SEQUENCE : __eliscript_numeric_sub(total, offset));
|
|
927
|
+
return make_chunked_cons(array_chunk_owned(items, 0, remaining), (((total === UNBOUNDED_SEQUENCE) || __eliscript_numeric_relation("<", next_offset, total)) ? (() => {
|
|
928
|
+
return build_range_cons(start, step, total, next_offset);
|
|
929
|
+
}) : null), hint);
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
function chunkedRange(...bounds) {
|
|
935
|
+
if (__eliscript_numeric_relation(">", ((bounds) ?? []).length, 3)) {
|
|
936
|
+
fail("range expects zero to three arguments");
|
|
937
|
+
}
|
|
938
|
+
if ((((bounds) ?? []).length === 0)) {
|
|
939
|
+
return make_lazy_chunked((() => {
|
|
940
|
+
return build_range_cons(0, 1, UNBOUNDED_SEQUENCE, 0);
|
|
941
|
+
}), UNBOUNDED_SEQUENCE);
|
|
942
|
+
} else {
|
|
943
|
+
{
|
|
944
|
+
let start = require_finite(((((bounds) ?? []).length === 1) ? 0 : (bounds)[0]), "range start");
|
|
945
|
+
let end = require_finite(((((bounds) ?? []).length === 1) ? (bounds)[0] : (bounds)[1]), "range end");
|
|
946
|
+
let step = require_finite(((((bounds) ?? []).length === 3) ? (bounds)[2] : 1), "range step");
|
|
947
|
+
if ((step === 0)) {
|
|
948
|
+
fail("range step must be non-zero");
|
|
949
|
+
}
|
|
950
|
+
{
|
|
951
|
+
let distance = __eliscript_numeric_div(__eliscript_numeric_sub(end, start), step);
|
|
952
|
+
let length = (__eliscript_numeric_relation(">", distance, 0) ? require_nonnegative(Math.ceil(distance), "range count") : 0);
|
|
953
|
+
if ((length === 0)) {
|
|
954
|
+
return null;
|
|
955
|
+
} else {
|
|
956
|
+
return make_lazy_chunked((() => {
|
|
957
|
+
return build_range_cons(start, step, length, 0);
|
|
958
|
+
}), length);
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
function build_repeat_cons(value, remaining) {
|
|
965
|
+
if ((!((remaining === UNBOUNDED_SEQUENCE)) && __eliscript_numeric_relation("<=", remaining, 0))) {
|
|
966
|
+
return null;
|
|
967
|
+
} else {
|
|
968
|
+
{
|
|
969
|
+
let batch = ((remaining === UNBOUNDED_SEQUENCE) ? (__eliscript_tdz_ready_0 === true ? CHUNK_SIZE : __eliscript_tdz_error("CHUNK_SIZE")) : Math.min((__eliscript_tdz_ready_0 === true ? CHUNK_SIZE : __eliscript_tdz_error("CHUNK_SIZE")), remaining));
|
|
970
|
+
let items = new (globalThis.Array)(batch);
|
|
971
|
+
let i = 0;
|
|
972
|
+
while (__eliscript_numeric_relation("<", i, batch)) {
|
|
973
|
+
((items)[i] = value);
|
|
974
|
+
((i = (i + 1)));
|
|
975
|
+
}
|
|
976
|
+
Object.freeze(items);
|
|
977
|
+
{
|
|
978
|
+
let next_rem = ((remaining === UNBOUNDED_SEQUENCE) ? UNBOUNDED_SEQUENCE : __eliscript_numeric_sub(remaining, batch));
|
|
979
|
+
return make_chunked_cons(array_chunk_owned(items, 0, batch), (((next_rem === UNBOUNDED_SEQUENCE) || __eliscript_numeric_relation(">", next_rem, 0)) ? (() => {
|
|
980
|
+
return build_repeat_cons(value, next_rem);
|
|
981
|
+
}) : null), remaining);
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
function chunkedRepeat(...arguments$) {
|
|
987
|
+
if ((((arguments$) ?? []).length === 1)) {
|
|
988
|
+
{
|
|
989
|
+
let value = (arguments$)[0];
|
|
990
|
+
return make_lazy_chunked((() => {
|
|
991
|
+
return build_repeat_cons(value, UNBOUNDED_SEQUENCE);
|
|
992
|
+
}), UNBOUNDED_SEQUENCE);
|
|
993
|
+
}
|
|
994
|
+
} else {
|
|
995
|
+
if ((((arguments$) ?? []).length === 2)) {
|
|
996
|
+
{
|
|
997
|
+
let length = require_nonnegative((arguments$)[0], "repeat count");
|
|
998
|
+
let value = (arguments$)[1];
|
|
999
|
+
if ((length === 0)) {
|
|
1000
|
+
return null;
|
|
1001
|
+
} else {
|
|
1002
|
+
return make_lazy_chunked((() => {
|
|
1003
|
+
return build_repeat_cons(value, length);
|
|
1004
|
+
}), length);
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
} else {
|
|
1008
|
+
return fail("repeat expects a value or a count and value");
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
function chunked_map_seq(transform, source) {
|
|
1013
|
+
{
|
|
1014
|
+
let unbounded = ((__eliscript_value_11) => (__eliscript_truthy(__eliscript_value_11) ? ((((__eliscript_tdz_ready_10 === true ? lazy_chunked_states : __eliscript_tdz_error("lazy_chunked_states")))["get"](source))["countHint"] === UNBOUNDED_SEQUENCE) : __eliscript_value_11))((__eliscript_tdz_ready_2 === true ? instance_of_QMARK_ : __eliscript_tdz_error("instance_of_QMARK_"))(source, (__eliscript_tdz_ready_22 === true ? LazyChunkedSeq : __eliscript_tdz_error("LazyChunkedSeq"))));
|
|
1015
|
+
return make_lazy_chunked((() => {
|
|
1016
|
+
{
|
|
1017
|
+
let resolved = normalize_chunk_head(source);
|
|
1018
|
+
if ((resolved === null)) {
|
|
1019
|
+
return null;
|
|
1020
|
+
} else {
|
|
1021
|
+
if (__eliscript_truthy(isChunkedSeq(resolved))) {
|
|
1022
|
+
{
|
|
1023
|
+
let chunk = chunked_first_of(resolved);
|
|
1024
|
+
let cnt = chunk_count_of(chunk);
|
|
1025
|
+
let buf = chunkBuffer(cnt);
|
|
1026
|
+
let cstate = chunk_state(chunk);
|
|
1027
|
+
if (!((cstate === undefined))) {
|
|
1028
|
+
{
|
|
1029
|
+
let arr = (cstate)["array"];
|
|
1030
|
+
let i = (cstate)["off"];
|
|
1031
|
+
let end = (cstate)["end"];
|
|
1032
|
+
while (__eliscript_numeric_relation("<", i, end)) {
|
|
1033
|
+
chunkAppend(buf, transform((arr)[i]));
|
|
1034
|
+
((i = (i + 1)));
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
} else {
|
|
1038
|
+
{
|
|
1039
|
+
let i = 0;
|
|
1040
|
+
while (__eliscript_numeric_relation("<", i, cnt)) {
|
|
1041
|
+
chunkAppend(buf, transform(chunk_nth_of(chunk, i)));
|
|
1042
|
+
((i = (i + 1)));
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
{
|
|
1047
|
+
let rest_seq = chunked_next_of(resolved);
|
|
1048
|
+
return make_chunked_cons(chunkFromBuffer(buf), ((rest_seq === null) ? null : (() => {
|
|
1049
|
+
return chunked_map_seq(transform, rest_seq);
|
|
1050
|
+
})), (__eliscript_truthy(unbounded) ? UNBOUNDED_SEQUENCE : (__eliscript_tdz_ready_18 === true ? UNKNOWN_COUNT : __eliscript_tdz_error("UNKNOWN_COUNT"))));
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
} else {
|
|
1054
|
+
return sequence(mapping(transform), resolved);
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
}), (__eliscript_truthy(unbounded) ? UNBOUNDED_SEQUENCE : (__eliscript_tdz_ready_18 === true ? UNKNOWN_COUNT : __eliscript_tdz_error("UNKNOWN_COUNT"))));
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
function chunked_filter_seq(predicate, source) {
|
|
1062
|
+
return make_lazy_chunked((() => {
|
|
1063
|
+
{
|
|
1064
|
+
let curr = normalize_chunk_head(source);
|
|
1065
|
+
let result = null;
|
|
1066
|
+
let done = false;
|
|
1067
|
+
while ((!((curr === null)) && !(__eliscript_truthy(done)))) {
|
|
1068
|
+
if (__eliscript_truthy(isChunkedSeq(curr))) {
|
|
1069
|
+
{
|
|
1070
|
+
let chunk = chunked_first_of(curr);
|
|
1071
|
+
let cnt = chunk_count_of(chunk);
|
|
1072
|
+
let buf = chunkBuffer(cnt);
|
|
1073
|
+
let cstate = chunk_state(chunk);
|
|
1074
|
+
if (!((cstate === undefined))) {
|
|
1075
|
+
{
|
|
1076
|
+
let arr = (cstate)["array"];
|
|
1077
|
+
let i = (cstate)["off"];
|
|
1078
|
+
let end = (cstate)["end"];
|
|
1079
|
+
while (__eliscript_numeric_relation("<", i, end)) {
|
|
1080
|
+
{
|
|
1081
|
+
let item = (arr)[i];
|
|
1082
|
+
if (__eliscript_truthy(truth(isTruthy(predicate(item))))) {
|
|
1083
|
+
chunkAppend(buf, item);
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
((i = (i + 1)));
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
} else {
|
|
1090
|
+
{
|
|
1091
|
+
let i = 0;
|
|
1092
|
+
while (__eliscript_numeric_relation("<", i, cnt)) {
|
|
1093
|
+
{
|
|
1094
|
+
let item = chunk_nth_of(chunk, i);
|
|
1095
|
+
if (__eliscript_truthy(truth(isTruthy(predicate(item))))) {
|
|
1096
|
+
chunkAppend(buf, item);
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
((i = (i + 1)));
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
{
|
|
1104
|
+
let next_curr = chunked_next_of(curr);
|
|
1105
|
+
if (__eliscript_numeric_relation(">", (buf)["count"], 0)) {
|
|
1106
|
+
((result = make_chunked_cons(chunkFromBuffer(buf), ((next_curr === null) ? null : (() => {
|
|
1107
|
+
return chunked_filter_seq(predicate, next_curr);
|
|
1108
|
+
})))), (done = true));
|
|
1109
|
+
} else {
|
|
1110
|
+
((curr = next_curr));
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
} else {
|
|
1115
|
+
((result = sequence(filtering(predicate), curr)), (done = true));
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
return result;
|
|
1119
|
+
}
|
|
1120
|
+
}));
|
|
1121
|
+
}
|
|
1122
|
+
function chunked_keep_seq(transform, source) {
|
|
1123
|
+
return make_lazy_chunked((() => {
|
|
1124
|
+
{
|
|
1125
|
+
let curr = normalize_chunk_head(source);
|
|
1126
|
+
let result = null;
|
|
1127
|
+
let done = false;
|
|
1128
|
+
while ((!((curr === null)) && !(__eliscript_truthy(done)))) {
|
|
1129
|
+
if (__eliscript_truthy(isChunkedSeq(curr))) {
|
|
1130
|
+
{
|
|
1131
|
+
let chunk = chunked_first_of(curr);
|
|
1132
|
+
let cnt = chunk_count_of(chunk);
|
|
1133
|
+
let buf = chunkBuffer(cnt);
|
|
1134
|
+
let cstate = chunk_state(chunk);
|
|
1135
|
+
if (!((cstate === undefined))) {
|
|
1136
|
+
{
|
|
1137
|
+
let arr = (cstate)["array"];
|
|
1138
|
+
let i = (cstate)["off"];
|
|
1139
|
+
let end = (cstate)["end"];
|
|
1140
|
+
while (__eliscript_numeric_relation("<", i, end)) {
|
|
1141
|
+
{
|
|
1142
|
+
let kept = transform((arr)[i]);
|
|
1143
|
+
if ((!(kept === null))) {
|
|
1144
|
+
chunkAppend(buf, kept);
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
((i = (i + 1)));
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
} else {
|
|
1151
|
+
{
|
|
1152
|
+
let i = 0;
|
|
1153
|
+
while (__eliscript_numeric_relation("<", i, cnt)) {
|
|
1154
|
+
{
|
|
1155
|
+
let kept = transform(chunk_nth_of(chunk, i));
|
|
1156
|
+
if ((!(kept === null))) {
|
|
1157
|
+
chunkAppend(buf, kept);
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
((i = (i + 1)));
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
{
|
|
1165
|
+
let next_curr = chunked_next_of(curr);
|
|
1166
|
+
if (__eliscript_numeric_relation(">", (buf)["count"], 0)) {
|
|
1167
|
+
((result = make_chunked_cons(chunkFromBuffer(buf), ((next_curr === null) ? null : (() => {
|
|
1168
|
+
return chunked_keep_seq(transform, next_curr);
|
|
1169
|
+
})))), (done = true));
|
|
1170
|
+
} else {
|
|
1171
|
+
((curr = next_curr));
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
} else {
|
|
1176
|
+
((result = sequence(keeping(transform), curr)), (done = true));
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
return result;
|
|
1180
|
+
}
|
|
1181
|
+
}));
|
|
1182
|
+
}
|
|
1183
|
+
function chunked_take_seq(limit, source) {
|
|
1184
|
+
if ((limit === 0)) {
|
|
1185
|
+
return make_lazy_chunked((() => {
|
|
1186
|
+
return null;
|
|
1187
|
+
}), 0);
|
|
1188
|
+
} else {
|
|
1189
|
+
return make_lazy_chunked((() => {
|
|
1190
|
+
{
|
|
1191
|
+
let resolved = normalize_chunk_head(source);
|
|
1192
|
+
if ((resolved === null)) {
|
|
1193
|
+
return null;
|
|
1194
|
+
} else {
|
|
1195
|
+
if (__eliscript_truthy(isChunkedSeq(resolved))) {
|
|
1196
|
+
{
|
|
1197
|
+
let chunk = chunked_first_of(resolved);
|
|
1198
|
+
let cnt = chunk_count_of(chunk);
|
|
1199
|
+
let take_cnt = Math.min(limit, cnt);
|
|
1200
|
+
let buf = chunkBuffer(take_cnt);
|
|
1201
|
+
let cstate = chunk_state(chunk);
|
|
1202
|
+
if (!((cstate === undefined))) {
|
|
1203
|
+
{
|
|
1204
|
+
let arr = (cstate)["array"];
|
|
1205
|
+
let off = (cstate)["off"];
|
|
1206
|
+
let i = 0;
|
|
1207
|
+
while (__eliscript_numeric_relation("<", i, take_cnt)) {
|
|
1208
|
+
chunkAppend(buf, (arr)[(off + i)]);
|
|
1209
|
+
((i = (i + 1)));
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
} else {
|
|
1213
|
+
{
|
|
1214
|
+
let i = 0;
|
|
1215
|
+
while (__eliscript_numeric_relation("<", i, take_cnt)) {
|
|
1216
|
+
chunkAppend(buf, chunk_nth_of(chunk, i));
|
|
1217
|
+
((i = (i + 1)));
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
{
|
|
1222
|
+
let rem = __eliscript_numeric_sub(limit, take_cnt);
|
|
1223
|
+
let next_src = chunked_next_of(resolved);
|
|
1224
|
+
return make_chunked_cons(chunkFromBuffer(buf), (((rem === 0) || (next_src === null)) ? null : (() => {
|
|
1225
|
+
return chunked_take_seq(rem, next_src);
|
|
1226
|
+
})));
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
} else {
|
|
1230
|
+
return sequence(taking(limit), resolved);
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
}));
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
function chunked_drop_seq(limit, source) {
|
|
1238
|
+
if ((limit === 0)) {
|
|
1239
|
+
return source;
|
|
1240
|
+
} else {
|
|
1241
|
+
{
|
|
1242
|
+
let unbounded = ((__eliscript_value_12) => (__eliscript_truthy(__eliscript_value_12) ? ((((__eliscript_tdz_ready_10 === true ? lazy_chunked_states : __eliscript_tdz_error("lazy_chunked_states")))["get"](source))["countHint"] === UNBOUNDED_SEQUENCE) : __eliscript_value_12))((__eliscript_tdz_ready_2 === true ? instance_of_QMARK_ : __eliscript_tdz_error("instance_of_QMARK_"))(source, (__eliscript_tdz_ready_22 === true ? LazyChunkedSeq : __eliscript_tdz_error("LazyChunkedSeq"))));
|
|
1243
|
+
return make_lazy_chunked((() => {
|
|
1244
|
+
{
|
|
1245
|
+
let rem = limit;
|
|
1246
|
+
let curr = normalize_chunk_head(source);
|
|
1247
|
+
let result = null;
|
|
1248
|
+
let done = false;
|
|
1249
|
+
while ((__eliscript_numeric_relation(">", rem, 0) && !((curr === null)) && !(__eliscript_truthy(done)))) {
|
|
1250
|
+
if (__eliscript_truthy(isChunkedSeq(curr))) {
|
|
1251
|
+
{
|
|
1252
|
+
let chunk = chunked_first_of(curr);
|
|
1253
|
+
let cnt = chunk_count_of(chunk);
|
|
1254
|
+
if (__eliscript_numeric_relation("<=", cnt, rem)) {
|
|
1255
|
+
((rem = __eliscript_numeric_sub(rem, cnt)), (curr = chunked_next_of(curr)));
|
|
1256
|
+
} else {
|
|
1257
|
+
{
|
|
1258
|
+
let trimmed = chunk;
|
|
1259
|
+
while (__eliscript_numeric_relation(">", rem, 0)) {
|
|
1260
|
+
((trimmed = chunk_drop_first_of(trimmed)), (rem = __eliscript_numeric_decrement(rem)));
|
|
1261
|
+
}
|
|
1262
|
+
((result = make_chunked_cons(trimmed, chunked_next_of(curr), (__eliscript_truthy(unbounded) ? UNBOUNDED_SEQUENCE : (__eliscript_tdz_ready_18 === true ? UNKNOWN_COUNT : __eliscript_tdz_error("UNKNOWN_COUNT"))))), (done = true));
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
} else {
|
|
1267
|
+
((result = sequence(dropping(rem), curr)), (done = true));
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
if (__eliscript_truthy(done)) {
|
|
1271
|
+
return result;
|
|
1272
|
+
} else {
|
|
1273
|
+
return curr;
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
}), (__eliscript_truthy(unbounded) ? UNBOUNDED_SEQUENCE : (__eliscript_tdz_ready_18 === true ? UNKNOWN_COUNT : __eliscript_tdz_error("UNKNOWN_COUNT"))));
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
registerChunkedSliceHandler(((source, offset) => {
|
|
1281
|
+
return chunked_drop_seq(offset, source);
|
|
1282
|
+
}));
|
|
1283
|
+
registerChunkedPrependHandler(((value, source) => {
|
|
1284
|
+
{
|
|
1285
|
+
let items = Object.freeze([value]);
|
|
1286
|
+
let single = array_chunk_owned(items, 0, 1);
|
|
1287
|
+
let unbounded = ((__eliscript_value_13) => (__eliscript_truthy(__eliscript_value_13) ? (((lazy_chunked_states)["get"](source))["countHint"] === UNBOUNDED_SEQUENCE) : __eliscript_value_13))(instance_of_QMARK_(source, LazyChunkedSeq));
|
|
1288
|
+
return make_chunked_cons(single, source, (__eliscript_truthy(unbounded) ? UNBOUNDED_SEQUENCE : UNKNOWN_COUNT));
|
|
1289
|
+
}
|
|
1290
|
+
}));
|
|
140
1291
|
function lazySequence(...arguments$) {
|
|
141
1292
|
if ((!(((arguments$) ?? []).length === 1))) {
|
|
142
1293
|
fail("lazySequence requires exactly one thunk");
|
|
@@ -158,18 +1309,29 @@ function lazyCons(...arguments$) {
|
|
|
158
1309
|
let tail_thunk = (arguments$)[1];
|
|
159
1310
|
require_thunk(tail_thunk, "lazyCons tail thunk");
|
|
160
1311
|
{
|
|
161
|
-
let state = ({"value": value, "tailThunk": tail_thunk, "tailStarted": false, "tail": null, "failure": (
|
|
1312
|
+
let state = ({"value": value, "tailThunk": tail_thunk, "tailStarted": false, "tail": null, "failure": (__eliscript_tdz_ready_11 === true ? no_failure : __eliscript_tdz_error("no_failure"))});
|
|
162
1313
|
let result = memoizedSequenceView((() => {
|
|
163
1314
|
return cons_iterator(state);
|
|
164
1315
|
}));
|
|
165
|
-
((
|
|
1316
|
+
((__eliscript_tdz_ready_6 === true ? lazy_cons_states : __eliscript_tdz_error("lazy_cons_states")))["set"](result, state);
|
|
166
1317
|
return result;
|
|
167
1318
|
}
|
|
168
1319
|
}
|
|
169
1320
|
}
|
|
170
1321
|
function lazyMap(...arguments$) {
|
|
171
1322
|
require_arity(((arguments$) ?? []).length, 2, "lazyMap");
|
|
172
|
-
|
|
1323
|
+
{
|
|
1324
|
+
let transform = (arguments$)[0];
|
|
1325
|
+
let collection = (arguments$)[1];
|
|
1326
|
+
if (__eliscript_truthy(isChunkedSeq(collection))) {
|
|
1327
|
+
if ((!__eliscript_truthy(callable_QMARK_(transform)))) {
|
|
1328
|
+
mapping(transform);
|
|
1329
|
+
}
|
|
1330
|
+
return chunked_map_seq(transform, collection);
|
|
1331
|
+
} else {
|
|
1332
|
+
return sequence(mapping(transform), collection);
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
173
1335
|
}
|
|
174
1336
|
function lazyMapIndexed(...arguments$) {
|
|
175
1337
|
require_arity(((arguments$) ?? []).length, 2, "lazyMapIndexed");
|
|
@@ -177,7 +1339,18 @@ function lazyMapIndexed(...arguments$) {
|
|
|
177
1339
|
}
|
|
178
1340
|
function lazyKeep(...arguments$) {
|
|
179
1341
|
require_arity(((arguments$) ?? []).length, 2, "lazyKeep");
|
|
180
|
-
|
|
1342
|
+
{
|
|
1343
|
+
let transform = (arguments$)[0];
|
|
1344
|
+
let collection = (arguments$)[1];
|
|
1345
|
+
if (__eliscript_truthy(isChunkedSeq(collection))) {
|
|
1346
|
+
if ((!__eliscript_truthy(callable_QMARK_(transform)))) {
|
|
1347
|
+
keeping(transform);
|
|
1348
|
+
}
|
|
1349
|
+
return chunked_keep_seq(transform, collection);
|
|
1350
|
+
} else {
|
|
1351
|
+
return sequence(keeping(transform), collection);
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
181
1354
|
}
|
|
182
1355
|
function lazyKeepIndexed(...arguments$) {
|
|
183
1356
|
require_arity(((arguments$) ?? []).length, 2, "lazyKeepIndexed");
|
|
@@ -185,7 +1358,18 @@ function lazyKeepIndexed(...arguments$) {
|
|
|
185
1358
|
}
|
|
186
1359
|
function lazyFilter(...arguments$) {
|
|
187
1360
|
require_arity(((arguments$) ?? []).length, 2, "lazyFilter");
|
|
188
|
-
|
|
1361
|
+
{
|
|
1362
|
+
let predicate = (arguments$)[0];
|
|
1363
|
+
let collection = (arguments$)[1];
|
|
1364
|
+
if (__eliscript_truthy(isChunkedSeq(collection))) {
|
|
1365
|
+
if ((!__eliscript_truthy(callable_QMARK_(predicate)))) {
|
|
1366
|
+
filtering(predicate);
|
|
1367
|
+
}
|
|
1368
|
+
return chunked_filter_seq(predicate, collection);
|
|
1369
|
+
} else {
|
|
1370
|
+
return sequence(filtering(predicate), collection);
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
189
1373
|
}
|
|
190
1374
|
function lazyRemove(...arguments$) {
|
|
191
1375
|
require_arity(((arguments$) ?? []).length, 2, "lazyRemove");
|
|
@@ -193,11 +1377,33 @@ function lazyRemove(...arguments$) {
|
|
|
193
1377
|
}
|
|
194
1378
|
function lazyTake(...arguments$) {
|
|
195
1379
|
require_arity(((arguments$) ?? []).length, 2, "lazyTake");
|
|
196
|
-
|
|
1380
|
+
{
|
|
1381
|
+
let limit = (arguments$)[0];
|
|
1382
|
+
let collection = (arguments$)[1];
|
|
1383
|
+
if (__eliscript_truthy(isChunkedSeq(collection))) {
|
|
1384
|
+
if ((!(__eliscript_truthy(Number.isSafeInteger(limit)) && __eliscript_numeric_relation(">=", limit, 0)))) {
|
|
1385
|
+
taking(limit);
|
|
1386
|
+
}
|
|
1387
|
+
return chunked_take_seq(limit, collection);
|
|
1388
|
+
} else {
|
|
1389
|
+
return sequence(taking(limit), collection);
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
197
1392
|
}
|
|
198
1393
|
function lazyDrop(...arguments$) {
|
|
199
1394
|
require_arity(((arguments$) ?? []).length, 2, "lazyDrop");
|
|
200
|
-
|
|
1395
|
+
{
|
|
1396
|
+
let limit = (arguments$)[0];
|
|
1397
|
+
let collection = (arguments$)[1];
|
|
1398
|
+
if (__eliscript_truthy(isChunkedSeq(collection))) {
|
|
1399
|
+
if ((!(__eliscript_truthy(Number.isSafeInteger(limit)) && __eliscript_numeric_relation(">=", limit, 0)))) {
|
|
1400
|
+
dropping(limit);
|
|
1401
|
+
}
|
|
1402
|
+
return chunked_drop_seq(limit, collection);
|
|
1403
|
+
} else {
|
|
1404
|
+
return sequence(dropping(limit), collection);
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
201
1407
|
}
|
|
202
1408
|
function lazyTakeWhile(...arguments$) {
|
|
203
1409
|
require_arity(((arguments$) ?? []).length, 2, "lazyTakeWhile");
|
|
@@ -236,13 +1442,34 @@ function lazyPartitionBy(...arguments$) {
|
|
|
236
1442
|
return sequence(partitioningBy((arguments$)[0]), (arguments$)[1]);
|
|
237
1443
|
}
|
|
238
1444
|
function isLazySequence(value) {
|
|
239
|
-
return (
|
|
1445
|
+
return ((__eliscript_value_14) => (__eliscript_truthy(__eliscript_value_14) ? __eliscript_value_14 : ((__eliscript_value_15) => (__eliscript_truthy(__eliscript_value_15) ? __eliscript_value_15 : (__eliscript_tdz_ready_2 === true ? instance_of_QMARK_ : __eliscript_tdz_error("instance_of_QMARK_"))(value, (__eliscript_tdz_ready_21 === true ? ChunkedCons : __eliscript_tdz_error("ChunkedCons")))))((__eliscript_tdz_ready_2 === true ? instance_of_QMARK_ : __eliscript_tdz_error("instance_of_QMARK_"))(value, (__eliscript_tdz_ready_22 === true ? LazyChunkedSeq : __eliscript_tdz_error("LazyChunkedSeq"))))))((__eliscript_tdz_ready_2 === true ? instance_of_QMARK_ : __eliscript_tdz_error("instance_of_QMARK_"))(value, MemoizedSequenceView));
|
|
240
1446
|
}
|
|
241
1447
|
function status(value) {
|
|
242
|
-
if (
|
|
243
|
-
|
|
1448
|
+
if (__eliscript_truthy((__eliscript_tdz_ready_2 === true ? instance_of_QMARK_ : __eliscript_tdz_error("instance_of_QMARK_"))(value, MemoizedSequenceView))) {
|
|
1449
|
+
return memoizedSequenceStatus(value);
|
|
1450
|
+
} else {
|
|
1451
|
+
if (__eliscript_truthy((__eliscript_tdz_ready_2 === true ? instance_of_QMARK_ : __eliscript_tdz_error("instance_of_QMARK_"))(value, (__eliscript_tdz_ready_22 === true ? LazyChunkedSeq : __eliscript_tdz_error("LazyChunkedSeq"))))) {
|
|
1452
|
+
{
|
|
1453
|
+
let state = ((__eliscript_tdz_ready_10 === true ? lazy_chunked_states : __eliscript_tdz_error("lazy_chunked_states")))["get"](value);
|
|
1454
|
+
return Object.freeze(({"started": (state)["started"], "complete": ((__eliscript_value_16) => (__eliscript_truthy(__eliscript_value_16) ? ((state)["value"] === null) : __eliscript_value_16))((state)["started"]), "failed": (!((state)["failure"] === (__eliscript_tdz_ready_11 === true ? no_failure : __eliscript_tdz_error("no_failure")))), "realizedCount": ((__eliscript_truthy((state)["started"]) && !(((state)["value"] === null))) ? ((chunk) => {
|
|
1455
|
+
if ((chunk === null)) {
|
|
1456
|
+
return 0;
|
|
1457
|
+
} else {
|
|
1458
|
+
return chunk_count_of(chunk);
|
|
1459
|
+
}
|
|
1460
|
+
})(chunked_first_of((state)["value"])) : 0)}));
|
|
1461
|
+
}
|
|
1462
|
+
} else {
|
|
1463
|
+
if (__eliscript_truthy((__eliscript_tdz_ready_2 === true ? instance_of_QMARK_ : __eliscript_tdz_error("instance_of_QMARK_"))(value, (__eliscript_tdz_ready_21 === true ? ChunkedCons : __eliscript_tdz_error("ChunkedCons"))))) {
|
|
1464
|
+
{
|
|
1465
|
+
let state = ((__eliscript_tdz_ready_9 === true ? chunked_cons_states : __eliscript_tdz_error("chunked_cons_states")))["get"](value);
|
|
1466
|
+
return Object.freeze(({"started": true, "complete": ((__eliscript_value_17) => (__eliscript_truthy(__eliscript_value_17) ? ((state)["cachedMore"] === null) : __eliscript_value_17))((state)["moreRealized"]), "failed": (!((state)["failure"] === (__eliscript_tdz_ready_11 === true ? no_failure : __eliscript_tdz_error("no_failure")))), "realizedCount": chunk_count_of((state)["chunk"])}));
|
|
1467
|
+
}
|
|
1468
|
+
} else {
|
|
1469
|
+
return fail("operation requires a lazy sequence");
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
244
1472
|
}
|
|
245
|
-
return memoizedSequenceStatus(value);
|
|
246
1473
|
}
|
|
247
1474
|
function isLazySequenceRealized(value) {
|
|
248
1475
|
return (status(value))["started"];
|
|
@@ -253,7 +1480,7 @@ function realizedLazySequenceCount(value) {
|
|
|
253
1480
|
function realizeLazySequence(value) {
|
|
254
1481
|
status(value);
|
|
255
1482
|
{
|
|
256
|
-
let iterator = __eliscript_at((value)[(
|
|
1483
|
+
let iterator = __eliscript_at((value)[(__eliscript_tdz_ready_5 === true ? iterator_symbol : __eliscript_tdz_error("iterator_symbol"))], "call")(value);
|
|
257
1484
|
let done = false;
|
|
258
1485
|
while (!(__eliscript_truthy(done))) {
|
|
259
1486
|
{
|
|
@@ -285,5 +1512,5 @@ Object.defineProperty(lazyDistinct, "length", ({"value": 1, "configurable": true
|
|
|
285
1512
|
Object.defineProperty(lazyMapcat, "length", ({"value": 2, "configurable": true}));
|
|
286
1513
|
Object.defineProperty(lazyPartitionAll, "length", ({"value": 2, "configurable": true}));
|
|
287
1514
|
Object.defineProperty(lazyPartitionBy, "length", ({"value": 2, "configurable": true}));
|
|
288
|
-
export {lazySequence, lazyCons, lazyMap, lazyMapIndexed, lazyKeep, lazyKeepIndexed, lazyFilter, lazyRemove, lazyTake, lazyDrop, lazyTakeWhile, lazyDropWhile, lazyTakeNth, lazyInterpose, lazyDedupe, lazyDistinct, lazyMapcat, lazyPartitionAll, lazyPartitionBy, isLazySequence, isLazySequenceRealized, realizedLazySequenceCount, realizeLazySequence};
|
|
1515
|
+
export {CHUNK_SIZE, ArrayChunk, ChunkBuffer, ChunkedCons, LazyChunkedSeq, arrayChunk, chunkBuffer, chunkAppend, chunkFromBuffer, chunkedCons, chunkedRange, chunkedRepeat, lazySequence, lazyCons, lazyMap, lazyMapIndexed, lazyKeep, lazyKeepIndexed, lazyFilter, lazyRemove, lazyTake, lazyDrop, lazyTakeWhile, lazyDropWhile, lazyTakeNth, lazyInterpose, lazyDedupe, lazyDistinct, lazyMapcat, lazyPartitionAll, lazyPartitionBy, isLazySequence, isLazySequenceRealized, realizedLazySequenceCount, realizeLazySequence};
|
|
289
1516
|
//# sourceMappingURL=lazy-sequence.mjs.map
|