@fncts/base 0.0.20 → 0.0.21
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/_cjs/collection/Iterable/api/traverseConc.cjs +8 -8
- package/_cjs/collection/Iterable/api/traverseConc.cjs.map +1 -1
- package/_cjs/collection/Iterable/api.cjs +497 -444
- package/_cjs/collection/Iterable/api.cjs.map +1 -1
- package/_cjs/collection/Iterable/constructors.cjs +7 -7
- package/_cjs/collection/Iterable/constructors.cjs.map +1 -1
- package/_cjs/collection/compat/Array/api.cjs +16 -12
- package/_cjs/collection/compat/Array/api.cjs.map +1 -1
- package/_cjs/collection/compat/Array/derivations.cjs +41 -19
- package/_cjs/collection/compat/Array/derivations.cjs.map +1 -1
- package/_cjs/collection/compat/ArrayLike/api.cjs +1 -1
- package/_cjs/collection/compat/ArrayLike/api.cjs.map +1 -1
- package/_cjs/collection/compat/Record/instances.cjs +39 -3
- package/_cjs/collection/compat/Record/instances.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/api/makeBy.cjs +1 -1
- package/_cjs/collection/immutable/Conc/api/makeBy.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/api.cjs +866 -765
- package/_cjs/collection/immutable/Conc/api.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/definition.cjs +55 -53
- package/_cjs/collection/immutable/Conc/definition.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc/derivations.cjs +13 -2
- package/_cjs/collection/immutable/Conc/derivations.cjs.map +1 -1
- package/_cjs/collection/immutable/Conc.cjs.map +1 -1
- package/_cjs/collection/immutable/Dictionary/api.cjs +57 -44
- package/_cjs/collection/immutable/Dictionary/api.cjs.map +1 -1
- package/_cjs/collection/immutable/HashMap/api.cjs +351 -258
- package/_cjs/collection/immutable/HashMap/api.cjs.map +1 -1
- package/_cjs/collection/immutable/HashMap/definition.cjs +1 -1
- package/_cjs/collection/immutable/HashMap/definition.cjs.map +1 -1
- package/_cjs/collection/immutable/HashMap/internal.cjs.map +1 -1
- package/_cjs/collection/immutable/HashSet/api.cjs +230 -192
- package/_cjs/collection/immutable/HashSet/api.cjs.map +1 -1
- package/_cjs/collection/immutable/HashSet/definition.cjs +1 -1
- package/_cjs/collection/immutable/HashSet/definition.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableArray/api/chunksOf.cjs +6 -4
- package/_cjs/collection/immutable/ImmutableArray/api/chunksOf.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableArray/api/slice.cjs +6 -4
- package/_cjs/collection/immutable/ImmutableArray/api/slice.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableArray/api/splitAt.cjs +6 -4
- package/_cjs/collection/immutable/ImmutableArray/api/splitAt.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableArray/api/splitWhere.cjs +15 -13
- package/_cjs/collection/immutable/ImmutableArray/api/splitWhere.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableArray/api.cjs +943 -749
- package/_cjs/collection/immutable/ImmutableArray/api.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableArray/derivations.cjs +12 -1
- package/_cjs/collection/immutable/ImmutableArray/derivations.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableArray/instances.cjs +33 -33
- package/_cjs/collection/immutable/ImmutableArray/instances.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableArray.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableNonEmptyArray/api.cjs +338 -273
- package/_cjs/collection/immutable/ImmutableNonEmptyArray/api.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableNonEmptyArray/constructors.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableNonEmptyArray/definition.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableNonEmptyArray/derivations.cjs +15 -4
- package/_cjs/collection/immutable/ImmutableNonEmptyArray/derivations.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableNonEmptyArray/destructors.cjs +2 -2
- package/_cjs/collection/immutable/ImmutableNonEmptyArray/destructors.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableNonEmptyArray/instances.cjs +12 -12
- package/_cjs/collection/immutable/ImmutableNonEmptyArray/instances.cjs.map +1 -1
- package/_cjs/collection/immutable/List/api/foldLeft.cjs +12 -10
- package/_cjs/collection/immutable/List/api/foldLeft.cjs.map +1 -1
- package/_cjs/collection/immutable/List/api.cjs +164 -141
- package/_cjs/collection/immutable/List/api.cjs.map +1 -1
- package/_cjs/collection/immutable/List.cjs.map +1 -1
- package/_cjs/collection/immutable/Queue/api.cjs +64 -48
- package/_cjs/collection/immutable/Queue/api.cjs.map +1 -1
- package/_cjs/collection/immutable/Queue/definition.cjs +1 -1
- package/_cjs/collection/immutable/Queue/definition.cjs.map +1 -1
- package/_cjs/collection/immutable/RoseTree/api.cjs +50 -36
- package/_cjs/collection/immutable/RoseTree/api.cjs.map +1 -1
- package/_cjs/collection/immutable/RoseTree/definition.cjs.map +1 -1
- package/_cjs/collection/immutable/SortedMap/api.cjs +408 -368
- package/_cjs/collection/immutable/SortedMap/api.cjs.map +1 -1
- package/_cjs/collection/immutable/Vector/api.cjs +723 -608
- package/_cjs/collection/immutable/Vector/api.cjs.map +1 -1
- package/_cjs/collection/immutable/Vector/definition.cjs +18 -16
- package/_cjs/collection/immutable/Vector/definition.cjs.map +1 -1
- package/_cjs/collection/immutable/Vector/internal.cjs +40 -39
- package/_cjs/collection/immutable/Vector/internal.cjs.map +1 -1
- package/_cjs/collection/mutable/HashMap.cjs +3 -5
- package/_cjs/collection/mutable/HashMap.cjs.map +1 -1
- package/_cjs/collection/mutable/HashSet.cjs.map +1 -1
- package/_cjs/collection/mutable/ListBuffer.cjs +2 -2
- package/_cjs/collection/mutable/ListBuffer.cjs.map +1 -1
- package/_cjs/collection/mutable/internal.cjs +0 -2
- package/_cjs/collection/mutable/internal.cjs.map +1 -1
- package/_cjs/collection/weak/IterableWeakMap.cjs +7 -7
- package/_cjs/collection/weak/IterableWeakMap.cjs.map +1 -1
- package/_cjs/collection/weak/IterableWeakSet.cjs +7 -7
- package/_cjs/collection/weak/IterableWeakSet.cjs.map +1 -1
- package/_cjs/control/Eval/api.cjs +55 -43
- package/_cjs/control/Eval/api.cjs.map +1 -1
- package/_cjs/control/Eval/instance.cjs +4 -4
- package/_cjs/control/Eval/instance.cjs.map +1 -1
- package/_cjs/control/Eval/run.cjs +1 -1
- package/_cjs/control/Eval/run.cjs.map +1 -1
- package/_cjs/control/Z/api.cjs +241 -172
- package/_cjs/control/Z/api.cjs.map +1 -1
- package/_cjs/control/Z/instances.cjs +3 -3
- package/_cjs/control/Z/instances.cjs.map +1 -1
- package/_cjs/control/Z/runtime.cjs +250 -241
- package/_cjs/control/Z/runtime.cjs.map +1 -1
- package/_cjs/data/Branded/definition.cjs.map +1 -1
- package/_cjs/data/Branded/derivations.cjs +3 -3
- package/_cjs/data/Branded/derivations.cjs.map +1 -1
- package/_cjs/data/CaseClass.cjs.map +1 -1
- package/_cjs/data/Cause/api/fold.cjs +20 -18
- package/_cjs/data/Cause/api/fold.cjs.map +1 -1
- package/_cjs/data/Cause/api/isEmpty.cjs +1 -1
- package/_cjs/data/Cause/api/isEmpty.cjs.map +1 -1
- package/_cjs/data/Cause/api/linearize.cjs +8 -8
- package/_cjs/data/Cause/api/linearize.cjs.map +1 -1
- package/_cjs/data/Cause/api/prettyPrint.cjs +1 -1
- package/_cjs/data/Cause/api/prettyPrint.cjs.map +1 -1
- package/_cjs/data/Cause/api.cjs +160 -140
- package/_cjs/data/Cause/api.cjs.map +1 -1
- package/_cjs/data/Cause/definition.cjs +18 -18
- package/_cjs/data/Cause/definition.cjs.map +1 -1
- package/_cjs/data/Cause.cjs.map +1 -1
- package/_cjs/data/Const/api.cjs +8 -6
- package/_cjs/data/Const/api.cjs.map +1 -1
- package/_cjs/data/Const/instances.cjs +4 -4
- package/_cjs/data/Const/instances.cjs.map +1 -1
- package/_cjs/data/Datum/api.cjs +219 -176
- package/_cjs/data/Datum/api.cjs.map +1 -1
- package/_cjs/data/Datum/definition.cjs.map +1 -1
- package/_cjs/data/DatumEither/api.cjs +165 -133
- package/_cjs/data/DatumEither/api.cjs.map +1 -1
- package/_cjs/data/DecodeError/definition.cjs +14 -14
- package/_cjs/data/DecodeError/definition.cjs.map +1 -1
- package/_cjs/data/Decoder/api.cjs +9 -7
- package/_cjs/data/Decoder/api.cjs.map +1 -1
- package/_cjs/data/Duration/api.cjs +18 -12
- package/_cjs/data/Duration/api.cjs.map +1 -1
- package/_cjs/data/Either/api/align.cjs +8 -3
- package/_cjs/data/Either/api/align.cjs.map +1 -1
- package/_cjs/data/Either/api/alignWith.cjs +14 -12
- package/_cjs/data/Either/api/alignWith.cjs.map +1 -1
- package/_cjs/data/Either/api.cjs +206 -169
- package/_cjs/data/Either/api.cjs.map +1 -1
- package/_cjs/data/Either/constructors.cjs +11 -9
- package/_cjs/data/Either/constructors.cjs.map +1 -1
- package/_cjs/data/Either/destructors.cjs +16 -14
- package/_cjs/data/Either/destructors.cjs.map +1 -1
- package/_cjs/data/Either/instances.cjs +8 -8
- package/_cjs/data/Either/instances.cjs.map +1 -1
- package/_cjs/data/EitherT/api.cjs +8 -8
- package/_cjs/data/EitherT/api.cjs.map +1 -1
- package/_cjs/data/Encoder/api.cjs +134 -0
- package/_cjs/data/Encoder/api.cjs.map +1 -0
- package/_cjs/data/Encoder/definition.cjs +25 -0
- package/_cjs/data/Encoder/definition.cjs.map +1 -0
- package/_cjs/data/Encoder.cjs +32 -0
- package/_cjs/data/Encoder.cjs.map +1 -0
- package/_cjs/data/Environment/api.cjs +45 -33
- package/_cjs/data/Environment/api.cjs.map +1 -1
- package/_cjs/data/EnvironmentPatch.cjs +17 -13
- package/_cjs/data/EnvironmentPatch.cjs.map +1 -1
- package/_cjs/data/ExecutionStrategy.cjs +21 -29
- package/_cjs/data/ExecutionStrategy.cjs.map +1 -1
- package/_cjs/data/Exit/api.cjs +159 -127
- package/_cjs/data/Exit/api.cjs.map +1 -1
- package/_cjs/data/Exit/constructors.cjs +4 -4
- package/_cjs/data/Exit/constructors.cjs.map +1 -1
- package/_cjs/data/FiberId/api.cjs +23 -21
- package/_cjs/data/FiberId/api.cjs.map +1 -1
- package/_cjs/data/FiberId/constructors.cjs.map +1 -1
- package/_cjs/data/Identity/api.cjs +26 -18
- package/_cjs/data/Identity/api.cjs.map +1 -1
- package/_cjs/data/Identity/instances.cjs +3 -3
- package/_cjs/data/Identity/instances.cjs.map +1 -1
- package/_cjs/data/Interval.cjs +43 -33
- package/_cjs/data/Interval.cjs.map +1 -1
- package/_cjs/data/Intervals.cjs +35 -27
- package/_cjs/data/Intervals.cjs.map +1 -1
- package/_cjs/data/Maybe/api.cjs +160 -125
- package/_cjs/data/Maybe/api.cjs.map +1 -1
- package/_cjs/data/Maybe/constructors.cjs +2 -2
- package/_cjs/data/Maybe/constructors.cjs.map +1 -1
- package/_cjs/data/Maybe/definition.cjs.map +1 -1
- package/_cjs/data/Maybe/destructors.cjs +9 -7
- package/_cjs/data/Maybe/destructors.cjs.map +1 -1
- package/_cjs/data/Maybe/instances.cjs +11 -11
- package/_cjs/data/Maybe/instances.cjs.map +1 -1
- package/_cjs/data/Predicate/api.cjs +10 -8
- package/_cjs/data/Predicate/api.cjs.map +1 -1
- package/_cjs/data/Refinement/api.cjs +15 -9
- package/_cjs/data/Refinement/api.cjs.map +1 -1
- package/_cjs/data/Struct/api.cjs +62 -50
- package/_cjs/data/Struct/api.cjs.map +1 -1
- package/_cjs/data/Tag/constructors.cjs +3 -2
- package/_cjs/data/Tag/constructors.cjs.map +1 -1
- package/_cjs/data/Tag/definition.cjs +0 -3
- package/_cjs/data/Tag/definition.cjs.map +1 -1
- package/_cjs/data/These/api.cjs +188 -170
- package/_cjs/data/These/api.cjs.map +1 -1
- package/_cjs/data/These/constructors.cjs +1 -1
- package/_cjs/data/These/constructors.cjs.map +1 -1
- package/_cjs/data/These/destructors.cjs +39 -35
- package/_cjs/data/These/destructors.cjs.map +1 -1
- package/_cjs/data/These/instances.cjs +1 -1
- package/_cjs/data/These/instances.cjs.map +1 -1
- package/_cjs/data/Trace/api.cjs +7 -5
- package/_cjs/data/Trace/api.cjs.map +1 -1
- package/_cjs/data/Zipped.cjs.map +1 -1
- package/_cjs/data/function/api.cjs +6 -4
- package/_cjs/data/function/api.cjs.map +1 -1
- package/_cjs/data/function/pipe.cjs +9 -0
- package/_cjs/data/function/pipe.cjs.map +1 -1
- package/_cjs/data/string/api.cjs +53 -96
- package/_cjs/data/string/api.cjs.map +1 -1
- package/_cjs/global/api.cjs +4 -2
- package/_cjs/global/api.cjs.map +1 -1
- package/_cjs/internal/AtomicBoolean.cjs.map +1 -1
- package/_cjs/internal/AtomicNumber.cjs.map +1 -1
- package/_cjs/internal/AtomicReference.cjs.map +1 -1
- package/_cjs/internal/Stack.cjs +2 -2
- package/_cjs/internal/Stack.cjs.map +1 -1
- package/_cjs/optics/At/api.cjs +1 -1
- package/_cjs/optics/At/api.cjs.map +1 -1
- package/_cjs/optics/At/definition.cjs +2 -2
- package/_cjs/optics/At/definition.cjs.map +1 -1
- package/_cjs/optics/Fold/definition.cjs +3 -4
- package/_cjs/optics/Fold/definition.cjs.map +1 -1
- package/_cjs/optics/Getter/definition.cjs +2 -3
- package/_cjs/optics/Getter/definition.cjs.map +1 -1
- package/_cjs/optics/Index/api.cjs +4 -4
- package/_cjs/optics/Index/api.cjs.map +1 -1
- package/_cjs/optics/Index/definition.cjs +2 -2
- package/_cjs/optics/Index/definition.cjs.map +1 -1
- package/_cjs/optics/Iso/api.cjs +9 -7
- package/_cjs/optics/Iso/api.cjs.map +1 -1
- package/_cjs/optics/Iso/definition.cjs +12 -12
- package/_cjs/optics/Iso/definition.cjs.map +1 -1
- package/_cjs/optics/Lens/api.cjs +54 -44
- package/_cjs/optics/Lens/api.cjs.map +1 -1
- package/_cjs/optics/Lens/definition.cjs +10 -10
- package/_cjs/optics/Lens/definition.cjs.map +1 -1
- package/_cjs/optics/Optional/api/compose.cjs +9 -7
- package/_cjs/optics/Optional/api/compose.cjs.map +1 -1
- package/_cjs/optics/Optional/definition.cjs +12 -13
- package/_cjs/optics/Optional/definition.cjs.map +1 -1
- package/_cjs/optics/Optional.cjs.map +1 -1
- package/_cjs/optics/Prism/api/compose.cjs +9 -7
- package/_cjs/optics/Prism/api/compose.cjs.map +1 -1
- package/_cjs/optics/Prism/api/fromNullable.cjs +2 -2
- package/_cjs/optics/Prism/api/fromNullable.cjs.map +1 -1
- package/_cjs/optics/Prism/api/just.cjs +2 -2
- package/_cjs/optics/Prism/api/just.cjs.map +1 -1
- package/_cjs/optics/Prism/definition.cjs +9 -9
- package/_cjs/optics/Prism/definition.cjs.map +1 -1
- package/_cjs/optics/Prism.cjs.map +1 -1
- package/_cjs/optics/Setter/definition.cjs +8 -13
- package/_cjs/optics/Setter/definition.cjs.map +1 -1
- package/_cjs/optics/Traversal/api/compose.cjs +8 -6
- package/_cjs/optics/Traversal/api/compose.cjs.map +1 -1
- package/_cjs/optics/Traversal/api/fromTraversable.cjs +2 -2
- package/_cjs/optics/Traversal/api/fromTraversable.cjs.map +1 -1
- package/_cjs/optics/Traversal/definition.cjs +12 -12
- package/_cjs/optics/Traversal/definition.cjs.map +1 -1
- package/_cjs/optics/Traversal.cjs.map +1 -1
- package/_cjs/typeclass/Align.cjs.map +1 -1
- package/_cjs/typeclass/Alt.cjs.map +1 -1
- package/_cjs/typeclass/Applicative.cjs.map +1 -1
- package/_cjs/typeclass/ApplicativeExcept.cjs +5 -10
- package/_cjs/typeclass/ApplicativeExcept.cjs.map +1 -1
- package/_cjs/typeclass/Apply.cjs +8 -8
- package/_cjs/typeclass/Apply.cjs.map +1 -1
- package/_cjs/typeclass/Chain.cjs +4 -4
- package/_cjs/typeclass/Chain.cjs.map +1 -1
- package/_cjs/typeclass/Eq/definition.cjs.map +1 -1
- package/_cjs/typeclass/Eq/derivations.cjs.map +1 -1
- package/_cjs/typeclass/Equatable/api.cjs.map +1 -1
- package/_cjs/typeclass/Equatable/definition.cjs.map +1 -1
- package/_cjs/typeclass/Equatable/fast-equals.cjs.map +1 -1
- package/_cjs/typeclass/Filterable.cjs.map +1 -1
- package/_cjs/typeclass/FilterableWithIndex.cjs.map +1 -1
- package/_cjs/typeclass/Foldable.cjs +1 -1
- package/_cjs/typeclass/Foldable.cjs.map +1 -1
- package/_cjs/typeclass/FoldableWithIndex.cjs +1 -1
- package/_cjs/typeclass/FoldableWithIndex.cjs.map +1 -1
- package/_cjs/typeclass/Functor.cjs.map +1 -1
- package/_cjs/typeclass/FunctorWithIndex.cjs.map +1 -1
- package/_cjs/typeclass/Guard/api.cjs +18 -10
- package/_cjs/typeclass/Guard/api.cjs.map +1 -1
- package/_cjs/typeclass/Guard/definition.cjs.map +1 -1
- package/_cjs/typeclass/Guard/derivations.cjs.map +1 -1
- package/_cjs/typeclass/Has.cjs +7 -5
- package/_cjs/typeclass/Has.cjs.map +1 -1
- package/_cjs/typeclass/HashEq.cjs.map +1 -1
- package/_cjs/typeclass/Hashable/definition.cjs.map +1 -1
- package/_cjs/typeclass/Hashable/hash.cjs.map +1 -1
- package/_cjs/typeclass/MonadExcept.cjs +1 -1
- package/_cjs/typeclass/MonadExcept.cjs.map +1 -1
- package/_cjs/typeclass/Ord/api/contramap.cjs +7 -5
- package/_cjs/typeclass/Ord/api/contramap.cjs.map +1 -1
- package/_cjs/typeclass/Ord/api/max.cjs.map +1 -1
- package/_cjs/typeclass/Ord/api/min.cjs.map +1 -1
- package/_cjs/typeclass/Ord/definition.cjs.map +1 -1
- package/_cjs/typeclass/Ord/instances.cjs.map +1 -1
- package/_cjs/typeclass/Ordering.cjs.map +1 -1
- package/_cjs/typeclass/Semialign.cjs +7 -7
- package/_cjs/typeclass/Semialign.cjs.map +1 -1
- package/_cjs/typeclass/Semigroup/api.cjs.map +1 -1
- package/_cjs/typeclass/Semigroup/definition.cjs.map +1 -1
- package/_cjs/typeclass/Semigroup/derivations.cjs.map +1 -1
- package/_cjs/typeclass/Semimonoidal.cjs.map +1 -1
- package/_cjs/typeclass/Showable/definition.cjs.map +1 -1
- package/_cjs/typeclass/Showable/show.cjs +107 -107
- package/_cjs/typeclass/Showable/show.cjs.map +1 -1
- package/_cjs/typeclass/Showable/styles.cjs.map +1 -1
- package/_cjs/typeclass/Showable/util.cjs +1 -1
- package/_cjs/typeclass/Showable/util.cjs.map +1 -1
- package/_cjs/typeclass/Traversable.cjs +1 -2
- package/_cjs/typeclass/Traversable.cjs.map +1 -1
- package/_cjs/typeclass/TraversableWithIndex.cjs.map +1 -1
- package/_cjs/typeclass/Witherable.cjs +3 -1
- package/_cjs/typeclass/Witherable.cjs.map +1 -1
- package/_cjs/typeclass/WitherableWithIndex.cjs +3 -1
- package/_cjs/typeclass/WitherableWithIndex.cjs.map +1 -1
- package/_cjs/util/AnsiFormat.cjs +11 -11
- package/_cjs/util/AnsiFormat.cjs.map +1 -1
- package/_cjs/util/PCGRandom.cjs.map +1 -1
- package/_cjs/util/assert.cjs.map +1 -1
- package/_cjs/util/pattern.cjs.map +1 -1
- package/_cjs/util/predicates.cjs.map +1 -1
- package/_cjs/util/rand/Random.cjs.map +1 -1
- package/_cjs/util/rand/distribution/UniformArrayIntDistribution.cjs.map +1 -1
- package/_cjs/util/rand/distribution/UniformBigIntDistribution.cjs.map +1 -1
- package/_cjs/util/rand/distribution/UniformIntDistribution.cjs.map +1 -1
- package/_cjs/util/rand/distribution/internals/ArrayInt.cjs.map +1 -1
- package/_cjs/util/rand/distribution/internals/UniformArrayIntDistributionInternal.cjs.map +1 -1
- package/_cjs/util/rand/distribution/internals/UniformIntDistributionInternal.cjs.map +1 -1
- package/_cjs/util/rand/generator/MersenneTwister.cjs.map +1 -1
- package/_cjs/util/rand/generator/RandomGenerator.cjs.map +1 -1
- package/_cjs/util/rand.cjs.map +1 -1
- package/_mjs/collection/Iterable/api/traverseConc.mjs +5 -5
- package/_mjs/collection/Iterable/api/traverseConc.mjs.map +1 -1
- package/_mjs/collection/Iterable/api.mjs +465 -411
- package/_mjs/collection/Iterable/api.mjs.map +1 -1
- package/_mjs/collection/Iterable/constructors.mjs +5 -5
- package/_mjs/collection/Iterable/constructors.mjs.map +1 -1
- package/_mjs/collection/compat/Array/api.mjs +16 -12
- package/_mjs/collection/compat/Array/api.mjs.map +1 -1
- package/_mjs/collection/compat/Array/derivations.mjs +35 -19
- package/_mjs/collection/compat/Array/derivations.mjs.map +1 -1
- package/_mjs/collection/compat/ArrayLike/api.mjs +1 -1
- package/_mjs/collection/compat/ArrayLike/api.mjs.map +1 -1
- package/_mjs/collection/compat/Record/instances.mjs +34 -3
- package/_mjs/collection/compat/Record/instances.mjs.map +1 -1
- package/_mjs/collection/immutable/Conc/api/makeBy.mjs +1 -1
- package/_mjs/collection/immutable/Conc/api/makeBy.mjs.map +1 -1
- package/_mjs/collection/immutable/Conc/api.mjs +795 -697
- package/_mjs/collection/immutable/Conc/api.mjs.map +1 -1
- package/_mjs/collection/immutable/Conc/definition.mjs +53 -51
- package/_mjs/collection/immutable/Conc/definition.mjs.map +1 -1
- package/_mjs/collection/immutable/Conc/derivations.mjs +10 -2
- package/_mjs/collection/immutable/Conc/derivations.mjs.map +1 -1
- package/_mjs/collection/immutable/Conc.mjs.map +1 -1
- package/_mjs/collection/immutable/Dictionary/api.mjs +47 -35
- package/_mjs/collection/immutable/Dictionary/api.mjs.map +1 -1
- package/_mjs/collection/immutable/HashMap/api.mjs +295 -217
- package/_mjs/collection/immutable/HashMap/api.mjs.map +1 -1
- package/_mjs/collection/immutable/HashMap/definition.mjs +1 -1
- package/_mjs/collection/immutable/HashMap/definition.mjs.map +1 -1
- package/_mjs/collection/immutable/HashMap/internal.mjs.map +1 -1
- package/_mjs/collection/immutable/HashSet/api.mjs +206 -168
- package/_mjs/collection/immutable/HashSet/api.mjs.map +1 -1
- package/_mjs/collection/immutable/HashSet/definition.mjs +1 -1
- package/_mjs/collection/immutable/HashSet/definition.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableArray/api/chunksOf.mjs +5 -3
- package/_mjs/collection/immutable/ImmutableArray/api/chunksOf.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableArray/api/slice.mjs +5 -3
- package/_mjs/collection/immutable/ImmutableArray/api/slice.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableArray/api/splitAt.mjs +5 -3
- package/_mjs/collection/immutable/ImmutableArray/api/splitAt.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableArray/api/splitWhere.mjs +13 -11
- package/_mjs/collection/immutable/ImmutableArray/api/splitWhere.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableArray/api.mjs +816 -629
- package/_mjs/collection/immutable/ImmutableArray/api.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableArray/derivations.mjs +9 -1
- package/_mjs/collection/immutable/ImmutableArray/derivations.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableArray/instances.mjs +34 -34
- package/_mjs/collection/immutable/ImmutableArray/instances.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableArray.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableNonEmptyArray/api.mjs +301 -239
- package/_mjs/collection/immutable/ImmutableNonEmptyArray/api.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableNonEmptyArray/constructors.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableNonEmptyArray/definition.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableNonEmptyArray/derivations.mjs +12 -4
- package/_mjs/collection/immutable/ImmutableNonEmptyArray/derivations.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableNonEmptyArray/destructors.mjs +2 -2
- package/_mjs/collection/immutable/ImmutableNonEmptyArray/destructors.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableNonEmptyArray/instances.mjs +13 -13
- package/_mjs/collection/immutable/ImmutableNonEmptyArray/instances.mjs.map +1 -1
- package/_mjs/collection/immutable/List/api/foldLeft.mjs +11 -9
- package/_mjs/collection/immutable/List/api/foldLeft.mjs.map +1 -1
- package/_mjs/collection/immutable/List/api.mjs +157 -133
- package/_mjs/collection/immutable/List/api.mjs.map +1 -1
- package/_mjs/collection/immutable/List.mjs.map +1 -1
- package/_mjs/collection/immutable/Queue/api.mjs +55 -39
- package/_mjs/collection/immutable/Queue/api.mjs.map +1 -1
- package/_mjs/collection/immutable/Queue/definition.mjs +1 -1
- package/_mjs/collection/immutable/Queue/definition.mjs.map +1 -1
- package/_mjs/collection/immutable/RoseTree/api.mjs +50 -36
- package/_mjs/collection/immutable/RoseTree/api.mjs.map +1 -1
- package/_mjs/collection/immutable/RoseTree/definition.mjs.map +1 -1
- package/_mjs/collection/immutable/SortedMap/api.mjs +398 -358
- package/_mjs/collection/immutable/SortedMap/api.mjs.map +1 -1
- package/_mjs/collection/immutable/Vector/api.mjs +650 -538
- package/_mjs/collection/immutable/Vector/api.mjs.map +1 -1
- package/_mjs/collection/immutable/Vector/definition.mjs +16 -14
- package/_mjs/collection/immutable/Vector/definition.mjs.map +1 -1
- package/_mjs/collection/immutable/Vector/internal.mjs +40 -39
- package/_mjs/collection/immutable/Vector/internal.mjs.map +1 -1
- package/_mjs/collection/mutable/HashMap.mjs +3 -5
- package/_mjs/collection/mutable/HashMap.mjs.map +1 -1
- package/_mjs/collection/mutable/HashSet.mjs.map +1 -1
- package/_mjs/collection/mutable/ListBuffer.mjs +2 -2
- package/_mjs/collection/mutable/ListBuffer.mjs.map +1 -1
- package/_mjs/collection/mutable/internal.mjs +0 -2
- package/_mjs/collection/mutable/internal.mjs.map +1 -1
- package/_mjs/collection/weak/IterableWeakMap.mjs +7 -7
- package/_mjs/collection/weak/IterableWeakMap.mjs.map +1 -1
- package/_mjs/collection/weak/IterableWeakSet.mjs +7 -7
- package/_mjs/collection/weak/IterableWeakSet.mjs.map +1 -1
- package/_mjs/control/Eval/api.mjs +40 -28
- package/_mjs/control/Eval/api.mjs.map +1 -1
- package/_mjs/control/Eval/instance.mjs +5 -5
- package/_mjs/control/Eval/instance.mjs.map +1 -1
- package/_mjs/control/Eval/run.mjs +1 -1
- package/_mjs/control/Eval/run.mjs.map +1 -1
- package/_mjs/control/Z/api.mjs +196 -128
- package/_mjs/control/Z/api.mjs.map +1 -1
- package/_mjs/control/Z/instances.mjs +4 -4
- package/_mjs/control/Z/instances.mjs.map +1 -1
- package/_mjs/control/Z/runtime.mjs +244 -234
- package/_mjs/control/Z/runtime.mjs.map +1 -1
- package/_mjs/data/Branded/definition.mjs.map +1 -1
- package/_mjs/data/Branded/derivations.mjs +3 -3
- package/_mjs/data/Branded/derivations.mjs.map +1 -1
- package/_mjs/data/CaseClass.mjs.map +1 -1
- package/_mjs/data/Cause/api/fold.mjs +19 -17
- package/_mjs/data/Cause/api/fold.mjs.map +1 -1
- package/_mjs/data/Cause/api/isEmpty.mjs +1 -1
- package/_mjs/data/Cause/api/isEmpty.mjs.map +1 -1
- package/_mjs/data/Cause/api/linearize.mjs +8 -8
- package/_mjs/data/Cause/api/linearize.mjs.map +1 -1
- package/_mjs/data/Cause/api/prettyPrint.mjs +1 -1
- package/_mjs/data/Cause/api/prettyPrint.mjs.map +1 -1
- package/_mjs/data/Cause/api.mjs +149 -129
- package/_mjs/data/Cause/api.mjs.map +1 -1
- package/_mjs/data/Cause/definition.mjs +18 -18
- package/_mjs/data/Cause/definition.mjs.map +1 -1
- package/_mjs/data/Cause.mjs.map +1 -1
- package/_mjs/data/Const/api.mjs +6 -4
- package/_mjs/data/Const/api.mjs.map +1 -1
- package/_mjs/data/Const/instances.mjs +4 -4
- package/_mjs/data/Const/instances.mjs.map +1 -1
- package/_mjs/data/Datum/api.mjs +220 -179
- package/_mjs/data/Datum/api.mjs.map +1 -1
- package/_mjs/data/Datum/definition.mjs.map +1 -1
- package/_mjs/data/DatumEither/api.mjs +163 -132
- package/_mjs/data/DatumEither/api.mjs.map +1 -1
- package/_mjs/data/DecodeError/definition.mjs +14 -14
- package/_mjs/data/DecodeError/definition.mjs.map +1 -1
- package/_mjs/data/Decoder/api.mjs +9 -7
- package/_mjs/data/Decoder/api.mjs.map +1 -1
- package/_mjs/data/Duration/api.mjs +16 -10
- package/_mjs/data/Duration/api.mjs.map +1 -1
- package/_mjs/data/Either/api/align.mjs +8 -2
- package/_mjs/data/Either/api/align.mjs.map +1 -1
- package/_mjs/data/Either/api/alignWith.mjs +13 -11
- package/_mjs/data/Either/api/alignWith.mjs.map +1 -1
- package/_mjs/data/Either/api.mjs +175 -136
- package/_mjs/data/Either/api.mjs.map +1 -1
- package/_mjs/data/Either/constructors.mjs +7 -5
- package/_mjs/data/Either/constructors.mjs.map +1 -1
- package/_mjs/data/Either/destructors.mjs +15 -13
- package/_mjs/data/Either/destructors.mjs.map +1 -1
- package/_mjs/data/Either/instances.mjs +9 -9
- package/_mjs/data/Either/instances.mjs.map +1 -1
- package/_mjs/data/EitherT/api.mjs +8 -8
- package/_mjs/data/EitherT/api.mjs.map +1 -1
- package/_mjs/data/Encoder/api.mjs +102 -0
- package/_mjs/data/Encoder/api.mjs.map +1 -0
- package/_mjs/data/Encoder/definition.mjs +15 -0
- package/_mjs/data/Encoder/definition.mjs.map +1 -0
- package/_mjs/data/Encoder.mjs +4 -0
- package/_mjs/data/Encoder.mjs.map +1 -0
- package/_mjs/data/Environment/api.mjs +45 -33
- package/_mjs/data/Environment/api.mjs.map +1 -1
- package/_mjs/data/EnvironmentPatch.mjs +17 -13
- package/_mjs/data/EnvironmentPatch.mjs.map +1 -1
- package/_mjs/data/ExecutionStrategy.mjs +19 -27
- package/_mjs/data/ExecutionStrategy.mjs.map +1 -1
- package/_mjs/data/Exit/api.mjs +140 -108
- package/_mjs/data/Exit/api.mjs.map +1 -1
- package/_mjs/data/Exit/constructors.mjs +3 -3
- package/_mjs/data/Exit/constructors.mjs.map +1 -1
- package/_mjs/data/FiberId/api.mjs +22 -20
- package/_mjs/data/FiberId/api.mjs.map +1 -1
- package/_mjs/data/FiberId/constructors.mjs.map +1 -1
- package/_mjs/data/Identity/api.mjs +21 -13
- package/_mjs/data/Identity/api.mjs.map +1 -1
- package/_mjs/data/Identity/instances.mjs +4 -4
- package/_mjs/data/Identity/instances.mjs.map +1 -1
- package/_mjs/data/Interval.mjs +38 -28
- package/_mjs/data/Interval.mjs.map +1 -1
- package/_mjs/data/Intervals.mjs +35 -27
- package/_mjs/data/Intervals.mjs.map +1 -1
- package/_mjs/data/Maybe/api.mjs +141 -106
- package/_mjs/data/Maybe/api.mjs.map +1 -1
- package/_mjs/data/Maybe/constructors.mjs +1 -1
- package/_mjs/data/Maybe/constructors.mjs.map +1 -1
- package/_mjs/data/Maybe/definition.mjs.map +1 -1
- package/_mjs/data/Maybe/destructors.mjs +8 -6
- package/_mjs/data/Maybe/destructors.mjs.map +1 -1
- package/_mjs/data/Maybe/instances.mjs +12 -12
- package/_mjs/data/Maybe/instances.mjs.map +1 -1
- package/_mjs/data/Predicate/api.mjs +10 -8
- package/_mjs/data/Predicate/api.mjs.map +1 -1
- package/_mjs/data/Refinement/api.mjs +15 -9
- package/_mjs/data/Refinement/api.mjs.map +1 -1
- package/_mjs/data/Struct/api.mjs +56 -44
- package/_mjs/data/Struct/api.mjs.map +1 -1
- package/_mjs/data/Tag/constructors.mjs +3 -2
- package/_mjs/data/Tag/constructors.mjs.map +1 -1
- package/_mjs/data/Tag/definition.mjs +0 -2
- package/_mjs/data/Tag/definition.mjs.map +1 -1
- package/_mjs/data/These/api.mjs +187 -169
- package/_mjs/data/These/api.mjs.map +1 -1
- package/_mjs/data/These/constructors.mjs +1 -1
- package/_mjs/data/These/constructors.mjs.map +1 -1
- package/_mjs/data/These/destructors.mjs +35 -31
- package/_mjs/data/These/destructors.mjs.map +1 -1
- package/_mjs/data/These/instances.mjs +1 -1
- package/_mjs/data/These/instances.mjs.map +1 -1
- package/_mjs/data/Trace/api.mjs +6 -4
- package/_mjs/data/Trace/api.mjs.map +1 -1
- package/_mjs/data/Zipped.mjs.map +1 -1
- package/_mjs/data/function/api.mjs +5 -3
- package/_mjs/data/function/api.mjs.map +1 -1
- package/_mjs/data/function/pipe.mjs +7 -0
- package/_mjs/data/function/pipe.mjs.map +1 -1
- package/_mjs/data/string/api.mjs +46 -66
- package/_mjs/data/string/api.mjs.map +1 -1
- package/_mjs/global/api.mjs +4 -2
- package/_mjs/global/api.mjs.map +1 -1
- package/_mjs/internal/AtomicBoolean.mjs.map +1 -1
- package/_mjs/internal/AtomicNumber.mjs.map +1 -1
- package/_mjs/internal/AtomicReference.mjs.map +1 -1
- package/_mjs/internal/Stack.mjs +1 -1
- package/_mjs/internal/Stack.mjs.map +1 -1
- package/_mjs/optics/At/api.mjs +1 -1
- package/_mjs/optics/At/api.mjs.map +1 -1
- package/_mjs/optics/At/definition.mjs +2 -2
- package/_mjs/optics/At/definition.mjs.map +1 -1
- package/_mjs/optics/Fold/definition.mjs +2 -3
- package/_mjs/optics/Fold/definition.mjs.map +1 -1
- package/_mjs/optics/Getter/definition.mjs +1 -2
- package/_mjs/optics/Getter/definition.mjs.map +1 -1
- package/_mjs/optics/Index/api.mjs +4 -4
- package/_mjs/optics/Index/api.mjs.map +1 -1
- package/_mjs/optics/Index/definition.mjs +1 -1
- package/_mjs/optics/Index/definition.mjs.map +1 -1
- package/_mjs/optics/Iso/api.mjs +8 -6
- package/_mjs/optics/Iso/api.mjs.map +1 -1
- package/_mjs/optics/Iso/definition.mjs +9 -9
- package/_mjs/optics/Iso/definition.mjs.map +1 -1
- package/_mjs/optics/Lens/api.mjs +49 -39
- package/_mjs/optics/Lens/api.mjs.map +1 -1
- package/_mjs/optics/Lens/definition.mjs +7 -7
- package/_mjs/optics/Lens/definition.mjs.map +1 -1
- package/_mjs/optics/Optional/api/compose.mjs +8 -6
- package/_mjs/optics/Optional/api/compose.mjs.map +1 -1
- package/_mjs/optics/Optional/definition.mjs +8 -10
- package/_mjs/optics/Optional/definition.mjs.map +1 -1
- package/_mjs/optics/Optional.mjs.map +1 -1
- package/_mjs/optics/Prism/api/compose.mjs +8 -6
- package/_mjs/optics/Prism/api/compose.mjs.map +1 -1
- package/_mjs/optics/Prism/api/fromNullable.mjs +2 -2
- package/_mjs/optics/Prism/api/fromNullable.mjs.map +1 -1
- package/_mjs/optics/Prism/api/just.mjs +2 -2
- package/_mjs/optics/Prism/api/just.mjs.map +1 -1
- package/_mjs/optics/Prism/definition.mjs +6 -6
- package/_mjs/optics/Prism/definition.mjs.map +1 -1
- package/_mjs/optics/Prism.mjs.map +1 -1
- package/_mjs/optics/Setter/definition.mjs +5 -10
- package/_mjs/optics/Setter/definition.mjs.map +1 -1
- package/_mjs/optics/Traversal/api/compose.mjs +7 -5
- package/_mjs/optics/Traversal/api/compose.mjs.map +1 -1
- package/_mjs/optics/Traversal/api/fromTraversable.mjs +2 -2
- package/_mjs/optics/Traversal/api/fromTraversable.mjs.map +1 -1
- package/_mjs/optics/Traversal/definition.mjs +9 -9
- package/_mjs/optics/Traversal/definition.mjs.map +1 -1
- package/_mjs/optics/Traversal.mjs.map +1 -1
- package/_mjs/typeclass/Align.mjs.map +1 -1
- package/_mjs/typeclass/Alt.mjs.map +1 -1
- package/_mjs/typeclass/Applicative.mjs.map +1 -1
- package/_mjs/typeclass/ApplicativeExcept.mjs +6 -10
- package/_mjs/typeclass/ApplicativeExcept.mjs.map +1 -1
- package/_mjs/typeclass/Apply.mjs +9 -9
- package/_mjs/typeclass/Apply.mjs.map +1 -1
- package/_mjs/typeclass/Chain.mjs +5 -5
- package/_mjs/typeclass/Chain.mjs.map +1 -1
- package/_mjs/typeclass/Eq/definition.mjs.map +1 -1
- package/_mjs/typeclass/Eq/derivations.mjs.map +1 -1
- package/_mjs/typeclass/Equatable/api.mjs.map +1 -1
- package/_mjs/typeclass/Equatable/definition.mjs.map +1 -1
- package/_mjs/typeclass/Equatable/fast-equals.mjs.map +1 -1
- package/_mjs/typeclass/Filterable.mjs.map +1 -1
- package/_mjs/typeclass/FilterableWithIndex.mjs.map +1 -1
- package/_mjs/typeclass/Foldable.mjs +1 -1
- package/_mjs/typeclass/Foldable.mjs.map +1 -1
- package/_mjs/typeclass/FoldableWithIndex.mjs +1 -1
- package/_mjs/typeclass/FoldableWithIndex.mjs.map +1 -1
- package/_mjs/typeclass/Functor.mjs.map +1 -1
- package/_mjs/typeclass/FunctorWithIndex.mjs.map +1 -1
- package/_mjs/typeclass/Guard/api.mjs +18 -10
- package/_mjs/typeclass/Guard/api.mjs.map +1 -1
- package/_mjs/typeclass/Guard/definition.mjs.map +1 -1
- package/_mjs/typeclass/Guard/derivations.mjs.map +1 -1
- package/_mjs/typeclass/Has.mjs +7 -5
- package/_mjs/typeclass/Has.mjs.map +1 -1
- package/_mjs/typeclass/HashEq.mjs.map +1 -1
- package/_mjs/typeclass/Hashable/definition.mjs.map +1 -1
- package/_mjs/typeclass/Hashable/hash.mjs.map +1 -1
- package/_mjs/typeclass/MonadExcept.mjs +1 -1
- package/_mjs/typeclass/MonadExcept.mjs.map +1 -1
- package/_mjs/typeclass/Ord/api/contramap.mjs +7 -5
- package/_mjs/typeclass/Ord/api/contramap.mjs.map +1 -1
- package/_mjs/typeclass/Ord/api/max.mjs.map +1 -1
- package/_mjs/typeclass/Ord/api/min.mjs.map +1 -1
- package/_mjs/typeclass/Ord/definition.mjs.map +1 -1
- package/_mjs/typeclass/Ord/instances.mjs.map +1 -1
- package/_mjs/typeclass/Ordering.mjs.map +1 -1
- package/_mjs/typeclass/Semialign.mjs +7 -7
- package/_mjs/typeclass/Semialign.mjs.map +1 -1
- package/_mjs/typeclass/Semigroup/api.mjs.map +1 -1
- package/_mjs/typeclass/Semigroup/definition.mjs.map +1 -1
- package/_mjs/typeclass/Semigroup/derivations.mjs.map +1 -1
- package/_mjs/typeclass/Semimonoidal.mjs.map +1 -1
- package/_mjs/typeclass/Showable/definition.mjs.map +1 -1
- package/_mjs/typeclass/Showable/show.mjs +107 -107
- package/_mjs/typeclass/Showable/show.mjs.map +1 -1
- package/_mjs/typeclass/Showable/styles.mjs.map +1 -1
- package/_mjs/typeclass/Showable/util.mjs +1 -1
- package/_mjs/typeclass/Showable/util.mjs.map +1 -1
- package/_mjs/typeclass/Traversable.mjs +1 -2
- package/_mjs/typeclass/Traversable.mjs.map +1 -1
- package/_mjs/typeclass/TraversableWithIndex.mjs.map +1 -1
- package/_mjs/typeclass/Witherable.mjs +2 -1
- package/_mjs/typeclass/Witherable.mjs.map +1 -1
- package/_mjs/typeclass/WitherableWithIndex.mjs +2 -1
- package/_mjs/typeclass/WitherableWithIndex.mjs.map +1 -1
- package/_mjs/util/AnsiFormat.mjs +11 -11
- package/_mjs/util/AnsiFormat.mjs.map +1 -1
- package/_mjs/util/PCGRandom.mjs.map +1 -1
- package/_mjs/util/assert.mjs.map +1 -1
- package/_mjs/util/pattern.mjs.map +1 -1
- package/_mjs/util/predicates.mjs.map +1 -1
- package/_mjs/util/rand/Random.mjs.map +1 -1
- package/_mjs/util/rand/distribution/UniformArrayIntDistribution.mjs.map +1 -1
- package/_mjs/util/rand/distribution/UniformBigIntDistribution.mjs.map +1 -1
- package/_mjs/util/rand/distribution/UniformIntDistribution.mjs.map +1 -1
- package/_mjs/util/rand/distribution/internals/ArrayInt.mjs.map +1 -1
- package/_mjs/util/rand/distribution/internals/UniformArrayIntDistributionInternal.mjs.map +1 -1
- package/_mjs/util/rand/distribution/internals/UniformIntDistributionInternal.mjs.map +1 -1
- package/_mjs/util/rand/generator/MersenneTwister.mjs.map +1 -1
- package/_mjs/util/rand/generator/RandomGenerator.mjs.map +1 -1
- package/_mjs/util/rand.mjs.map +1 -1
- package/_src/collection/Iterable/api/traverseConc.ts +3 -3
- package/_src/collection/Iterable/api.ts +445 -408
- package/_src/collection/Iterable/constructors.ts +1 -1
- package/_src/collection/compat/Array/api.ts +16 -13
- package/_src/collection/compat/Array/derivations.ts +27 -1
- package/_src/collection/compat/Record/instances.ts +51 -2
- package/_src/collection/immutable/Conc/api.ts +716 -607
- package/_src/collection/immutable/Conc/definition.ts +60 -68
- package/_src/collection/immutable/Conc/derivations.ts +13 -0
- package/_src/collection/immutable/Conc.ts +0 -1
- package/_src/collection/immutable/Dictionary/api.ts +44 -32
- package/_src/collection/immutable/HashMap/api.ts +338 -224
- package/_src/collection/immutable/HashMap/internal.ts +3 -7
- package/_src/collection/immutable/HashSet/api.ts +193 -158
- package/_src/collection/immutable/ImmutableArray/api/chunksOf.ts +5 -3
- package/_src/collection/immutable/ImmutableArray/api/slice.ts +5 -3
- package/_src/collection/immutable/ImmutableArray/api/splitAt.ts +5 -3
- package/_src/collection/immutable/ImmutableArray/api/splitWhere.ts +13 -14
- package/_src/collection/immutable/ImmutableArray/api.ts +870 -722
- package/_src/collection/immutable/ImmutableArray/derivations.ts +13 -0
- package/_src/collection/immutable/ImmutableArray/instances.ts +54 -73
- package/_src/collection/immutable/ImmutableArray.ts +0 -1
- package/_src/collection/immutable/ImmutableNonEmptyArray/api.ts +311 -273
- package/_src/collection/immutable/ImmutableNonEmptyArray/constructors.ts +19 -4
- package/_src/collection/immutable/ImmutableNonEmptyArray/definition.ts +0 -1
- package/_src/collection/immutable/ImmutableNonEmptyArray/derivations.ts +13 -0
- package/_src/collection/immutable/ImmutableNonEmptyArray/instances.ts +22 -23
- package/_src/collection/immutable/List/api/foldLeft.ts +11 -9
- package/_src/collection/immutable/List/api.ts +147 -133
- package/_src/collection/immutable/List.ts +0 -1
- package/_src/collection/immutable/Queue/api.ts +53 -37
- package/_src/collection/immutable/Queue/definition.ts +0 -1
- package/_src/collection/immutable/RoseTree/api.ts +38 -32
- package/_src/collection/immutable/RoseTree/definition.ts +2 -0
- package/_src/collection/immutable/SortedMap/api.ts +364 -332
- package/_src/collection/immutable/Vector/api.ts +608 -482
- package/_src/collection/immutable/Vector/definition.ts +11 -12
- package/_src/collection/immutable/Vector/internal.ts +37 -38
- package/_src/collection/mutable/HashMap.ts +1 -4
- package/_src/collection/mutable/HashSet.ts +1 -2
- package/_src/collection/mutable/ListBuffer.ts +1 -1
- package/_src/collection/mutable/internal.ts +0 -2
- package/_src/collection/weak/IterableWeakMap.ts +11 -7
- package/_src/collection/weak/IterableWeakSet.ts +10 -5
- package/_src/control/Eval/api.ts +35 -19
- package/_src/control/Eval/instance.ts +5 -5
- package/_src/control/Z/api.ts +191 -208
- package/_src/control/Z/instances.ts +4 -5
- package/_src/control/Z/runtime.ts +190 -189
- package/_src/data/Branded/definition.ts +11 -12
- package/_src/data/Branded/derivations.ts +2 -2
- package/_src/data/CaseClass.ts +4 -1
- package/_src/data/Cause/api/fold.ts +13 -14
- package/_src/data/Cause/api.ts +125 -105
- package/_src/data/Cause.ts +0 -1
- package/_src/data/Const/api.ts +6 -4
- package/_src/data/Const/instances.ts +3 -3
- package/_src/data/Datum/api.ts +229 -197
- package/_src/data/Datum/definition.ts +2 -5
- package/_src/data/DatumEither/api.ts +208 -193
- package/_src/data/Decoder/api.ts +5 -3
- package/_src/data/Duration/api.ts +19 -15
- package/_src/data/Either/api/align.ts +7 -2
- package/_src/data/Either/api/alignWith.ts +13 -15
- package/_src/data/Either/api.ts +141 -119
- package/_src/data/Either/constructors.ts +12 -10
- package/_src/data/Either/destructors.ts +11 -9
- package/_src/data/Either/instances.ts +24 -20
- package/_src/data/EitherT/api.ts +43 -49
- package/_src/data/Encoder/api.ts +123 -0
- package/_src/data/Encoder/definition.ts +12 -0
- package/_src/data/Encoder.ts +4 -0
- package/_src/data/Environment/api.ts +52 -44
- package/_src/data/EnvironmentPatch.ts +10 -9
- package/_src/data/ExecutionStrategy.ts +14 -24
- package/_src/data/Exit/api.ts +104 -73
- package/_src/data/Exit/constructors.ts +2 -2
- package/_src/data/FiberId/api.ts +19 -17
- package/_src/data/FiberId/constructors.ts +1 -2
- package/_src/data/Identity/api.ts +20 -12
- package/_src/data/Identity/instances.ts +4 -7
- package/_src/data/Interval.ts +39 -29
- package/_src/data/Intervals.ts +31 -23
- package/_src/data/Maybe/api.ts +112 -79
- package/_src/data/Maybe/constructors.ts +3 -3
- package/_src/data/Maybe/definition.ts +11 -1
- package/_src/data/Maybe/destructors.ts +6 -4
- package/_src/data/Maybe/instances.ts +10 -21
- package/_src/data/Predicate/api.ts +14 -8
- package/_src/data/Refinement/api.ts +19 -13
- package/_src/data/Struct/api.ts +75 -55
- package/_src/data/Tag/constructors.ts +1 -2
- package/_src/data/Tag/definition.ts +0 -1
- package/_src/data/These/api.ts +114 -114
- package/_src/data/These/destructors.ts +23 -24
- package/_src/data/Trace/api.ts +5 -3
- package/_src/data/Zipped.ts +3 -4
- package/_src/data/function/api.ts +6 -7
- package/_src/data/function/pipe.ts +9 -1
- package/_src/data/string/api.ts +40 -60
- package/_src/data.ts +1 -0
- package/_src/global/api.ts +7 -12
- package/_src/global.ts +4 -0
- package/_src/internal/AtomicBoolean.ts +0 -1
- package/_src/internal/AtomicNumber.ts +0 -7
- package/_src/internal/AtomicReference.ts +0 -4
- package/_src/internal/Stack.ts +1 -7
- package/_src/optics/At/definition.ts +5 -3
- package/_src/optics/Fold/definition.ts +3 -10
- package/_src/optics/Getter/definition.ts +1 -2
- package/_src/optics/Index/definition.ts +1 -1
- package/_src/optics/Iso/api.ts +8 -6
- package/_src/optics/Iso/definition.ts +3 -3
- package/_src/optics/Lens/api.ts +44 -42
- package/_src/optics/Lens/definition.ts +5 -5
- package/_src/optics/Optional/api/compose.ts +9 -9
- package/_src/optics/Optional/definition.ts +9 -16
- package/_src/optics/Optional.ts +0 -1
- package/_src/optics/Prism/api/compose.ts +9 -6
- package/_src/optics/Prism/definition.ts +3 -3
- package/_src/optics/Prism.ts +0 -1
- package/_src/optics/Setter/definition.ts +3 -23
- package/_src/optics/Traversal/api/compose.ts +7 -8
- package/_src/optics/Traversal/api/fromTraversable.ts +1 -1
- package/_src/optics/Traversal/definition.ts +10 -15
- package/_src/optics/Traversal.ts +0 -1
- package/_src/typeclass/Align.ts +0 -3
- package/_src/typeclass/Alt.ts +2 -1
- package/_src/typeclass/Applicative.ts +0 -1
- package/_src/typeclass/ApplicativeExcept.ts +15 -10
- package/_src/typeclass/Apply.ts +30 -33
- package/_src/typeclass/Chain.ts +9 -12
- package/_src/typeclass/Eq/definition.ts +0 -3
- package/_src/typeclass/Eq/derivations.ts +0 -2
- package/_src/typeclass/Equatable/api.ts +0 -2
- package/_src/typeclass/Equatable/definition.ts +0 -4
- package/_src/typeclass/Equatable/fast-equals.ts +11 -93
- package/_src/typeclass/Filterable.ts +19 -13
- package/_src/typeclass/FilterableWithIndex.ts +19 -13
- package/_src/typeclass/Foldable.ts +7 -10
- package/_src/typeclass/FoldableWithIndex.ts +7 -10
- package/_src/typeclass/Functor.ts +6 -4
- package/_src/typeclass/FunctorWithIndex.ts +3 -2
- package/_src/typeclass/Guard/api.ts +21 -16
- package/_src/typeclass/Guard/definition.ts +0 -3
- package/_src/typeclass/Guard/derivations.ts +5 -6
- package/_src/typeclass/Has.ts +6 -4
- package/_src/typeclass/HashEq.ts +0 -7
- package/_src/typeclass/Hashable/definition.ts +0 -4
- package/_src/typeclass/Hashable/hash.ts +0 -26
- package/_src/typeclass/MonadExcept.ts +1 -1
- package/_src/typeclass/Ord/api/contramap.ts +7 -6
- package/_src/typeclass/Ord/api/max.ts +0 -1
- package/_src/typeclass/Ord/api/min.ts +0 -1
- package/_src/typeclass/Ord/definition.ts +0 -4
- package/_src/typeclass/Ord/instances.ts +0 -2
- package/_src/typeclass/Ordering.ts +2 -0
- package/_src/typeclass/Semialign.ts +43 -32
- package/_src/typeclass/Semigroup/api.ts +0 -2
- package/_src/typeclass/Semigroup/definition.ts +0 -4
- package/_src/typeclass/Semigroup/derivations.ts +0 -2
- package/_src/typeclass/Semimonoidal.ts +3 -2
- package/_src/typeclass/Showable/definition.ts +0 -6
- package/_src/typeclass/Showable/show.ts +1 -57
- package/_src/typeclass/Showable/styles.ts +0 -8
- package/_src/typeclass/Showable/util.ts +22 -57
- package/_src/typeclass/Traversable.ts +13 -18
- package/_src/typeclass/TraversableWithIndex.ts +5 -7
- package/_src/typeclass/Witherable.ts +21 -13
- package/_src/typeclass/WitherableWithIndex.ts +26 -17
- package/_src/typeclass/builtin/Symbol.ts +0 -1
- package/_src/types/extractions.ts +12 -3
- package/_src/types/utility.ts +3 -5
- package/_src/util/AnsiFormat.ts +0 -25
- package/_src/util/PCGRandom.ts +4 -9
- package/_src/util/assert.ts +1 -2
- package/_src/util/pattern.ts +91 -12
- package/_src/util/predicates.ts +3 -1
- package/_src/util/rand/Random.ts +12 -16
- package/_src/util/rand/distribution/Distribution.ts +0 -1
- package/_src/util/rand/distribution/UniformArrayIntDistribution.ts +0 -3
- package/_src/util/rand/distribution/UniformBigIntDistribution.ts +0 -5
- package/_src/util/rand/distribution/UniformIntDistribution.ts +0 -7
- package/_src/util/rand/distribution/internals/ArrayInt.ts +3 -13
- package/_src/util/rand/distribution/internals/UniformArrayIntDistributionInternal.ts +0 -3
- package/_src/util/rand/distribution/internals/UniformIntDistributionInternal.ts +0 -4
- package/_src/util/rand/generator/MersenneTwister.ts +6 -29
- package/_src/util/rand/generator/RandomGenerator.ts +0 -3
- package/_src/util/rand.ts +0 -2
- package/collection/Iterable/api/traverseConc.d.ts +2 -2
- package/collection/Iterable/api.d.ts +64 -64
- package/collection/Iterable/constructors.d.ts +1 -1
- package/collection/compat/Array/api.d.ts +6 -6
- package/collection/compat/Array/derivations.d.ts +11 -0
- package/collection/compat/Record/instances.d.ts +30 -6
- package/collection/immutable/Conc/api.d.ts +108 -105
- package/collection/immutable/Conc/definition.d.ts +2 -2
- package/collection/immutable/Conc/derivations.d.ts +6 -0
- package/collection/immutable/Dictionary/api.d.ts +12 -12
- package/collection/immutable/HashMap/api.d.ts +76 -70
- package/collection/immutable/HashSet/api.d.ts +45 -41
- package/collection/immutable/ImmutableArray/api/chunksOf.d.ts +2 -2
- package/collection/immutable/ImmutableArray/api/slice.d.ts +2 -2
- package/collection/immutable/ImmutableArray/api/splitAt.d.ts +2 -2
- package/collection/immutable/ImmutableArray/api/splitWhere.d.ts +3 -3
- package/collection/immutable/ImmutableArray/api.d.ts +206 -206
- package/collection/immutable/ImmutableArray/derivations.d.ts +6 -0
- package/collection/immutable/ImmutableNonEmptyArray/api.d.ts +64 -63
- package/collection/immutable/ImmutableNonEmptyArray/derivations.d.ts +6 -0
- package/collection/immutable/List/api/foldLeft.d.ts +2 -2
- package/collection/immutable/List/api.d.ts +24 -24
- package/collection/immutable/Queue/api.d.ts +16 -16
- package/collection/immutable/RoseTree/api.d.ts +14 -14
- package/collection/immutable/SortedMap/api.d.ts +41 -41
- package/collection/immutable/Vector/api.d.ts +121 -117
- package/collection/immutable/Vector/definition.d.ts +2 -2
- package/collection/immutable/Vector/internal.d.ts +2 -2
- package/collection/mutable/ListBuffer.d.ts +1 -1
- package/control/Eval/api.d.ts +12 -12
- package/control/Z/api.d.ts +68 -68
- package/control/Z/runtime.d.ts +10 -10
- package/data/Branded/derivations.d.ts +2 -2
- package/data/Cause/api/fold.d.ts +3 -3
- package/data/Cause/api.d.ts +20 -20
- package/data/Const/api.d.ts +3 -3
- package/data/Datum/api.d.ts +43 -41
- package/data/DatumEither/api.d.ts +48 -46
- package/data/Decoder/api.d.ts +2 -2
- package/data/Duration/api.d.ts +7 -7
- package/data/Either/api/align.d.ts +5 -1
- package/data/Either/api/alignWith.d.ts +2 -2
- package/data/Either/api.d.ts +40 -46
- package/data/Either/constructors.d.ts +6 -6
- package/data/Either/destructors.d.ts +2 -2
- package/data/EitherT/api.d.ts +6 -6
- package/data/Encoder/api.d.ts +73 -0
- package/data/Encoder/definition.d.ts +12 -0
- package/data/Encoder.d.ts +2 -0
- package/data/Environment/api.d.ts +14 -14
- package/data/EnvironmentPatch.d.ts +4 -4
- package/data/ExecutionStrategy.d.ts +1 -6
- package/data/Exit/api.d.ts +32 -32
- package/data/Exit/constructors.d.ts +2 -2
- package/data/FiberId/api.d.ts +2 -2
- package/data/Identity/api.d.ts +8 -8
- package/data/Interval.d.ts +11 -11
- package/data/Intervals.d.ts +11 -11
- package/data/Maybe/api.d.ts +36 -37
- package/data/Maybe/constructors.d.ts +2 -2
- package/data/Maybe/definition.d.ts +7 -3
- package/data/Maybe/destructors.d.ts +2 -2
- package/data/Predicate/api.d.ts +5 -5
- package/data/Refinement/api.d.ts +9 -9
- package/data/Struct/api.d.ts +13 -23
- package/data/Tag/constructors.d.ts +1 -2
- package/data/Tag/definition.d.ts +0 -1
- package/data/These/api.d.ts +18 -22
- package/data/These/destructors.d.ts +4 -4
- package/data/Trace/api.d.ts +2 -2
- package/data/function/api.d.ts +3 -3
- package/data/function/pipe.d.ts +7 -1
- package/data/string/api.d.ts +9 -49
- package/data.d.ts +1 -0
- package/global/api.d.ts +3 -3
- package/global.d.ts +4 -0
- package/internal/Stack.d.ts +1 -1
- package/optics/At/definition.d.ts +1 -1
- package/optics/Fold/definition.d.ts +2 -6
- package/optics/Getter/definition.d.ts +1 -1
- package/optics/Index/definition.d.ts +1 -1
- package/optics/Iso/api.d.ts +2 -2
- package/optics/Iso/definition.d.ts +2 -2
- package/optics/Lens/api.d.ts +10 -10
- package/optics/Lens/definition.d.ts +4 -4
- package/optics/Optional/api/compose.d.ts +2 -2
- package/optics/Optional/definition.d.ts +4 -8
- package/optics/Prism/api/compose.d.ts +2 -2
- package/optics/Prism/definition.d.ts +2 -2
- package/optics/Setter/definition.d.ts +2 -14
- package/optics/Traversal/api/compose.d.ts +2 -2
- package/optics/Traversal/definition.d.ts +4 -4
- package/package.json +1 -1
- package/typeclass/Alt.d.ts +1 -1
- package/typeclass/ApplicativeExcept.d.ts +2 -6
- package/typeclass/Apply.d.ts +5 -5
- package/typeclass/Chain.d.ts +4 -4
- package/typeclass/Filterable.d.ts +6 -6
- package/typeclass/FilterableWithIndex.d.ts +6 -6
- package/typeclass/Foldable.d.ts +4 -4
- package/typeclass/FoldableWithIndex.d.ts +4 -4
- package/typeclass/Functor.d.ts +2 -2
- package/typeclass/FunctorWithIndex.d.ts +1 -1
- package/typeclass/Guard/api.d.ts +7 -7
- package/typeclass/Has.d.ts +3 -3
- package/typeclass/Ord/api/contramap.d.ts +2 -2
- package/typeclass/Semialign.d.ts +14 -14
- package/typeclass/Semimonoidal.d.ts +1 -1
- package/typeclass/Traversable.d.ts +4 -6
- package/typeclass/TraversableWithIndex.d.ts +2 -2
- package/typeclass/Witherable.d.ts +3 -3
- package/typeclass/WitherableWithIndex.d.ts +5 -5
- package/types/extractions.d.ts +10 -6
- package/util/assert.d.ts +1 -1
|
@@ -4,152 +4,160 @@ import * as tsplus_module_3 from "@fncts/base/typeclass/Equatable/api";
|
|
|
4
4
|
import * as tsplus_module_4 from "@fncts/base/collection/immutable/Vector/definition";
|
|
5
5
|
import * as tsplus_module_5 from "@fncts/base/data/Maybe/constructors";
|
|
6
6
|
import * as tsplus_module_6 from "@fncts/base/collection/mutable/ListBuffer";
|
|
7
|
-
import * as tsplus_module_7 from "@fncts/base/
|
|
8
|
-
|
|
9
|
-
export const
|
|
10
|
-
export const
|
|
11
|
-
export const dropRepeatsWith_ = dropRepeatsWith_1;
|
|
7
|
+
import * as tsplus_module_7 from "@fncts/base/data/Maybe/definition";
|
|
8
|
+
export const append = append_1;
|
|
9
|
+
export const concat = concat_1;
|
|
10
|
+
export const dropRepeatsWith = dropRepeatsWith_1;
|
|
12
11
|
export const empty = empty_1;
|
|
13
12
|
export const emptyPushable = emptyPushable_1;
|
|
14
|
-
export const
|
|
15
|
-
export const
|
|
13
|
+
export const exists = exists_1;
|
|
14
|
+
export const findIndex = findIndex_1;
|
|
16
15
|
export const flatten = flatten_1;
|
|
17
|
-
export const
|
|
18
|
-
export const
|
|
19
|
-
export const
|
|
20
|
-
export const
|
|
21
|
-
export const
|
|
22
|
-
export const
|
|
23
|
-
export const
|
|
16
|
+
export const foldLeft = foldLeft_1;
|
|
17
|
+
export const foldLeftWithIndex = foldLeftWithIndex_1;
|
|
18
|
+
export const foldMapWithIndex = foldMapWithIndex_1;
|
|
19
|
+
export const foldRightWithIndex = foldRightWithIndex_1;
|
|
20
|
+
export const forEach = forEach_1;
|
|
21
|
+
export const map = map_1;
|
|
22
|
+
export const mapWithIndex = mapWithIndex_1;
|
|
24
23
|
export const mutableClone = mutableClone_1;
|
|
25
24
|
export const pop = pop_1;
|
|
26
|
-
export const
|
|
27
|
-
export const
|
|
28
|
-
export const
|
|
29
|
-
export const
|
|
30
|
-
export const
|
|
31
|
-
export const
|
|
32
|
-
export const
|
|
25
|
+
export const prepend = prepend_1;
|
|
26
|
+
export const slice = slice_1;
|
|
27
|
+
export const sortWith = sortWith_1;
|
|
28
|
+
export const splitAt = splitAt_1;
|
|
29
|
+
export const _traverseWithIndex = _traverseWithIndex_1;
|
|
30
|
+
export const unsafeFind = unsafeFind_1;
|
|
31
|
+
export const unsafeFindLast = unsafeFindLast_1;
|
|
32
|
+
export const unsafeGet = unsafeGet_1;
|
|
33
33
|
export const unsafeHead = unsafeHead_1;
|
|
34
34
|
export const unsafeLast = unsafeLast_1;
|
|
35
|
-
export const
|
|
35
|
+
export const updateAt = updateAt_1;
|
|
36
36
|
export const vector = vector_1;
|
|
37
|
-
import { affixPush, appendNodeToTree, arrayPush, branchBits, concatAffixes, concatBuffer, concatSubTree, copyArray, emptyAffix, foldLeftCb, foldLeftNode, foldLeftPrefix, foldLeftSuffix, foldRightCb, foldRightNode, foldRightPrefix, foldRightSuffix, getDepth, getHeight, getPrefixSize, getSuffixSize, handleOffset, incrementPrefix, incrementSuffix, mapAffix, mapNode, mapPrefix, mask, newAffix, newOffset, nodeNth, nodeNthDense, prependNodeToTree,
|
|
37
|
+
import { affixPush, appendNodeToTree, arrayPush, branchBits, concatAffixes, concatBuffer, concatSubTree, copyArray, emptyAffix, foldLeftCb, foldLeftNode, foldLeftPrefix, foldLeftSuffix, foldRightCb, foldRightNode, foldRightPrefix, foldRightSuffix, getDepth, getHeight, getPrefixSize, getSuffixSize, handleOffset, incrementPrefix, incrementSuffix, mapAffix, mapNode, mapPrefix, mask, newAffix, newOffset, nodeNth, nodeNthDense, prependNodeToTree, reverseArray, setDepth, setPrefix, setSizes, setSuffix, sliceLeft, sliceRight, sliceTreeVector, updateNode, zeroOffset } from "@fncts/base/collection/immutable/Vector/internal";
|
|
38
38
|
/**
|
|
39
39
|
* Appends an element to the end of a Vector and returns the new Vector.
|
|
40
40
|
*
|
|
41
41
|
* @complexity O(n)
|
|
42
42
|
*
|
|
43
|
-
* @tsplus
|
|
44
|
-
* @tsplus operator fncts.Vector +
|
|
43
|
+
* @tsplus pipeable fncts.Vector append
|
|
44
|
+
* @tsplus pipeable-operator fncts.Vector +
|
|
45
45
|
*/
|
|
46
46
|
|
|
47
|
-
function append_1(
|
|
48
|
-
|
|
47
|
+
function append_1(a) {
|
|
48
|
+
return as => {
|
|
49
|
+
const suffixSize = getSuffixSize(as);
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
if (suffixSize < 32) {
|
|
52
|
+
return new tsplus_module_1.Vector(incrementSuffix(as.bits), as.offset, as.length + 1, as.prefix, as.root, affixPush(a, as.suffix, suffixSize));
|
|
53
|
+
}
|
|
53
54
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
const newSuffix = [a];
|
|
56
|
+
const newVector = mutableClone_1(as);
|
|
57
|
+
appendNodeToTree(newVector, as.suffix);
|
|
58
|
+
newVector.suffix = newSuffix;
|
|
59
|
+
newVector.length++;
|
|
60
|
+
newVector.bits = setSuffix(1, newVector.bits);
|
|
61
|
+
return newVector;
|
|
62
|
+
};
|
|
61
63
|
}
|
|
62
64
|
/**
|
|
63
65
|
* Maps a function over a Vector and concatenates all the resulting
|
|
64
66
|
* Vectors together.
|
|
65
67
|
*
|
|
66
|
-
* @tsplus
|
|
68
|
+
* @tsplus pipeable fncts.Vector flatMap
|
|
67
69
|
*/
|
|
68
70
|
|
|
69
71
|
|
|
70
|
-
export function
|
|
71
|
-
return
|
|
72
|
+
export function flatMap(f) {
|
|
73
|
+
return ma => {
|
|
74
|
+
return flatten_1(map_1(f)(ma));
|
|
75
|
+
};
|
|
72
76
|
}
|
|
73
77
|
/**
|
|
74
78
|
* Splits the Vector into chunks of the given size.
|
|
75
79
|
*
|
|
76
|
-
* @tsplus
|
|
77
|
-
*/
|
|
78
|
-
|
|
79
|
-
export function
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
80
|
+
* @tsplus pipeable fncts.Vector chunksOf
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
export function chunksOf(size) {
|
|
84
|
+
return as => {
|
|
85
|
+
const {
|
|
86
|
+
buffer,
|
|
87
|
+
l2
|
|
88
|
+
} = foldLeft_1({
|
|
89
|
+
l2: emptyPushable_1(),
|
|
90
|
+
buffer: emptyPushable_1()
|
|
91
|
+
}, ({
|
|
92
|
+
buffer,
|
|
93
|
+
l2
|
|
94
|
+
}, elem) => {
|
|
95
|
+
tsplus_module_2.push(elem)(buffer);
|
|
96
|
+
|
|
97
|
+
if (buffer.length === size) {
|
|
98
|
+
return {
|
|
99
|
+
l2: tsplus_module_2.push(buffer)(l2),
|
|
100
|
+
buffer: emptyPushable_1()
|
|
101
|
+
};
|
|
102
|
+
} else {
|
|
103
|
+
return {
|
|
104
|
+
l2,
|
|
105
|
+
buffer
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
})(as);
|
|
109
|
+
return buffer.length === 0 ? l2 : tsplus_module_2.push(buffer)(l2);
|
|
110
|
+
};
|
|
105
111
|
}
|
|
106
112
|
|
|
107
|
-
function concat_1(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
+
function concat_1(that) {
|
|
114
|
+
return self => {
|
|
115
|
+
if (self.length === 0) {
|
|
116
|
+
return that;
|
|
117
|
+
} else if (that.length === 0) {
|
|
118
|
+
return self;
|
|
119
|
+
}
|
|
113
120
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
121
|
+
const newSize = self.length + that.length;
|
|
122
|
+
const rightSuffixSize = getSuffixSize(that);
|
|
123
|
+
let newVector = mutableClone_1(self);
|
|
117
124
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
125
|
+
if (that.root === undefined) {
|
|
126
|
+
// right is nothing but a prefix and a suffix
|
|
127
|
+
const nrOfAffixes = concatAffixes(self, that);
|
|
121
128
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
129
|
+
for (let i = 0; i < nrOfAffixes; ++i) {
|
|
130
|
+
newVector = appendNodeToTree(newVector, concatBuffer[i]);
|
|
131
|
+
newVector.length += concatBuffer[i].length; // wipe pointer, otherwise it might end up keeping the array alive
|
|
125
132
|
|
|
126
|
-
|
|
127
|
-
|
|
133
|
+
concatBuffer[i] = undefined;
|
|
134
|
+
}
|
|
128
135
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
+
newVector.length = newSize;
|
|
137
|
+
newVector.suffix = concatBuffer[nrOfAffixes];
|
|
138
|
+
newVector.bits = setSuffix(concatBuffer[nrOfAffixes].length, newVector.bits);
|
|
139
|
+
concatBuffer[nrOfAffixes] = undefined;
|
|
140
|
+
return newVector;
|
|
141
|
+
} else {
|
|
142
|
+
const leftSuffixSize = getSuffixSize(self);
|
|
136
143
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
144
|
+
if (leftSuffixSize > 0) {
|
|
145
|
+
newVector = appendNodeToTree(newVector, self.suffix.slice(0, leftSuffixSize));
|
|
146
|
+
newVector.length += leftSuffixSize;
|
|
147
|
+
}
|
|
141
148
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
149
|
+
newVector = appendNodeToTree(newVector, that.prefix.slice(0, getPrefixSize(that)).reverse());
|
|
150
|
+
const newNode = concatSubTree(newVector.root, getDepth(newVector), that.root, getDepth(that), true);
|
|
151
|
+
const newDepth = getHeight(newNode);
|
|
152
|
+
setSizes(newNode, newDepth);
|
|
153
|
+
newVector.root = newNode;
|
|
154
|
+
newVector.offset &= ~(mask << getDepth(self) * branchBits);
|
|
155
|
+
newVector.length = newSize;
|
|
156
|
+
newVector.bits = setSuffix(rightSuffixSize, setDepth(newDepth, newVector.bits));
|
|
157
|
+
newVector.suffix = that.suffix;
|
|
158
|
+
return newVector;
|
|
159
|
+
}
|
|
160
|
+
};
|
|
153
161
|
}
|
|
154
162
|
|
|
155
163
|
const containsState = {
|
|
@@ -165,34 +173,40 @@ function containsCb(value, state) {
|
|
|
165
173
|
* Otherwise it returns `false`.
|
|
166
174
|
*
|
|
167
175
|
* @complexity O(n)
|
|
168
|
-
* @tsplus
|
|
176
|
+
* @tsplus pipeable fncts.Vector contains
|
|
169
177
|
*/
|
|
170
178
|
|
|
171
179
|
|
|
172
|
-
export function
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
180
|
+
export function contains(element) {
|
|
181
|
+
return as => {
|
|
182
|
+
containsState.element = element;
|
|
183
|
+
containsState.result = false;
|
|
184
|
+
return foldLeftCb(containsCb, containsState, as).result;
|
|
185
|
+
};
|
|
176
186
|
}
|
|
177
187
|
/**
|
|
178
188
|
* Returns a new Vector without the first `n` elements.
|
|
179
189
|
*
|
|
180
190
|
* @complexity `O(log(n))`
|
|
181
|
-
* @tsplus
|
|
191
|
+
* @tsplus pipeable fncts.Vector drop
|
|
182
192
|
*/
|
|
183
193
|
|
|
184
|
-
export function
|
|
185
|
-
return
|
|
194
|
+
export function drop(n) {
|
|
195
|
+
return as => {
|
|
196
|
+
return slice_1(n, as.length)(as);
|
|
197
|
+
};
|
|
186
198
|
}
|
|
187
199
|
/**
|
|
188
200
|
* Returns a new Vector without the last `n` elements.
|
|
189
201
|
*
|
|
190
202
|
* @complexity `O(log(n))`
|
|
191
|
-
* @tsplus
|
|
203
|
+
* @tsplus pipeable fncts.Vector dropLast
|
|
192
204
|
*/
|
|
193
205
|
|
|
194
|
-
export function
|
|
195
|
-
return
|
|
206
|
+
export function dropLast(n) {
|
|
207
|
+
return as => {
|
|
208
|
+
return slice_1(0, as.length - n)(as);
|
|
209
|
+
};
|
|
196
210
|
}
|
|
197
211
|
/**
|
|
198
212
|
* Returns a new Vector without repeated elements.
|
|
@@ -202,18 +216,20 @@ export function dropLast_(as, n) {
|
|
|
202
216
|
*/
|
|
203
217
|
|
|
204
218
|
export function dropRepeats(as) {
|
|
205
|
-
return dropRepeatsWith_1(
|
|
219
|
+
return dropRepeatsWith_1(tsplus_module_3.strictEquals)(as);
|
|
206
220
|
}
|
|
207
221
|
/**
|
|
208
222
|
* Returns a new Vector without repeated elements by using the given
|
|
209
223
|
* function to determine when elements are equal.
|
|
210
224
|
*
|
|
211
225
|
* @complexity `O(n)`
|
|
212
|
-
* @tsplus
|
|
226
|
+
* @tsplus pipeable fncts.Vector dropRepeatsWith
|
|
213
227
|
*/
|
|
214
228
|
|
|
215
|
-
function dropRepeatsWith_1(
|
|
216
|
-
return
|
|
229
|
+
function dropRepeatsWith_1(predicate) {
|
|
230
|
+
return as => {
|
|
231
|
+
return foldLeft_1(emptyPushable_1(), (acc, a) => acc.length !== 0 && predicate(unsafeLast_1(acc), a) ? acc : tsplus_module_2.push(a)(acc))(as);
|
|
232
|
+
};
|
|
217
233
|
}
|
|
218
234
|
|
|
219
235
|
function findNotIndexCb(value, state) {
|
|
@@ -230,61 +246,67 @@ function findNotIndexCb(value, state) {
|
|
|
230
246
|
*
|
|
231
247
|
* @complexity `O(k + log(n))` where `k` is the number of elements
|
|
232
248
|
* satisfying the predicate.
|
|
233
|
-
* @tsplus
|
|
249
|
+
* @tsplus pipeable fncts.Vector dropWhile
|
|
234
250
|
*/
|
|
235
251
|
|
|
236
252
|
|
|
237
|
-
export function
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
253
|
+
export function dropWhile(predicate) {
|
|
254
|
+
return as => {
|
|
255
|
+
const {
|
|
256
|
+
index
|
|
257
|
+
} = foldLeftCb(findNotIndexCb, {
|
|
258
|
+
predicate,
|
|
259
|
+
index: 0
|
|
260
|
+
}, as);
|
|
261
|
+
return slice_1(index, as.length)(as);
|
|
262
|
+
};
|
|
245
263
|
}
|
|
246
264
|
|
|
247
265
|
function elemCb(value, state) {
|
|
248
266
|
return !(state.result = state.equals(value, state.element));
|
|
249
267
|
}
|
|
250
268
|
/**
|
|
251
|
-
* @tsplus
|
|
269
|
+
* @tsplus pipeable fncts.Vector elem
|
|
252
270
|
*/
|
|
253
271
|
|
|
254
272
|
|
|
255
|
-
export function
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
273
|
+
export function elem(a,
|
|
274
|
+
/** @tsplus auto */
|
|
275
|
+
E) {
|
|
276
|
+
const elemState = {
|
|
277
|
+
equals: E.equals,
|
|
278
|
+
element: undefined,
|
|
279
|
+
result: false
|
|
280
|
+
};
|
|
281
|
+
return self => {
|
|
282
|
+
elemState.element = a;
|
|
283
|
+
return foldLeftCb(elemCb, elemState, self).result;
|
|
266
284
|
};
|
|
267
285
|
}
|
|
268
286
|
/**
|
|
269
287
|
* Returns true if the two Vectors are equivalent.
|
|
270
288
|
*
|
|
271
289
|
* @complexity O(n)
|
|
272
|
-
* @tsplus
|
|
290
|
+
* @tsplus pipeable fncts.Vector equals
|
|
273
291
|
*/
|
|
274
292
|
|
|
275
|
-
export function
|
|
276
|
-
return
|
|
293
|
+
export function equals(that) {
|
|
294
|
+
return self => {
|
|
295
|
+
return tsplus_module_4.corresponds(that, tsplus_module_3.strictEquals)(self);
|
|
296
|
+
};
|
|
277
297
|
}
|
|
278
298
|
|
|
279
299
|
function everyCb(value, state) {
|
|
280
300
|
return state.result = state.predicate(value);
|
|
281
301
|
}
|
|
282
302
|
|
|
283
|
-
export function
|
|
284
|
-
return
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
303
|
+
export function every(predicate) {
|
|
304
|
+
return as => {
|
|
305
|
+
return foldLeftCb(everyCb, {
|
|
306
|
+
predicate,
|
|
307
|
+
result: true
|
|
308
|
+
}, as).result;
|
|
309
|
+
};
|
|
288
310
|
}
|
|
289
311
|
/**
|
|
290
312
|
* Creates an empty Vector.
|
|
@@ -314,27 +336,31 @@ function existsCb(value, state) {
|
|
|
314
336
|
*
|
|
315
337
|
* @complexity O(n)
|
|
316
338
|
*
|
|
317
|
-
* @tsplus
|
|
339
|
+
* @tsplus pipeable fncts.Vector exists
|
|
318
340
|
*/
|
|
319
341
|
|
|
320
342
|
|
|
321
|
-
function exists_1(
|
|
322
|
-
return
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
343
|
+
function exists_1(predicate) {
|
|
344
|
+
return as => {
|
|
345
|
+
return foldLeftCb(existsCb, {
|
|
346
|
+
predicate,
|
|
347
|
+
result: false
|
|
348
|
+
}, as).result;
|
|
349
|
+
};
|
|
326
350
|
}
|
|
327
351
|
/**
|
|
328
352
|
* Returns the _first_ element for which the predicate returns `true`.
|
|
329
353
|
* If no such element is found the function returns `undefined`.
|
|
330
354
|
*
|
|
331
355
|
* @complexity O(n)
|
|
332
|
-
* @tsplus
|
|
356
|
+
* @tsplus pipeable fncts.Vector find
|
|
333
357
|
*/
|
|
334
358
|
|
|
335
359
|
|
|
336
|
-
export function
|
|
337
|
-
return
|
|
360
|
+
export function find(predicate) {
|
|
361
|
+
return as => {
|
|
362
|
+
return tsplus_module_5.fromNullable(unsafeFind_1(predicate)(as));
|
|
363
|
+
};
|
|
338
364
|
}
|
|
339
365
|
|
|
340
366
|
function findIndexCb(value, state) {
|
|
@@ -347,32 +373,36 @@ function findIndexCb(value, state) {
|
|
|
347
373
|
* `-1`.
|
|
348
374
|
*
|
|
349
375
|
* @complexity O(n)
|
|
350
|
-
* @tsplus
|
|
376
|
+
* @tsplus pipeable fncts.Vector findIndex
|
|
351
377
|
*/
|
|
352
378
|
|
|
353
379
|
|
|
354
|
-
function findIndex_1(
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
380
|
+
function findIndex_1(predicate) {
|
|
381
|
+
return as => {
|
|
382
|
+
const {
|
|
383
|
+
found,
|
|
384
|
+
index
|
|
385
|
+
} = foldLeftCb(findIndexCb, {
|
|
386
|
+
predicate,
|
|
387
|
+
found: false,
|
|
388
|
+
index: -1
|
|
389
|
+
}, as);
|
|
390
|
+
return found ? index : -1;
|
|
391
|
+
};
|
|
364
392
|
}
|
|
365
393
|
/**
|
|
366
394
|
* Returns the _last_ element for which the predicate returns `true`.
|
|
367
395
|
* If no such element is found the function returns `undefined`.
|
|
368
396
|
*
|
|
369
397
|
* @complexity O(n)
|
|
370
|
-
* @tsplus
|
|
398
|
+
* @tsplus pipeable fncts.Vector findLast
|
|
371
399
|
*/
|
|
372
400
|
|
|
373
401
|
|
|
374
|
-
export function
|
|
375
|
-
return
|
|
402
|
+
export function findLast(predicate) {
|
|
403
|
+
return as => {
|
|
404
|
+
return tsplus_module_5.fromNullable(unsafeFindLast_1(predicate)(as));
|
|
405
|
+
};
|
|
376
406
|
}
|
|
377
407
|
/**
|
|
378
408
|
* Returns the index of the `last` element for which the predicate
|
|
@@ -380,19 +410,21 @@ export function findLast_(as, predicate) {
|
|
|
380
410
|
* `-1`.
|
|
381
411
|
*
|
|
382
412
|
* @complexity O(n)
|
|
383
|
-
* @tsplus
|
|
384
|
-
*/
|
|
385
|
-
|
|
386
|
-
export function
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
413
|
+
* @tsplus pipeable fncts.Vector findLastIndex
|
|
414
|
+
*/
|
|
415
|
+
|
|
416
|
+
export function findLastIndex(predicate) {
|
|
417
|
+
return as => {
|
|
418
|
+
const {
|
|
419
|
+
found,
|
|
420
|
+
index
|
|
421
|
+
} = foldRightCb(findIndexCb, {
|
|
422
|
+
predicate,
|
|
423
|
+
found: false,
|
|
424
|
+
index: -0
|
|
425
|
+
}, as);
|
|
426
|
+
return found ? index : -1;
|
|
427
|
+
};
|
|
396
428
|
}
|
|
397
429
|
/**
|
|
398
430
|
* Flattens a Vector of Vectors into a Vector. Note that this function does
|
|
@@ -404,7 +436,7 @@ export function findLastIndex_(as, predicate) {
|
|
|
404
436
|
*/
|
|
405
437
|
|
|
406
438
|
function flatten_1(mma) {
|
|
407
|
-
return foldLeft_1(
|
|
439
|
+
return foldLeft_1(empty_1(), (acc, a) => concat_1(a)(acc))(mma);
|
|
408
440
|
}
|
|
409
441
|
|
|
410
442
|
export function from(sequence) {
|
|
@@ -412,14 +444,14 @@ export function from(sequence) {
|
|
|
412
444
|
|
|
413
445
|
if (sequence.length > 0 && (sequence[0] !== undefined || 0 in sequence)) {
|
|
414
446
|
for (let i = 0; i < sequence.length; ++i) {
|
|
415
|
-
tsplus_module_2.push(
|
|
447
|
+
tsplus_module_2.push(sequence[i])(l);
|
|
416
448
|
}
|
|
417
449
|
} else if (Symbol.iterator in sequence) {
|
|
418
450
|
const iterator = sequence[Symbol.iterator]();
|
|
419
451
|
let cur;
|
|
420
452
|
|
|
421
453
|
while (!(cur = iterator.next()).done) {
|
|
422
|
-
tsplus_module_2.push(
|
|
454
|
+
tsplus_module_2.push(cur.value)(l);
|
|
423
455
|
}
|
|
424
456
|
}
|
|
425
457
|
|
|
@@ -428,27 +460,31 @@ export function from(sequence) {
|
|
|
428
460
|
/**
|
|
429
461
|
* Folds a function over a Vector. Left-associative.
|
|
430
462
|
*
|
|
431
|
-
* @tsplus
|
|
463
|
+
* @tsplus pipeable fncts.Vector foldLeft
|
|
432
464
|
*/
|
|
433
465
|
|
|
434
|
-
function foldLeft_1(
|
|
435
|
-
return
|
|
466
|
+
function foldLeft_1(initial, f) {
|
|
467
|
+
return fa => {
|
|
468
|
+
return foldLeftWithIndex_1(initial, (_, b, a) => f(b, a))(fa);
|
|
469
|
+
};
|
|
436
470
|
}
|
|
437
471
|
/**
|
|
438
|
-
* @tsplus
|
|
472
|
+
* @tsplus pipeable fncts.Vector foldLeftWithIndex
|
|
439
473
|
*/
|
|
440
474
|
|
|
441
475
|
|
|
442
|
-
function foldLeftWithIndex_1(
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
476
|
+
function foldLeftWithIndex_1(b, f) {
|
|
477
|
+
return fa => {
|
|
478
|
+
const suffixSize = getSuffixSize(fa);
|
|
479
|
+
const prefixSize = getPrefixSize(fa);
|
|
480
|
+
let [acc, index] = foldLeftPrefix(f, b, fa.prefix, prefixSize);
|
|
446
481
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
482
|
+
if (fa.root !== undefined) {
|
|
483
|
+
[acc, index] = foldLeftNode(f, acc, fa.root, getDepth(fa), index);
|
|
484
|
+
}
|
|
450
485
|
|
|
451
|
-
|
|
486
|
+
return foldLeftSuffix(f, acc, fa.suffix, suffixSize, index)[0];
|
|
487
|
+
};
|
|
452
488
|
}
|
|
453
489
|
/**
|
|
454
490
|
* Similar to `foldl`. But, for each element it calls the predicate function
|
|
@@ -475,78 +511,90 @@ function foldWhileCb(a, state, i) {
|
|
|
475
511
|
return true;
|
|
476
512
|
}
|
|
477
513
|
/**
|
|
478
|
-
* @tsplus
|
|
514
|
+
* @tsplus pipeable fncts.Vector foldLeftWhile
|
|
479
515
|
*/
|
|
480
516
|
|
|
481
517
|
|
|
482
|
-
export function
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
518
|
+
export function foldLeftWhile(b, cont, f) {
|
|
519
|
+
return fa => {
|
|
520
|
+
if (!cont(b)) {
|
|
521
|
+
return b;
|
|
522
|
+
}
|
|
486
523
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
524
|
+
return foldLeftCb(foldWhileCb, {
|
|
525
|
+
predicate: cont,
|
|
526
|
+
f,
|
|
527
|
+
result: b
|
|
528
|
+
}, fa).result;
|
|
529
|
+
};
|
|
492
530
|
}
|
|
493
531
|
/**
|
|
494
|
-
* @tsplus
|
|
532
|
+
* @tsplus pipeable fncts.Vector foldRightWhile
|
|
495
533
|
*/
|
|
496
534
|
|
|
497
|
-
export function
|
|
498
|
-
return
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
535
|
+
export function foldRightWhile(b, cont, f) {
|
|
536
|
+
return fa => {
|
|
537
|
+
return foldRightCb(foldWhileCb, {
|
|
538
|
+
predicate: cont,
|
|
539
|
+
result: b,
|
|
540
|
+
f: (i, b, a) => f(i, a, b)
|
|
541
|
+
}, fa).result;
|
|
542
|
+
};
|
|
503
543
|
}
|
|
504
544
|
/**
|
|
505
|
-
* @tsplus
|
|
545
|
+
* @tsplus pipeable fncts.Vector foldMap
|
|
506
546
|
*/
|
|
507
547
|
|
|
508
|
-
export function
|
|
548
|
+
export function foldMap(f,
|
|
509
549
|
/** @tsplus auto */
|
|
510
550
|
M) {
|
|
511
|
-
return
|
|
551
|
+
return self => {
|
|
552
|
+
return foldMapWithIndex_1((_, a) => f(a), M)(self);
|
|
553
|
+
};
|
|
512
554
|
}
|
|
513
555
|
/**
|
|
514
|
-
* @tsplus
|
|
556
|
+
* @tsplus pipeable fncts.Vector foldMapWithIndex
|
|
515
557
|
*/
|
|
516
558
|
|
|
517
|
-
function foldMapWithIndex_1(
|
|
559
|
+
function foldMapWithIndex_1(f,
|
|
518
560
|
/** @tsplus auto */
|
|
519
561
|
M) {
|
|
520
|
-
return
|
|
562
|
+
return self => {
|
|
563
|
+
return foldLeftWithIndex_1(M.nat, (i, b, a) => M.combine(b, f(i, a)))(self);
|
|
564
|
+
};
|
|
521
565
|
}
|
|
522
566
|
/**
|
|
523
567
|
* Folds a function over a Vector. Right-associative.
|
|
524
568
|
*
|
|
525
569
|
* @complexity O(n)
|
|
526
|
-
* @tsplus
|
|
570
|
+
* @tsplus pipeable fncts.Vector foldRight
|
|
527
571
|
*/
|
|
528
572
|
|
|
529
573
|
|
|
530
|
-
export function
|
|
531
|
-
return
|
|
574
|
+
export function foldRight(initial, f) {
|
|
575
|
+
return fa => {
|
|
576
|
+
return foldRightWithIndex_1(initial, (_, a, b) => f(a, b))(fa);
|
|
577
|
+
};
|
|
532
578
|
}
|
|
533
579
|
/**
|
|
534
580
|
* Folds a function over a Vector. Right-associative.
|
|
535
581
|
*
|
|
536
582
|
* @complexity O(n)
|
|
537
|
-
* @tsplus
|
|
583
|
+
* @tsplus pipeable fncts.Vector foldRightWithIndex
|
|
538
584
|
*/
|
|
539
585
|
|
|
540
|
-
function foldRightWithIndex_1(
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
586
|
+
function foldRightWithIndex_1(b, f) {
|
|
587
|
+
return fa => {
|
|
588
|
+
const suffixSize = getSuffixSize(fa);
|
|
589
|
+
const prefixSize = getPrefixSize(fa);
|
|
590
|
+
let [acc, j] = foldRightSuffix(f, b, fa.suffix, suffixSize, fa.length - 1);
|
|
544
591
|
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
592
|
+
if (fa.root !== undefined) {
|
|
593
|
+
[acc, j] = foldRightNode(f, acc, fa.root, getDepth(fa), j);
|
|
594
|
+
}
|
|
548
595
|
|
|
549
|
-
|
|
596
|
+
return foldRightPrefix(f, acc, fa.prefix, prefixSize, j)[0];
|
|
597
|
+
};
|
|
550
598
|
}
|
|
551
599
|
/**
|
|
552
600
|
* Invokes a given callback for each element in the Vector from left to
|
|
@@ -558,31 +606,37 @@ function foldRightWithIndex_1(fa, b, f) {
|
|
|
558
606
|
* makes `forEach` faster when the new Vector is unneeded.
|
|
559
607
|
*
|
|
560
608
|
* @complexity O(n)
|
|
561
|
-
* @tsplus
|
|
609
|
+
* @tsplus pipeable fncts.Vector forEach
|
|
562
610
|
*/
|
|
563
611
|
|
|
564
612
|
|
|
565
|
-
function forEach_1(
|
|
566
|
-
|
|
613
|
+
function forEach_1(f) {
|
|
614
|
+
return as => {
|
|
615
|
+
foldLeft_1(undefined, (_, element) => f(element))(as);
|
|
616
|
+
};
|
|
567
617
|
}
|
|
568
618
|
/**
|
|
569
|
-
* @tsplus
|
|
619
|
+
* @tsplus pipeable fncts.Vector forEachWithIndex
|
|
570
620
|
*/
|
|
571
621
|
|
|
572
622
|
|
|
573
|
-
export function
|
|
574
|
-
|
|
623
|
+
export function forEachWithIndex(f) {
|
|
624
|
+
return as => {
|
|
625
|
+
foldLeftWithIndex_1(undefined, (index, _, element) => f(index, element))(as);
|
|
626
|
+
};
|
|
575
627
|
}
|
|
576
628
|
/**
|
|
577
629
|
* Gets the nth element of the Vector. If `n` is out of bounds
|
|
578
630
|
* `undefined` is returned.
|
|
579
631
|
*
|
|
580
632
|
* @complexity O(log(n))
|
|
581
|
-
* @tsplus
|
|
633
|
+
* @tsplus pipeable fncts.Vector get
|
|
582
634
|
*/
|
|
583
635
|
|
|
584
|
-
export function
|
|
585
|
-
return
|
|
636
|
+
export function get(index) {
|
|
637
|
+
return self => {
|
|
638
|
+
return tsplus_module_5.fromNullable(unsafeGet_1(index)(self));
|
|
639
|
+
};
|
|
586
640
|
}
|
|
587
641
|
/**
|
|
588
642
|
* Returns a Vector of Vectors where each subvector's elements are pairwise
|
|
@@ -592,21 +646,23 @@ export function get_(self, index) {
|
|
|
592
646
|
* equal elements should be grouped together the Vector should be sorted
|
|
593
647
|
* before grouping.
|
|
594
648
|
*
|
|
595
|
-
* @tsplus
|
|
649
|
+
* @tsplus pipeable fncts.Vector groupWith
|
|
596
650
|
*/
|
|
597
651
|
|
|
598
|
-
export function
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
652
|
+
export function groupWith(f) {
|
|
653
|
+
return as => {
|
|
654
|
+
const result = emptyPushable_1();
|
|
655
|
+
let buffer = emptyPushable_1();
|
|
656
|
+
forEach_1(a => {
|
|
657
|
+
if (buffer.length !== 0 && !f(unsafeLast_1(buffer), a)) {
|
|
658
|
+
tsplus_module_2.push(buffer)(result);
|
|
659
|
+
buffer = emptyPushable_1();
|
|
660
|
+
}
|
|
606
661
|
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
662
|
+
tsplus_module_2.push(a)(buffer);
|
|
663
|
+
})(as);
|
|
664
|
+
return buffer.length === 0 ? result : tsplus_module_2.push(buffer)(result);
|
|
665
|
+
};
|
|
610
666
|
}
|
|
611
667
|
/**
|
|
612
668
|
* Returns the first element of the Vector.
|
|
@@ -628,47 +684,55 @@ function indexOfCb(value, state) {
|
|
|
628
684
|
* to the given element. If no such element is found `-1` is returned.
|
|
629
685
|
*
|
|
630
686
|
* @complexity O(n)
|
|
631
|
-
* @tsplus
|
|
687
|
+
* @tsplus pipeable fncts.Vector indexOf
|
|
632
688
|
*/
|
|
633
689
|
|
|
634
690
|
|
|
635
|
-
export function
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
691
|
+
export function indexOf(element) {
|
|
692
|
+
return as => {
|
|
693
|
+
const state = {
|
|
694
|
+
element,
|
|
695
|
+
found: false,
|
|
696
|
+
index: -1
|
|
697
|
+
};
|
|
698
|
+
foldLeftCb(indexOfCb, state, as);
|
|
699
|
+
return state.found ? state.index : -1;
|
|
640
700
|
};
|
|
641
|
-
foldLeftCb(indexOfCb, state, as);
|
|
642
|
-
return state.found ? state.index : -1;
|
|
643
701
|
}
|
|
644
702
|
/**
|
|
645
703
|
* Inserts the given element at the given index in the Vector.
|
|
646
704
|
*
|
|
647
705
|
* @complexity O(log(n))
|
|
648
|
-
* @tsplus
|
|
706
|
+
* @tsplus pipeable fncts.Vector insertAt
|
|
649
707
|
*/
|
|
650
708
|
|
|
651
|
-
export function
|
|
652
|
-
return
|
|
709
|
+
export function insertAt(index, element) {
|
|
710
|
+
return as => {
|
|
711
|
+
return concat_1(slice_1(index, as.length)(as))(append_1(element)(slice_1(0, index)(as)));
|
|
712
|
+
};
|
|
653
713
|
}
|
|
654
714
|
/**
|
|
655
715
|
* Inserts the given Vector of elements at the given index in the Vector.
|
|
656
716
|
*
|
|
657
717
|
* @complexity `O(log(n))`
|
|
658
|
-
* @tsplus
|
|
718
|
+
* @tsplus pipeable fncts.Vector insertAllAt
|
|
659
719
|
*/
|
|
660
720
|
|
|
661
|
-
export function
|
|
662
|
-
return
|
|
721
|
+
export function insertAllAt(index, elements) {
|
|
722
|
+
return as => {
|
|
723
|
+
return concat_1(slice_1(index, as.length)(as))(concat_1(elements)(slice_1(0, index)(as)));
|
|
724
|
+
};
|
|
663
725
|
}
|
|
664
726
|
/**
|
|
665
727
|
* Inserts a separator between each element in a Vector.
|
|
666
728
|
*
|
|
667
|
-
* @tsplus
|
|
729
|
+
* @tsplus pipeable fncts.Vector intersperse
|
|
668
730
|
*/
|
|
669
731
|
|
|
670
|
-
export function
|
|
671
|
-
return
|
|
732
|
+
export function intersperse(separator) {
|
|
733
|
+
return as => {
|
|
734
|
+
return pop_1(foldLeft_1(emptyPushable_1(), (l2, a) => tsplus_module_2.push(separator)(tsplus_module_2.push(a)(l2)))(as));
|
|
735
|
+
};
|
|
672
736
|
}
|
|
673
737
|
/**
|
|
674
738
|
* @tsplus fluent fncts.Vector isEmpty
|
|
@@ -687,11 +751,13 @@ export function isNonEmpty(l) {
|
|
|
687
751
|
/**
|
|
688
752
|
* Concatenates the strings in the Vector separated by a specified separator.
|
|
689
753
|
*
|
|
690
|
-
* @tsplus
|
|
754
|
+
* @tsplus pipeable fncts.Vector join
|
|
691
755
|
*/
|
|
692
756
|
|
|
693
|
-
export function
|
|
694
|
-
return
|
|
757
|
+
export function join(separator) {
|
|
758
|
+
return as => {
|
|
759
|
+
return foldLeft_1("", (a, b) => a.length === 0 ? b : a + separator + b)(as);
|
|
760
|
+
};
|
|
695
761
|
}
|
|
696
762
|
/**
|
|
697
763
|
* Returns the last element of the Vector.
|
|
@@ -708,17 +774,19 @@ export function last(l) {
|
|
|
708
774
|
* to the given element. If no such element is found `-1` is returned.
|
|
709
775
|
*
|
|
710
776
|
* @complexity O(n)
|
|
711
|
-
* @tsplus
|
|
777
|
+
* @tsplus pipeable fncts.Vector lastIndexOf
|
|
712
778
|
*/
|
|
713
779
|
|
|
714
|
-
export function
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
780
|
+
export function lastIndexOf(element) {
|
|
781
|
+
return as => {
|
|
782
|
+
const state = {
|
|
783
|
+
element,
|
|
784
|
+
found: false,
|
|
785
|
+
index: 0
|
|
786
|
+
};
|
|
787
|
+
foldRightCb(indexOfCb, state, as);
|
|
788
|
+
return state.found ? as.length - state.index : -1;
|
|
719
789
|
};
|
|
720
|
-
foldRightCb(indexOfCb, state, as);
|
|
721
|
-
return state.found ? as.length - state.index : -1;
|
|
722
790
|
}
|
|
723
791
|
/**
|
|
724
792
|
* Generates a new Vector by calling a function with the current index
|
|
@@ -732,44 +800,50 @@ export function makeBy(n, f) {
|
|
|
732
800
|
const l = emptyPushable_1();
|
|
733
801
|
|
|
734
802
|
for (let i = 0; i < n; i++) {
|
|
735
|
-
tsplus_module_2.push(
|
|
803
|
+
tsplus_module_2.push(f(i))(l);
|
|
736
804
|
}
|
|
737
805
|
|
|
738
806
|
return l;
|
|
739
807
|
}
|
|
740
808
|
/**
|
|
741
|
-
* @tsplus
|
|
809
|
+
* @tsplus pipeable fncts.Vector mapAccum
|
|
742
810
|
*/
|
|
743
811
|
|
|
744
|
-
export function
|
|
745
|
-
return
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
812
|
+
export function mapAccum(s, f) {
|
|
813
|
+
return fa => {
|
|
814
|
+
return foldLeft_1([emptyPushable_1(), s], ([acc, s], a) => {
|
|
815
|
+
const r = f(s, a);
|
|
816
|
+
tsplus_module_2.push(r[0])(acc);
|
|
817
|
+
return [acc, r[1]];
|
|
818
|
+
})(fa);
|
|
819
|
+
};
|
|
750
820
|
}
|
|
751
821
|
/**
|
|
752
822
|
* Applies a function to each element in the given Vector and returns a
|
|
753
823
|
* new Vector of the values that the function return.
|
|
754
824
|
*
|
|
755
825
|
* @complexity O(n)
|
|
756
|
-
* @tsplus
|
|
826
|
+
* @tsplus pipeable fncts.Vector map
|
|
757
827
|
*/
|
|
758
828
|
|
|
759
|
-
function map_1(
|
|
760
|
-
return
|
|
829
|
+
function map_1(f) {
|
|
830
|
+
return fa => {
|
|
831
|
+
return mapWithIndex_1((_, a) => f(a))(fa);
|
|
832
|
+
};
|
|
761
833
|
}
|
|
762
834
|
/**
|
|
763
835
|
* Applies a function to each element in the given Vector and returns a
|
|
764
836
|
* new Vector of the values that the function return.
|
|
765
837
|
*
|
|
766
838
|
* @complexity O(n)
|
|
767
|
-
* @tsplus
|
|
839
|
+
* @tsplus pipeable fncts.Vector mapWithIndex
|
|
768
840
|
*/
|
|
769
841
|
|
|
770
842
|
|
|
771
|
-
function mapWithIndex_1(
|
|
772
|
-
return
|
|
843
|
+
function mapWithIndex_1(f) {
|
|
844
|
+
return fa => {
|
|
845
|
+
return new tsplus_module_1.Vector(fa.bits, fa.offset, fa.length, mapPrefix(f, fa.prefix, getPrefixSize(fa)), fa.root === undefined ? undefined : mapNode(f, fa.root, getDepth(fa), getPrefixSize(fa), 1)[0], mapAffix(f, fa.suffix, getSuffixSize(fa), fa.length));
|
|
846
|
+
};
|
|
773
847
|
}
|
|
774
848
|
/**
|
|
775
849
|
* @tsplus getter fncts.Vector mutableClone
|
|
@@ -788,16 +862,18 @@ function mutableClone_1(as) {
|
|
|
788
862
|
*
|
|
789
863
|
* @complexity `O(log(n))`
|
|
790
864
|
*
|
|
791
|
-
* @tsplus
|
|
865
|
+
* @tsplus pipeable fncts.Vector modifyAt
|
|
792
866
|
*/
|
|
793
867
|
|
|
794
868
|
|
|
795
|
-
export function
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
869
|
+
export function modifyAt(i, f) {
|
|
870
|
+
return as => {
|
|
871
|
+
if (i < 0 || as.length <= i) {
|
|
872
|
+
return as;
|
|
873
|
+
}
|
|
799
874
|
|
|
800
|
-
|
|
875
|
+
return updateAt_1(i, f(unsafeGet_1(i)(as)))(as);
|
|
876
|
+
};
|
|
801
877
|
}
|
|
802
878
|
/**
|
|
803
879
|
* Returns `true` if and only if the predicate function returns
|
|
@@ -805,11 +881,13 @@ export function modifyAt_(as, i, f) {
|
|
|
805
881
|
*
|
|
806
882
|
* @complexity O(n)
|
|
807
883
|
*
|
|
808
|
-
* @tsplus
|
|
884
|
+
* @tsplus pipeable fncts.Vector none
|
|
809
885
|
*/
|
|
810
886
|
|
|
811
|
-
export function
|
|
812
|
-
return
|
|
887
|
+
export function none(predicate) {
|
|
888
|
+
return as => {
|
|
889
|
+
return !exists_1(predicate)(as);
|
|
890
|
+
};
|
|
813
891
|
}
|
|
814
892
|
/**
|
|
815
893
|
* Takes two arguments and returns a Vector that contains them.
|
|
@@ -830,31 +908,33 @@ export function pair(first, second) {
|
|
|
830
908
|
*/
|
|
831
909
|
|
|
832
910
|
function pop_1(as) {
|
|
833
|
-
return slice_1(
|
|
911
|
+
return slice_1(0, -1)(as);
|
|
834
912
|
}
|
|
835
913
|
/**
|
|
836
914
|
* Prepends an element to the front of a Vector and returns the new Vector.
|
|
837
915
|
*
|
|
838
916
|
* @complexity O(1)
|
|
839
917
|
*
|
|
840
|
-
* @tsplus
|
|
918
|
+
* @tsplus pipeable fncts.Vector prepend
|
|
841
919
|
*/
|
|
842
920
|
|
|
843
921
|
|
|
844
|
-
function prepend_1(
|
|
845
|
-
|
|
922
|
+
function prepend_1(a) {
|
|
923
|
+
return as => {
|
|
924
|
+
const prefixSize = getPrefixSize(as);
|
|
846
925
|
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
926
|
+
if (prefixSize < 32) {
|
|
927
|
+
return new tsplus_module_1.Vector(incrementPrefix(as.bits), as.offset, as.length + 1, affixPush(a, as.prefix, prefixSize), as.root, as.suffix);
|
|
928
|
+
} else {
|
|
929
|
+
const newVector = mutableClone_1(as);
|
|
930
|
+
prependNodeToTree(newVector, reverseArray(as.prefix));
|
|
931
|
+
const newPrefix = [a];
|
|
932
|
+
newVector.prefix = newPrefix;
|
|
933
|
+
newVector.length++;
|
|
934
|
+
newVector.bits = setPrefix(1, newVector.bits);
|
|
935
|
+
return newVector;
|
|
936
|
+
}
|
|
937
|
+
};
|
|
858
938
|
}
|
|
859
939
|
/**
|
|
860
940
|
* @tsplus operator fncts.Vector +
|
|
@@ -862,7 +942,7 @@ function prepend_1(as, a) {
|
|
|
862
942
|
|
|
863
943
|
|
|
864
944
|
export function prependOperator(a, as) {
|
|
865
|
-
return prepend_1(
|
|
945
|
+
return prepend_1(a)(as);
|
|
866
946
|
}
|
|
867
947
|
/**
|
|
868
948
|
* Returns a Vector of numbers between an inclusive lower bound and an exclusive upper bound.
|
|
@@ -875,7 +955,7 @@ export function range(start, end) {
|
|
|
875
955
|
const vec = emptyPushable_1();
|
|
876
956
|
|
|
877
957
|
for (let i = start; i < end; ++i) {
|
|
878
|
-
tsplus_module_2.push(
|
|
958
|
+
tsplus_module_2.push(i)(vec);
|
|
879
959
|
}
|
|
880
960
|
|
|
881
961
|
return vec;
|
|
@@ -887,11 +967,13 @@ export function range(start, end) {
|
|
|
887
967
|
*
|
|
888
968
|
* @complexity `O(log(n))`
|
|
889
969
|
*
|
|
890
|
-
* @tsplus
|
|
970
|
+
* @tsplus pipeable fncts.Vector remove
|
|
891
971
|
*/
|
|
892
972
|
|
|
893
|
-
export function
|
|
894
|
-
return
|
|
973
|
+
export function remove(from, amount) {
|
|
974
|
+
return as => {
|
|
975
|
+
return concat_1(slice_1(from + amount, as.length)(as))(slice_1(0, from)(as));
|
|
976
|
+
};
|
|
895
977
|
}
|
|
896
978
|
/**
|
|
897
979
|
* Returns a Vector of a given length that contains the specified value
|
|
@@ -906,7 +988,7 @@ export function replicate(n, a) {
|
|
|
906
988
|
const l = emptyPushable_1();
|
|
907
989
|
|
|
908
990
|
while (--t >= 0) {
|
|
909
|
-
tsplus_module_2.push(
|
|
991
|
+
tsplus_module_2.push(a)(l);
|
|
910
992
|
}
|
|
911
993
|
|
|
912
994
|
return l;
|
|
@@ -916,17 +998,19 @@ export function replicate(n, a) {
|
|
|
916
998
|
*/
|
|
917
999
|
|
|
918
1000
|
export function reverse(self) {
|
|
919
|
-
return foldLeft_1(
|
|
1001
|
+
return foldLeft_1(empty_1(), (vec, elem) => prepend_1(elem)(vec))(self);
|
|
920
1002
|
}
|
|
921
1003
|
/**
|
|
922
1004
|
* Folds a function over a Vector from left to right while collecting
|
|
923
1005
|
* all the intermediate steps in a resulting Vector.
|
|
924
1006
|
*
|
|
925
|
-
* @tsplus
|
|
1007
|
+
* @tsplus pipeable fncts.Vector scanLeft
|
|
926
1008
|
*/
|
|
927
1009
|
|
|
928
|
-
export function
|
|
929
|
-
return
|
|
1010
|
+
export function scanLeft(initial, f) {
|
|
1011
|
+
return as => {
|
|
1012
|
+
return foldLeft_1(tsplus_module_2.push(initial)(emptyPushable_1()), (l2, a) => tsplus_module_2.push(f(unsafeLast_1(l2), a))(l2))(as);
|
|
1013
|
+
};
|
|
930
1014
|
}
|
|
931
1015
|
/**
|
|
932
1016
|
* Takes a single arguments and returns a singleton Vector that contains it.
|
|
@@ -944,114 +1028,118 @@ export function single(a) {
|
|
|
944
1028
|
* from the right end of the Vector.
|
|
945
1029
|
*
|
|
946
1030
|
* @complexity `O(log(n))`
|
|
947
|
-
* @tsplus
|
|
1031
|
+
* @tsplus pipeable fncts.Vector slice
|
|
948
1032
|
*/
|
|
949
1033
|
|
|
950
|
-
function slice_1(
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
1034
|
+
function slice_1(from, to) {
|
|
1035
|
+
return as => {
|
|
1036
|
+
let {
|
|
1037
|
+
bits,
|
|
1038
|
+
length
|
|
1039
|
+
} = as;
|
|
1040
|
+
let _to = to;
|
|
1041
|
+
let _from = from;
|
|
1042
|
+
_to = Math.min(length, to); // Handle negative indices
|
|
958
1043
|
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
1044
|
+
if (_from < 0) {
|
|
1045
|
+
_from = length + from;
|
|
1046
|
+
}
|
|
962
1047
|
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
1048
|
+
if (_to < 0) {
|
|
1049
|
+
_to = length + to;
|
|
1050
|
+
} // Should we just return the empty Vector?
|
|
966
1051
|
|
|
967
1052
|
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
1053
|
+
if (_to <= _from || _to <= 0 || length <= _from) {
|
|
1054
|
+
return empty_1();
|
|
1055
|
+
} // Return Vector unchanged if we are slicing nothing off
|
|
971
1056
|
|
|
972
1057
|
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
1058
|
+
if (_from <= 0 && length <= _to) {
|
|
1059
|
+
return as;
|
|
1060
|
+
}
|
|
976
1061
|
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
1062
|
+
const newLength = _to - _from;
|
|
1063
|
+
let prefixSize = getPrefixSize(as);
|
|
1064
|
+
const suffixSize = getSuffixSize(as); // Both indices lie in the prefix
|
|
980
1065
|
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
1066
|
+
if (_to <= prefixSize) {
|
|
1067
|
+
return new tsplus_module_1.Vector(setPrefix(newLength, 0), 0, newLength, as.prefix.slice(prefixSize - _to, prefixSize - _from), undefined, emptyAffix);
|
|
1068
|
+
}
|
|
984
1069
|
|
|
985
|
-
|
|
1070
|
+
const suffixStart = length - suffixSize; // Both indices lie in the suffix
|
|
986
1071
|
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
1072
|
+
if (suffixStart <= _from) {
|
|
1073
|
+
return new tsplus_module_1.Vector(setSuffix(newLength, 0), 0, newLength, emptyAffix, undefined, as.suffix.slice(_from - suffixStart, _to - suffixStart));
|
|
1074
|
+
}
|
|
990
1075
|
|
|
991
|
-
|
|
992
|
-
|
|
1076
|
+
const newVector = mutableClone_1(as);
|
|
1077
|
+
newVector.length = newLength; // Both indices lie in the tree
|
|
993
1078
|
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
1079
|
+
if (prefixSize <= _from && _to <= suffixStart) {
|
|
1080
|
+
sliceTreeVector(_from - prefixSize + as.offset, _to - prefixSize + as.offset - 1, as.root, getDepth(as), as.offset, newVector);
|
|
1081
|
+
return newVector;
|
|
1082
|
+
}
|
|
998
1083
|
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1084
|
+
if (0 < _from) {
|
|
1085
|
+
// we need _to slice something off of the left
|
|
1086
|
+
if (_from < prefixSize) {
|
|
1087
|
+
// shorten the prefix even though it's not strictly needed,
|
|
1088
|
+
// so that referenced items can be GC'd
|
|
1089
|
+
newVector.prefix = as.prefix.slice(0, prefixSize - _from);
|
|
1090
|
+
bits = setPrefix(prefixSize - _from, bits);
|
|
1091
|
+
} else {
|
|
1092
|
+
// if we're here `_to` can't lie in the tree, so we can set the
|
|
1093
|
+
// root
|
|
1094
|
+
zeroOffset();
|
|
1095
|
+
newVector.root = sliceLeft(newVector.root, getDepth(as), _from - prefixSize, as.offset, true);
|
|
1096
|
+
newVector.offset = newOffset;
|
|
1097
|
+
|
|
1098
|
+
if (newVector.root === undefined) {
|
|
1099
|
+
bits = setDepth(0, bits);
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
bits = setPrefix(newAffix.length, bits);
|
|
1103
|
+
prefixSize = newAffix.length;
|
|
1104
|
+
newVector.prefix = newAffix;
|
|
1015
1105
|
}
|
|
1016
|
-
|
|
1017
|
-
bits = setPrefix(newAffix.length, bits);
|
|
1018
|
-
prefixSize = newAffix.length;
|
|
1019
|
-
newVector.prefix = newAffix;
|
|
1020
1106
|
}
|
|
1021
|
-
}
|
|
1022
1107
|
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1108
|
+
if (_to < length) {
|
|
1109
|
+
// we need _to slice something off of the right
|
|
1110
|
+
if (length - _to < suffixSize) {
|
|
1111
|
+
bits = setSuffix(suffixSize - (length - _to), bits); // slice the suffix even though it's not strictly needed,
|
|
1112
|
+
// _to allow the removed items _to be GC'd
|
|
1028
1113
|
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1114
|
+
newVector.suffix = as.suffix.slice(0, suffixSize - (length - _to));
|
|
1115
|
+
} else {
|
|
1116
|
+
newVector.root = sliceRight(newVector.root, getDepth(as), _to - prefixSize - 1, newVector.offset);
|
|
1032
1117
|
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1118
|
+
if (newVector.root === undefined) {
|
|
1119
|
+
bits = setDepth(0, bits);
|
|
1120
|
+
newVector.offset = 0;
|
|
1121
|
+
}
|
|
1037
1122
|
|
|
1038
|
-
|
|
1039
|
-
|
|
1123
|
+
bits = setSuffix(newAffix.length, bits);
|
|
1124
|
+
newVector.suffix = newAffix;
|
|
1125
|
+
}
|
|
1040
1126
|
}
|
|
1041
|
-
}
|
|
1042
1127
|
|
|
1043
|
-
|
|
1044
|
-
|
|
1128
|
+
newVector.bits = bits;
|
|
1129
|
+
return newVector;
|
|
1130
|
+
};
|
|
1045
1131
|
}
|
|
1046
1132
|
/**
|
|
1047
|
-
* @tsplus
|
|
1133
|
+
* @tsplus pipeable fncts.Vector sort
|
|
1048
1134
|
*/
|
|
1049
1135
|
|
|
1050
1136
|
|
|
1051
|
-
export function
|
|
1137
|
+
export function sort(
|
|
1052
1138
|
/** @tsplus auto */
|
|
1053
1139
|
O) {
|
|
1054
|
-
return
|
|
1140
|
+
return self => {
|
|
1141
|
+
return sortWith_1(O.compare)(self);
|
|
1142
|
+
};
|
|
1055
1143
|
}
|
|
1056
1144
|
/**
|
|
1057
1145
|
* Sort the given Vector by comparing values using the given function.
|
|
@@ -1062,33 +1150,35 @@ O) {
|
|
|
1062
1150
|
*
|
|
1063
1151
|
* @complexity O(n * log(n))
|
|
1064
1152
|
*
|
|
1065
|
-
* @tsplus
|
|
1066
|
-
*/
|
|
1067
|
-
|
|
1068
|
-
function sortWith_1(
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1153
|
+
* @tsplus pipeable fncts.Vector sortWith
|
|
1154
|
+
*/
|
|
1155
|
+
|
|
1156
|
+
function sortWith_1(compare) {
|
|
1157
|
+
return as => {
|
|
1158
|
+
const arr = [];
|
|
1159
|
+
let i = 0;
|
|
1160
|
+
forEach_1(elm => arr.push({
|
|
1161
|
+
idx: i++,
|
|
1162
|
+
elm
|
|
1163
|
+
}))(as);
|
|
1164
|
+
arr.sort(({
|
|
1165
|
+
elm: a,
|
|
1166
|
+
idx: i
|
|
1167
|
+
}, {
|
|
1168
|
+
elm: b,
|
|
1169
|
+
idx: j
|
|
1170
|
+
}) => {
|
|
1171
|
+
const c = compare(a, b);
|
|
1172
|
+
return c !== 0 ? c : i < j ? -1 : 1;
|
|
1173
|
+
});
|
|
1174
|
+
const newL = emptyPushable_1();
|
|
1175
|
+
|
|
1176
|
+
for (let i = 0; i < arr.length; ++i) {
|
|
1177
|
+
tsplus_module_2.push(arr[i].elm)(newL);
|
|
1178
|
+
}
|
|
1090
1179
|
|
|
1091
|
-
|
|
1180
|
+
return newL;
|
|
1181
|
+
};
|
|
1092
1182
|
}
|
|
1093
1183
|
/**
|
|
1094
1184
|
* Splits a Vector at the given index and return the two sides in a pair.
|
|
@@ -1098,12 +1188,14 @@ function sortWith_1(as, compare) {
|
|
|
1098
1188
|
*
|
|
1099
1189
|
* @complexity `O(log(n))`
|
|
1100
1190
|
*
|
|
1101
|
-
* @tsplus
|
|
1191
|
+
* @tsplus pipeable fncts.Vector splitAt
|
|
1102
1192
|
*/
|
|
1103
1193
|
|
|
1104
1194
|
|
|
1105
|
-
function splitAt_1(
|
|
1106
|
-
return
|
|
1195
|
+
function splitAt_1(index) {
|
|
1196
|
+
return as => {
|
|
1197
|
+
return [slice_1(0, index)(as), slice_1(index, as.length)(as)];
|
|
1198
|
+
};
|
|
1107
1199
|
}
|
|
1108
1200
|
/**
|
|
1109
1201
|
* Splits a Vector at the first element in the Vector for which the given
|
|
@@ -1111,13 +1203,15 @@ function splitAt_1(as, index) {
|
|
|
1111
1203
|
*
|
|
1112
1204
|
* @complexity `O(n)`
|
|
1113
1205
|
*
|
|
1114
|
-
* @tsplus
|
|
1206
|
+
* @tsplus pipeable fncts.Vector splitWhen
|
|
1115
1207
|
*/
|
|
1116
1208
|
|
|
1117
1209
|
|
|
1118
|
-
export function
|
|
1119
|
-
|
|
1120
|
-
|
|
1210
|
+
export function splitWhen(predicate) {
|
|
1211
|
+
return as => {
|
|
1212
|
+
const idx = findIndex_1(predicate)(as);
|
|
1213
|
+
return idx === -1 ? [as, empty_1()] : splitAt_1(idx)(as);
|
|
1214
|
+
};
|
|
1121
1215
|
}
|
|
1122
1216
|
/**
|
|
1123
1217
|
* Returns a new Vector with the first element removed. If the Vector is
|
|
@@ -1129,17 +1223,19 @@ export function splitWhen_(as, predicate) {
|
|
|
1129
1223
|
*/
|
|
1130
1224
|
|
|
1131
1225
|
export function tail(as) {
|
|
1132
|
-
return slice_1(
|
|
1226
|
+
return slice_1(1, as.length)(as);
|
|
1133
1227
|
}
|
|
1134
1228
|
/**
|
|
1135
1229
|
* Takes the first `n` elements from a Vector and returns them in a new Vector.
|
|
1136
1230
|
*
|
|
1137
1231
|
* @complexity `O(log(n))`
|
|
1138
|
-
* @tsplus
|
|
1232
|
+
* @tsplus pipeable fncts.Vector take
|
|
1139
1233
|
*/
|
|
1140
1234
|
|
|
1141
|
-
export function
|
|
1142
|
-
return
|
|
1235
|
+
export function take(n) {
|
|
1236
|
+
return as => {
|
|
1237
|
+
return slice_1(0, n)(as);
|
|
1238
|
+
};
|
|
1143
1239
|
}
|
|
1144
1240
|
/**
|
|
1145
1241
|
* Takes the first elements in the Vector for which the predicate returns
|
|
@@ -1148,28 +1244,32 @@ export function take_(as, n) {
|
|
|
1148
1244
|
* @complexity `O(k + log(n))` where `k` is the number of elements satisfying
|
|
1149
1245
|
* the predicate.
|
|
1150
1246
|
*
|
|
1151
|
-
* @tsplus
|
|
1247
|
+
* @tsplus pipeable fncts.Vector takeWhile
|
|
1152
1248
|
*/
|
|
1153
1249
|
|
|
1154
|
-
export function
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1250
|
+
export function takeWhile(predicate) {
|
|
1251
|
+
return as => {
|
|
1252
|
+
const {
|
|
1253
|
+
index
|
|
1254
|
+
} = foldLeftCb(findNotIndexCb, {
|
|
1255
|
+
predicate,
|
|
1256
|
+
index: 0
|
|
1257
|
+
}, as);
|
|
1258
|
+
return slice_1(0, index)(as);
|
|
1259
|
+
};
|
|
1162
1260
|
}
|
|
1163
1261
|
/**
|
|
1164
1262
|
* Takes the last `n` elements from a Vector and returns them in a new
|
|
1165
1263
|
* Vector.
|
|
1166
1264
|
*
|
|
1167
1265
|
* @complexity `O(log(n))`
|
|
1168
|
-
* @tsplus
|
|
1266
|
+
* @tsplus pipeable fncts.Vector takeLast
|
|
1169
1267
|
*/
|
|
1170
1268
|
|
|
1171
|
-
export function
|
|
1172
|
-
return
|
|
1269
|
+
export function takeLast(n) {
|
|
1270
|
+
return as => {
|
|
1271
|
+
return slice_1(as.length - n, as.length)(as);
|
|
1272
|
+
};
|
|
1173
1273
|
}
|
|
1174
1274
|
/**
|
|
1175
1275
|
* Takes the last elements in the Vector for which the predicate returns
|
|
@@ -1178,17 +1278,19 @@ export function takeLast_(as, n) {
|
|
|
1178
1278
|
* @complexity `O(k + log(n))` where `k` is the number of elements
|
|
1179
1279
|
* satisfying the predicate.
|
|
1180
1280
|
*
|
|
1181
|
-
* @tsplus
|
|
1281
|
+
* @tsplus pipeable fncts.Vector takeLastWhile
|
|
1182
1282
|
*/
|
|
1183
1283
|
|
|
1184
|
-
export function
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1284
|
+
export function takeLastWhile(predicate) {
|
|
1285
|
+
return as => {
|
|
1286
|
+
const {
|
|
1287
|
+
index
|
|
1288
|
+
} = foldRightCb(findNotIndexCb, {
|
|
1289
|
+
predicate,
|
|
1290
|
+
index: 0
|
|
1291
|
+
}, as);
|
|
1292
|
+
return slice_1(as.length - index, as.length)(as);
|
|
1293
|
+
};
|
|
1192
1294
|
}
|
|
1193
1295
|
/**
|
|
1194
1296
|
* Converts a Vector into an array.
|
|
@@ -1198,7 +1300,7 @@ export function takeLastWhile_(as, predicate) {
|
|
|
1198
1300
|
*/
|
|
1199
1301
|
|
|
1200
1302
|
export function toArray(self) {
|
|
1201
|
-
return foldLeft_1(
|
|
1303
|
+
return foldLeft_1([], arrayPush)(self);
|
|
1202
1304
|
}
|
|
1203
1305
|
/**
|
|
1204
1306
|
* Converts a Vector into a List.
|
|
@@ -1209,27 +1311,28 @@ export function toArray(self) {
|
|
|
1209
1311
|
|
|
1210
1312
|
export function toList(self) {
|
|
1211
1313
|
const buffer = new tsplus_module_6.ListBuffer();
|
|
1212
|
-
forEach_1(
|
|
1314
|
+
forEach_1(a => {
|
|
1213
1315
|
buffer.append(a);
|
|
1214
|
-
});
|
|
1316
|
+
})(self);
|
|
1215
1317
|
return buffer.toList;
|
|
1216
1318
|
}
|
|
1217
|
-
/**
|
|
1218
|
-
* @tsplus getter fncts.Vector traverseWithIndex
|
|
1219
|
-
*/
|
|
1220
1319
|
|
|
1221
|
-
|
|
1222
|
-
return foldLeftWithIndex_1(
|
|
1223
|
-
push(
|
|
1320
|
+
function _traverseWithIndex_1(self) {
|
|
1321
|
+
return G => f => foldLeftWithIndex_1(G.pure(emptyPushable_1()), (i, b, a) => G.zipWith(f(i, a), (v, b) => {
|
|
1322
|
+
tsplus_module_2.push(b)(v);
|
|
1224
1323
|
return v;
|
|
1225
|
-
}));
|
|
1226
|
-
}
|
|
1227
|
-
export const traverseWithIndex = traverseWithIndex_1;
|
|
1324
|
+
})(b))(self);
|
|
1325
|
+
}
|
|
1228
1326
|
/**
|
|
1229
1327
|
* @tsplus getter fncts.Vector traverse
|
|
1230
1328
|
*/
|
|
1231
1329
|
|
|
1232
|
-
|
|
1330
|
+
|
|
1331
|
+
export function _traverse(self) {
|
|
1332
|
+
return G => f => _traverseWithIndex_1(self)(G)((_, a) => f(a));
|
|
1333
|
+
}
|
|
1334
|
+
export const traverseWithIndex = G => f => self => _traverseWithIndex_1(self)(G)(f);
|
|
1335
|
+
export const traverse = G => f => self => _traverseWithIndex_1(self)(G)((_, a) => f(a));
|
|
1233
1336
|
/**
|
|
1234
1337
|
* Returns a new Vector without repeated elements by using the given
|
|
1235
1338
|
* Eq instance to determine when elements are equal
|
|
@@ -1239,7 +1342,7 @@ export const traverse = self => G => f => traverseWithIndex_1(self)(G)((_, a) =>
|
|
|
1239
1342
|
*/
|
|
1240
1343
|
|
|
1241
1344
|
export function uniq(as) {
|
|
1242
|
-
return E => dropRepeatsWith_1(
|
|
1345
|
+
return E => dropRepeatsWith_1(E.equals)(as);
|
|
1243
1346
|
}
|
|
1244
1347
|
/**
|
|
1245
1348
|
* @tsplus static fncts.VectorOps unfold
|
|
@@ -1252,9 +1355,9 @@ export function unfold(b, f) {
|
|
|
1252
1355
|
while (true) {
|
|
1253
1356
|
const mt = f(state);
|
|
1254
1357
|
|
|
1255
|
-
if (
|
|
1358
|
+
if (tsplus_module_7.isJust(mt)) {
|
|
1256
1359
|
const [a, b] = mt.value;
|
|
1257
|
-
tsplus_module_2.push(
|
|
1360
|
+
tsplus_module_2.push(a)(out);
|
|
1258
1361
|
state = b;
|
|
1259
1362
|
} else {
|
|
1260
1363
|
break;
|
|
@@ -1277,59 +1380,66 @@ function findCb(value, state) {
|
|
|
1277
1380
|
* If no such element is found the function returns `undefined`.
|
|
1278
1381
|
*
|
|
1279
1382
|
* @complexity O(n)
|
|
1280
|
-
* @tsplus
|
|
1383
|
+
* @tsplus pipeable fncts.Vector unsafeFind
|
|
1281
1384
|
*/
|
|
1282
1385
|
|
|
1283
1386
|
|
|
1284
|
-
function unsafeFind_1(
|
|
1285
|
-
return
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1387
|
+
function unsafeFind_1(predicate) {
|
|
1388
|
+
return as => {
|
|
1389
|
+
return foldLeftCb(findCb, {
|
|
1390
|
+
predicate,
|
|
1391
|
+
result: undefined
|
|
1392
|
+
}, as).result;
|
|
1393
|
+
};
|
|
1289
1394
|
}
|
|
1290
1395
|
/**
|
|
1291
1396
|
* Returns the _last_ element for which the predicate returns `true`.
|
|
1292
1397
|
* If no such element is found the function returns `undefined`.
|
|
1293
1398
|
*
|
|
1294
1399
|
* @complexity O(n)
|
|
1295
|
-
* @tsplus
|
|
1400
|
+
* @tsplus pipeable fncts.Vector unsafeFindLast
|
|
1296
1401
|
*/
|
|
1297
1402
|
|
|
1298
1403
|
|
|
1299
|
-
function unsafeFindLast_1(
|
|
1300
|
-
return
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1404
|
+
function unsafeFindLast_1(predicate) {
|
|
1405
|
+
return as => {
|
|
1406
|
+
return foldRightCb(findCb, {
|
|
1407
|
+
predicate,
|
|
1408
|
+
result: undefined
|
|
1409
|
+
}, as).result;
|
|
1410
|
+
};
|
|
1304
1411
|
}
|
|
1305
1412
|
/**
|
|
1306
1413
|
* Gets the nth element of the Vector. If `n` is out of bounds
|
|
1307
1414
|
* `undefined` is returned.
|
|
1308
1415
|
*
|
|
1309
1416
|
* @complexity O(log(n))
|
|
1310
|
-
* @tsplus
|
|
1417
|
+
* @tsplus pipeable fncts.Vector unsafeGet
|
|
1418
|
+
* @tsplus pipeable-index fncts.Vector
|
|
1311
1419
|
*/
|
|
1312
1420
|
|
|
1313
1421
|
|
|
1314
|
-
function unsafeGet_1(
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1422
|
+
function unsafeGet_1(index) {
|
|
1423
|
+
return l => {
|
|
1424
|
+
if (index < 0 || l.length <= index) {
|
|
1425
|
+
return undefined;
|
|
1426
|
+
}
|
|
1318
1427
|
|
|
1319
|
-
|
|
1320
|
-
|
|
1428
|
+
const prefixSize = getPrefixSize(l);
|
|
1429
|
+
const suffixSize = getSuffixSize(l);
|
|
1321
1430
|
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1431
|
+
if (index < prefixSize) {
|
|
1432
|
+
return l.prefix[prefixSize - index - 1];
|
|
1433
|
+
} else if (index >= l.length - suffixSize) {
|
|
1434
|
+
return l.suffix[index - (l.length - suffixSize)];
|
|
1435
|
+
}
|
|
1327
1436
|
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1437
|
+
const {
|
|
1438
|
+
offset
|
|
1439
|
+
} = l;
|
|
1440
|
+
const depth = getDepth(l);
|
|
1441
|
+
return l.root.sizes === undefined ? nodeNthDense(l.root, depth, offset === 0 ? index - prefixSize : handleOffset(depth, offset, index - prefixSize)) : nodeNth(l.root, depth, offset, index - prefixSize);
|
|
1442
|
+
};
|
|
1333
1443
|
}
|
|
1334
1444
|
/**
|
|
1335
1445
|
* Returns the first element of the Vector. If the Vector is empty the
|
|
@@ -1363,32 +1473,34 @@ function unsafeLast_1(l) {
|
|
|
1363
1473
|
* If the index is out of bounds the given Vector is returned unchanged.
|
|
1364
1474
|
*
|
|
1365
1475
|
* @complexity O(log(n))
|
|
1366
|
-
* @tsplus
|
|
1476
|
+
* @tsplus pipeable fncts.Vector updateAt
|
|
1367
1477
|
*/
|
|
1368
1478
|
|
|
1369
1479
|
|
|
1370
|
-
function updateAt_1(
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1480
|
+
function updateAt_1(i, a) {
|
|
1481
|
+
return as => {
|
|
1482
|
+
if (i < 0 || as.length <= i) {
|
|
1483
|
+
return as;
|
|
1484
|
+
}
|
|
1374
1485
|
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
if (i < prefixSize) {
|
|
1380
|
-
const newPrefix = copyArray(newVector.prefix);
|
|
1381
|
-
newPrefix[newPrefix.length - i - 1] = a;
|
|
1382
|
-
newVector.prefix = newPrefix;
|
|
1383
|
-
} else if (i >= as.length - suffixSize) {
|
|
1384
|
-
const newSuffix = copyArray(newVector.suffix);
|
|
1385
|
-
newSuffix[i - (as.length - suffixSize)] = a;
|
|
1386
|
-
newVector.suffix = newSuffix;
|
|
1387
|
-
} else {
|
|
1388
|
-
newVector.root = updateNode(as.root, getDepth(as), i - prefixSize, as.offset, a);
|
|
1389
|
-
}
|
|
1486
|
+
const prefixSize = getPrefixSize(as);
|
|
1487
|
+
const suffixSize = getSuffixSize(as);
|
|
1488
|
+
const newVector = mutableClone_1(as);
|
|
1390
1489
|
|
|
1391
|
-
|
|
1490
|
+
if (i < prefixSize) {
|
|
1491
|
+
const newPrefix = copyArray(newVector.prefix);
|
|
1492
|
+
newPrefix[newPrefix.length - i - 1] = a;
|
|
1493
|
+
newVector.prefix = newPrefix;
|
|
1494
|
+
} else if (i >= as.length - suffixSize) {
|
|
1495
|
+
const newSuffix = copyArray(newVector.suffix);
|
|
1496
|
+
newSuffix[i - (as.length - suffixSize)] = a;
|
|
1497
|
+
newVector.suffix = newSuffix;
|
|
1498
|
+
} else {
|
|
1499
|
+
newVector.root = updateNode(as.root, getDepth(as), i - prefixSize, as.offset, a);
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
return newVector;
|
|
1503
|
+
};
|
|
1392
1504
|
}
|
|
1393
1505
|
/**
|
|
1394
1506
|
* @tsplus static fncts.VectorOps __call
|
|
@@ -1399,7 +1511,7 @@ function vector_1(...elements) {
|
|
|
1399
1511
|
const v = emptyPushable_1();
|
|
1400
1512
|
|
|
1401
1513
|
for (const element of elements) {
|
|
1402
|
-
tsplus_module_2.push(
|
|
1514
|
+
tsplus_module_2.push(element)(v);
|
|
1403
1515
|
}
|
|
1404
1516
|
|
|
1405
1517
|
return v;
|