@mojir/lits 2.1.40 → 2.2.0
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/README.md +25 -24
- package/dist/cli/cli.js +21071 -20546
- package/dist/cli/reference/api.d.ts +32 -18
- package/dist/cli/reference/index.d.ts +129 -209
- package/dist/cli/src/builtin/bindingNode.d.ts +1 -1
- package/dist/cli/src/builtin/core/vector.d.ts +2 -0
- package/dist/cli/src/builtin/interface.d.ts +23 -23
- package/dist/cli/src/builtin/modules/bitwise/index.d.ts +2 -0
- package/dist/cli/src/builtin/modules/collection/index.d.ts +2 -0
- package/dist/cli/src/builtin/modules/functional/index.d.ts +2 -0
- package/dist/cli/src/builtin/modules/math/index.d.ts +2 -0
- package/dist/cli/src/builtin/modules/sequence/index.d.ts +2 -0
- package/dist/cli/src/builtin/modules/string/index.d.ts +2 -0
- package/dist/cli/src/parser/Parser.d.ts +1 -1
- package/dist/cli/src/parser/types.d.ts +1 -1
- package/dist/cli/src/tokenizer/token.d.ts +2 -2
- package/dist/full.esm.js +1 -1
- package/dist/full.esm.js.map +1 -1
- package/dist/full.js +1 -1
- package/dist/full.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lits.iife.js +1 -1
- package/dist/lits.iife.js.map +1 -1
- package/dist/modules/assert.esm.js +1 -1
- package/dist/modules/assert.esm.js.map +1 -1
- package/dist/modules/assert.js +1 -1
- package/dist/modules/assert.js.map +1 -1
- package/dist/modules/bitwise.esm.js +2 -0
- package/dist/modules/bitwise.esm.js.map +1 -0
- package/dist/modules/bitwise.js +2 -0
- package/dist/modules/bitwise.js.map +1 -0
- package/dist/modules/collection.esm.js +2 -0
- package/dist/modules/collection.esm.js.map +1 -0
- package/dist/modules/collection.js +2 -0
- package/dist/modules/collection.js.map +1 -0
- package/dist/modules/functional.esm.js +2 -0
- package/dist/modules/functional.esm.js.map +1 -0
- package/dist/modules/functional.js +2 -0
- package/dist/modules/functional.js.map +1 -0
- package/dist/modules/grid.esm.js +1 -1
- package/dist/modules/grid.esm.js.map +1 -1
- package/dist/modules/grid.js +1 -1
- package/dist/modules/grid.js.map +1 -1
- package/dist/modules/linear-algebra.esm.js +2 -0
- package/dist/modules/linear-algebra.esm.js.map +1 -0
- package/dist/modules/linear-algebra.js +2 -0
- package/dist/modules/linear-algebra.js.map +1 -0
- package/dist/modules/math.esm.js +2 -0
- package/dist/modules/math.esm.js.map +1 -0
- package/dist/modules/math.js +2 -0
- package/dist/modules/math.js.map +1 -0
- package/dist/modules/matrix.esm.js +1 -1
- package/dist/modules/matrix.esm.js.map +1 -1
- package/dist/modules/matrix.js +1 -1
- package/dist/modules/matrix.js.map +1 -1
- package/dist/modules/number-theory.esm.js +2 -0
- package/dist/modules/number-theory.esm.js.map +1 -0
- package/dist/modules/number-theory.js +2 -0
- package/dist/modules/number-theory.js.map +1 -0
- package/dist/modules/random.esm.js +1 -1
- package/dist/modules/random.esm.js.map +1 -1
- package/dist/modules/random.js +1 -1
- package/dist/modules/random.js.map +1 -1
- package/dist/modules/reference/api.d.ts +32 -18
- package/dist/modules/reference/index.d.ts +129 -209
- package/dist/modules/sequence.esm.js +2 -0
- package/dist/modules/sequence.esm.js.map +1 -0
- package/dist/modules/sequence.js +2 -0
- package/dist/modules/sequence.js.map +1 -0
- package/dist/modules/src/builtin/bindingNode.d.ts +1 -1
- package/dist/modules/src/builtin/core/vector.d.ts +2 -0
- package/dist/modules/src/builtin/interface.d.ts +23 -23
- package/dist/modules/src/builtin/modules/bitwise/index.d.ts +2 -0
- package/dist/modules/src/builtin/modules/collection/index.d.ts +2 -0
- package/dist/modules/src/builtin/modules/functional/index.d.ts +2 -0
- package/dist/modules/src/builtin/modules/math/index.d.ts +2 -0
- package/dist/modules/src/builtin/modules/sequence/index.d.ts +2 -0
- package/dist/modules/src/builtin/modules/string/index.d.ts +2 -0
- package/dist/modules/src/full.d.ts +6 -16
- package/dist/modules/src/modules/bitwise.d.ts +2 -0
- package/dist/modules/src/modules/collection.d.ts +2 -0
- package/dist/modules/src/modules/functional.d.ts +2 -0
- package/dist/modules/src/modules/linear-algebra.d.ts +2 -0
- package/dist/modules/src/modules/math.d.ts +2 -0
- package/dist/modules/src/modules/number-theory.d.ts +2 -0
- package/dist/modules/src/modules/sequence.d.ts +2 -0
- package/dist/modules/src/modules/string.d.ts +2 -0
- package/dist/modules/src/parser/Parser.d.ts +1 -1
- package/dist/modules/src/parser/types.d.ts +1 -1
- package/dist/modules/src/tokenizer/token.d.ts +2 -2
- package/dist/modules/string.esm.js +2 -0
- package/dist/modules/string.esm.js.map +1 -0
- package/dist/modules/string.js +2 -0
- package/dist/modules/string.js.map +1 -0
- package/dist/modules/vector.esm.js +1 -1
- package/dist/modules/vector.esm.js.map +1 -1
- package/dist/modules/vector.js +1 -1
- package/dist/modules/vector.js.map +1 -1
- package/dist/reference/api.d.ts +32 -18
- package/dist/reference/index.d.ts +129 -209
- package/dist/src/builtin/bindingNode.d.ts +1 -1
- package/dist/src/builtin/core/vector.d.ts +2 -0
- package/dist/src/builtin/interface.d.ts +23 -23
- package/dist/src/builtin/modules/bitwise/index.d.ts +2 -0
- package/dist/src/builtin/modules/collection/index.d.ts +2 -0
- package/dist/src/builtin/modules/functional/index.d.ts +2 -0
- package/dist/src/builtin/modules/math/index.d.ts +2 -0
- package/dist/src/builtin/modules/sequence/index.d.ts +2 -0
- package/dist/src/builtin/modules/string/index.d.ts +2 -0
- package/dist/src/full.d.ts +6 -16
- package/dist/src/modules/bitwise.d.ts +2 -0
- package/dist/src/modules/collection.d.ts +2 -0
- package/dist/src/modules/functional.d.ts +2 -0
- package/dist/src/modules/linear-algebra.d.ts +2 -0
- package/dist/src/modules/math.d.ts +2 -0
- package/dist/src/modules/number-theory.d.ts +2 -0
- package/dist/src/modules/sequence.d.ts +2 -0
- package/dist/src/modules/string.d.ts +2 -0
- package/dist/src/parser/Parser.d.ts +1 -1
- package/dist/src/parser/types.d.ts +1 -1
- package/dist/src/tokenizer/token.d.ts +2 -2
- package/dist/testFramework.esm.js +1 -1
- package/dist/testFramework.esm.js.map +1 -1
- package/dist/testFramework.js +1 -1
- package/dist/testFramework.js.map +1 -1
- package/package.json +39 -9
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/max.d.ts +0 -2
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/min.d.ts +0 -2
- package/dist/modules/linearAlgebra.esm.js +0 -2
- package/dist/modules/linearAlgebra.esm.js.map +0 -1
- package/dist/modules/linearAlgebra.js +0 -2
- package/dist/modules/linearAlgebra.js.map +0 -1
- package/dist/modules/numberTheory.esm.js +0 -2
- package/dist/modules/numberTheory.esm.js.map +0 -1
- package/dist/modules/numberTheory.js +0 -2
- package/dist/modules/numberTheory.js.map +0 -1
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/max.d.ts +0 -2
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/min.d.ts +0 -2
- package/dist/modules/src/modules/linearAlgebra.d.ts +0 -2
- package/dist/modules/src/modules/numberTheory.d.ts +0 -2
- package/dist/src/builtin/modules/vector/reductionFunctions/max.d.ts +0 -2
- package/dist/src/builtin/modules/vector/reductionFunctions/min.d.ts +0 -2
- package/dist/src/modules/linearAlgebra.d.ts +0 -2
- package/dist/src/modules/numberTheory.d.ts +0 -2
- /package/dist/cli/src/builtin/modules/{linearAlgebra → linear-algebra}/docs.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/calcFractionalRanks.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/collinear.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/corrleation.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/covariance.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/dot.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/gaussJordanElimination.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/getUnit.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/isZeroVector.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/kendallTau.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/length.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/pearsonCorr.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/scale.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/solve.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/subtract.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{linearAlgebra → linear-algebra}/index.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/binomialCefficient.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/combinations.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/derangements.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/divisors.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/docs.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/factorial.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/index.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/partitions.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/permutations.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/powerSet.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/primeFactors.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/abundant.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/arithmetic.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/bell.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/bernoulli.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/catalan.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/collatz.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/composite.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/deficient.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/factorial.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/fibonacci.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/geometric.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/golomb.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/happy.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/index.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/juggler.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/lookAndSay.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/lucas.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/lucky.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/mersenne.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/padovan.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/partition.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/pell.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/perfect.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/perfectCube.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/perfectPower.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/perfectSquare.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/poligonal.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/prime.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/recaman.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/sylvester.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/thueMorse.d.ts +0 -0
- /package/dist/cli/src/builtin/modules/{numberTheory → number-theory}/sequences/tribonacci.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{linearAlgebra → linear-algebra}/docs.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/calcFractionalRanks.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/collinear.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/corrleation.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/covariance.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/dot.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/gaussJordanElimination.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/getUnit.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/isZeroVector.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/kendallTau.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/length.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/pearsonCorr.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/scale.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/solve.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/subtract.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{linearAlgebra → linear-algebra}/index.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/binomialCefficient.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/combinations.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/derangements.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/divisors.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/docs.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/factorial.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/index.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/partitions.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/permutations.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/powerSet.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/primeFactors.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/abundant.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/arithmetic.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/bell.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/bernoulli.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/catalan.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/collatz.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/composite.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/deficient.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/factorial.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/fibonacci.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/geometric.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/golomb.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/happy.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/index.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/juggler.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/lookAndSay.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/lucas.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/lucky.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/mersenne.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/padovan.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/partition.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/pell.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/perfect.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/perfectCube.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/perfectPower.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/perfectSquare.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/poligonal.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/prime.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/recaman.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/sylvester.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/thueMorse.d.ts +0 -0
- /package/dist/modules/src/builtin/modules/{numberTheory → number-theory}/sequences/tribonacci.d.ts +0 -0
- /package/dist/src/builtin/modules/{linearAlgebra → linear-algebra}/docs.d.ts +0 -0
- /package/dist/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/calcFractionalRanks.d.ts +0 -0
- /package/dist/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/collinear.d.ts +0 -0
- /package/dist/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/corrleation.d.ts +0 -0
- /package/dist/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/covariance.d.ts +0 -0
- /package/dist/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/dot.d.ts +0 -0
- /package/dist/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/gaussJordanElimination.d.ts +0 -0
- /package/dist/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/getUnit.d.ts +0 -0
- /package/dist/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/isZeroVector.d.ts +0 -0
- /package/dist/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/kendallTau.d.ts +0 -0
- /package/dist/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/length.d.ts +0 -0
- /package/dist/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/pearsonCorr.d.ts +0 -0
- /package/dist/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/scale.d.ts +0 -0
- /package/dist/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/solve.d.ts +0 -0
- /package/dist/src/builtin/modules/{linearAlgebra → linear-algebra}/helpers/subtract.d.ts +0 -0
- /package/dist/src/builtin/modules/{linearAlgebra → linear-algebra}/index.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/binomialCefficient.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/combinations.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/derangements.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/divisors.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/docs.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/factorial.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/index.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/partitions.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/permutations.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/powerSet.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/primeFactors.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/abundant.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/arithmetic.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/bell.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/bernoulli.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/catalan.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/collatz.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/composite.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/deficient.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/factorial.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/fibonacci.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/geometric.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/golomb.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/happy.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/index.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/juggler.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/lookAndSay.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/lucas.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/lucky.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/mersenne.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/padovan.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/partition.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/pell.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/perfect.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/perfectCube.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/perfectPower.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/perfectSquare.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/poligonal.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/prime.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/recaman.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/sylvester.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/thueMorse.d.ts +0 -0
- /package/dist/src/builtin/modules/{numberTheory → number-theory}/sequences/tribonacci.d.ts +0 -0
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/utils/debug/getCodeMarker.ts","../src/errors.ts","../src/constants/constants.ts","../src/utils/symbols.ts","../src/utils/debug/debugTools.ts","../src/utils/debug/getSourceCodeInfo.ts","../src/utils/getAssertionError.ts","../src/typeGuards/index.ts","../src/typeGuards/litsFunction.ts","../src/typeGuards/number.ts","../src/typeGuards/lits.ts","../src/utils/arity.ts","../src/builtin/core/bitwise.ts","../src/typeGuards/string.ts","../src/utils/index.ts","../src/typeGuards/array.ts","../src/builtin/core/collection.ts","../src/builtin/core/array.ts","../src/builtin/core/sequence.ts","../src/typeGuards/annotatedArrays.ts","../src/builtin/core/math.ts","../src/builtin/core/misc.ts","../src/builtin/core/object.ts","../src/builtin/core/predicates.ts","../src/builtin/core/regexp.ts","../src/builtin/core/string.ts","../src/builtin/core/functional.ts","../src/utils/docString/generateDocString.ts","../src/builtin/core/meta.ts","../src/builtin/normalExpressions/index.ts","../src/builtin/specialExpressions/and.ts"],"sourcesContent":["import type { SourceCodeInfo } from '../../tokenizer/token'\n\nexport function getCodeMarker(sourceCodeInfo: SourceCodeInfo): string {\n if (!sourceCodeInfo.position || !sourceCodeInfo.code)\n return ''\n\n const leftPadding = sourceCodeInfo.position.column - 1\n const rightPadding = sourceCodeInfo.code.length - leftPadding - 1\n return `${' '.repeat(Math.max(leftPadding, 0))}^${' '.repeat(Math.max(rightPadding, 0))}`\n}\n","import { getCodeMarker } from '../src/utils/debug/getCodeMarker'\nimport type { Arr } from './interface'\nimport type { SourceCodeInfo } from './tokenizer/token'\n\nfunction getLitsErrorMessage(message: string, sourceCodeInfo?: SourceCodeInfo) {\n if (!sourceCodeInfo) {\n return message\n }\n const location = `${sourceCodeInfo.position.line}:${sourceCodeInfo.position.column}`\n const filePathLine = sourceCodeInfo.filePath\n ? `\\n${sourceCodeInfo.filePath}:${location}`\n : `\\nLocation ${location}`\n const codeLine = `\\n${sourceCodeInfo.code}`\n const codeMarker = `\\n${getCodeMarker(sourceCodeInfo)}`\n return `${message}${filePathLine}${codeLine}${codeMarker}`\n}\n\nexport class RecurSignal extends Error {\n public params: Arr\n constructor(params: Arr) {\n super(`recur, params: ${params}`)\n Object.setPrototypeOf(this, RecurSignal.prototype)\n this.name = 'RecurSignal'\n this.params = params\n }\n}\n\nexport class LitsError extends Error {\n public readonly sourceCodeInfo?: SourceCodeInfo\n public readonly shortMessage: string\n constructor(err: unknown, sourceCodeInfo: SourceCodeInfo | undefined) {\n const message = err instanceof Error\n ? err.message\n : `${err}`\n\n super(getLitsErrorMessage(message, sourceCodeInfo))\n this.shortMessage = message\n this.sourceCodeInfo = sourceCodeInfo\n Object.setPrototypeOf(this, LitsError.prototype)\n this.name = 'LitsError'\n }\n\n public getCodeMarker(): string | undefined {\n return this.sourceCodeInfo && getCodeMarker(this.sourceCodeInfo)\n }\n}\n\nexport class UserDefinedError extends LitsError {\n public userMessage: string\n constructor(message: string, sourceCodeInfo?: SourceCodeInfo) {\n super(message, sourceCodeInfo)\n this.userMessage = message\n Object.setPrototypeOf(this, UserDefinedError.prototype)\n this.name = 'UserDefinedError'\n }\n}\n\nexport class AssertionError extends LitsError {\n constructor(message: string | Error, sourceCodeInfo?: SourceCodeInfo) {\n super(message, sourceCodeInfo)\n Object.setPrototypeOf(this, AssertionError.prototype)\n this.name = 'AssertionError'\n }\n}\n\nexport class UndefinedSymbolError extends LitsError {\n public symbol: string\n constructor(symbolName: string, sourceCodeInfo?: SourceCodeInfo) {\n const message = `Undefined symbol '${symbolName}'.`\n super(message, sourceCodeInfo)\n this.symbol = symbolName\n Object.setPrototypeOf(this, UndefinedSymbolError.prototype)\n this.name = 'UndefinedSymbolError'\n }\n}\n\nexport function isLitsError(error: unknown): error is LitsError {\n return error instanceof LitsError\n}\n","export const NodeTypes = {\n Number: 1,\n String: 2,\n NormalExpression: 3,\n SpecialExpression: 4,\n UserDefinedSymbol: 5,\n NormalBuiltinSymbol: 6,\n SpecialBuiltinSymbol: 7,\n ReservedSymbol: 8,\n Binding: 9,\n Spread: 10,\n} as const\n\nconst NodeTypesSet = new Set(Object.values(NodeTypes))\n\nexport type NodeType = typeof NodeTypes[keyof typeof NodeTypes]\n\nexport function getNodeTypeName(type: NodeType): keyof typeof NodeTypes {\n return Object.keys(NodeTypes).find(key => NodeTypes[key as keyof typeof NodeTypes] === type) as keyof typeof NodeTypes\n}\n\n// TODO, is this needed?\nexport function isNodeType(type: unknown): type is NodeType {\n return typeof type === 'number' && NodeTypesSet.has(type as NodeType)\n}\n\nconst functionTypes = [\n 'UserDefined',\n 'Partial',\n 'Comp',\n 'Constantly',\n 'Juxt',\n 'Complement',\n 'EveryPred',\n 'SomePred',\n 'Fnull',\n 'Builtin',\n 'SpecialBuiltin',\n 'NativeJsFunction',\n 'Module',\n] as const\n\nconst functionTypeSet = new Set(functionTypes)\n\nexport type FunctionType = typeof functionTypes[number]\n\nexport function isFunctionType(type: unknown): type is FunctionType {\n return typeof type === 'string' && functionTypeSet.has(type as FunctionType)\n}\n","export const FUNCTION_SYMBOL = '^^fn^^'\nexport const REGEXP_SYMBOL = '^^re^^'\n","import { getNodeTypeName, isFunctionType, isNodeType } from '../../constants/constants'\nimport type { LitsFunction, Node } from '../../parser/types'\nimport { FUNCTION_SYMBOL } from '../symbols'\n\nfunction isLitsFunction(func: unknown): func is LitsFunction {\n if (func === null || typeof func !== 'object')\n return false\n\n return FUNCTION_SYMBOL in func && 'functionType' in func && isFunctionType(func.functionType)\n}\n\nfunction isNode(value: unknown): value is Node {\n if (!Array.isArray(value) || value.length < 2)\n return false\n return isNodeType(value[0])\n}\n\nexport function valueToString(value: unknown): string {\n if (isLitsFunction(value))\n // eslint-disable-next-line ts/no-unsafe-member-access\n return `<function ${(value as any).name || '\\u03BB'}>`\n\n if (isNode(value))\n return `${getNodeTypeName(value[0])}-node`\n\n if (value === null)\n return 'null'\n\n if (typeof value === 'object' && value instanceof RegExp)\n return `${value}`\n\n if (typeof value === 'object' && value instanceof Error)\n return value.toString()\n\n return JSON.stringify(value)\n}\n","import type { SourceCodeInfo } from '../../tokenizer/token'\n\nexport function getSourceCodeInfo(anyValue: any, sourceCodeInfo: SourceCodeInfo | undefined): SourceCodeInfo | undefined {\n // eslint-disable-next-line ts/no-unsafe-return, ts/no-unsafe-member-access\n return anyValue?.sourceCodeInfo ?? sourceCodeInfo\n}\n","import { LitsError } from '../errors'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { valueToString } from './debug/debugTools'\nimport { getSourceCodeInfo } from './debug/getSourceCodeInfo'\n\nexport function getAssertionError(typeName: string, value: unknown, sourceCodeInfo?: SourceCodeInfo): LitsError {\n return new LitsError(`Expected ${typeName}, got ${valueToString(value)}.`, getSourceCodeInfo(value, sourceCodeInfo))\n}\n","import { LitsError } from '../errors'\nimport type { UnknownRecord } from '../interface'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { valueToString } from '../utils/debug/debugTools'\nimport { getSourceCodeInfo } from '../utils/debug/getSourceCodeInfo'\n\nexport function isNonUndefined<T>(value: T | undefined): value is T {\n return value !== undefined\n}\n\nexport function asNonUndefined<T>(value: T | undefined, sourceCodeInfo?: SourceCodeInfo): T {\n assertNonUndefined(value, sourceCodeInfo)\n return value\n}\n\nexport function assertNonUndefined<T>(value: T | undefined, sourceCodeInfo?: SourceCodeInfo): asserts value is T {\n if (!isNonUndefined(value))\n throw new LitsError('Unexpected undefined', getSourceCodeInfo(value, sourceCodeInfo))\n}\n\nexport function isUnknownRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === 'object' && !Array.isArray(value)\n}\n\nexport function assertUnknownRecord(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is UnknownRecord {\n if (!isUnknownRecord(value)) {\n throw new LitsError(\n `Expected ${'UnknownRecord'}, got ${valueToString(value)}.`,\n getSourceCodeInfo(value, sourceCodeInfo),\n )\n }\n}\n\nexport function asUnknownRecord(value: unknown, sourceCodeInfo?: SourceCodeInfo): UnknownRecord {\n assertUnknownRecord(value, sourceCodeInfo)\n return value\n}\n","import type { LitsFunction, NativeJsFunction, NormalBuiltinFunction, UserDefinedFunction } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\nimport { FUNCTION_SYMBOL } from '../utils/symbols'\nimport { isUnknownRecord } from '.'\n\nexport function isLitsFunction(value: unknown): value is LitsFunction {\n if (value === null || typeof value !== 'object')\n return false\n\n return !!(value as LitsFunction)[FUNCTION_SYMBOL]\n}\nexport function asLitsFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): LitsFunction {\n assertLitsFunction(value, sourceCodeInfo)\n return value\n}\nexport function assertLitsFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is LitsFunction {\n if (!isLitsFunction(value))\n throw getAssertionError('LitsFunction', value, sourceCodeInfo)\n}\n\nexport function isUserDefinedFunction(value: unknown): value is UserDefinedFunction {\n return isLitsFunction(value) && value.functionType === 'UserDefined'\n}\nexport function asUserDefinedFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): UserDefinedFunction {\n assertUserDefinedFunction(value, sourceCodeInfo)\n return value\n}\nexport function assertUserDefinedFunction(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is UserDefinedFunction {\n if (!isUserDefinedFunction(value))\n throw getAssertionError('NativeJsFunction', value, sourceCodeInfo)\n}\n\nexport function isNativeJsFunction(value: unknown): value is NativeJsFunction {\n return isLitsFunction(value) && value.functionType === 'NativeJsFunction'\n}\nexport function asNativeJsFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): NativeJsFunction {\n assertNativeJsFunction(value, sourceCodeInfo)\n return value\n}\nexport function assertNativeJsFunction(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is NativeJsFunction {\n if (!isNativeJsFunction(value))\n throw getAssertionError('NativeJsFunction', value, sourceCodeInfo)\n}\n\nexport function isBuiltinFunction(value: unknown): value is NormalBuiltinFunction {\n return isUnknownRecord(value) && value.functionType === 'Builtin'\n}\n","import { LitsError } from '../errors'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { valueToString } from '../utils/debug/debugTools'\nimport { getSourceCodeInfo } from '../utils/debug/getSourceCodeInfo'\n\ntype SignOptions =\n | {\n positive?: true\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: true\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: true\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: true\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: true\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: true\n }\n\ntype GtOptions =\n | {\n gt?: number\n gte?: never\n }\n | {\n gt?: never\n gte?: number\n }\n\ntype LtOptions =\n | {\n lt?: number\n lte?: never\n }\n | {\n lt?: never\n lte?: number\n }\n\ntype NumberOptions = {\n integer?: true\n finite?: true\n} & SignOptions &\nGtOptions &\nLtOptions\n\nfunction getRangeString(options: NumberOptions): string {\n const hasUpperAndLowerBound\n = (typeof options.gt === 'number' || typeof options.gte === 'number')\n && (typeof options.lt === 'number' || typeof options.lte === 'number')\n if (hasUpperAndLowerBound) {\n return `${typeof options.gt === 'number' ? `${options.gt} < n ` : `${options.gte} <= n `}${\n typeof options.lt === 'number' ? `< ${options.lt}` : `<= ${options.lte}`\n }`\n }\n else if (typeof options.gt === 'number' || typeof options.gte === 'number') {\n return `${typeof options.gt === 'number' ? `n > ${options.gt}` : `n >= ${options.gte}`}`\n }\n else if (typeof options.lt === 'number' || typeof options.lte === 'number') {\n return `${typeof options.lt === 'number' ? `n < ${options.lt}` : `n <= ${options.lte}`}`\n }\n else { return '' }\n}\n\nfunction getSignString(options: NumberOptions): string {\n return options.positive\n ? 'positive'\n : options.negative\n ? 'negative'\n : options.nonNegative\n ? 'non negative'\n : options.nonPositive\n ? 'non positive'\n : options.nonZero\n ? 'non zero'\n : ''\n}\n\nfunction getNumberTypeName(options: NumberOptions): string {\n if (options.zero)\n return 'zero'\n\n const sign = getSignString(options)\n const numberType = options.integer ? 'integer' : 'number'\n const finite = options.finite ? 'finite' : ''\n const range = getRangeString(options)\n\n return [sign, finite, numberType, range].filter(x => !!x).join(' ')\n}\n\nexport function isNumber(value: unknown, options: NumberOptions = {}): value is number {\n if (typeof value !== 'number')\n return false\n\n if (Number.isNaN(value))\n return false\n\n if (options.integer && !Number.isInteger(value))\n return false\n\n if (options.finite && !Number.isFinite(value))\n return false\n\n if (options.zero && value !== 0)\n return false\n\n if (options.nonZero && value === 0)\n return false\n\n if (options.positive && value <= 0)\n return false\n\n if (options.negative && value >= 0)\n return false\n\n if (options.nonPositive && value > 0)\n return false\n\n if (options.nonNegative && value < 0)\n return false\n\n if (typeof options.gt === 'number' && value <= options.gt)\n return false\n\n if (typeof options.gte === 'number' && value < options.gte)\n return false\n\n if (typeof options.lt === 'number' && value >= options.lt)\n return false\n\n if (typeof options.lte === 'number' && value > options.lte)\n return false\n\n return true\n}\n\nexport function assertNumber(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n options: NumberOptions = {},\n): asserts value is number {\n if (!isNumber(value, options)) {\n throw new LitsError(\n `Expected ${getNumberTypeName(options)}, got ${valueToString(value)}.`,\n getSourceCodeInfo(value, sourceCodeInfo),\n )\n }\n}\n\nexport function asNumber(\n value: unknown,\n sourceCodeInfo: SourceCodeInfo | undefined,\n options: NumberOptions = {},\n): number {\n assertNumber(value, sourceCodeInfo, options)\n return value\n}\n","import type { Any, Coll, Obj, Seq } from '../interface'\nimport type { FunctionLike, RegularExpression } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\nimport { REGEXP_SYMBOL } from '../utils/symbols'\nimport { isLitsFunction } from './litsFunction'\n\nexport function isAny(value: unknown): value is Any {\n // TODO weak test\n return value !== undefined\n}\nexport function asAny(value: unknown, sourceCodeInfo?: SourceCodeInfo): Any {\n assertAny(value, sourceCodeInfo)\n return value\n}\nexport function assertAny(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Any {\n if (!isAny(value))\n throw getAssertionError('not undefined', value, sourceCodeInfo)\n}\n\nexport function isSeq(value: unknown): value is Seq {\n return Array.isArray(value) || typeof value === 'string'\n}\nexport function asSeq(value: unknown, sourceCodeInfo?: SourceCodeInfo): Seq {\n assertSeq(value, sourceCodeInfo)\n return value\n}\nexport function assertSeq(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Seq {\n if (!isSeq(value))\n throw getAssertionError('string or array', value, sourceCodeInfo)\n}\n\nexport function isObj(value: unknown): value is Obj {\n return !(\n value === null\n || typeof value !== 'object'\n || Array.isArray(value)\n || value instanceof RegExp\n || isLitsFunction(value)\n || isRegularExpression(value)\n )\n}\nexport function asObj(value: unknown, sourceCodeInfo?: SourceCodeInfo): Obj {\n assertObj(value, sourceCodeInfo)\n return value\n}\nexport function assertObj(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Obj {\n if (!isObj(value))\n throw getAssertionError('object', value, sourceCodeInfo)\n}\n\nexport function isColl(value: unknown): value is Coll {\n return isSeq(value) || isObj(value)\n}\nexport function asColl(value: unknown, sourceCodeInfo?: SourceCodeInfo): Coll {\n assertColl(value, sourceCodeInfo)\n return value\n}\nexport function assertColl(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Coll {\n if (!isColl(value))\n throw getAssertionError('string, array or object', value, sourceCodeInfo)\n}\n\nexport function isRegularExpression(regexp: unknown): regexp is RegularExpression {\n if (regexp === null || typeof regexp !== 'object')\n return false\n\n return !!(regexp as RegularExpression)[REGEXP_SYMBOL]\n}\nexport function asRegularExpression(value: unknown, sourceCodeInfo?: SourceCodeInfo): RegularExpression {\n assertRegularExpression(value, sourceCodeInfo)\n return value\n}\nexport function assertRegularExpression(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is RegularExpression {\n if (!isRegularExpression(value))\n throw getAssertionError('RegularExpression', value, sourceCodeInfo)\n}\n\nexport function isStringOrRegularExpression(value: unknown): value is string | RegularExpression {\n return isRegularExpression(value) || typeof value === 'string'\n}\nexport function asStringOrRegularExpression(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): string | RegularExpression {\n assertStringOrRegularExpression(value, sourceCodeInfo)\n return value\n}\nexport function assertStringOrRegularExpression(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is string | RegularExpression {\n if (!isStringOrRegularExpression(value))\n throw getAssertionError('string or RegularExpression', value, sourceCodeInfo)\n}\n\nexport function isFunctionLike(value: unknown): value is FunctionLike {\n if (typeof value === 'number')\n return true\n if (isColl(value))\n return true\n if (isLitsFunction(value))\n return true\n\n return false\n}\nexport function asFunctionLike(value: unknown, sourceCodeInfo?: SourceCodeInfo): FunctionLike {\n assertFunctionLike(value, sourceCodeInfo)\n return value\n}\nexport function assertFunctionLike(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is FunctionLike {\n if (!isFunctionLike(value))\n throw getAssertionError('FunctionLike', value, sourceCodeInfo)\n}\n","import type { Arity } from '../builtin/interface'\nimport { LitsError } from '../errors'\nimport type { FunctionLike } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { isColl } from '../typeGuards/lits'\nimport { valueToString } from './debug/debugTools'\n\nexport function arityAccepts(arity: Arity, nbrOfParams: number): boolean {\n const { min, max } = arity\n if (typeof min === 'number' && nbrOfParams < min) {\n return false\n }\n if (typeof max === 'number' && nbrOfParams > max) {\n return false\n }\n return true\n}\n\nexport function arityAcceptsMin(arity: Arity, nbrOfParams: number): boolean {\n const { min } = arity\n if (typeof min === 'number' && nbrOfParams < min) {\n return false\n }\n return true\n}\n\nexport function getCommonArityFromFunctions(params: FunctionLike[]): Arity | null {\n return params.reduce((acc: Arity | null, param): Arity | null => {\n if (acc === null) {\n return null\n }\n const arity: Arity = (typeof param === 'number' || isColl(param)) ? toFixedArity(1) : param.arity\n const { min: aMin, max: aMax } = arity\n const { min: bMin, max: bMax } = acc\n const min = typeof aMin === 'number' && typeof bMin === 'number'\n ? Math.max(aMin, bMin)\n : typeof aMin === 'number' ? aMin : typeof bMin === 'number' ? bMin : undefined\n const max = typeof aMax === 'number' && typeof bMax === 'number'\n ? Math.min(aMax, bMax)\n : typeof aMax === 'number' ? aMax : typeof bMax === 'number' ? bMax : undefined\n\n if (typeof min === 'number' && typeof max === 'number' && min > max) {\n return null\n }\n\n return { min, max }\n }, {})\n}\n\nexport function getArityFromFunction(param: FunctionLike): Arity {\n return (typeof param === 'number' || isColl(param)) ? toFixedArity(1) : param.arity\n}\n\nexport function assertNumberOfParams(arity: Arity, length: number, sourceCodeInfo: SourceCodeInfo | undefined): void {\n const { min, max } = arity\n if (typeof min === 'number' && length < min) {\n throw new LitsError(\n `Wrong number of arguments, expected at least ${min}, got ${valueToString(length)}.`,\n sourceCodeInfo,\n )\n }\n\n if (typeof max === 'number' && length > max) {\n throw new LitsError(\n `Wrong number of arguments, expected at most ${max}, got ${valueToString(length)}.`,\n sourceCodeInfo,\n )\n }\n}\n\nexport function canBeOperator(count: Arity): boolean {\n if (typeof count.max === 'number' && count.max < 2) {\n return false\n }\n\n if (typeof count.min === 'number' && count.min > 2) {\n return false\n }\n\n return true\n}\n\nexport function toFixedArity(arity: number): Arity {\n return { min: arity, max: arity }\n}\n","import { assertNumber } from '../../typeGuards/number'\nimport { toFixedArity } from '../../utils/arity'\nimport type { Argument, BuiltinNormalExpressions } from '../interface'\n\nfunction getOperatorArgs(a: 'integer', b: 'integer'): Record<string, Argument> {\n return { a: { type: a }, b: { type: b } }\n}\n\nexport const bitwiseNormalExpression: BuiltinNormalExpressions = {\n '<<': {\n evaluate: ([num, count], sourceCodeInfo): number => {\n assertNumber(num, sourceCodeInfo, { integer: true })\n assertNumber(count, sourceCodeInfo, { integer: true, nonNegative: true })\n\n return num << count\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Bitwise',\n returns: { type: 'integer' },\n args: { ...getOperatorArgs('integer', 'integer') },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Shifts $a arithmetically left by $b bit positions.',\n seeAlso: ['>>', '>>>'],\n examples: [\n '1 << 10',\n '<<(1, 10)',\n '<<(-4, 2)',\n ],\n },\n },\n '>>': {\n evaluate: ([num, count], sourceCodeInfo): number => {\n assertNumber(num, sourceCodeInfo, { integer: true })\n assertNumber(count, sourceCodeInfo, { integer: true, nonNegative: true })\n\n return num >> count\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Bitwise',\n returns: { type: 'integer' },\n args: { ...getOperatorArgs('integer', 'integer') },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Shifts $a arithmetically right by $b bit positions.',\n seeAlso: ['<<', '>>>'],\n examples: [\n '2048 >> 10',\n '>>(2048, 10)',\n '>>>(-16, 2)',\n '>>(4, 10)',\n ],\n },\n },\n '>>>': {\n evaluate: ([num, count], sourceCodeInfo): number => {\n assertNumber(num, sourceCodeInfo, { integer: true })\n assertNumber(count, sourceCodeInfo, { integer: true, nonNegative: true })\n\n return num >>> count\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Bitwise',\n returns: { type: 'integer' },\n args: { ...getOperatorArgs('integer', 'integer') },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Shifts $a arithmetically right by $b bit positions without sign extension.',\n seeAlso: ['<<', '>>'],\n examples: [\n '-16 >>> 2',\n '>>>(2048, 10)',\n '>>>(-16, 2)',\n '>>>(4, 10)',\n '>>>(-1, 10)',\n ],\n },\n },\n 'bit-not': {\n evaluate: ([num], sourceCodeInfo): number => {\n assertNumber(num, sourceCodeInfo, { integer: true })\n return ~num\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Bitwise',\n returns: { type: 'integer' },\n args: { a: { type: 'integer' } },\n variants: [{ argumentNames: ['a'] }],\n description: 'Returns bitwise `not` of $a.',\n seeAlso: ['&', '|', 'xor', 'bit-and-not'],\n examples: [\n 'bit-not(0)',\n 'bit-not(255)',\n ],\n },\n },\n '&': {\n evaluate: ([first, ...rest], sourceCodeInfo): number => {\n assertNumber(first, sourceCodeInfo, { integer: true })\n\n return rest.reduce((result: number, value) => {\n assertNumber(value, sourceCodeInfo, { integer: true })\n return result & value\n }, first)\n },\n arity: { min: 2 },\n docs: {\n category: 'Bitwise',\n returns: { type: 'integer' },\n args: {\n ...getOperatorArgs('integer', 'integer'),\n c: { type: 'integer', rest: true },\n },\n variants: [\n { argumentNames: ['a', 'b'] },\n { argumentNames: ['a', 'b', 'c'] },\n ],\n description: 'Returns bitwise `and` of all arguments.',\n seeAlso: ['|', 'xor', 'bit-not', 'bit-and-not'],\n examples: [\n '0b0011 & 0b0110',\n '&(0b0011, 0b0110)',\n '&(0b0011, 0b0110, 0b1001)',\n ],\n },\n },\n 'bit-and-not': {\n evaluate: ([first, ...rest], sourceCodeInfo): number => {\n assertNumber(first, sourceCodeInfo, { integer: true })\n\n return rest.reduce((result: number, value) => {\n assertNumber(value, sourceCodeInfo, { integer: true })\n return result & ~value\n }, first)\n },\n arity: { min: 2 },\n docs: {\n category: 'Bitwise',\n returns: { type: 'integer' },\n args: {\n ...getOperatorArgs('integer', 'integer'),\n c: { type: 'integer', rest: true },\n },\n variants: [\n { argumentNames: ['a', 'b'] },\n { argumentNames: ['a', 'b', 'c'] },\n ],\n description: 'Returns bitwise `and` with complement.',\n seeAlso: ['&', '|', 'xor', 'bit-not'],\n examples: [\n '0b0011 bit-and-not 0b0110',\n 'bit-and-not(0b0011, 0b0110)',\n 'bit-and-not(0b0011, 0b0110, 0b1001)',\n ],\n },\n },\n '|': {\n evaluate: ([first, ...rest], sourceCodeInfo): number => {\n assertNumber(first, sourceCodeInfo, { integer: true })\n\n return rest.reduce((result: number, value) => {\n assertNumber(value, sourceCodeInfo, { integer: true })\n return result | value\n }, first)\n },\n arity: { min: 2 },\n docs: {\n category: 'Bitwise',\n returns: { type: 'integer' },\n args: {\n ...getOperatorArgs('integer', 'integer'),\n c: { type: 'integer', rest: true },\n },\n variants: [\n { argumentNames: ['a', 'b'] },\n { argumentNames: ['a', 'b', 'c'] },\n ],\n description: 'Returns bitwise `or` of all arguments.',\n seeAlso: ['&', 'xor', 'bit-not', 'bit-and-not'],\n examples: [\n '0b0011 | 0b0110',\n '|(0b0011, 0b0110)',\n '|(0b1000, 0b0100, 0b0010)',\n ],\n },\n },\n 'xor': {\n evaluate: ([first, ...rest], sourceCodeInfo): number => {\n assertNumber(first, sourceCodeInfo, { integer: true })\n\n return rest.reduce((result: number, value) => {\n assertNumber(value, sourceCodeInfo, { integer: true })\n return result ^ value\n }, first)\n },\n arity: { min: 2 },\n docs: {\n category: 'Bitwise',\n returns: { type: 'integer' },\n args: {\n ...getOperatorArgs('integer', 'integer'),\n c: { type: 'integer', rest: true },\n },\n variants: [\n { argumentNames: ['a', 'b'] },\n { argumentNames: ['a', 'b', 'c'] },\n ],\n description: 'Returns bitwise `xor` of all arguments.',\n seeAlso: ['&', '|', 'bit-not', 'bit-and-not'],\n examples: [\n '0b0011 xor 0b0110',\n 'xor(0b0011, 0b0110)',\n 'xor(0b11110000, 0b00111100, 0b10101010)',\n ],\n },\n },\n 'bit-flip': {\n evaluate: ([num, index], sourceCodeInfo): number => {\n assertNumber(num, sourceCodeInfo, { integer: true })\n assertNumber(index, sourceCodeInfo, { integer: true, nonNegative: true })\n\n const mask = 1 << index\n return (num ^= mask)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Bitwise',\n returns: { type: 'integer' },\n args: { ...getOperatorArgs('integer', 'integer') },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Flips bit number $b.',\n seeAlso: ['bit-set', 'bit-clear', 'bit-test'],\n examples: [\n '0b0011 bit-flip 1',\n 'bit-flip(0b0011, 1)',\n 'bit-flip(0b1100, 1)',\n ],\n },\n },\n 'bit-set': {\n evaluate: ([num, index], sourceCodeInfo): number => {\n assertNumber(num, sourceCodeInfo, { integer: true })\n assertNumber(index, sourceCodeInfo, { integer: true, nonNegative: true })\n\n const mask = 1 << index\n return (num |= mask)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Bitwise',\n returns: { type: 'integer' },\n args: { ...getOperatorArgs('integer', 'integer') },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Sets bit number $b.',\n seeAlso: ['bit-flip', 'bit-clear', 'bit-test'],\n examples: [\n '0b0010 bit-set 1',\n 'bit-set(0b0011, 1)',\n 'bit-set(0b1100, 1)',\n ],\n },\n },\n 'bit-clear': {\n evaluate: ([num, index], sourceCodeInfo): number => {\n assertNumber(num, sourceCodeInfo, { integer: true })\n assertNumber(index, sourceCodeInfo, { integer: true, nonNegative: true })\n\n const mask = 1 << index\n return (num &= ~mask)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Bitwise',\n returns: { type: 'integer' },\n args: { ...getOperatorArgs('integer', 'integer') },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Clears bit number $b.',\n seeAlso: ['bit-flip', 'bit-set', 'bit-test'],\n examples: [\n '0b0011 bit-clear 1',\n 'bit-clear(0b0011, 1)',\n 'bit-clear(0b1100, 1)',\n ],\n },\n },\n 'bit-test': {\n evaluate: ([num, index], sourceCodeInfo): boolean => {\n assertNumber(num, sourceCodeInfo, { integer: true })\n assertNumber(index, sourceCodeInfo, { integer: true, nonNegative: true })\n\n const mask = 1 << index\n return !!(num & mask)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Bitwise',\n returns: { type: 'boolean' },\n args: { ...getOperatorArgs('integer', 'integer') },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Checks if bit number $b is set.',\n seeAlso: ['bit-flip', 'bit-set', 'bit-clear'],\n examples: [\n '0b0011 bit-test 1',\n 'bit-test(0b0011, 1)',\n 'bit-test(0b1100, 1)',\n ],\n },\n },\n}\n","import type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\n\ntype StringAssertionOptions =\n | {\n nonEmpty?: true\n char?: never\n }\n | {\n nonEmpty?: never\n char?: true\n }\n\nexport function isString(value: unknown, options: StringAssertionOptions = {}): value is string {\n if (typeof value !== 'string')\n return false\n\n if (options.nonEmpty && value.length === 0)\n return false\n\n if (options.char && value.length !== 1)\n return false\n\n return true\n}\n\nexport function assertString(\n value: unknown,\n sourceCodeInfo: SourceCodeInfo | undefined,\n options: StringAssertionOptions = {},\n): asserts value is string {\n if (!isString(value, options)) {\n throw getAssertionError(\n `${options.nonEmpty ? 'non empty string' : options.char ? 'character' : 'string'}`,\n value,\n sourceCodeInfo,\n )\n }\n}\n\nexport function asString(\n value: unknown,\n sourceCodeInfo: SourceCodeInfo | undefined,\n options: StringAssertionOptions = {},\n): string {\n assertString(value, sourceCodeInfo, options)\n return value\n}\n\nexport function isStringOrNumber(value: unknown): value is string | number {\n return typeof value === 'string' || typeof value === 'number'\n}\nexport function asStringOrNumber(value: unknown, sourceCodeInfo?: SourceCodeInfo): string | number {\n assertStringOrNumber(value, sourceCodeInfo)\n return value\n}\nexport function assertStringOrNumber(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is string | number {\n if (!isStringOrNumber(value))\n throw getAssertionError('string or number', value, sourceCodeInfo)\n}\n","import type { Any, Coll, Obj } from '../interface'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { asAny, isColl, isObj, isRegularExpression } from '../typeGuards/lits'\nimport { isNumber } from '../typeGuards/number'\nimport { asString, assertStringOrNumber } from '../typeGuards/string'\nimport { isUnknownRecord } from '../typeGuards'\nimport { LitsError } from '../errors'\n\nexport function collHasKey(coll: unknown, key: string | number): boolean {\n if (!isColl(coll))\n return false\n\n if (typeof coll === 'string' || Array.isArray(coll)) {\n if (!isNumber(key, { integer: true }))\n return false\n\n return key >= 0 && key < coll.length\n }\n return !!Object.getOwnPropertyDescriptor(coll, key)\n}\n\nexport function compare<T extends string | number>(a: T, b: T, sourceCodeInfo: SourceCodeInfo | undefined): number {\n assertStringOrNumber(a, sourceCodeInfo)\n assertStringOrNumber(b, sourceCodeInfo)\n\n if (typeof a === 'string' && typeof b === 'string') {\n return a < b ? -1 : a > b ? 1 : 0\n }\n if (typeof a === 'number' && typeof b === 'number') {\n return Math.sign((a) - (b))\n }\n throw new LitsError(`Cannot compare values of different types: ${typeof a} and ${typeof b}`, sourceCodeInfo)\n}\n\nexport function deepEqual(a: unknown, b: unknown, sourceCodeInfo?: SourceCodeInfo): boolean {\n if (a === b)\n return true\n\n if (typeof a === 'number' && typeof b === 'number')\n return approxEqual(a, b)\n\n if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length)\n return false\n\n for (let i = 0; i < a.length; i += 1) {\n if (!deepEqual(asAny(a[i], sourceCodeInfo), asAny(b[i], sourceCodeInfo), sourceCodeInfo))\n return false\n }\n return true\n }\n if (isRegularExpression(a) && isRegularExpression(b))\n return a.s === b.s && a.f === b.f\n\n if (isUnknownRecord(a) && isUnknownRecord(b)) {\n const aKeys = Object.keys(a)\n const bKeys = Object.keys(b)\n if (aKeys.length !== bKeys.length)\n return false\n\n for (let i = 0; i < aKeys.length; i += 1) {\n const key = asString(aKeys[i], sourceCodeInfo)\n if (!deepEqual(a[key], b[key], sourceCodeInfo))\n return false\n }\n return true\n }\n return false\n}\n\nexport function toNonNegativeInteger(num: number): number {\n return Math.max(0, Math.ceil(num))\n}\n\nexport function toAny(value: unknown): Any {\n return (value ?? null) as Any\n}\n\nfunction clone<T>(value: T): T {\n if (isObj(value)) {\n return Object.entries(value).reduce((result: Obj, entry) => {\n const [key, val] = entry\n result[key] = clone(val)\n return result\n }, {}) as T\n }\n if (Array.isArray(value))\n // eslint-disable-next-line ts/no-unsafe-return\n return value.map(item => clone(item)) as unknown as T\n\n return value\n}\n\nexport function cloneColl<T extends Coll>(value: T): T {\n return clone(value)\n}\n\nexport function joinSets<T>(...results: Set<T>[]): Set<T> {\n const result = new Set<T>()\n for (const symbols of results)\n symbols.forEach(symbol => result.add(symbol))\n\n return result\n}\n\nexport function addToSet<T>(target: Set<T>, source: Set<T>): void {\n source.forEach(symbol => target.add(symbol))\n}\n\nexport const EPSILON = 1e-10\n\nexport function approxEqual(a: number, b: number, epsilon: number = EPSILON): boolean {\n if (a === b) {\n return true\n }\n\n const diff = Math.abs(a - b)\n\n if (a === 0 || b === 0 || diff < epsilon) {\n // Use absolute error for values near zero\n return diff < epsilon\n }\n const absA = Math.abs(a)\n const absB = Math.abs(b)\n\n // Use relative error for larger values\n return diff / (absA + absB) < epsilon\n}\n\nexport function approxZero(value: number): boolean {\n return Math.abs(value) < EPSILON\n}\n\nexport function smartTrim(str: string, minIndent = 0): string {\n const lines = str.split('\\n')\n while (lines[0]?.match(/^\\s*$/)) {\n lines.shift() // Remove leading empty lines\n }\n while (lines[lines.length - 1]?.match(/^\\s*$/)) {\n lines.pop() // Remove trailing empty lines\n }\n const indent = lines.reduce((acc, line) => {\n if (line.match(/^\\s*$/))\n return acc // Skip empty lines\n const lineIndent = line.match(/^\\s*/)![0].length\n return Math.min(acc, lineIndent)\n }, Infinity)\n return lines.map(line => ' '.repeat(minIndent) + line.slice(indent)).join('\\n').trimEnd()\n}\n","import type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\n\n// isArray not needed, use Array.isArary\nexport function asArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): unknown[] {\n assertArray(value, sourceCodeInfo)\n return value\n}\nexport function assertArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is unknown[] {\n if (!Array.isArray(value))\n throw getAssertionError('array', value, sourceCodeInfo)\n}\n\nexport function isStringArray(value: unknown): value is string[] {\n return Array.isArray(value) && value.every(v => typeof v === 'string')\n}\nexport function asStringArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): string[] {\n assertStringArray(value, sourceCodeInfo)\n return value\n}\nexport function assertStringArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is string[] {\n if (!isStringArray(value))\n throw getAssertionError('array of strings', value, sourceCodeInfo)\n}\n\nexport function isCharArray(value: unknown): value is string[] {\n return Array.isArray(value) && value.every(v => typeof v === 'string' && v.length === 1)\n}\nexport function asCharArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): string[] {\n assertCharArray(value, sourceCodeInfo)\n return value\n}\nexport function assertCharArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is string[] {\n if (!isCharArray(value))\n throw getAssertionError('array of strings', value, sourceCodeInfo)\n}\n","import type { ContextStack } from '../../evaluator/ContextStack'\nimport type { ExecuteFunction } from '../../evaluator/interface'\nimport type { Any, Arr, Coll, Obj, Seq } from '../../interface'\nimport type { SourceCodeInfo } from '../../tokenizer/token'\nimport { cloneColl, collHasKey, deepEqual, toAny, toNonNegativeInteger } from '../../utils'\nimport { asAny, asColl, asFunctionLike, assertAny, assertColl, assertFunctionLike, assertObj, assertSeq, isColl, isObj, isSeq } from '../../typeGuards/lits'\nimport type { BuiltinNormalExpressions } from '../interface'\nimport { assertArray } from '../../typeGuards/array'\nimport { assertNumber, isNumber } from '../../typeGuards/number'\nimport { asString, asStringOrNumber, assertString, assertStringOrNumber, isString, isStringOrNumber } from '../../typeGuards/string'\nimport type { FunctionLike } from '../../parser/types'\nimport { LitsError } from '../../errors'\nimport { toFixedArity } from '../../utils/arity'\n\ninterface CollMeta {\n coll: Coll\n parent: Obj | Arr\n}\n\nfunction mapObjects({\n colls,\n contextStack,\n executeFunction,\n fn,\n sourceCodeInfo,\n}: {\n colls: unknown[]\n fn: FunctionLike\n sourceCodeInfo: SourceCodeInfo | undefined\n contextStack: ContextStack\n executeFunction: ExecuteFunction\n}): Obj {\n assertObj(colls[0], sourceCodeInfo)\n const keys = Object.keys(colls[0])\n const params: Record<string, unknown[]> = {}\n colls.forEach((obj) => {\n assertObj(obj, sourceCodeInfo)\n const objKeys = Object.keys(obj)\n if (objKeys.length !== keys.length) {\n throw new LitsError(`All objects must have the same keys. Expected: ${keys.join(', ')}. Found: ${objKeys.join(', ')}`, sourceCodeInfo)\n }\n if (!objKeys.every(key => keys.includes(key))) {\n throw new LitsError(`All objects must have the same keys. Expected: ${keys.join(', ')}. Found: ${objKeys.join(', ')}`, sourceCodeInfo)\n }\n Object.entries(obj).forEach(([key, value]) => {\n if (!params[key])\n params[key] = []\n params[key].push(value)\n })\n })\n\n return keys.reduce((result: Obj, key) => {\n result[key] = executeFunction(fn, params[key]!, contextStack, sourceCodeInfo)\n return result\n }, {})\n}\n\nfunction cloneAndGetMeta(\n originalColl: Coll,\n keys: Arr,\n sourceCodeInfo?: SourceCodeInfo,\n): { coll: Coll, innerCollMeta: CollMeta } {\n const coll = cloneColl(originalColl)\n\n const butLastKeys = keys.slice(0, keys.length - 1)\n\n const innerCollMeta = butLastKeys.reduce(\n (result: CollMeta, key) => {\n const resultColl = result.coll\n\n let newResultColl: Coll\n if (Array.isArray(resultColl)) {\n assertNumber(key, sourceCodeInfo)\n newResultColl = asColl(resultColl[key], sourceCodeInfo)\n }\n else {\n assertObj(resultColl, sourceCodeInfo)\n assertString(key, sourceCodeInfo)\n if (!collHasKey(result.coll, key))\n resultColl[key] = {}\n\n newResultColl = asColl(resultColl[key], sourceCodeInfo)\n }\n\n return { coll: newResultColl, parent: resultColl }\n },\n { coll, parent: {} },\n )\n return { coll, innerCollMeta }\n}\n\nfunction get(coll: Coll, key: string | number): Any | undefined {\n if (isObj(coll)) {\n if (typeof key === 'string' && collHasKey(coll, key))\n return toAny(coll[key])\n }\n else {\n if (isNumber(key, { nonNegative: true, integer: true }) && key >= 0 && key < coll.length)\n return toAny(coll[key])\n }\n return undefined\n}\n\nfunction update(\n coll: Coll,\n key: string | number,\n fn: FunctionLike,\n params: Arr,\n contextStack: ContextStack,\n executeFunction: ExecuteFunction,\n sourceCodeInfo?: SourceCodeInfo,\n): Coll {\n if (isObj(coll)) {\n assertString(key, sourceCodeInfo)\n const result = { ...coll }\n result[key] = executeFunction(fn, [result[key], ...params], contextStack, sourceCodeInfo)\n return result\n }\n else {\n assertNumber(key, sourceCodeInfo)\n const intKey = toNonNegativeInteger(key)\n assertNumber(intKey, sourceCodeInfo, { lte: coll.length })\n if (Array.isArray(coll)) {\n const result = coll.map((elem, index) => {\n if (intKey === index)\n return executeFunction(fn, [elem, ...params], contextStack, sourceCodeInfo)\n\n return elem\n })\n if (intKey === coll.length)\n result[intKey] = executeFunction(fn, [undefined, ...params], contextStack, sourceCodeInfo)\n\n return result\n }\n else {\n const result = coll.split('').map((elem, index) => {\n if (intKey === index) {\n return asString(executeFunction(fn, [elem, ...params], contextStack, sourceCodeInfo), sourceCodeInfo, {\n char: true,\n })\n }\n return elem\n })\n if (intKey === coll.length) {\n result[intKey] = asString(\n executeFunction(fn, [undefined, ...params], contextStack, sourceCodeInfo),\n sourceCodeInfo,\n {\n char: true,\n },\n )\n }\n return result.join('')\n }\n }\n}\n\nfunction assoc(coll: Coll, key: string | number, value: Any, sourceCodeInfo?: SourceCodeInfo) {\n assertColl(coll, sourceCodeInfo)\n assertStringOrNumber(key, sourceCodeInfo)\n if (Array.isArray(coll) || typeof coll === 'string') {\n assertNumber(key, sourceCodeInfo, { integer: true })\n assertNumber(key, sourceCodeInfo, { gte: 0 })\n assertNumber(key, sourceCodeInfo, { lte: coll.length })\n if (typeof coll === 'string') {\n assertString(value, sourceCodeInfo, { char: true })\n return `${coll.slice(0, key)}${value}${coll.slice(key + 1)}`\n }\n const copy = [...coll]\n copy[key] = value\n return copy\n }\n assertString(key, sourceCodeInfo)\n const copy = { ...coll }\n copy[key] = value\n return copy\n}\n\nexport const collectionNormalExpression: BuiltinNormalExpressions = {\n 'filter': {\n evaluate: ([coll, fn]: Arr, sourceCodeInfo, contextStack, { executeFunction }): Coll => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n if (Array.isArray(coll)) {\n const result = coll.filter(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n return result\n }\n if (isString(coll)) {\n return coll\n .split('')\n .filter(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n .join('')\n }\n return Object.entries(coll)\n .filter(([, value]) => executeFunction(fn, [value], contextStack, sourceCodeInfo))\n .reduce((result: Obj, [key, value]) => {\n result[key] = value\n return result\n }, {})\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Collection',\n returns: { type: 'collection' },\n args: {\n a: { type: 'collection' },\n b: { type: 'function' },\n coll: { type: 'collection' },\n fun: { type: 'function' },\n },\n variants: [{ argumentNames: ['coll', 'fun'] }],\n description: 'Creates a new collection with all elements that pass the test implemented by $fun.',\n seeAlso: ['filteri', 'map', 'remove'],\n examples: [\n `\nfilter(\n [\"Albert\", \"Mojir\", 160, [1, 2]],\n string?\n)`,\n `\nfilter(\n [5, 10, 15, 20],\n -> $ > 10\n)`,\n `\nfilter(\n { a: 1, b: 2 },\n odd?\n)`,\n ],\n },\n },\n 'filteri': {\n evaluate: ([coll, fn], sourceCodeInfo, contextStack, { executeFunction }): Coll => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n if (Array.isArray(coll)) {\n const result = coll.filter((elem, index) => executeFunction(fn, [elem, index], contextStack, sourceCodeInfo))\n return result\n }\n if (isString(coll)) {\n return coll\n .split('')\n .filter((elem, index) => executeFunction(fn, [elem, index], contextStack, sourceCodeInfo))\n .join('')\n }\n return Object.entries(coll)\n .filter(([key, value]) => executeFunction(fn, [value, key], contextStack, sourceCodeInfo))\n .reduce((result: Obj, [key, value]) => {\n result[key] = value\n return result\n }, {})\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Collection',\n returns: { type: 'collection' },\n args: {\n a: { type: 'collection' },\n b: {\n type: 'function',\n description: 'The function to call for each element in the collection. The function should take two arguments: the element itself and the index.',\n },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Creates a new collection with all elements that pass the test implemented by $b. The function is called for each element in the collection, and it should take two arguments: the element itself and the index.',\n seeAlso: ['filter', 'mapi'],\n examples: [\n 'filteri([1, 2, 3], (x, i) -> i % 2 == 0)',\n 'filteri([1, 2, 3], (x, i) -> x % 2 == 0)',\n 'filteri([1, 2, 3], (x, i) -> x + i > 3)',\n ],\n },\n },\n 'map': {\n evaluate: (params, sourceCodeInfo, contextStack, { executeFunction }) => {\n const fn = asFunctionLike(params.at(-1), sourceCodeInfo)\n\n if (isObj(params[0])) {\n return mapObjects({\n colls: params.slice(0, -1),\n fn,\n sourceCodeInfo,\n contextStack,\n executeFunction,\n })\n }\n\n const seqs = params.slice(0, -1) as Seq[]\n assertSeq(seqs[0], sourceCodeInfo)\n\n const isStr = typeof seqs[0] === 'string'\n let len = seqs[0].length\n seqs.slice(1).forEach((seq) => {\n if (isStr) {\n assertString(seq, sourceCodeInfo)\n }\n else {\n assertArray(seq, sourceCodeInfo)\n }\n len = Math.min(len, seq.length)\n })\n\n const paramArray: unknown[][] = []\n for (let i = 0; i < len; i++) {\n paramArray.push(seqs.map(seq => seq[i]))\n }\n\n const mapped = paramArray.map(p => executeFunction(fn, p, contextStack, sourceCodeInfo))\n\n if (!isStr) {\n return mapped\n }\n mapped.forEach(char => assertString(char, sourceCodeInfo))\n return mapped.join('')\n },\n arity: { min: 2 },\n docs: {\n category: 'Collection',\n returns: { type: 'collection' },\n args: {\n a: { type: 'collection' },\n b: { type: 'function' },\n colls: { type: 'collection', rest: true, description: 'At least one.' },\n fun: { type: 'function' },\n },\n variants: [{ argumentNames: ['colls', 'fun'] }],\n description: 'Creates a new collection populated with the results of calling $fun on every element in $colls.',\n seeAlso: ['mapi', 'filter', 'reduce', 'mapcat', 'Grid.map', 'Grid.mapi'],\n examples: [\n '[1, 2, 3] map -',\n '[1, 2, 3] map -> -($)',\n 'map([\"Albert\", \"Mojir\", 42], str)',\n 'map([1, 2, 3], inc)',\n 'map([1, 2, 3], [1, 10, 100], *)',\n 'map({ a: 1, b: 2 }, inc)',\n 'map({ a: 1, b: 2 }, { a: 10, b: 20 }, +)',\n ],\n },\n },\n 'mapi': {\n evaluate: ([coll, fn], sourceCodeInfo, contextStack, { executeFunction }) => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n\n if (Array.isArray(coll)) {\n return coll.map((elem, index) => executeFunction(fn, [elem, index], contextStack, sourceCodeInfo))\n }\n if (isString(coll)) {\n return coll\n .split('')\n .map((elem, index) => executeFunction(fn, [elem, index], contextStack, sourceCodeInfo))\n .join('')\n }\n return Object.entries(coll)\n .reduce((acc: Obj, [key, value]) => {\n acc[key] = executeFunction(fn, [value, key], contextStack, sourceCodeInfo)\n return acc\n }, {})\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Collection',\n returns: { type: 'collection' },\n args: {\n a: { type: 'collection' },\n b: {\n type: 'function',\n description: 'The function to call for each element in the collection. The function should take two arguments: the element itself and the index.',\n },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Creates a new collection populated with the results of calling $b on every element in $a. The function is called for each element in the collection, and it should take two arguments: the element itself and the index.',\n seeAlso: ['map', 'filteri'],\n examples: [\n 'mapi([1, 2, 3], (x, i) -> x + i)',\n 'mapi([1, 2, 3], (x, i) -> x * i)',\n 'mapi([1, 2, 3], (x, i) -> x - i)',\n 'mapi([1, 2, 3], (x, i) -> x / i)',\n 'mapi([1, 2, 3], (x, i) -> x % inc(i))',\n ],\n },\n },\n 'reduce': {\n evaluate: ([coll, fn, initial], sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n assertAny(initial, sourceCodeInfo)\n\n if (typeof coll === 'string') {\n assertString(initial, sourceCodeInfo)\n if (coll.length === 0)\n return initial\n\n return coll.split('').reduce((result: Any, elem) => {\n return executeFunction(fn, [result, elem], contextStack, sourceCodeInfo)\n }, initial)\n }\n else if (Array.isArray(coll)) {\n if (coll.length === 0)\n return initial\n\n return coll.reduce((result: Any, elem) => {\n return executeFunction(fn, [result, elem], contextStack, sourceCodeInfo)\n }, initial)\n }\n else {\n if (Object.keys(coll).length === 0)\n return initial\n\n return Object.entries(coll).reduce((result: Any, [, elem]) => {\n return executeFunction(fn, [result, elem], contextStack, sourceCodeInfo)\n }, initial)\n }\n },\n arity: toFixedArity(3),\n docs: {\n category: 'Collection',\n returns: { type: 'any' },\n args: {\n fun: { type: 'function' },\n coll: { type: 'collection' },\n initial: { type: 'any' },\n },\n variants: [{ argumentNames: ['coll', 'fun', 'initial'] }],\n description: 'Runs $fun function on each element of the $coll, passing in the return value from the calculation on the preceding element. The final result of running the reducer across all elements of the $coll is a single value.',\n seeAlso: ['reduce-right', 'reducei', 'reductions', 'map', 'Grid.reduce', 'Grid.reducei'],\n examples: [\n 'reduce([1, 2, 3], +, 0)',\n 'reduce([], +, 0)',\n 'reduce({ a: 1, b: 2 }, +, 0)',\n `\nreduce(\n [1, 2, 3, 4, 5, 6, 7, 8, 9],\n (result, value) -> result + (even?(value) ? value : 0),\n 0)`,\n ],\n },\n },\n 'reducei': {\n evaluate: ([coll, fn, initial], sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n assertAny(initial, sourceCodeInfo)\n\n if (typeof coll === 'string') {\n assertString(initial, sourceCodeInfo)\n if (coll.length === 0)\n return initial\n\n return coll.split('').reduce((result: Any, elem, index) => {\n return executeFunction(fn, [result, elem, index], contextStack, sourceCodeInfo)\n }, initial)\n }\n else if (Array.isArray(coll)) {\n if (coll.length === 0)\n return initial\n\n return coll.reduce((result: Any, elem, index) => {\n return executeFunction(fn, [result, elem, index], contextStack, sourceCodeInfo)\n }, initial)\n }\n else {\n if (Object.keys(coll).length === 0)\n return initial\n\n return Object.entries(coll).reduce((result: Any, [key, elem]) => {\n return executeFunction(fn, [result, elem, key], contextStack, sourceCodeInfo)\n }, initial)\n }\n },\n arity: toFixedArity(3),\n docs: {\n category: 'Collection',\n returns: { type: 'any' },\n args: {\n coll: { type: 'collection' },\n fun: {\n type: 'function',\n description: 'The function to call for each element in the collection. The function should take three arguments: the accumulator, the element itself, and the index.',\n },\n initial: {\n type: 'any',\n description: 'The initial value to use as the accumulator.',\n },\n },\n variants: [{ argumentNames: ['coll', 'fun', 'initial'] }],\n description: 'Runs $fun function on each element of the $coll, passing in the return value from the calculation on the preceding element. The final result of running the reducer across all elements of the $coll is a single value. The function is called for each element in the collection, and it should take three arguments: the accumulator, the element itself, and the index.',\n seeAlso: ['reduce', 'reducei-right', 'reductionsi'],\n examples: [\n 'reducei([1, 2, 3], (acc, x, i) -> acc + x + i, 0)',\n 'reducei(\"Albert\", (acc, x, i) -> acc ++ x ++ i, \"\")',\n 'reducei({ a: 1, b: 2 }, -> $1 ++ $3, \"\")',\n ],\n },\n },\n 'reduce-right': {\n evaluate: ([coll, fn, initial], sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n assertAny(initial, sourceCodeInfo)\n\n if (typeof coll === 'string') {\n if (coll.length === 0)\n return initial\n\n return coll.split('').reduceRight((result: Any, elem) => {\n return executeFunction(fn, [result, elem], contextStack, sourceCodeInfo)\n }, initial)\n }\n else if (Array.isArray(coll)) {\n if (coll.length === 0)\n return initial\n\n return coll.reduceRight((result: Any, elem) => {\n return executeFunction(fn, [result, elem], contextStack, sourceCodeInfo)\n }, initial)\n }\n else {\n if (Object.keys(coll).length === 0)\n return initial\n\n return Object.entries(coll).reduceRight((result: Any, [, elem]) => {\n return executeFunction(fn, [result, elem], contextStack, sourceCodeInfo)\n }, initial)\n }\n },\n arity: toFixedArity(3),\n docs: {\n category: 'Collection',\n returns: { type: 'any' },\n args: {\n fun: { type: 'function' },\n coll: { type: 'collection' },\n initial: { type: 'any' },\n },\n variants: [{ argumentNames: ['coll', 'fun', 'initial'] }],\n description: 'Runs $fun function on each element of the $coll (starting from the last item), passing in the return value from the calculation on the preceding element. The final result of running the reducer across all elements of the $coll is a single value.',\n seeAlso: ['reduce', 'reducei-right'],\n examples: [\n 'reduce-right([\"A\", \"B\", \"C\"], str, \"\")',\n 'reduce-right({ a: 1, b: 2 }, +, 0)',\n ],\n },\n },\n 'reducei-right': {\n evaluate: ([coll, fn, initial], sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n assertAny(initial, sourceCodeInfo)\n\n if (typeof coll === 'string') {\n if (coll.length === 0)\n return initial\n\n return coll.split('').reduceRight((result: Any, elem, index) => {\n return executeFunction(fn, [result, elem, index], contextStack, sourceCodeInfo)\n }, initial)\n }\n else if (Array.isArray(coll)) {\n if (coll.length === 0)\n return initial\n\n return coll.reduceRight((result: Any, elem, index) => {\n return executeFunction(fn, [result, elem, index], contextStack, sourceCodeInfo)\n }, initial)\n }\n else {\n if (Object.keys(coll).length === 0)\n return initial\n\n return Object.entries(coll).reduceRight((result: Any, [key, elem]) => {\n return executeFunction(fn, [result, elem, key], contextStack, sourceCodeInfo)\n }, initial)\n }\n },\n arity: toFixedArity(3),\n docs: {\n category: 'Collection',\n returns: { type: 'any' },\n args: {\n coll: { type: 'collection' },\n fun: {\n type: 'function',\n description: 'The function to call for each element in the collection. The function should take three arguments: the accumulator, the element itself, and the index.',\n },\n initial: {\n type: 'any',\n description: 'The initial value to use as the accumulator.',\n },\n },\n variants: [{ argumentNames: ['coll', 'fun', 'initial'] }],\n description: 'Runs $fun function on each element of the $coll (starting from the last item), passing in the return value from the calculation on the preceding element. The final result of running the reducer across all elements of the $coll is a single value. The function is called for each element in the collection, and it should take three arguments: the accumulator, the element itself, and the index.',\n seeAlso: ['reducei', 'reduce-right'],\n examples: [\n 'reducei-right([1, 2, 3], (acc, x, i) -> acc + x + i, 0)',\n 'reducei-right(\"Albert\", (acc, x, i) -> acc ++ x ++ i, \"\")',\n 'reducei-right({ a: 1, b: 2 }, -> $1 ++ $3, \"\")',\n ],\n },\n },\n 'reductions': {\n evaluate: ([coll, fn, initial], sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n assertAny(initial, sourceCodeInfo)\n\n assertAny(initial, sourceCodeInfo)\n if (typeof coll === 'string') {\n assertString(initial, sourceCodeInfo)\n if (coll.length === 0)\n return [initial]\n\n const resultArray: Any[] = [initial]\n coll.split('').reduce((result: Any, elem) => {\n const newVal = executeFunction(fn, [result, elem], contextStack, sourceCodeInfo)\n resultArray.push(newVal)\n return newVal\n }, initial)\n return resultArray\n }\n else if (Array.isArray(coll)) {\n if (coll.length === 0)\n return [initial]\n\n const resultArray: Any[] = [initial]\n coll.reduce((result: Any, elem) => {\n const newVal = executeFunction(fn, [result, elem], contextStack, sourceCodeInfo)\n resultArray.push(newVal)\n return newVal\n }, initial)\n return resultArray\n }\n else {\n if (Object.keys(coll).length === 0)\n return [initial]\n\n const resultArray: Any[] = [initial]\n Object.entries(coll).reduce((result: Any, [, elem]) => {\n const newVal = executeFunction(fn, [result, elem], contextStack, sourceCodeInfo)\n resultArray.push(newVal)\n return newVal\n }, initial)\n return resultArray\n }\n },\n arity: toFixedArity(3),\n docs: {\n category: 'Collection',\n returns: { type: 'any', array: true },\n args: {\n fun: { type: 'function' },\n coll: { type: 'collection' },\n initial: { type: 'any' },\n },\n variants: [{ argumentNames: ['coll', 'fun', 'initial'] }],\n description: 'Returns an array of the intermediate values of the reduction (see `reduce`) of $coll by $fun.',\n seeAlso: ['reduce', 'reductionsi'],\n examples: [\n 'reductions([1, 2, 3], +, 0)',\n 'reductions([1, 2, 3], +, 10)',\n 'reductions([], +, 0)',\n 'reductions({ a: 1, b: 2 }, +, 0)',\n `\nreductions(\n [1, 2, 3, 4, 5, 6, 7, 8, 9],\n (result, value) -> result + (even?(value) ? value : 0),\n 0\n)`,\n ],\n },\n },\n 'reductionsi': {\n evaluate: ([coll, fn, initial], sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n assertAny(initial, sourceCodeInfo)\n\n assertAny(initial, sourceCodeInfo)\n if (typeof coll === 'string') {\n assertString(initial, sourceCodeInfo)\n if (coll.length === 0)\n return [initial]\n\n const resultArray: Any[] = [initial]\n coll.split('').reduce((result: Any, elem, index) => {\n const newVal = executeFunction(fn, [result, elem, index], contextStack, sourceCodeInfo)\n resultArray.push(newVal)\n return newVal\n }, initial)\n return resultArray\n }\n else if (Array.isArray(coll)) {\n if (coll.length === 0)\n return [initial]\n\n const resultArray: Any[] = [initial]\n coll.reduce((result: Any, elem, index) => {\n const newVal = executeFunction(fn, [result, elem, index], contextStack, sourceCodeInfo)\n resultArray.push(newVal)\n return newVal\n }, initial)\n return resultArray\n }\n else {\n if (Object.keys(coll).length === 0)\n return [initial]\n\n const resultArray: Any[] = [initial]\n Object.entries(coll).reduce((result: Any, [key, elem]) => {\n const newVal = executeFunction(fn, [result, elem, key], contextStack, sourceCodeInfo)\n resultArray.push(newVal)\n return newVal\n }, initial)\n return resultArray\n }\n },\n arity: toFixedArity(3),\n docs: {\n category: 'Collection',\n returns: { type: 'any', array: true },\n args: {\n coll: { type: 'collection' },\n fun: {\n type: 'function',\n description: 'The function to call for each element in the collection. The function should take three arguments: the accumulator, the element itself, and the index.',\n },\n initial: {\n type: 'any',\n description: 'The initial value to use as the accumulator.',\n },\n },\n variants: [{ argumentNames: ['coll', 'fun', 'initial'] }],\n description: 'Returns an array of the intermediate values of the reduction (see `reduce`) of $coll by $fun. The function is called for each element in the collection, and it should take three arguments: the accumulator, the element itself, and the index.',\n seeAlso: ['reductions', 'reducei'],\n examples: [\n 'reductionsi([1, 2, 3], (acc, x, i) -> acc + x + i, 0)',\n 'reductionsi(\"Albert\", (acc, x, i) -> acc ++ x ++ i, \"\")',\n 'reductionsi({ a: 1, b: 2 }, -> $1 ++ $3, \"\")',\n ],\n },\n },\n 'get': {\n evaluate: (params, sourceCodeInfo) => {\n const [coll, key] = params\n const defaultValue = toAny(params[2])\n assertStringOrNumber(key, sourceCodeInfo)\n if (coll === null)\n return defaultValue\n\n assertColl(coll, sourceCodeInfo)\n const result = get(coll, key)\n return result === undefined ? defaultValue : result\n },\n arity: { min: 2, max: 3 },\n docs: {\n category: 'Collection',\n returns: { type: 'any' },\n args: {\n 'a': { type: 'collection' },\n 'b': { type: ['string', 'integer'] },\n 'not-found': { type: 'any', description: 'Default value to return if $b is not found.' },\n },\n variants: [\n { argumentNames: ['a', 'b'] },\n { argumentNames: ['a', 'b', 'not-found'] },\n ],\n description: 'Returns value in $a mapped at $b.',\n seeAlso: ['get-in', 'contains?', 'find', 'nth'],\n examples: [\n '[1, 2, 3] get 1',\n '{ a: 1 } get \"a\"',\n '\"Albert\" get \"3\"',\n `\nget(\n [1, 2, 3],\n 1, // Optional comma after last argument\n)`,\n `\nget(\n [],\n 1\n)`,\n `\nget(\n [],\n 1,\n \"default\"\n)`,\n `\nget(\n { a: 1 },\n \"a\"\n)`,\n `\nget(\n { a: 1 },\n \"b\"\n)`,\n `\nget(\n { a: 1 },\n \"b\",\n \"default\"\n)`,\n `\nget(\n null,\n \"a\"\n)`,\n `\nget(\n null,\n \"b\",\n \"default\"\n)`,\n ],\n },\n },\n 'get-in': {\n evaluate: (params, sourceCodeInfo): Any => {\n let coll = toAny(params[0])\n const keys = params[1] ?? [] // null behaves as empty array\n const defaultValue = toAny(params[2])\n assertArray(keys, sourceCodeInfo)\n for (const key of keys) {\n assertStringOrNumber(key, sourceCodeInfo)\n if (isColl(coll)) {\n const nextValue = get(coll, key)\n if (nextValue !== undefined)\n coll = nextValue\n else\n return defaultValue\n }\n else {\n return defaultValue\n }\n }\n return coll\n },\n arity: { min: 2, max: 3 },\n docs: {\n category: 'Collection',\n returns: { type: 'any' },\n args: {\n 'a': { type: 'collection' },\n 'b': { type: 'array' },\n 'not-found': { type: 'any' },\n },\n variants: [\n { argumentNames: ['a', 'b'] },\n { argumentNames: ['a', 'b', 'not-found'] },\n ],\n description: 'Returns the value in a nested collection, where $b is an array of keys. Returns $not-found if the key is not present. If $not-found is not set, `null` is returned.',\n seeAlso: ['get', 'assoc-in', 'update-in'],\n examples: [\n `\nget-in(\n [[1, 2, 3], [4, { a: \"Kalle\" }, 6]],\n [1, 1, \"a\", 0]\n)`,\n `\nget-in(\n [[1, 2, 3], [4, { a: \"Kalle\" }, 6]],\n [1, 1, \"b\", 0]\n)`,\n `\nget-in(\n [[1, 2, 3], [4, { a: \"Kalle\" }, 6]],\n [1, 1, \"b\", 0],\n \"Lisa\"\n)`,\n ],\n },\n },\n 'count': {\n evaluate: ([coll], sourceCodeInfo): number => {\n if (coll === null)\n return 0\n\n if (typeof coll === 'string')\n return coll.length\n\n assertColl(coll, sourceCodeInfo)\n if (Array.isArray(coll))\n return coll.length\n\n return Object.keys(coll).length\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Collection',\n returns: { type: 'number' },\n args: {\n coll: { type: ['collection', 'null'] },\n },\n variants: [{ argumentNames: ['coll'] }],\n description: 'Returns number of elements in $coll.',\n seeAlso: ['empty?'],\n examples: [\n 'count([1, 2, 3])',\n 'count([])',\n 'count({ a: 1 })',\n 'count(\"\")',\n 'count(\"Albert\")',\n 'count(null)',\n ],\n },\n },\n 'contains?': {\n evaluate: ([coll, key], sourceCodeInfo): boolean => {\n if (coll === null)\n return false\n\n assertColl(coll, sourceCodeInfo)\n if (isString(coll)) {\n assertString(key, sourceCodeInfo)\n return coll.includes(key)\n }\n if (isSeq(coll)) {\n assertAny(key, sourceCodeInfo)\n return !!coll.find(elem => deepEqual(asAny(elem), key, sourceCodeInfo))\n }\n assertString(key, sourceCodeInfo)\n return key in coll\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Collection',\n returns: { type: 'boolean' },\n args: {\n a: { type: ['collection', 'null'] },\n b: { type: ['string', 'integer'] },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns `true` if $a contains $b, otherwise returns `false`. For strings, it checks if substring is included.',\n seeAlso: ['get', 'find', 'index-of'],\n examples: [\n '[1, 2, 3] contains? 1',\n 'null contains? 1',\n '{ a: 1, b: 2 } contains? \"a\"',\n `\ncontains?(\n [],\n 1\n)`,\n `\ncontains?(\n [1],\n 1\n)`,\n `\ncontains?(\n [1, 2, 3],\n 1\n)`,\n `\ncontains?(\n {},\n \"a\"\n)`,\n `\ncontains?(\n { a: 1, b: 2 },\n \"a\"\n)`,\n ],\n },\n },\n 'assoc': {\n evaluate: ([coll, key, value], sourceCodeInfo): Coll => {\n assertColl(coll, sourceCodeInfo)\n assertStringOrNumber(key, sourceCodeInfo)\n assertAny(value, sourceCodeInfo)\n return assoc(coll, key, value, sourceCodeInfo)\n },\n arity: toFixedArity(3),\n docs: {\n category: 'Collection',\n returns: { type: 'collection' },\n args: {\n coll: { type: 'collection' },\n key: { type: ['string', 'number'] },\n value: { type: 'any' },\n kvs: { type: 'any', description: 'Key-value pairs to associate.', rest: true },\n },\n variants: [\n { argumentNames: ['coll', 'key', 'value'] },\n { argumentNames: ['coll', 'key', 'value', 'kvs'] },\n ],\n description: `\nAdd or replace the value of element $key to $value in $coll. Repeated for all key-value pairs in $kvs.\nIf $coll is an 'array', $key must be \\`number\\` satisfying \\`0 <=\\` $key \\`<= length\\`.`,\n seeAlso: ['assoc-in', 'dissoc', 'merge', 'update'],\n examples: [\n `\nassoc(\n [1, 2, 3],\n 1,\n \"Two\"\n)`,\n `\nassoc(\n [1, 2, 3],\n 3,\n \"Four\"\n)`,\n `\nassoc(\n { a: 1, b: 2 },\n \"a\",\n \"One\")`,\n `\nassoc(\n { a: 1, b: 2 },\n \"c\",\n \"Three\")`,\n `\nassoc(\n \"Albert\",\n 6,\n \"a\")`,\n ],\n },\n },\n 'assoc-in': {\n evaluate: ([originalColl, keys, value], sourceCodeInfo): Coll => {\n assertColl(originalColl, sourceCodeInfo)\n assertArray(keys, sourceCodeInfo)\n assertAny(value, sourceCodeInfo)\n\n if (keys.length === 1) {\n assertStringOrNumber(keys[0], sourceCodeInfo)\n return assoc(originalColl, keys[0], value, sourceCodeInfo)\n }\n\n const { coll, innerCollMeta } = cloneAndGetMeta(originalColl, keys, sourceCodeInfo)\n\n const lastKey = asStringOrNumber(keys[keys.length - 1], sourceCodeInfo)\n const parentKey = asStringOrNumber(keys[keys.length - 2], sourceCodeInfo)\n\n if (Array.isArray(innerCollMeta.parent)) {\n assertNumber(parentKey, sourceCodeInfo)\n innerCollMeta.parent[parentKey] = assoc(innerCollMeta.coll, lastKey, value, sourceCodeInfo)\n }\n else {\n assertString(parentKey, sourceCodeInfo)\n innerCollMeta.parent[parentKey] = assoc(innerCollMeta.coll, lastKey, value, sourceCodeInfo)\n }\n\n return coll\n },\n arity: toFixedArity(3),\n docs: {\n category: 'Collection',\n returns: { type: 'collection' },\n args: {\n coll: { type: 'collection' },\n ks: { type: ['number', 'string'], array: true },\n value: { type: 'any' },\n },\n variants: [{ argumentNames: ['coll', 'ks', 'value'] }],\n description: `\nAssociates a value in the nested collection $coll, where $ks is an array of keys and $value is the new value.\n\nIf any levels do not exist, objects will be created - and the corresponding keys must be of type string.`,\n seeAlso: ['assoc', 'get-in', 'update-in'],\n examples: [\n `\nassoc-in(\n {},\n [\"a\", \"b\", \"c\"],\n \"Albert\"\n)`,\n `\nassoc-in(\n [1, 2, [1, 2, 3]],\n [2, 1],\n \"Albert\"\n)`,\n `\nassoc-in(\n [1, 2, { name: \"albert\" }],\n [2, \"name\", 0],\n \"A\"\n)`,\n ],\n },\n },\n 'update': {\n evaluate: ([coll, key, fn, ...params], sourceCodeInfo, contextStack, { executeFunction }): Coll => {\n assertColl(coll, sourceCodeInfo)\n assertStringOrNumber(key, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n return update(coll, key, fn, params, contextStack, executeFunction, sourceCodeInfo)\n },\n arity: { min: 3 },\n docs: {\n category: 'Collection',\n returns: { type: 'collection' },\n args: {\n 'coll': { type: 'collection' },\n 'key': { type: ['string', 'number'] },\n 'fun': { type: 'function' },\n 'fun-args': { type: 'any', rest: true },\n },\n variants: [\n { argumentNames: ['coll', 'value', 'fun'] },\n { argumentNames: ['coll', 'value', 'fun', 'fun-args'] },\n ],\n description: `\nUpdates a value in the $coll collection, where $key is a key. $fun is a function\nthat will take the old value and any supplied $fun-args and\nreturn the new value.\nIf the key does not exist, \\`null\\` is passed as the old value.`,\n seeAlso: ['update-in', 'assoc'],\n examples: [\n `\nlet x = { a: 1, b: 2 };\nupdate(x, \"a\", inc)`,\n `\nlet x = { a: 1, b: 2 };\nupdate(\n x,\n \"c\",\n val -> null?(val) ? 0 : inc(val)\n)`,\n ],\n },\n },\n 'update-in': {\n evaluate: ([originalColl, keys, fn, ...params], sourceCodeInfo, contextStack, { executeFunction }): Coll => {\n assertColl(originalColl, sourceCodeInfo)\n assertArray(keys, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n\n if (keys.length === 1) {\n assertStringOrNumber(keys[0], sourceCodeInfo)\n return update(originalColl, keys[0], fn, params, contextStack, executeFunction, sourceCodeInfo)\n }\n\n const { coll, innerCollMeta } = cloneAndGetMeta(originalColl, keys, sourceCodeInfo)\n\n const lastKey = asStringOrNumber(keys[keys.length - 1], sourceCodeInfo)\n const parentKey = asStringOrNumber(keys[keys.length - 2], sourceCodeInfo)\n\n if (Array.isArray(innerCollMeta.parent)) {\n assertNumber(parentKey, sourceCodeInfo)\n innerCollMeta.parent[parentKey] = update(\n innerCollMeta.coll,\n lastKey,\n fn,\n params,\n contextStack,\n executeFunction,\n sourceCodeInfo,\n )\n }\n else {\n assertString(parentKey, sourceCodeInfo)\n innerCollMeta.parent[parentKey] = update(\n innerCollMeta.coll,\n lastKey,\n fn,\n params,\n contextStack,\n executeFunction,\n sourceCodeInfo,\n )\n }\n\n return coll\n },\n arity: { min: 3 },\n docs: {\n category: 'Collection',\n returns: { type: 'collection' },\n args: {\n 'coll': { type: 'collection' },\n 'ks': { type: 'array' },\n 'fun': { type: 'function' },\n 'fun-args': { type: 'any', rest: true },\n },\n variants: [\n { argumentNames: ['coll', 'ks', 'fun'] },\n { argumentNames: ['coll', 'ks', 'fun', 'fun-args'] },\n ],\n description: `Updates a value in the $coll collection, where $ks is an array of\nkeys and $fun is a function that will take the old value and\nany supplied $fun-args and return the new value. If any levels do not exist,\nobjects will be created - and the corresponding keys must be of type string.`,\n seeAlso: ['update', 'assoc-in', 'get-in'],\n examples: [\n `\nupdate-in(\n { a: [1, 2, 3] },\n [\"a\", 1],\n -> null?($) ? 0 : inc($)\n)`,\n `\nupdate-in(\n { a: { foo: \"bar\"} },\n [\"a\", \"foo\"],\n -> null?($) ? \"?\" : \"!\"\n)`,\n `\nupdate-in(\n { a: { foo: \"bar\"} },\n [\"a\", \"baz\"],\n -> null?($) ? \"?\" : \"!\"\n)`,\n `\nupdate-in(\n { a: [1, 2, 3] },\n [\"a\", 1],\n *,\n 10,\n 10,\n 10,\n)`,\n ],\n },\n },\n '++': {\n evaluate: (params, sourceCodeInfo): Any => {\n if (!isNumber(params[0])) {\n assertColl(params[0], sourceCodeInfo)\n }\n if (Array.isArray(params[0])) {\n return params.reduce((result: Arr, arr) => {\n assertArray(arr, sourceCodeInfo)\n return result.concat(arr)\n }, [])\n }\n else if (isStringOrNumber(params[0])) {\n return params.reduce((result: string, s) => {\n assertStringOrNumber(s, sourceCodeInfo)\n return `${result}${s}`\n }, '')\n }\n else {\n return params.reduce((result: Obj, obj) => {\n assertObj(obj, sourceCodeInfo)\n return Object.assign(result, obj)\n }, {})\n }\n },\n arity: { min: 1 },\n docs: {\n category: 'Collection',\n returns: { type: 'collection' },\n args: {\n a: { type: 'collection' },\n b: { type: 'collection' },\n colls: { type: 'collection', rest: true },\n },\n variants: [\n { argumentNames: ['a'] },\n { argumentNames: ['a', 'colls'] },\n ],\n description: 'Concatenates collections into one collection.',\n seeAlso: ['mapcat', 'str', 'join', 'push', 'unshift'],\n examples: [\n '\"Albert\" ++ \" \" ++ \"Mojir\"',\n '\"Albert\" ++ \"Mojir\"',\n\n '++(\"Albert\", \"-\", \"Mojir\")',\n '++(\"Albert\")',\n\n '++(\"A\", \"l\", \"b\", \"e\", \"r\", \"t\")',\n '++([1, 2], [3, 4])',\n '++([], [3, 4])',\n '++([1, 2], [])',\n '++([1, 2], [3, 4], [5, 6])',\n '++([])',\n '++({ a: 1, b: 2 }, { b: 1, c: 2 })',\n '++({}, { a: 1 })',\n ],\n },\n },\n 'not-empty': {\n evaluate: ([coll], sourceCodeInfo): Coll | null => {\n if (coll === null)\n return null\n\n assertColl(coll, sourceCodeInfo)\n if (typeof coll === 'string')\n return coll.length > 0 ? coll : null\n\n if (Array.isArray(coll))\n return coll.length > 0 ? coll : null\n\n return Object.keys(coll).length > 0 ? coll : null\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Collection',\n returns: { type: 'boolean' },\n args: {\n coll: { type: ['collection', 'null'] },\n },\n variants: [{ argumentNames: ['coll'] }],\n description: 'Returns `null` if $coll is empty or `null`, otherwise $coll.',\n seeAlso: ['empty?', 'not-empty?'],\n examples: [\n 'not-empty([])',\n 'not-empty([1, 2, 3])',\n 'not-empty({})',\n 'not-empty({ a: 2 })',\n 'not-empty(\"\")',\n 'not-empty(\"Albert\")',\n 'not-empty(null)',\n ],\n },\n },\n 'every?': {\n evaluate: ([coll, fn], sourceCodeInfo, contextStack, { executeFunction }): boolean => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n\n if (Array.isArray(coll))\n return coll.every(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n\n if (typeof coll === 'string')\n return coll.split('').every(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n\n return Object.entries(coll).every(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Collection',\n returns: { type: 'boolean' },\n args: {\n a: { type: 'collection' },\n b: { type: 'function' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns `true` if all entries in $a pass the test implemented by $b, otherwise returns `false`.',\n seeAlso: ['any?', 'not-every?', 'not-any?', 'every-pred', 'Grid.every?'],\n examples: [\n '[1, 2, 3] every? number?',\n '[1, 2, 3] every? even?',\n `\nevery?(\n [\"Albert\", \"Mojir\", 160, [1, 2]],\n string?,\n)`,\n `\nevery?(\n [50, 100, 150, 200],\n -> $ > 10,\n)`,\n `\nevery?(\n [],\n number?\n)`,\n `\nevery?(\n \"\",\n number?\n)`,\n `\nevery?(\n {},\n number?\n)`,\n `\nevery?(\n { a: 2, b: 4},\n -> even?(second($))\n)`,\n `\nevery?(\n { a: 2, b: 3 },\n -> even?(second($))\n)`,\n ],\n },\n },\n 'any?': {\n evaluate: ([coll, fn], sourceCodeInfo, contextStack, { executeFunction }): boolean => {\n assertFunctionLike(fn, sourceCodeInfo)\n assertColl(coll, sourceCodeInfo)\n\n if (Array.isArray(coll))\n return coll.some(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n\n if (typeof coll === 'string')\n return coll.split('').some(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n\n return Object.entries(coll).some(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Collection',\n returns: { type: 'boolean' },\n args: {\n a: { type: 'collection' },\n b: { type: 'function' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns `true` if any element in $a pass the test implemented by $b, otherwise returns `false`.',\n seeAlso: ['every?', 'not-any?', 'not-every?', 'some-pred', 'some', 'Grid.some?'],\n examples: [\n `\nany?(\n [\"Albert\", \"Mojir\", 160, [1, 2]],\n string?\n)`,\n `\nany?(\n [50, 100, 150, 200],\n x -> x > 10\n)`,\n `\nany?(\n [],\n number?\n)`,\n `\nany?(\n \"\",\n number?\n)`,\n `\nany?(\n {},\n number?\n)`,\n `\nany?(\n { a: 2, b: 3 },\n -> even?(second($))\n)`,\n `\nany?(\n { a: 1, b: 3 },\n -> even?(second($))\n)`,\n ],\n },\n },\n 'not-any?': {\n evaluate: ([coll, fn], sourceCodeInfo, contextStack, { executeFunction }): boolean => {\n assertFunctionLike(fn, sourceCodeInfo)\n assertColl(coll, sourceCodeInfo)\n\n if (Array.isArray(coll))\n return !coll.some(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n\n if (typeof coll === 'string')\n return !coll.split('').some(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n\n return !Object.entries(coll).some(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Collection',\n returns: { type: 'boolean' },\n args: {\n a: { type: 'collection' },\n b: { type: 'function' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns `false` if any element in $a pass the test implemented by $b, otherwise returns `true`.',\n seeAlso: ['any?', 'every?', 'not-every?'],\n examples: [\n `\nnot-any?(\n [\"Albert\", \"Mojir\", 160, [1, 2]],\n string?\n)`,\n `\nnot-any?(\n [50, 100, 150, 200],\n x -> x > 10\n)`,\n `\nnot-any?(\n [],\n number?\n)`,\n `\nnot-any?(\n \"\",\n number?\n)`,\n `\nnot-any?(\n {},\n number?\n)`,\n `\nnot-any?(\n { a: 2, b: 3 },\n -> even?(second($))\n)`,\n `\nnot-any?(\n { a: 1, b: 3 },\n -> even?(second($))\n)`,\n ],\n },\n },\n 'not-every?': {\n evaluate: ([coll, fn], sourceCodeInfo, contextStack, { executeFunction }): boolean => {\n assertFunctionLike(fn, sourceCodeInfo)\n assertColl(coll, sourceCodeInfo)\n\n if (Array.isArray(coll))\n return !coll.every(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n\n if (typeof coll === 'string')\n return !coll.split('').every(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n\n return !Object.entries(coll).every(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Collection',\n returns: { type: 'boolean' },\n args: {\n a: { type: 'collection' },\n b: { type: 'function' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns `true` if at least one element in $a does not pass the test implemented by $b, otherwise returns `false`.',\n seeAlso: ['every?', 'any?', 'not-any?'],\n examples: [\n `\nnot-every?(\n [\"Albert\", \"Mojir\", 160, [1, 2]],\n string?\n)`,\n `\nnot-every?(\n [50, 100, 150, 200],\n x -> x > 10\n)`,\n `\nnot-every?(\n [],\n number?\n)`,\n `\nnot-every?(\n \"\",\n number?\n)`,\n `\nnot-every?(\n {},\n number?\n)`,\n `\nnot-every?(\n { a: 2, b: 4 },\n -> even?(second($))\n)`,\n `\nnot-every?(\n { a: 2, b: 3 },\n -> even?(second($))\n)`,\n ],\n },\n },\n}\n","import type { Arr } from '../../interface'\nimport { assertArray } from '../../typeGuards/array'\nimport { asNumber, assertNumber } from '../../typeGuards/number'\nimport type { BuiltinNormalExpressions } from '../interface'\nimport { assertFunctionLike } from '../../typeGuards/lits'\nimport { toFixedArity } from '../../utils/arity'\n\nexport const arrayNormalExpression: BuiltinNormalExpressions = {\n 'range': {\n evaluate: (params, sourceCodeInfo): Arr => {\n const [first, second, third] = params\n let from: number\n let to: number\n let step: number\n assertNumber(first, sourceCodeInfo, { finite: true })\n\n if (params.length === 1) {\n from = 0\n to = first\n step = to >= 0 ? 1 : -1\n }\n else if (params.length === 2) {\n assertNumber(second, sourceCodeInfo, { finite: true })\n from = first\n to = second\n step = to >= from ? 1 : -1\n }\n else {\n assertNumber(second, sourceCodeInfo, { finite: true })\n assertNumber(third, sourceCodeInfo, { finite: true })\n from = first\n to = second\n step = third\n if (to > from)\n assertNumber(step, sourceCodeInfo, { positive: true })\n else if (to < from)\n assertNumber(step, sourceCodeInfo, { negative: true })\n else\n assertNumber(step, sourceCodeInfo, { nonZero: true })\n }\n\n const result: number[] = []\n\n for (let i = from; step < 0 ? i > to : i < to; i += step)\n result.push(i)\n\n return result\n },\n arity: { min: 1, max: 3 },\n docs: {\n category: 'Array',\n returns: { type: 'number', array: true },\n args: {\n a: { type: 'number' },\n b: { type: 'number' },\n step: { type: 'number' },\n },\n variants: [\n { argumentNames: ['b'] },\n { argumentNames: ['a', 'b'] },\n { argumentNames: ['a', 'b', 'step'] },\n ],\n description: `$range creates an array with a range of numbers from $a to $b (exclusive), by $step.\n\n$a defaults to 0.\n$step defaults to 1.`,\n seeAlso: ['repeat', 'Vector.linspace'],\n examples: [\n 'range(4)',\n 'range(1, 4)',\n '1 range 10',\n 'range(0.4, 4.9)',\n `\nrange(\n 0.25, // start value\n 1, // end value (exclusive)\n 0.25, // step value\n)`,\n ],\n },\n },\n\n 'repeat': {\n evaluate: ([value, count], sourceCodeInfo): Arr => {\n assertNumber(count, sourceCodeInfo, { integer: true, nonNegative: true })\n const result: Arr = []\n for (let i = 0; i < count; i += 1)\n result.push(value)\n\n return result\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Array',\n returns: { type: 'any', array: true },\n args: {\n a: { type: 'any' },\n b: { type: 'integer' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns an array with $a repeated $b times.',\n seeAlso: ['range', 'Vector.ones', 'Vector.zeros', 'Vector.fill', 'Vector.generate', 'string-repeat'],\n examples: [\n 'repeat(10, 3)',\n 'repeat(10, 0)',\n '\"Albert\" repeat 5',\n ],\n },\n },\n\n 'flatten': {\n evaluate: ([seq, depth], sourceCodeInfo): Arr => {\n assertArray(seq, sourceCodeInfo)\n\n const actualDepth = depth === undefined || depth === Number.POSITIVE_INFINITY\n ? Number.POSITIVE_INFINITY\n : asNumber(depth, sourceCodeInfo, { integer: true, nonNegative: true })\n\n return seq.flat(actualDepth)\n },\n arity: { min: 1, max: 2 },\n docs: {\n category: 'Array',\n returns: { type: 'any', array: true },\n args: {\n x: { type: ['array', 'any'], description: 'If $x is not an array, `[ ]` is returned.' },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'Takes a nested array $x and flattens it.',\n seeAlso: ['mapcat'],\n examples: [\n 'flatten([1, 2, [3, 4], 5])',\n `\nlet foo = \"bar\";\nflatten([\n 1,\n \" 2 A \",\n [foo, [4, [\"ABC\"]]],\n 6,\n])`,\n ],\n hideOperatorForm: true,\n },\n },\n 'mapcat': {\n evaluate: ([arr, fn], sourceCodeInfo, contextStack, { executeFunction }): Arr | string => {\n assertArray(arr, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n return arr.map(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo)).flat(1)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Array',\n returns: { type: 'collection' },\n args: {\n a: { type: 'collection' },\n b: { type: 'function' },\n colls: { type: 'collection', array: true },\n fun: { type: 'function' },\n },\n variants: [{ argumentNames: ['colls', 'fun'] }],\n description: 'Returns the result of applying concat to the result of applying map to $fun and $colls.',\n seeAlso: ['flatten', 'map', '++'],\n examples: [\n '[[3, 2, 1, 0], [6, 5, 4], [9, 8, 7]] mapcat reverse',\n 'mapcat([[3, 2, 1, 0], [6, 5, 4], [9, 8, 7]], reverse)',\n '[[3, 2, 1, 0,], [6, 5, 4,], [9, 8, 7]] mapcat reverse',\n `\nlet foo = (n) -> do\n [n - 1, n, n + 1]\nend;\n[1, 2, 3] mapcat foo`,\n `\nmapcat(\n [[1, 2], [2, 2], [2, 3]],\n -> $ remove even?\n)`,\n ],\n },\n },\n 'moving-fn': {\n evaluate: ([arr, windowSize, fn], sourceCodeInfo, contextStack, { executeFunction }): Arr => {\n assertArray(arr, sourceCodeInfo)\n assertNumber(windowSize, sourceCodeInfo, { integer: true, lte: arr.length })\n assertFunctionLike(fn, sourceCodeInfo)\n\n const result = []\n for (let i = 0; i <= arr.length - windowSize; i++) {\n const window = arr.slice(i, i + windowSize)\n const value = executeFunction(fn, [window], contextStack, sourceCodeInfo)\n result.push(value)\n }\n return result\n },\n arity: toFixedArity(3),\n docs: {\n category: 'Array',\n returns: { type: 'array' },\n args: {\n arr: { type: 'array' },\n windowSize: { type: 'number', description: 'The size of the moving window.' },\n fn: { type: 'function' },\n },\n variants: [{ argumentNames: ['arr', 'windowSize', 'fn'] }],\n description: 'Returns the result of applying $fn to each moving window of size $windowSize in $arr.',\n seeAlso: ['running-fn', 'Vector.moving-mean'],\n examples: [\n 'let v = import(\"Vector\"); moving-fn([1, 2, 3], 2, v.sum)',\n 'let v = import(\"Vector\"); moving-fn([1, 2, 3], 1, v.sum)',\n 'let v = import(\"Vector\"); moving-fn([1, 2, 3], 3, v.sum)',\n ],\n },\n },\n 'running-fn': {\n evaluate: ([arr, fn], sourceCodeInfo, contextStack, { executeFunction }): Arr => {\n assertArray(arr, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n\n const result = []\n for (let i = 0; i < arr.length; i += 1) {\n const subArr = arr.slice(0, i + 1)\n result.push(executeFunction(fn, [subArr], contextStack, sourceCodeInfo))\n }\n return result\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Array',\n returns: { type: 'array' },\n args: {\n a: { type: 'array' },\n b: { type: 'function' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns the result of applying $b to each element of $a.',\n seeAlso: ['moving-fn', 'Vector.running-mean'],\n examples: [\n 'let v = import(\"Vector\"); running-fn([1, 2, 3], v.sum)',\n 'let v = import(\"Vector\"); running-fn([1, 2, 3], v.max)',\n 'let v = import(\"Vector\"); running-fn([1, 2, 3], v.min)',\n ],\n },\n },\n}\n","import type { Any, Arr, Obj, Seq } from '../../interface'\nimport type { SourceCodeInfo } from '../../tokenizer/token'\nimport { asArray, assertArray, assertCharArray } from '../../typeGuards/array'\nimport { asAny, asSeq, assertAny, assertFunctionLike, assertSeq } from '../../typeGuards/lits'\nimport { asNumber, assertNumber } from '../../typeGuards/number'\nimport { assertString, assertStringOrNumber } from '../../typeGuards/string'\nimport { collHasKey, compare, deepEqual, toAny, toNonNegativeInteger } from '../../utils'\nimport { toFixedArity } from '../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../interface'\n\nexport const sequenceNormalExpression: BuiltinNormalExpressions = {\n 'nth': {\n evaluate: (params, sourceCodeInfo): Any => {\n const [seq, i] = params\n const defaultValue = toAny(params[2])\n\n assertNumber(i, sourceCodeInfo, { integer: true })\n\n if (seq === null)\n return defaultValue\n\n assertSeq(seq, sourceCodeInfo)\n if (i >= 0 && i < seq.length) {\n const result = toAny(seq[i])\n return result\n }\n else {\n return defaultValue\n }\n },\n arity: { min: 2, max: 3 },\n docs: {\n category: 'Sequence',\n returns: { type: 'any' },\n args: {\n 'a': { type: 'sequence' },\n 'b': { type: 'integer' },\n 'seq': { type: ['sequence', 'null'] },\n 'n': { type: 'integer' },\n 'not-found': { type: 'any' },\n },\n variants: [\n { argumentNames: ['seq', 'n'] },\n { argumentNames: ['seq', 'n', 'not-found'] },\n ],\n description: 'Accesses element $n of $seq. Accessing out-of-bounds indices returns $not-found, if present, else `null`.',\n seeAlso: ['first', 'second', 'last', 'get', 'slice'],\n examples: [\n '[1, 2, 3] nth 1',\n '\"A string\" nth 3',\n 'nth([1, 2, 3], 1)',\n 'nth([1, 2, 3], 3)',\n 'nth([1, 2, 3], -1)',\n 'nth([1, 2, 3], 3, 99)',\n 'nth(\"A string\", 1)',\n 'nth(\"A string\", 3)',\n 'nth(\"A string\", -3)',\n 'nth(\"A string\", 30, \"X\")',\n 'nth(null, 1)',\n 'nth(null, 1, \"Default value\")',\n ],\n },\n },\n 'first': {\n evaluate: ([array], sourceCodeInfo): Any => {\n if (array === null)\n return null\n\n assertSeq(array, sourceCodeInfo)\n const result = toAny(array[0])\n\n return result\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Sequence',\n returns: { type: 'any' },\n args: { seq: { type: ['sequence', 'null'] } },\n variants: [{ argumentNames: ['seq'] }],\n description: 'Returns the first element of $seq. If $seq is empty or `null`, `null` is returned.',\n seeAlso: ['second', 'last', 'nth', 'rest', 'next'],\n examples: [\n 'first([\"Albert\", \"Mojir\", 160, [1, 2]])',\n 'first([])',\n 'first(null)',\n ],\n },\n },\n 'last': {\n evaluate: ([array], sourceCodeInfo): Any => {\n if (array === null)\n return null\n\n assertSeq(array, sourceCodeInfo)\n const result = toAny(array.at(-1))\n\n return result\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Sequence',\n returns: { type: 'any' },\n args: { seq: { type: ['sequence', 'null'] } },\n variants: [{ argumentNames: ['seq'] }],\n description: 'Returns the last element of $seq. If $seq is empty, `null` is returned.',\n seeAlso: ['first', 'second', 'nth', 'pop'],\n examples: [\n 'last([\"Albert\", \"Mojir\", 160, [1, 2]])',\n 'last([1, 2])',\n 'last([1])',\n 'last([])',\n 'last(null)',\n ],\n },\n },\n 'pop': {\n evaluate: ([seq], sourceCodeInfo): Seq => {\n assertSeq(seq, sourceCodeInfo)\n if (typeof seq === 'string') {\n return seq.substring(0, seq.length - 1)\n }\n\n return seq.slice(0, seq.length - 1)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Sequence',\n returns: { type: ['sequence', 'null'], rest: true },\n args: { seq: { type: 'sequence' } },\n variants: [{ argumentNames: ['seq'] }],\n description: 'Returns a copy of $seq with last element removed. If $seq is empty `null` is returned.',\n seeAlso: ['push', 'shift', 'last'],\n examples: [\n 'pop([1, 2, 3])',\n 'pop([])',\n ],\n },\n },\n 'position': {\n evaluate: ([seq, fn]: Arr, sourceCodeInfo, contextStack, { executeFunction }): number | null => {\n assertFunctionLike(fn, sourceCodeInfo)\n if (seq === null)\n return null\n\n assertSeq(seq, sourceCodeInfo)\n if (typeof seq === 'string') {\n const index = seq.split('').findIndex(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n return index !== -1 ? index : null\n }\n else {\n const index = seq.findIndex(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n return index !== -1 ? index : null\n }\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Sequence',\n returns: { type: ['number', 'null'] },\n args: {\n a: { type: 'sequence' },\n b: { type: 'function' },\n seq: { type: ['sequence', 'null'] },\n fun: { type: 'function' },\n },\n variants: [{ argumentNames: ['seq', 'fun'] }],\n description: 'Returns the index of the first elements that passes the test implemented by $fun. If no element was found, `null` is returned.',\n seeAlso: ['index-of', 'some', 'find'],\n examples: [\n `\nposition(\n [\"Albert\", \"Mojir\", 160, [1, 2]],\n string?\n)`,\n `\nposition(\n [5, 10, 15, 20],\n -> $ > 10\n)`,\n `\nposition(\n [5, 10, 15, 20],\n -> $ > 100\n)`,\n `\nposition(\n null,\n -> $ > 100\n)`,\n ],\n },\n },\n 'index-of': {\n evaluate: ([seq, value], sourceCodeInfo): number | null => {\n assertAny(value, sourceCodeInfo)\n if (seq === null)\n return null\n\n assertSeq(seq, sourceCodeInfo)\n if (typeof seq === 'string') {\n assertString(value, sourceCodeInfo)\n const index = seq.indexOf(value)\n return index !== -1 ? index : null\n }\n else {\n const index = seq.findIndex(item => deepEqual(asAny(item, sourceCodeInfo), value), sourceCodeInfo)\n return index !== -1 ? index : null\n }\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Sequence',\n returns: { type: ['number', 'null'] },\n args: {\n a: { type: 'sequence' },\n b: { type: 'any' },\n seq: { type: ['sequence', 'null'] },\n x: { type: 'any' },\n },\n variants: [{ argumentNames: ['seq', 'x'] }],\n description: 'Returns the index of $x in $seq. If element is not present in $seq `null` is returned.',\n seeAlso: ['last-index-of', 'position', 'contains?'],\n examples: [\n '[[1], [2], [1], [2]] index-of [1]',\n 'index-of([\"Albert\", \"Mojir\", 160, [1, 2]], \"Mojir\")',\n 'index-of([5, 10, 15, 20], 15)',\n 'index-of([5, 10, 15, 20], 1)',\n 'index-of(null, 1)',\n ],\n },\n },\n 'last-index-of': {\n evaluate: ([seq, value], sourceCodeInfo): number | null => {\n assertAny(value, sourceCodeInfo)\n if (seq === null)\n return null\n\n assertSeq(seq, sourceCodeInfo)\n if (typeof seq === 'string') {\n assertString(value, sourceCodeInfo)\n const index = seq.lastIndexOf(value)\n return index !== -1 ? index : null\n }\n else {\n const index = seq.findLastIndex(item => deepEqual(asAny(item, sourceCodeInfo), value), sourceCodeInfo)\n return index !== -1 ? index : null\n }\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Sequence',\n returns: { type: ['number', 'null'] },\n args: {\n a: { type: 'sequence' },\n b: { type: 'any' },\n seq: { type: ['sequence', 'null'] },\n x: { type: 'any' },\n },\n variants: [{ argumentNames: ['seq', 'x'] }],\n description: 'Returns the last index of $x in $seq. If element is not present in $seq `null` is returned.',\n seeAlso: ['index-of'],\n examples: [\n '[[1], [2], [1], [2]] last-index-of [1]',\n 'last-index-of([\"Albert\", \"Mojir\", 160, [1, 2]], \"Mojir\")',\n 'last-index-of([5, 10, 15, 20, 15], 15)',\n 'last-index-of([5, 10, 15, 20], 1)',\n 'last-index-of(null, 1)',\n ],\n },\n },\n 'push': {\n evaluate: ([seq, ...values], sourceCodeInfo): Seq => {\n assertSeq(seq, sourceCodeInfo)\n if (typeof seq === 'string') {\n assertCharArray(values, sourceCodeInfo)\n return [seq, ...values].join('')\n }\n else {\n return [...seq, ...values]\n }\n },\n arity: { min: 2 },\n docs: {\n category: 'Sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'any' },\n seq: { type: 'sequence' },\n values: { type: 'any', rest: true, description: 'At least one.' },\n },\n variants: [{ argumentNames: ['seq', 'values'] }],\n description: 'Returns copy of $seq with $values added to the end of it.',\n seeAlso: ['unshift', 'pop', '++'],\n examples: [\n '[1, 2, 3] push 4',\n '\"Albert\" push \"!\"',\n 'push([1, 2, 3], 4)',\n 'push([1, 2, 3], 4, 5, 6)',\n `\nlet l = [1, 2, 3];\npush(l, 4);\nl`,\n ],\n },\n },\n 'rest': {\n evaluate: ([seq], sourceCodeInfo): Arr | string => {\n assertSeq(seq, sourceCodeInfo)\n if (Array.isArray(seq)) {\n if (seq.length <= 1)\n return []\n\n return seq.slice(1)\n }\n return seq.substring(1)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Sequence',\n returns: { type: ['sequence', 'null'] },\n args: { seq: { type: 'sequence' } },\n variants: [{ argumentNames: ['seq'] }],\n description: `If $seq is an array, returns a new array with all but the first element from $seq.\nIf $seq has less than two elements, an empty array is returned.\nFor string $seq returns all but the first characters in $seq.`,\n seeAlso: ['next', 'first', 'shift'],\n examples: [\n 'rest([\"Albert\", \"Mojir\", 160, [1, 2]])',\n 'rest([\"Albert\"])',\n 'rest([])',\n 'rest(\"Albert\")',\n 'rest(\"A\",)',\n 'rest(\"\")',\n ],\n },\n },\n 'next': {\n evaluate: ([seq], sourceCodeInfo): Arr | string | null => {\n assertSeq(seq, sourceCodeInfo)\n if (Array.isArray(seq)) {\n if (seq.length <= 1)\n return null\n\n return seq.slice(1)\n }\n if (seq.length <= 1)\n return null\n\n return seq.substring(1)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Sequence',\n returns: { type: ['sequence', 'null'] },\n args: { seq: { type: 'sequence' } },\n variants: [{ argumentNames: ['seq'] }],\n description: 'If $seq is an array, returns a new array with all but the first element from $seq. If $seq has less than two elements, `null` is returned. For string $seq returns all but the first characters in $seq. If length of string $seq is less than two, `null` is returned.',\n seeAlso: ['rest', 'first'],\n examples: [\n 'next([\"Albert\", \"Mojir\", 160, [1, 2]])',\n 'next([\"Albert\"])',\n 'next([])',\n 'next(\"Albert\")',\n 'next(\"A\",)',\n 'next(\"\")',\n ],\n },\n },\n 'reverse': {\n evaluate: ([seq], sourceCodeInfo): Any => {\n if (seq === null)\n return null\n\n assertSeq(seq, sourceCodeInfo)\n if (Array.isArray(seq)) {\n return [...seq].reverse()\n }\n\n return seq.split('').reverse().join('')\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Sequence',\n returns: { type: ['sequence', 'null'] },\n args: { seq: { type: ['sequence', 'null'] } },\n variants: [{ argumentNames: ['seq'] }],\n description: 'If $seq is an array, creates a new array with the elements from $seq in reversed order. If $seq is a string, returns new reversed string.',\n seeAlso: ['sort'],\n examples: [\n 'reverse([\"Albert\", \"Mojir\", 160, [1, 2]])',\n 'reverse([])',\n 'reverse(\"Albert\")',\n 'reverse(null)',\n ],\n },\n },\n 'second': {\n evaluate: ([seq], sourceCodeInfo): Any => {\n if (seq === null)\n return null\n\n assertSeq(seq, sourceCodeInfo)\n return toAny(seq[1])\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Sequence',\n returns: { type: 'any' },\n args: { seq: { type: ['sequence', 'null'] } },\n variants: [{ argumentNames: ['seq'] }],\n description: 'Returns the second element of $seq. If $seq has less than two elements or is `null`, `null` is returned.',\n seeAlso: ['first', 'last', 'nth'],\n examples: [\n 'second([\"Albert\", \"Mojir\", 160, [1, 2]])',\n 'second([1])',\n 'second([])',\n 'second(null)',\n ],\n },\n },\n 'shift': {\n evaluate: ([seq], sourceCodeInfo): Any => {\n assertSeq(seq, sourceCodeInfo)\n if (typeof seq === 'string')\n return seq.substring(1)\n\n const copy = [...seq]\n copy.shift()\n return copy\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Sequence',\n returns: { type: ['sequence', 'null'] },\n args: { seq: { type: 'sequence' } },\n variants: [{ argumentNames: ['seq'] }],\n description: 'Returns a copy of $seq with first element removed. If $seq is empty `null` is returned.',\n seeAlso: ['unshift', 'pop', 'rest'],\n examples: [\n 'shift([1, 2, 3])',\n 'shift([])',\n ],\n },\n },\n 'slice': {\n evaluate: (params, sourceCodeInfo): Any => {\n const [seq, from, to] = params\n assertSeq(seq, sourceCodeInfo)\n assertNumber(from, sourceCodeInfo, { integer: true })\n\n if (params.length === 2) {\n if (Array.isArray(seq)) {\n return seq.slice(from)\n }\n return seq.slice(from)\n }\n\n assertNumber(to, sourceCodeInfo, { integer: true })\n if (Array.isArray(seq)) {\n return seq.slice(from, to)\n }\n return seq.slice(from, to)\n },\n arity: { min: 2, max: 3 },\n docs: {\n category: 'Sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'integer' },\n seq: { type: 'sequence', rest: true },\n start: { type: 'integer', description: 'Defaults to `0`.' },\n stop: { type: 'integer', description: 'Defaults lenght of sequence + 1.' },\n },\n variants: [\n { argumentNames: ['seq'] },\n { argumentNames: ['seq', 'start'] },\n { argumentNames: ['seq', 'start', 'stop'] },\n ],\n description: 'Returns a copy of a portion of $seq from index $start (inclusive) to $stop (exclusive).',\n seeAlso: ['take', 'drop', 'splice', 'nth'],\n examples: [\n '[1, 2, 3, 4, 5] slice 2',\n 'slice([1, 2, 3, 4, 5], 2, 4)',\n 'slice([1, 2, 3, 4, 5], 2)',\n ],\n },\n },\n 'splice': {\n evaluate: (params, sourceCodeInfo): Any => {\n const [seq, start, deleteCount, ...rest] = params\n assertSeq(seq, sourceCodeInfo)\n assertNumber(start, sourceCodeInfo, { integer: true })\n assertNumber(deleteCount, sourceCodeInfo, { integer: true, nonNegative: true })\n\n const from = start < 0 ? seq.length + start : start\n\n if (Array.isArray(seq)) {\n return [...seq.slice(0, from), ...rest, ...seq.slice(from + deleteCount)]\n }\n\n rest.forEach(elem => assertString(elem, sourceCodeInfo))\n return `${seq.substring(0, from)}${rest.join('')}${seq.substring(from + deleteCount)}`\n },\n arity: { min: 3 },\n docs: {\n category: 'Sequence',\n returns: { type: 'sequence' },\n args: {\n seq: { type: 'sequence', rest: true },\n start: { type: 'integer' },\n deleteCount: { type: 'integer' },\n items: { type: 'any', rest: true },\n },\n variants: [\n { argumentNames: ['seq', 'start', 'deleteCount'] },\n { argumentNames: ['seq', 'start', 'deleteCount', 'items'] },\n ],\n description: 'Returns a a spliced array. Removes $deleteCount elements from $seq starting at $start and replaces them with $items. If $start is negative, it is counting from the end of the array.',\n seeAlso: ['slice', 'remove-at'],\n examples: [\n 'splice([1, 2, 3, 4, 5], 2, 2, \"x\")',\n 'splice([1, 2, 3, 4, 5], -2, 1, \"x\")',\n 'splice(\"Albert\", 2, 2, \"fo\")',\n ],\n },\n },\n 'some': {\n evaluate: ([seq, fn]: Arr, sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertFunctionLike(fn, sourceCodeInfo)\n if (seq === null)\n return null\n\n assertSeq(seq, sourceCodeInfo)\n\n if (seq.length === 0)\n return null\n\n if (typeof seq === 'string')\n return seq.split('').find(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo)) ?? null\n\n return toAny(seq.find(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo)))\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Sequence',\n returns: { type: 'any' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'function' },\n seq: { type: ['sequence', 'null'] },\n fun: { type: 'function' },\n },\n variants: [{ argumentNames: ['seq', 'fun'] }],\n description: 'Returns the first element that passes the test implemented by $fun. I no element was found, `null` is returned.',\n seeAlso: ['position', 'any?', 'find'],\n examples: [\n `\nsome(\n [\"Albert\", \"Mojir\", 160, [1, 2]],\n string?\n)`,\n `\nsome(\n [5, 10, 15, 20],\n -> $ > 10\n)`,\n `\nsome(\n [1, 2, 3, 4],\n -> $ > 10\n)`,\n `\nsome(\n [],\n -> $ > 10\n)`,\n `\nsome(\n null,\n -> $ > 10\n)`,\n ],\n },\n },\n 'sort': {\n evaluate: (params: Arr, sourceCodeInfo, contextStack, { executeFunction }): Seq => {\n const [seq] = params\n const defaultComparer = params.length === 1\n const comparer = defaultComparer ? null : params[1]\n assertSeq(seq, sourceCodeInfo)\n\n if (typeof seq === 'string') {\n const result = seq.split('')\n if (defaultComparer) {\n result.sort((a, b) => compare(a, b, sourceCodeInfo))\n }\n else {\n assertFunctionLike(comparer, sourceCodeInfo)\n result.sort((a, b) => {\n const compareValue = executeFunction(comparer, [a, b], contextStack, sourceCodeInfo)\n assertNumber(compareValue, sourceCodeInfo, { finite: true })\n return compareValue\n })\n }\n return result.join('')\n }\n\n const result = [...seq]\n if (defaultComparer) {\n result.sort((a, b) => {\n assertStringOrNumber(a, sourceCodeInfo)\n assertStringOrNumber(b, sourceCodeInfo)\n return compare(a, b, sourceCodeInfo)\n })\n }\n else {\n result.sort((a, b) => {\n assertFunctionLike(comparer, sourceCodeInfo)\n const compareValue = executeFunction(comparer, [a, b], contextStack, sourceCodeInfo)\n assertNumber(compareValue, sourceCodeInfo, { finite: true })\n return compareValue\n })\n }\n return result\n },\n arity: { min: 1, max: 2 },\n docs: {\n category: 'Sequence',\n returns: { type: 'any', rest: true },\n args: {\n a: { type: 'sequence' },\n b: { type: 'function' },\n seq: { type: 'sequence' },\n fun: { type: 'function' },\n },\n variants: [\n { argumentNames: ['seq'] },\n { argumentNames: ['seq', 'fun'] },\n ],\n description: 'Returns a new sequence with the elements from $seq sorted according to $fun. If no $fun is supplied, builtin `compare` will be used.',\n seeAlso: ['sort-by', 'compare', 'reverse', 'Vector.sort-indices'],\n examples: [\n '[3, 1, 2] sort (a, b) -> b - a',\n 'sort([3, 1, 2])',\n `\nsort(\n [3, 1, 2],\n (a, b) -> cond case a < b then -1 case a > b then 1 case true then -1 end\n)`,\n `\nsort(\n [3, 1, 2],\n (a, b) -> cond case a > b then -1 case a < b then 1 case true then -1 end\n)`,\n ],\n },\n },\n 'sort-by': {\n evaluate: (params: Arr, sourceCodeInfo, contextStack, { executeFunction }): Seq => {\n const [seq, keyfn] = params\n const defaultComparer = params.length === 2\n\n assertSeq(seq, sourceCodeInfo)\n assertFunctionLike(keyfn, sourceCodeInfo)\n const comparer = defaultComparer ? null : params[2]\n\n if (typeof seq === 'string') {\n const result = seq.split('')\n if (defaultComparer) {\n result.sort((a, b) => {\n const aKey = executeFunction(keyfn, [a], contextStack, sourceCodeInfo)\n assertStringOrNumber(aKey, sourceCodeInfo)\n const bKey = executeFunction(keyfn, [b], contextStack, sourceCodeInfo)\n assertStringOrNumber(bKey, sourceCodeInfo)\n return compare(aKey, bKey, sourceCodeInfo)\n })\n }\n else {\n assertFunctionLike(comparer, sourceCodeInfo)\n result.sort((a, b) => {\n const aKey = executeFunction(keyfn, [a], contextStack, sourceCodeInfo)\n const bKey = executeFunction(keyfn, [b], contextStack, sourceCodeInfo)\n const compareValue = executeFunction(comparer, [aKey, bKey], contextStack, sourceCodeInfo)\n assertNumber(compareValue, sourceCodeInfo, { finite: true })\n return compareValue\n })\n }\n return result.join('')\n }\n\n const result = [...seq]\n if (defaultComparer) {\n result.sort((a, b) => {\n const aKey = executeFunction(keyfn, [a], contextStack, sourceCodeInfo)\n assertStringOrNumber(aKey, sourceCodeInfo)\n const bKey = executeFunction(keyfn, [b], contextStack, sourceCodeInfo)\n assertStringOrNumber(bKey, sourceCodeInfo)\n return compare(aKey, bKey, sourceCodeInfo)\n })\n }\n else {\n assertFunctionLike(comparer, sourceCodeInfo)\n result.sort((a, b) => {\n const aKey = executeFunction(keyfn, [a], contextStack, sourceCodeInfo)\n const bKey = executeFunction(keyfn, [b], contextStack, sourceCodeInfo)\n const compareValue = executeFunction(comparer, [aKey, bKey], contextStack, sourceCodeInfo)\n assertNumber(compareValue, sourceCodeInfo, { finite: true })\n return compareValue\n })\n }\n return result\n },\n arity: { min: 2, max: 3 },\n docs: {\n category: 'Sequence',\n returns: { type: 'any', rest: true },\n args: {\n a: { type: 'sequence' },\n b: { type: 'function' },\n seq: { type: 'sequence' },\n keyfn: { type: 'function' },\n comparer: { type: 'function' },\n },\n variants: [\n { argumentNames: ['seq', 'keyfn'] },\n { argumentNames: ['seq', 'keyfn', 'comparer'] },\n ],\n description: 'Returns a sorted sequence of the items in $seq, where the sort order is determined by comparing `(keyfn item)`. If no $comparer is supplied, uses builtin `compare`.',\n seeAlso: ['sort', 'compare'],\n examples: [\n '[\"Albert\", \"Mojir\", \"Nina\"] sort-by count',\n 'sort-by([\"Albert\", \"Mojir\", \"Nina\"], count)',\n 'sort-by(\"Albert\", lower-case, -> $2 compare $1)',\n ],\n },\n },\n 'take': {\n evaluate: ([input, n], sourceCodeInfo): Seq => {\n assertNumber(n, sourceCodeInfo)\n assertSeq(input, sourceCodeInfo)\n const num = Math.max(Math.ceil(n), 0)\n return input.slice(0, num)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'integer' },\n n: { type: 'integer' },\n seq: { type: 'sequence' },\n },\n variants: [{ argumentNames: ['seq', 'n'] }],\n description: 'Constructs a new array/string with the $n first elements from $seq.',\n seeAlso: ['take-last', 'take-while', 'drop', 'slice', 'split-at'],\n examples: [\n '[1, 2, 3, 4, 5] take 3',\n 'take([1, 2, 3, 4, 5], 3)',\n 'take([1, 2, 3, 4, 5], 0)',\n 'take(\"Albert\", 2)',\n 'take(\"Albert\", 50)',\n ],\n },\n },\n 'take-last': {\n evaluate: ([array, n], sourceCodeInfo): Seq => {\n assertSeq(array, sourceCodeInfo)\n assertNumber(n, sourceCodeInfo)\n const num = Math.max(Math.ceil(n), 0)\n const from = array.length - num\n return array.slice(from)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'integer' },\n n: { type: 'integer' },\n seq: { type: 'sequence' },\n },\n variants: [{ argumentNames: ['n', 'seq'] }],\n description: 'Constructs a new array with the $n last elements from $seq.',\n seeAlso: ['take', 'drop-last'],\n examples: [\n '[1, 2, 3, 4, 5] take-last 3',\n 'take-last([1, 2, 3, 4, 5], 3)',\n 'take-last([1, 2, 3, 4, 5], 0)',\n ],\n },\n },\n 'take-while': {\n evaluate: ([seq, fn]: Arr, sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertSeq(seq, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n\n const result: Arr = []\n for (const item of seq) {\n if (executeFunction(fn, [item], contextStack, sourceCodeInfo))\n result.push(item)\n else\n break\n }\n return typeof seq === 'string' ? result.join('') : result\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'function' },\n seq: { type: 'sequence' },\n fun: { type: 'function' },\n },\n variants: [{ argumentNames: ['seq', 'fun'] }],\n description: 'Returns the members of $seq in order, stopping before the first one for which `predicate` returns a falsy value.',\n seeAlso: ['take', 'drop-while', 'split-with'],\n examples: [\n `\ntake-while(\n [1, 2, 3, 2, 1],\n -> $ < 3\n)`,\n `\ntake-while(\n [1, 2, 3, 2, 1],\n -> $ > 3\n)`,\n ],\n },\n },\n 'drop': {\n evaluate: ([input, n], sourceCodeInfo): Seq => {\n assertNumber(n, sourceCodeInfo)\n const num = Math.max(Math.ceil(n), 0)\n assertSeq(input, sourceCodeInfo)\n return input.slice(num)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'integer' },\n seq: { type: 'sequence' },\n n: { type: 'integer' },\n },\n variants: [{ argumentNames: ['seq', 'n'] }],\n description: 'Constructs a new array/string with the $n first elements dropped from $seq.',\n seeAlso: ['drop-last', 'drop-while', 'take', 'slice', 'split-at'],\n examples: [\n 'drop([1, 2, 3, 4, 5], 3)',\n 'drop([1, 2, 3, 4, 5], 0)',\n 'drop(\"Albert\", 2)',\n 'drop(\"Albert\", 50)',\n ],\n },\n },\n 'drop-last': {\n evaluate: ([array, n], sourceCodeInfo): Seq => {\n assertSeq(array, sourceCodeInfo)\n assertNumber(n, sourceCodeInfo)\n const num = Math.max(Math.ceil(n), 0)\n\n const from = array.length - num\n return array.slice(0, from)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'integer' },\n seq: { type: 'sequence' },\n n: { type: 'integer' },\n },\n variants: [{ argumentNames: ['seq', 'n'] }],\n description: 'Constructs a new array with the $n last elements dropped from $seq.',\n seeAlso: ['drop', 'take-last'],\n examples: [\n '[1, 2, 3, 4, 5] drop-last 3',\n 'drop-last([1, 2, 3, 4, 5], 3)',\n 'drop-last([1, 2, 3, 4, 5], 0)',\n ],\n },\n },\n 'drop-while': {\n evaluate: ([seq, fn]: Arr, sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertSeq(seq, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n\n if (Array.isArray(seq)) {\n const from = seq.findIndex(elem => !executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n return seq.slice(from)\n }\n const charArray = seq.split('')\n const from = charArray.findIndex(elem => !executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n return charArray.slice(from).join('')\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'function' },\n seq: { type: 'sequence' },\n fun: { type: 'function' },\n },\n variants: [{ argumentNames: ['seq', 'fun'] }],\n description: 'Returns the members of $seq in order, skipping the fist elements for witch the `predicate` returns a truethy value.',\n seeAlso: ['drop', 'take-while', 'split-with'],\n examples: [\n `\ndrop-while(\n [1, 2, 3, 2, 1],\n -> $ < 3\n)`,\n `\ndrop-while(\n [1, 2, 3, 2, 1],\n -> $ > 3\n)`,\n ],\n },\n },\n 'unshift': {\n evaluate: ([seq, ...values], sourceCodeInfo): Seq => {\n assertSeq(seq, sourceCodeInfo)\n if (typeof seq === 'string') {\n assertCharArray(values, sourceCodeInfo)\n return [...values, seq].join('')\n }\n const copy = [...seq]\n copy.unshift(...values)\n return copy\n },\n arity: { min: 2 },\n docs: {\n category: 'Sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'any' },\n seq: { type: 'sequence' },\n values: { type: 'any', rest: true },\n },\n variants: [{ argumentNames: ['seq', 'values'] }],\n description: 'Returns copy of $seq with $values added to the beginning.',\n seeAlso: ['push', 'shift', '++'],\n examples: [\n '[1, 2, 3] unshift 4',\n 'unshift([1, 2, 3], 4)',\n 'unshift([1, 2, 3], 4, 5, 6)',\n `\nlet l = [1, 2, 3];\nunshift(l, 4);\nl`,\n ],\n },\n },\n 'distinct': {\n evaluate: ([input], sourceCodeInfo): Seq => {\n assertSeq(input, sourceCodeInfo)\n\n if (Array.isArray(input)) {\n const result: Any[] = []\n for (const item of input) {\n assertAny(item, sourceCodeInfo)\n if (!result.some(existingItem => deepEqual(existingItem, item, sourceCodeInfo))) {\n result.push(item)\n }\n }\n return result\n }\n\n return Array.from(new Set(input.split(''))).join('')\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Sequence',\n returns: { type: 'sequence' },\n args: { seq: { type: 'sequence' } },\n variants: [{ argumentNames: ['seq'] }],\n description: 'Returns a copy of $seq with no duplicates.',\n seeAlso: ['frequencies'],\n examples: [\n 'distinct([[1], [2], [3], [1], [3], [5]])',\n 'distinct([1, 2, 3, 1, 3, 5])',\n 'distinct(\"Albert Mojir\")',\n 'distinct([])',\n 'distinct(\"\")',\n ],\n },\n },\n 'remove': {\n evaluate: ([input, fn], sourceCodeInfo, contextStack, { executeFunction }): Seq => {\n assertFunctionLike(fn, sourceCodeInfo)\n assertSeq(input, sourceCodeInfo)\n if (Array.isArray(input))\n return input.filter(elem => !executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n\n return input\n .split('')\n .filter(elem => !executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n .join('')\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'function' },\n seq: { type: 'sequence' },\n fun: { type: 'function' },\n },\n variants: [{ argumentNames: ['seq', 'fun'] }],\n description: 'Returns a new sequence of items in $seq for witch `pred(item)` returns a falsy value.',\n seeAlso: ['filter', 'remove-at'],\n examples: [\n '[1, 2, 3, 1, 3, 5] remove odd?',\n 'remove([1, 2, 3, 1, 3, 5], even?)',\n 'remove(\"Albert Mojir\", -> \"aoueiyAOUEIY\" contains? $)',\n ],\n },\n },\n 'remove-at': {\n evaluate: ([input, index], sourceCodeInfo): Seq => {\n assertNumber(index, sourceCodeInfo, { integer: true })\n assertSeq(input, sourceCodeInfo)\n\n const at = index < 0 ? input.length + index : index\n if (at < 0 || at >= input.length)\n return input\n\n if (Array.isArray(input)) {\n return input.filter((_, i) => i !== at)\n }\n return `${input.substring(0, at)}${input.substring(at + 1)}`\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'integer' },\n seq: { type: 'sequence' },\n n: { type: 'number' },\n },\n variants: [{ argumentNames: ['seq', 'n'] }],\n description: 'Returns a new sequence of all items in $seq except item at position $n. If $n is negative, it is counting from the end of the sequence.',\n seeAlso: ['remove', 'splice'],\n examples: [\n '[1, 2, 3, 1, 3, 5] remove-at 2',\n '\"Albert\" remove-at -2',\n 'remove-at([1, 2, 3, 1, 3, 5], 0)',\n 'remove-at([1, 2, 3, 1, 3, 5], -1)',\n 'remove-at(\"Albert Mojir\", 6)',\n ],\n },\n },\n 'split-at': {\n evaluate: ([seq, pos], sourceCodeInfo): Seq => {\n assertNumber(pos, sourceCodeInfo, { integer: true })\n assertSeq(seq, sourceCodeInfo)\n\n const at = pos < 0 ? seq.length + pos : pos\n return [seq.slice(0, at), seq.slice(at)]\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'integer' },\n seq: { type: 'sequence' },\n n: { type: 'number' },\n },\n variants: [{ argumentNames: ['seq', 'n'] }],\n description: 'Returns a pair of sequence `[take(pos input), drop(pos input)]`.',\n seeAlso: ['split-with', 'take', 'drop'],\n examples: [\n '[1, 2, 3, 4, 5] split-at 2',\n '\"Albert\" split-at -2',\n 'split-at([1, 2, 3, 4, 5], -2)',\n 'split-at(\"Albert\", 2)',\n ],\n },\n },\n\n 'split-with': {\n evaluate: ([seq, fn], sourceCodeInfo, contextStack, { executeFunction }): Seq => {\n assertFunctionLike(fn, sourceCodeInfo)\n assertSeq(seq, sourceCodeInfo)\n const seqIsArray = Array.isArray(seq)\n const arr = seqIsArray ? seq : seq.split('')\n const index = arr.findIndex(elem => !executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n if (index === -1)\n return [seq, seqIsArray ? [] : '']\n\n return [seq.slice(0, index), seq.slice(index)]\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'function' },\n seq: { type: 'sequence' },\n fun: { type: 'function' },\n },\n variants: [{ argumentNames: ['seq', 'fun'] }],\n description: 'Returns a pair of sequences `[take-while(input, fun), drop-while(input, fun)]`.',\n seeAlso: ['split-at', 'take-while', 'drop-while'],\n examples: [\n '[1, 2, 3, 4, 5] split-with odd?',\n 'split-with([1, 2, 3, 4, 5], -> $ > 3)',\n 'split-with(\"Albert\", -> $ <= \"o\")',\n ],\n },\n },\n\n 'frequencies': {\n evaluate: ([seq], sourceCodeInfo): Obj => {\n assertSeq(seq, sourceCodeInfo)\n\n const arr = typeof seq === 'string' ? seq.split('') : seq\n\n return arr.reduce((result: Obj, val) => {\n assertString(val, sourceCodeInfo)\n if (collHasKey(result, val))\n result[val] = (result[val] as number) + 1\n else\n result[val] = 1\n\n return result\n }, {})\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Sequence',\n returns: { type: 'object' },\n args: { seq: { type: 'sequence' } },\n variants: [{ argumentNames: ['seq'] }],\n description: 'Returns an object from distinct items in $seq to the number of times they appear. Note that all items in $seq must be valid object keys i.e. strings.',\n seeAlso: ['group-by', 'distinct', 'Vector.count-values'],\n examples: [\n 'frequencies([\"Albert\", \"Mojir\", \"Nina\", \"Mojir\"])',\n 'frequencies(\"Pneumonoultramicroscopicsilicovolcanoconiosis\")',\n ],\n },\n },\n\n 'group-by': {\n evaluate: ([seq, fn], sourceCodeInfo, contextStack, { executeFunction }): Obj => {\n assertFunctionLike(fn, sourceCodeInfo)\n assertSeq(seq, sourceCodeInfo)\n const arr = Array.isArray(seq) ? seq : seq.split('')\n\n return arr.reduce((result: Obj, val) => {\n const key = executeFunction(fn, [val], contextStack, sourceCodeInfo)\n assertString(key, sourceCodeInfo)\n if (!collHasKey(result, key))\n result[key] = []\n\n ;(result[key] as Arr).push(val)\n return result\n }, {})\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Sequence',\n returns: { type: 'object' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'function' },\n seq: { type: 'sequence' },\n fun: { type: 'function' },\n },\n variants: [{ argumentNames: ['seq', 'fun'] }],\n description: 'Returns an object of the elements of $seq keyed by the result of $fun on each element. The value at each key will be an array of the corresponding elements.',\n seeAlso: ['frequencies', 'partition-by'],\n examples: [\n '[{ name: \"Albert\" }, { name: \"Albert\" }, { name: \"Mojir\" }] group-by \"name\"',\n 'group-by([{name: \"Albert\"}, {name: \"Albert\"}, {name: \"Mojir\"}], \"name\")',\n 'group-by(\"Albert Mojir\", -> \"aoueiAOUEI\" contains? $ ? \"vowel\" : \"other\")',\n ],\n },\n },\n\n 'partition': {\n evaluate: (params, sourceCodeInfo): Seq => {\n const seq = asSeq(params[0], sourceCodeInfo)\n const n = toNonNegativeInteger(asNumber(params[1], sourceCodeInfo))\n const step = params.length >= 3 ? toNonNegativeInteger(asNumber(params[2], sourceCodeInfo)) : n\n const pad = params.length === 4\n ? params[3] === null ? [] : asArray(params[3], sourceCodeInfo)\n : undefined\n\n return partition(n, step, seq, pad, sourceCodeInfo)\n },\n arity: { min: 2, max: 4 },\n docs: {\n category: 'Sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'number' },\n seq: { type: 'sequence' },\n n: { type: 'number' },\n step: { type: 'number' },\n pad: { type: 'array' },\n },\n variants: [\n { argumentNames: ['seq', 'n'] },\n { argumentNames: ['seq', 'n', 'step'] },\n { argumentNames: ['seq', 'n', 'step', 'pad'] },\n ],\n description: 'Returns an array of sequences of $n items each, at offsets $step apart. If $step is not supplied, defaults to $n. If a $pad array is supplied, use its elements as necessary to complete last partition upto $n items. In case there are not enough padding elements, return a partition with less than $n items.',\n seeAlso: ['partition-all', 'partition-by'],\n examples: [\n 'range(20) partition 4',\n 'partition(range(20), 4)',\n 'partition(range(22), 4)',\n 'partition(range(20), 4, 6)',\n 'partition(range(20), 4, 3)',\n 'partition(range(20), 3, 6, [\"a\"])',\n 'partition(range(20), 4, 6, [\"a\"])',\n 'partition(range(20), 4, 6, [\"a\", \"b\", \"c\", \"d\"])',\n 'partition([\"a\", \"b\", \"c\", \"d\", \"e\", \"f\"], 3, 1)',\n 'partition([1, 2, 3, 4], 10)',\n 'partition([1, 2, 3, 4], 10, 10)',\n 'partition([1, 2, 3, 4], 10, 10, [])',\n 'partition([1, 2, 3, 4], 10, 10, null)',\n 'partition(\"superfragilistic\", 5)',\n 'partition(\"superfragilistic\", 5, 5, null)',\n 'let foo = [5, 6, 7, 8]; partition(foo, 2, 1, foo)',\n ],\n },\n },\n\n 'partition-all': {\n evaluate: (params, sourceCodeInfo): Seq => {\n const seq = asSeq(params[0], sourceCodeInfo)\n const n = toNonNegativeInteger(asNumber(params[1], sourceCodeInfo))\n const step = params.length === 3 ? toNonNegativeInteger(asNumber(params[2], sourceCodeInfo)) : n\n\n return partition(n, step, seq, [], sourceCodeInfo)\n },\n arity: { min: 2, max: 3 },\n docs: {\n category: 'Sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'number' },\n seq: { type: 'sequence' },\n n: { type: 'number' },\n step: { type: 'number' },\n },\n variants: [\n { argumentNames: ['seq', 'n'] },\n { argumentNames: ['seq', 'n', 'step'] },\n ],\n description: 'Returns an array of sequences like partition, but may include partitions with fewer than n items at the end.',\n seeAlso: ['partition', 'partition-by'],\n examples: [\n '[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] partition-all 4',\n 'partition-all([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 4)',\n 'partition([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 4)',\n 'partition-all([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 2, 4)',\n ],\n },\n },\n\n 'partition-by': {\n evaluate: ([seq, fn], sourceCodeInfo, contextStack, { executeFunction }): Seq => {\n assertFunctionLike(fn, sourceCodeInfo)\n assertSeq(seq, sourceCodeInfo)\n const isStringSeq = typeof seq === 'string'\n let oldValue: unknown\n\n const result = (isStringSeq ? seq.split('') : seq).reduce((acc: Arr, elem) => {\n const value = executeFunction(fn, [elem], contextStack, sourceCodeInfo)\n if (value !== oldValue) {\n acc.push([])\n oldValue = value\n }\n ;(acc[acc.length - 1] as Arr).push(elem)\n return acc\n }, [])\n\n return isStringSeq ? result.map(elem => (elem as Arr).join('')) : result\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'function' },\n seq: { type: 'sequence' },\n fun: { type: 'function' },\n },\n variants: [{ argumentNames: ['seq', 'fun'] }],\n description: 'Applies $fun to each value in $seq, splitting it each time $fun returns a new value. Returns an array of sequences.',\n seeAlso: ['partition', 'partition-all', 'group-by'],\n examples: [\n '[1, 2, 3, 4, 5] partition-by odd?',\n 'partition-by([1, 2, 3, 4, 5], -> $ == 3)',\n 'partition-by([1, 1, 1, 2, 2, 3, 3], odd?)',\n 'partition-by(\"Leeeeeerrroyyy\", identity)',\n ],\n },\n },\n 'ends-with?': {\n evaluate: ([str, search], sourceCodeInfo): boolean => {\n assertSeq(str, sourceCodeInfo)\n\n if (typeof str === 'string') {\n assertString(search, sourceCodeInfo)\n return str.endsWith(search)\n }\n\n return deepEqual(asAny(str.at(-1), sourceCodeInfo), asAny(search, sourceCodeInfo), sourceCodeInfo)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Sequence',\n returns: { type: 'boolean' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'sequence' },\n seq: { type: 'sequence' },\n suffix: { type: 'sequence' },\n },\n variants: [{ argumentNames: ['seq', 'suffix'] }],\n description: 'Returns `true` if $seq ends with $suffix, otherwise `false`.',\n seeAlso: ['starts-with?'],\n examples: [\n '[[1], [2], [3], [4], [5]] starts-with? [5]',\n '[[1], [2], [3], [4], [5]] starts-with? 5',\n 'ends-with?([1, 2, 3, 4, 5], 5)',\n 'ends-with?([1, 2, 3, 4, 5], [5])',\n 'ends-with?(\"Albert\", \"rt\")',\n 'ends-with?(\"Albert\", \"RT\")',\n ],\n },\n },\n 'starts-with?': {\n evaluate: ([seq, search], sourceCodeInfo): boolean => {\n assertSeq(seq, sourceCodeInfo)\n\n if (typeof seq === 'string') {\n assertString(search, sourceCodeInfo)\n return seq.startsWith(search)\n }\n\n return deepEqual(asAny(seq[0], sourceCodeInfo), asAny(search, sourceCodeInfo), sourceCodeInfo)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Sequence',\n returns: { type: 'boolean' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'sequence' },\n seq: { type: 'sequence' },\n prefix: { type: 'sequence' },\n },\n variants: [{ argumentNames: ['seq', 'prefix'] }],\n description: 'Returns `true` if $seq starts with $prefix, otherwise `false`.',\n seeAlso: ['ends-with?'],\n examples: [\n '[[1], [2], [3], [4], [5]] starts-with? [1]',\n 'starts-with?([1, 2, 3, 4, 5], 1)',\n 'starts-with?([1, 2, 3, 4, 5], [1])',\n 'starts-with?(\"Albert\", \"Al\")',\n 'starts-with?(\"Albert\", \"al\")',\n ],\n },\n },\n 'interleave': {\n evaluate: ([...seqs], sourceCodeInfo): Seq => {\n const isStringSeq = typeof seqs[0] === 'string'\n\n const seqsArr = isStringSeq\n ? seqs.map((seq) => {\n assertString(seq, sourceCodeInfo)\n return seq.split('')\n })\n : seqs.map((seq) => {\n assertArray(seq, sourceCodeInfo)\n return seq\n })\n\n const maxLength = Math.min(...seqsArr.map(seq => seq.length))\n const result: Arr = []\n for (let i = 0; i < maxLength; i += 1) {\n for (const seq of seqsArr) {\n if (i < seq.length)\n result.push(seq[i])\n }\n }\n return isStringSeq ? result.join('') : result\n },\n arity: { min: 1 },\n docs: {\n category: 'Sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'sequence' },\n seqs: { type: 'sequence', rest: true },\n },\n variants: [{ argumentNames: ['seqs'] }],\n description: 'Returns a sequence of the first item from each of the $seqs, then the second item from each of the $seqs, until all items from the shortest seq are exhausted.',\n seeAlso: ['interpose', 'zipmap'],\n examples: [\n '[1, 2, 3] interleave [4, 5, 6]',\n '\"Albert\" interleave \".,.,.,\"',\n 'interleave([1, 2, 3], [4, 5, 6])',\n 'interleave([1, 2, 3], [4, 5, 6], [7, 8, 9])',\n 'interleave([1, 2, 3], [4, 5, 6], [7, 8])',\n 'interleave([1, 2, 3], [4, 5, 6], [7])',\n 'interleave([1, 2, 3], [4, 5, 6], [])',\n 'interleave([1, 2, 3], [])',\n 'interleave([])',\n ],\n },\n },\n 'interpose': {\n evaluate: ([seq, separator], sourceCodeInfo): Seq => {\n assertSeq(seq, sourceCodeInfo)\n if (typeof seq === 'string') {\n assertString(separator, sourceCodeInfo)\n return seq.split('').join(separator)\n }\n\n if (seq.length === 0)\n return []\n\n const result: Arr = []\n for (let i = 0; i < seq.length - 1; i += 1) {\n result.push(seq[i], separator)\n }\n result.push(seq[seq.length - 1])\n return result\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'any' },\n seq: { type: 'sequence' },\n separator: { type: 'any' },\n },\n variants: [{ argumentNames: ['seq', 'separator'] }],\n description: 'Returns a sequence of the elements of $seq separated by $separator. If $seq is a string, the separator must be a string.',\n seeAlso: ['interleave', 'join'],\n examples: [\n '\"Albert\" interpose \"-\"',\n 'interpose([1, 2, 3, 4, 5], \"a\")',\n 'interpose([\"Albert\", \"Mojir\", \"Nina\"], \", \")',\n 'interpose(\"Albert\", \".\")',\n ],\n },\n },\n\n}\n\nfunction partition(n: number, step: number, seq: Seq, pad: Arr | undefined, sourceCodeInfo?: SourceCodeInfo) {\n assertNumber(step, sourceCodeInfo, { positive: true })\n const isStringSeq = typeof seq === 'string'\n\n const result: Arr[] = []\n let start = 0\n outer: while (start < seq.length) {\n const innerArr: Arr = []\n for (let i = start; i < start + n; i += 1) {\n if (i >= seq.length) {\n const padIndex = i - seq.length\n if (!pad) {\n start += step\n continue outer\n }\n if (padIndex >= pad.length)\n break\n\n innerArr.push(pad[padIndex])\n }\n else {\n innerArr.push(seq[i])\n }\n }\n result.push(innerArr)\n start += step\n }\n return isStringSeq ? result.map(x => x.join('')) : result\n}\n","import { LitsError } from '../errors'\nimport type { Any } from '../interface'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { isNumber } from './number'\n\nconst annotatedArrays = new WeakSet<unknown[]>()\nconst vectors = new WeakSet<unknown[]>()\nconst matrices = new WeakSet<unknown[]>()\nconst grids = new WeakSet<unknown[]>()\n\nexport function annotate<T>(value: T): T {\n if (!Array.isArray(value)) {\n return value\n }\n if (annotatedArrays.has(value)) {\n return value\n }\n isVector(value)\n if (!isMatrix(value)) {\n isGrid(value)\n }\n\n return value\n}\nexport function isVector(vector: unknown): vector is number[] {\n if (!Array.isArray(vector)) {\n return false\n }\n\n if (vectors.has(vector)) {\n return true\n }\n\n if (vector.every(elem => isNumber(elem))) {\n annotatedArrays.add(vector)\n vectors.add(vector)\n return true\n }\n return false\n}\n\nexport function assertVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is number[] {\n if (!isVector(vector)) {\n throw new LitsError(`Expected a vector, but got ${vector}`, sourceCodeInfo)\n }\n}\n\nexport function is2dVector(vector: unknown): vector is [number, number] {\n if (!isVector(vector)) {\n return false\n }\n return vector.length === 2\n}\nexport function assert2dVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is [number, number] {\n if (!is2dVector(vector)) {\n throw new LitsError(`Expected a 2d vector, but got ${vector}`, sourceCodeInfo)\n }\n}\n\nexport function is3dVector(vector: unknown): vector is [number, number, number] {\n if (!isVector(vector)) {\n return false\n }\n return vector.length === 3\n}\nexport function assert3dVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is [number, number, number] {\n if (!is3dVector(vector)) {\n throw new LitsError(`Expected a 3d vector, but got ${vector}`, sourceCodeInfo)\n }\n}\n\nexport function assertNonEmptyVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is number[] {\n assertVector(vector, sourceCodeInfo)\n if (vector.length === 0) {\n throw new LitsError(`Expected a non empty vector, but got ${vector}`, sourceCodeInfo)\n }\n}\n\nexport function isGrid(grid: unknown): grid is unknown[][] {\n if (!Array.isArray(grid)) {\n return false\n }\n if (grids.has(grid)) {\n return true\n }\n if (grid.length === 0) {\n return false\n }\n if (!Array.isArray(grid[0])) {\n return false\n }\n const nbrOfCols = grid[0].length\n for (const row of grid.slice(1)) {\n if (!Array.isArray(row)) {\n return false\n }\n if (row.length !== nbrOfCols) {\n return false\n }\n }\n annotatedArrays.add(grid)\n grids.add(grid)\n return true\n}\n\nexport function assertGrid(grid: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts grid is Any[][] {\n if (!isGrid(grid)) {\n throw new LitsError(`Expected a grid, but got ${grid}`, sourceCodeInfo)\n }\n}\n\nexport function isMatrix(matrix: unknown): matrix is number[][] {\n if (!Array.isArray(matrix)) {\n return false\n }\n if (matrices.has(matrix)) {\n return true\n }\n if (matrix.length === 0) {\n return false\n }\n if (!Array.isArray(matrix[0])) {\n return false\n }\n if (matrix[0].length === 0) {\n return false\n }\n const nbrOfCols = matrix[0].length\n for (const row of matrix.slice(1)) {\n if (!Array.isArray(row)) {\n return false\n }\n if (row.length !== nbrOfCols) {\n return false\n }\n if (row.some(cell => !isNumber(cell))) {\n return false\n }\n }\n annotatedArrays.add(matrix)\n grids.add(matrix)\n matrices.add(matrix)\n return true\n}\n\nexport function assertMatrix(matrix: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts matrix is number[][] {\n if (!isMatrix(matrix)) {\n throw new LitsError(`Expected a matrix, but got ${matrix}`, sourceCodeInfo)\n }\n}\n\nexport function assertSquareMatrix(matrix: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts matrix is number[][] {\n if (!isMatrix(matrix)) {\n throw new LitsError(`Expected a matrix, but got ${matrix}`, sourceCodeInfo)\n }\n if (matrix.length !== matrix[0]!.length) {\n throw new LitsError(`Expected square matrix, but got ${matrix.length} and ${matrix[0]!.length}`, sourceCodeInfo)\n }\n}\n\nexport function isSquareMatrix(matrix: unknown): matrix is number[][] {\n if (!isMatrix(matrix)) {\n return false\n }\n if (matrix.length !== matrix[0]!.length) {\n return false\n }\n return true\n}\n","import { LitsError } from '../../errors'\nimport type { SourceCodeInfo } from '../../tokenizer/token'\nimport { isMatrix, isVector } from '../../typeGuards/annotatedArrays'\nimport { assertNumber, isNumber } from '../../typeGuards/number'\nimport { toFixedArity } from '../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../interface'\n\ntype NumberVectorOrMatrix = number | number[] | number[][]\n\nfunction getNumberVectorOrMatrixOperation(\n params: unknown[],\n sourceCodeInfo: SourceCodeInfo | undefined,\n):\n | ['number', number[]]\n | ['vector', number[][]]\n | ['matrix', number[][][]] {\n let hasVector: boolean = false\n let hasMatrix: boolean = false\n for (const param of params) {\n if (isVector(param)) {\n hasVector = true\n }\n else if (isMatrix(param)) {\n hasMatrix = true\n }\n else if (!isNumber(param)) {\n throw new LitsError(`Invalid parameter type: ${typeof param}`, sourceCodeInfo)\n }\n }\n if (hasMatrix) {\n if (hasVector) {\n throw new LitsError('Cannot mix vector and matrix types', sourceCodeInfo)\n }\n let rows: number | null = null\n let cold: number | null = null\n for (const param of params) {\n if (isMatrix(param)) {\n if (rows === null) {\n rows = param.length\n cold = param[0]!.length\n }\n else {\n if (param.length !== rows || param[0]!.length !== cold) {\n throw new LitsError('Matrix dimensions do not match', sourceCodeInfo)\n }\n }\n }\n }\n const matrices = params.map((param) => {\n if (isMatrix(param)) {\n return param\n }\n return Array.from({ length: rows as number }, () => Array.from({ length: cold as number }, () => param as number))\n })\n return ['matrix', matrices]\n }\n if (hasVector) {\n let length: number | null = null\n for (const param of params) {\n if (isVector(param)) {\n if (length === null) {\n length = param.length\n }\n else {\n if (param.length !== length) {\n throw new LitsError('Vector lengths do not match', sourceCodeInfo)\n }\n }\n }\n }\n const vectors = params.map((param) => {\n if (isVector(param)) {\n return param\n }\n return Array.from({ length: length as number }, () => param as number)\n })\n\n return ['vector', vectors]\n }\n return ['number', params as number[]]\n}\n\nfunction unaryMathOp(\n fn: (val: number) => number,\n): (params: unknown[], sourceCodeInfo: SourceCodeInfo | undefined) => NumberVectorOrMatrix {\n return (params, sourceCodeInfo) => {\n const [operation, operands] = getNumberVectorOrMatrixOperation(params, sourceCodeInfo)\n if (operation === 'number') {\n return fn(operands[0]!)\n }\n else if (operation === 'vector') {\n return operands[0]!.map(val => fn(val))\n }\n else {\n return operands[0]!.map(row => row.map(val => fn(val)))\n }\n }\n}\n\nfunction binaryMathOp(\n fn: (a: number, b: number) => number,\n): (params: unknown[], sourceCodeInfo: SourceCodeInfo | undefined) => NumberVectorOrMatrix {\n return (params, sourceCodeInfo) => {\n const [operation, operands] = getNumberVectorOrMatrixOperation(params, sourceCodeInfo)\n if (operation === 'number') {\n return fn(operands[0]!, operands[1]!)\n }\n else if (operation === 'vector') {\n return operands[0]!.map((val, i) => fn(val, operands[1]![i]!))\n }\n else {\n return operands[0]!.map((row, i) => row.map((val, j) => fn(val, operands[1]![i]![j]!)))\n }\n }\n}\n\nfunction reduceMathOp(\n identity: number,\n fn: (a: number, b: number) => number,\n): (params: unknown[], sourceCodeInfo: SourceCodeInfo | undefined) => NumberVectorOrMatrix {\n return (params, sourceCodeInfo) => {\n if (params.length === 0)\n return identity\n const [operation, operands] = getNumberVectorOrMatrixOperation(params, sourceCodeInfo)\n if (operation === 'number') {\n return operands.reduce((a, b) => fn(a, b), identity)\n }\n else if (operation === 'vector') {\n const [first, ...rest] = operands\n return rest.reduce((acc, v) => acc.map((val, i) => fn(val, v[i]!)), first!)\n }\n else {\n const [first, ...rest] = operands\n return rest.reduce((acc, m) => acc.map((row, i) => row.map((val, j) => fn(val, m[i]![j]!))), first!)\n }\n }\n}\n\nexport const mathNormalExpression: BuiltinNormalExpressions = {\n 'inc': {\n evaluate: unaryMathOp(val => val + 1),\n arity: toFixedArity(1),\n docs: {\n category: 'Math',\n returns: { type: 'number' },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `inc` function increments its argument by 1, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it increases each element by 1 while preserving the original structure.',\n seeAlso: ['dec', '+'],\n examples: [\n 'inc(0)',\n 'inc(1)',\n 'inc(100.1)',\n 'inc([1, 2, 3])',\n 'inc([[1, 2], [3, 4]])',\n ],\n },\n },\n 'dec': {\n evaluate: unaryMathOp(val => val - 1),\n arity: toFixedArity(1),\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `dec` function decrements its argument by 1, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it decreases each element by 1 while preserving the original structure.',\n seeAlso: ['inc', '-'],\n examples: [\n 'dec(0)',\n 'dec(1)',\n 'dec(100.1)',\n 'dec([1, 2, 3])',\n 'dec([[1, 2], [3, 4]])',\n ],\n },\n },\n '+': {\n evaluate: reduceMathOp(0, (a, b) => a + b),\n arity: {},\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n a: { type: ['number', 'vector', 'matrix'] },\n b: { type: ['number', 'vector', 'matrix'] },\n xs: { type: ['number', 'vector', 'matrix'], rest: true },\n },\n variants: [{ argumentNames: ['xs'] }],\n description: 'The `+` function performs addition of numbers and element-wise addition of `vectors` and `matrices` of compatible dimensions, returning the same type as its inputs. When used with mixed types, it adds the scalar to each element of the collection.',\n seeAlso: ['-', '*', '/', 'inc'],\n examples: [\n '1 + 2',\n '1 + 20 + 30',\n '+(1, 2, 3, 4)',\n '+()',\n '+(1)',\n '[1, 2, 3] + 2',\n '[1, 2, 3] + [4, 5, 6]',\n '[[1, 2, 3], [4, 5, 6]] + [[7, 8, 9], [10, 11, 12]]',\n '[[1, 2, 3], [4, 5, 6]] + 2',\n ],\n },\n },\n '*': {\n evaluate: reduceMathOp(1, (a, b) => a * b),\n arity: {},\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n a: { type: ['number', 'vector', 'matrix'] },\n b: { type: ['number', 'vector', 'matrix'] },\n xs: { type: ['number', 'vector', 'matrix'], rest: true },\n },\n variants: [{ argumentNames: ['xs'] }],\n description: 'The `*` function performs multiplication of `numbers` and element-wise multiplication of `vectors` and `matrices` of compatible dimensions, returning the same type as its inputs. When used with mixed types, it multiplies each element of the collection by the scalar.',\n seeAlso: ['/', '+', '-', '^'],\n examples: [\n '6 * 7',\n '-1 * 4',\n '*(4, 7)',\n '*(1, 2, 3, 4, 5)',\n '*()',\n '*(8)',\n '[1, 2, 3] * 2',\n '[1, 2, 3] * [4, 5, 6]',\n '[[1, 2, 3], [4, 5, 6]] * [[7, 8, 9], [10, 11, 12]]',\n '[[1, 2, 3], [4, 5, 6]] * 2',\n ],\n },\n },\n '/': {\n evaluate: (params, sourceCodeInfo): NumberVectorOrMatrix => {\n if (params.length === 0) {\n return 1\n }\n\n const [operation, operands] = getNumberVectorOrMatrixOperation(params, sourceCodeInfo)\n\n if (operation === 'number') {\n const [first, ...rest] = operands\n if (rest.length === 0) {\n return 1 / first!\n }\n return rest.reduce((result, param) => {\n return result / param\n }, first!)\n }\n else if (operation === 'vector') {\n const firstVector = operands[0]!\n const restVectors = operands.slice(1)\n return restVectors.reduce((acc, vector) => acc.map((val, i) => val / vector[i]!), firstVector)\n }\n else {\n const firstMatrix = operands[0]!\n const restMatrices = operands.slice(1)\n return restMatrices.reduce((acc, matrix) => acc.map((row, i) => row.map((val, j) => val / matrix[i]![j]!)), firstMatrix)\n }\n },\n arity: {},\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n a: { type: ['number', 'vector', 'matrix'] },\n b: { type: ['number', 'vector', 'matrix'] },\n xs: { type: ['number', 'vector', 'matrix'], rest: true },\n },\n variants: [{ argumentNames: ['xs'] }],\n description: 'The `/` function performs division of `numbers` and element-wise division of `vectors` and `matrices` of compatible dimensions, returning the same type as its inputs. When used with mixed types, it divides each element of the collection by the scalar.',\n seeAlso: ['*', '+', '-', 'quot', 'mod', '%'],\n examples: [\n '12 / 100',\n '-1 / 4',\n '/(7, 4)',\n '/(1, 2, 4, 8)',\n '/()',\n '/(8)',\n '[1, 2, 3] / 2',\n '[1, 2, 3] / [4, 5, 6]',\n '[[1, 2, 3], [4, 5, 6]] / [[7, 8, 9], [10, 11, 12]]',\n '[[1, 2, 3], [4, 5, 6]] / 2',\n ],\n },\n },\n '-': {\n evaluate: (params, sourceCodeInfo): NumberVectorOrMatrix => {\n if (params.length === 0) {\n return 0\n }\n\n const [operation, operands] = getNumberVectorOrMatrixOperation(params, sourceCodeInfo)\n\n if (operation === 'number') {\n const [first, ...rest] = operands\n if (rest.length === 0)\n return -first!\n\n return rest.reduce((result, param) => {\n return result - param\n }, first!)\n }\n else if (operation === 'vector') {\n const firstVector = operands[0]!\n const restVectors = operands.slice(1)\n return restVectors.reduce((acc, vector) => acc.map((val, i) => val - vector[i]!), firstVector)\n }\n else {\n const firstMatrix = operands[0]!\n const restMatrices = operands.slice(1)\n return restMatrices.reduce((acc, matrix) => acc.map((row, i) => row.map((val, j) => val - matrix[i]![j]!)), firstMatrix)\n }\n },\n arity: {},\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n a: { type: ['number', 'vector', 'matrix'] },\n b: { type: ['number', 'vector', 'matrix'] },\n xs: { type: ['number', 'vector', 'matrix'], rest: true },\n },\n variants: [{ argumentNames: ['xs'] }],\n description: 'Computes difference between first value and sum of the rest. When called with only one argument, it does negation.',\n seeAlso: ['+', '*', '/', 'dec', 'abs'],\n examples: [\n '50 - 8',\n '1 - 1 - 1',\n '-()',\n '-(4, 2)',\n '-(4, 3, 2, 1,)',\n '[1, 2, 3] - 2',\n '[1, 2, 3] - [4, 5, 6]',\n '[[1, 2, 3], [4, 5, 6]] - [[7, 8, 9], [10, 11, 12]]',\n '[[1, 2, 3], [4, 5, 6]] - 2',\n ],\n },\n },\n 'quot': {\n evaluate: binaryMathOp((a, b) => Math.trunc(a / b)),\n arity: toFixedArity(2),\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n a: { type: ['number', 'vector', 'matrix'] },\n b: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'The `quot` function performs integer division truncated toward zero, working on `numbers` and element-wise on `vectors` and `matrices` of compatible dimensions. When used with mixed types, it applies integer division between each element of the collection and the scalar.',\n seeAlso: ['mod', '%', '/', 'trunc'],\n examples: [\n 'quot(5, 3)',\n 'quot(5.2, 3.1)',\n 'quot(-5, 3)',\n '5 quot -3',\n '-5 quot -3',\n 'quot(5, 0)',\n 'quot(0, 5)',\n '[1, 2, 3] quot 2',\n '2 quot [1, 2, 3]',\n 'quot([1, 2, 3], [4, 5, 6])',\n '[[1, 2, 3], [4, 5, 6]] quot [[7, 8, 9], [10, 11, 12]]',\n 'quot([[1, 2, 3], [4, 5, 6]], 2)',\n '[[1, 2, 3], [4, 5, 6]] quot [[7, 8, 9], [10, 11, 12]]',\n ],\n },\n },\n 'mod': {\n evaluate: binaryMathOp((a, b) => a - b * Math.floor(a / b)),\n arity: toFixedArity(2),\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n a: { type: ['number', 'vector', 'matrix'] },\n b: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'The `mod` function computes the modulo of division with the same sign as the divisor, working on `numbers` and element-wise on `vectors` and `matrices` of compatible dimensions. When used with mixed types, it applies the modulo operation between each element of the collection and the scalar.',\n seeAlso: ['%', 'quot', '/'],\n examples: [\n 'mod(5, 3)',\n 'mod(5.2, 3.1)',\n 'mod(-5, 3)',\n '5 mod -3',\n '-5 mod -3',\n '[1, 2, 3] mod 2',\n '2 mod [1, 2, 3]',\n 'mod([1, 2, 3], [4, 5, 6])',\n '[[1, 2, 3], [4, 5, 6]] mod [[7, 8, 9], [10, 11, 12]]',\n 'mod([[1, 2, 3], [4, 5, 6]], 2)',\n ],\n },\n },\n '%': {\n evaluate: binaryMathOp((a, b) => a % b),\n arity: toFixedArity(2),\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n a: { type: ['number', 'vector', 'matrix'] },\n b: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'The `%` function computes the remainder of division with the same sign as the dividend, working on `numbers` and element-wise on `vectors` and `matrices` of compatible dimensions. When used with mixed types, it applies the remainder operation between each element of the collection and the scalar.',\n seeAlso: ['mod', 'quot', '/'],\n examples: [\n '5 % 3',\n '5.2 % 3.1',\n '-5 % 3',\n '%(5, -3)',\n '%(-5, -3)',\n '[1, 2, 3] % 2',\n '2 % [1, 2, 3]',\n '%([1, 2, 3], [4, 5, 6])',\n '[[1, 2, 3], [4, 5, 6]] % [[7, 8, 9], [10, 11, 12]]',\n '%([[1, 2, 3], [4, 5, 6]], 2)',\n ],\n },\n },\n 'sqrt': {\n evaluate: unaryMathOp(val => Math.sqrt(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `sqrt` function calculates the square root of `numbers` and computes element-wise square roots of `vectors` and `matrices`. When applied to collections, it returns the square root of each element while preserving the original structure.',\n seeAlso: ['cbrt', '^'],\n examples: [\n 'sqrt(0)',\n 'sqrt(9)',\n 'sqrt(2)',\n 'sqrt(0)',\n 'sqrt(9)',\n 'sqrt(2)',\n 'sqrt([1, 4, 9])',\n 'sqrt([[1, 4], [9, 16]])',\n ],\n },\n },\n 'cbrt': {\n evaluate: unaryMathOp(val => Math.cbrt(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `cbrt` function calculates the cube root of `numbers` and computes element-wise cube roots of `vectors` and `matrices`. When applied to collections, it returns the cube root of each element while preserving the original structure.',\n seeAlso: ['sqrt', '^'],\n examples: [\n 'cbrt(0)',\n 'cbrt(27)',\n 'cbrt(2)',\n 'cbrt(1)',\n 'cbrt(0)',\n 'cbrt(27)',\n 'cbrt(2)',\n 'cbrt(1)',\n 'cbrt([1, 8, 27])',\n 'cbrt([[1, 8], [27, 64]])',\n ],\n },\n },\n '^': {\n evaluate: binaryMathOp((a, b) => a ** b),\n arity: toFixedArity(2),\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n a: { type: ['number', 'vector', 'matrix'] },\n b: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'The ^ function computes exponentiation, raising the first argument to the power of the second, working on `numbers` and element-wise on `vectors` and `matrices` of compatible dimensions. When used with mixed types, it applies the power operation between each element of the collection and the scalar.',\n seeAlso: ['sqrt', 'cbrt', '*', 'ln'],\n examples: [\n '2 ^ 3',\n '2 ^ 0',\n '2 ^ -3',\n '^(-2, 3)',\n '^(-2, -3)',\n '[1, 2, 3] ^ 2',\n '2 ^ [1, 2, 3]',\n '^([1, 2, 3], [4, 5, 6])',\n '[[1, 2, 3], [4, 5, 6]] ^ [[7, 8, 9], [10, 11, 12]]',\n '^([[1, 2, 3], [4, 5, 6]], 2)',\n ],\n },\n },\n 'round': {\n evaluate: ([value, decimals], sourceCodeInfo): NumberVectorOrMatrix => {\n const [operation, operands] = getNumberVectorOrMatrixOperation([value], sourceCodeInfo)\n if (operation === 'number') {\n if (decimals === undefined || decimals === 0) {\n return Math.round(operands[0]!)\n }\n else {\n assertNumber(decimals, sourceCodeInfo, { integer: true, positive: true })\n const factor = 10 ** decimals\n return Math.round(operands[0]! * factor) / factor\n }\n }\n else if (operation === 'vector') {\n const vector = operands[0]!\n if (decimals === undefined || decimals === 0) {\n return vector.map(val => Math.round(val))\n }\n else {\n assertNumber(decimals, sourceCodeInfo, { integer: true, positive: true })\n const factor = 10 ** decimals\n return vector.map(val => Math.round(val * factor) / factor)\n }\n }\n else {\n const matrix = operands[0]!\n if (decimals === undefined || decimals === 0) {\n return matrix.map(row => row.map(val => Math.round(val)))\n }\n else {\n assertNumber(decimals, sourceCodeInfo, { integer: true, positive: true })\n const factor = 10 ** decimals\n return matrix.map(row => row.map(val => Math.round(val * factor) / factor))\n }\n }\n },\n arity: { min: 1, max: 2 },\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n a: { type: ['number', 'vector', 'matrix'] },\n b: { type: 'integer' },\n },\n variants: [\n { argumentNames: ['a'] },\n { argumentNames: ['a', 'b'] },\n ],\n description: 'The `round` function rounds a `number` to the nearest `integer` or to a specified number of `decimal` places, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it rounds each element while preserving the original structure.',\n seeAlso: ['floor', 'ceil', 'trunc'],\n examples: [\n 'round(2)',\n 'round(2.49)',\n 'round(2.5)',\n 'round(-2.49)',\n 'round(-2.5)',\n 'round(-2.501)',\n 'round(1.23456789, 4)',\n '1.123456789 round 2',\n 'round([1.23456789, 2.3456789], 1)',\n '[1.23456789, 2.3456789] round 4',\n '[[1.23456789, 2.3456789], [3.456789, 4.56789]] round 4',\n 'round([[1.23456789, 2.3456789], [3.456789, 4.56789]], 2)',\n ],\n },\n },\n 'trunc': {\n evaluate: unaryMathOp(val => Math.trunc(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'Math',\n returns: { type: ['integer', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `trunc` function truncates `numbers` toward zero (removing decimal portions without rounding), working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it truncates each element while preserving the original structure.',\n seeAlso: ['round', 'floor', 'ceil', 'quot'],\n examples: [\n 'trunc(2)',\n 'trunc(2.49)',\n 'trunc(2.5)',\n 'trunc(-2.49)',\n 'trunc(-2.5)',\n 'trunc(-2.501)',\n 'trunc([1.23456789, 2.3456789])',\n 'trunc([[1.23456789, 2.3456789], [3.456789, 4.56789]])',\n ],\n },\n },\n 'floor': {\n evaluate: unaryMathOp(val => Math.floor(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'Math',\n returns: { type: ['integer', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `floor` function returns the largest `integer` less than or equal to a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the floor of each element while preserving the original structure.',\n seeAlso: ['ceil', 'round', 'trunc'],\n examples: [\n 'floor(2)',\n 'floor(2.49)',\n 'floor(2.5)',\n 'floor(-2.49)',\n 'floor(-2.5)',\n 'floor(-2.501)',\n 'floor([1.23456789, 2.3456789])',\n 'floor([[1.23456789, 2.3456789], [3.456789, 4.56789]])',\n ],\n },\n },\n 'ceil': {\n evaluate: unaryMathOp(val => Math.ceil(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'Math',\n returns: { type: ['integer', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `ceil` function returns the smallest `integer` greater than or equal to a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the ceiling of each element while preserving the original structure.',\n seeAlso: ['floor', 'round', 'trunc'],\n examples: [\n 'ceil(2)',\n 'ceil(2.49)',\n 'ceil(2.5)',\n 'ceil(-2.49)',\n 'ceil(-2.5)',\n 'ceil(-2.501)',\n 'ceil([1.23456789, 2.3456789])',\n 'ceil([[1.23456789, 2.3456789], [3.456789, 4.56789]])',\n ],\n },\n },\n 'min': {\n evaluate: ([first, ...rest], sourceCodeInfo): number => {\n assertNumber(first, sourceCodeInfo)\n if (rest.length === 0)\n return first\n\n return rest.reduce((min: number, value) => {\n assertNumber(value, sourceCodeInfo)\n return Math.min(min, value)\n }, first)\n },\n arity: { min: 1 },\n docs: {\n category: 'Math',\n returns: { type: 'number' },\n args: {\n a: { type: 'number' },\n b: { type: 'number' },\n xs: { type: 'number', rest: true },\n },\n variants: [{ argumentNames: ['xs'] }],\n description: 'Returns the smallest number of the arguments.',\n seeAlso: ['max', 'Vector.min'],\n examples: [\n '2 min 3',\n 'min(2, 0, 1)',\n 'min(2, -1, 1)',\n 'min(2.5)',\n '12 min 14',\n ],\n },\n },\n 'max': {\n evaluate: ([first, ...rest], sourceCodeInfo): number => {\n assertNumber(first, sourceCodeInfo)\n if (rest.length === 0)\n return first\n\n return rest.reduce((min: number, value) => {\n assertNumber(value, sourceCodeInfo)\n return Math.max(min, value)\n }, first)\n },\n arity: { min: 1 },\n docs: {\n category: 'Math',\n returns: { type: 'number' },\n args: {\n a: { type: 'number' },\n b: { type: 'number' },\n xs: { type: 'number', rest: true },\n },\n variants: [{ argumentNames: ['xs'] }],\n description: 'Returns the largest number of the arguments.',\n seeAlso: ['min', 'Vector.max'],\n examples: [\n ' 2 max 3',\n 'max(2, 0, 1)',\n 'max(2, -1, 1)',\n 'max(2, 0.5)',\n '4 max 2',\n ],\n },\n },\n 'abs': {\n evaluate: unaryMathOp(val => Math.abs(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The abs function returns the absolute value (magnitude) of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the absolute value of each element while preserving the original structure.',\n seeAlso: ['sign', '-'],\n examples: [\n 'abs(-2.3)',\n 'abs(0)',\n 'abs(2.5)',\n 'abs([1, -2, 3])',\n 'abs([[1, -2], [3, -4]])',\n ],\n },\n },\n 'sign': {\n evaluate: unaryMathOp(val => Math.sign(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `sign` function returns the `sign` of a `number` (-1 for negative, 0 for zero, 1 for positive), working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the sign of each element while preserving the original structure.',\n seeAlso: ['abs'],\n examples: [\n 'sign(-2.3)',\n 'sign(-0)',\n 'sign(0)',\n 'sign(12312)',\n 'sign([1, -2, 3])',\n 'sign([[1, -2], [3, -4]])',\n ],\n },\n },\n 'ln': {\n evaluate: unaryMathOp(val => Math.log(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `ln` function computes the natural logarithm (base `e`) of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the natural logarithm of each element while preserving the original structure.',\n seeAlso: ['log2', 'log10', '^'],\n examples: [\n 'ln(0.01)',\n 'ln(2.5)',\n 'ln(E)',\n 'ln([1, 2, 3])',\n 'ln([[1, 2], [3, 4]])',\n ],\n },\n },\n 'log2': {\n evaluate: unaryMathOp(val => Math.log2(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `log2` function computes the base `2` logarithm of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the base-2 logarithm of each element while preserving the original structure.',\n seeAlso: ['ln', 'log10'],\n examples: [\n 'log2(0.01)',\n 'log2(2 ^ 12)',\n 'log2(2.5)',\n 'log2([1, 2, 3])',\n 'log2([[1, 2], [3, 4]])',\n ],\n },\n },\n 'log10': {\n evaluate: unaryMathOp(val => Math.log10(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `log10` function computes the base `10` logarithm of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the base-10 logarithm of each element while preserving the original structure.',\n seeAlso: ['ln', 'log2'],\n examples: [\n 'log10(0.01)',\n 'log10(10 ^ 12)',\n 'log10(2.5)',\n 'log10([1, 2, 3])',\n 'log10([[1, 2], [3, 4]])',\n ],\n },\n },\n 'sin': {\n evaluate: unaryMathOp(val => Math.sin(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `sin` function computes the sine of an angle (in radians), working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the sine of each element while preserving the original structure.',\n seeAlso: ['asin', 'sinh', 'cos', 'tan', 'to-rad'],\n examples: [\n 'sin(0)',\n 'sin(1)',\n 'sin(PI)',\n 'sin(-0.5)',\n 'sin([1, 2, 3])',\n 'sin([[1, 2], [3, 4]])',\n ],\n },\n },\n 'asin': {\n evaluate: unaryMathOp(val => Math.asin(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `asin` function computes the arcsine (inverse sine) of a `number` in radians, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the arcsine of each element while preserving the original structure.',\n seeAlso: ['sin', 'asinh', 'acos', 'atan'],\n examples: [\n 'asin(0)',\n 'asin(1)',\n 'asin(-0.5)',\n 'asin([1, 2, 3])',\n 'asin([[1, 2], [3, 4]])',\n ],\n },\n },\n 'sinh': {\n evaluate: unaryMathOp(val => Math.sinh(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `sinh` function computes the hyperbolic sine of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the hyperbolic sine of each element while preserving the original structure.',\n seeAlso: ['asinh', 'sin', 'cosh', 'tanh'],\n examples: [\n 'sinh(0)',\n 'sinh(1)',\n 'sinh(-0.5)',\n 'sinh([0.1, 0.2, 0.3])',\n 'sinh([[0.1, 0.2], [0.3, 0.4]])',\n ],\n },\n },\n 'asinh': {\n evaluate: unaryMathOp(val => Math.asinh(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `asinh` function computes the inverse hyperbolic sine of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the inverse hyperbolic sine of each element while preserving the original structure.',\n seeAlso: ['sinh', 'asin', 'acosh', 'atanh'],\n examples: [\n 'asinh(10)',\n 'asinh(90)',\n 'asinh (50)',\n 'asinh([10, 20, 30])',\n 'asinh([[10, 20], [30, 40]])',\n ],\n },\n },\n 'cos': {\n evaluate: unaryMathOp(val => Math.cos(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `cos` function computes the cosine of an angle (in radians), working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the cosine of each element while preserving the original structure.',\n seeAlso: ['acos', 'cosh', 'sin', 'tan', 'to-rad'],\n examples: [\n 'cos(0)',\n 'cos(1)',\n 'cos(PI)',\n 'cos(-0.5)',\n 'cos([1, 2, 3])',\n 'cos([[1, 2], [3, 4]])',\n ],\n },\n },\n 'acos': {\n evaluate: unaryMathOp(val => Math.acos(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `acos` function computes the arccosine (inverse cosine) of a `number` in radians, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the arccosine of each element while preserving the original structure.',\n seeAlso: ['cos', 'acosh', 'asin', 'atan'],\n examples: [\n 'acos(0)',\n 'acos(1)',\n 'acos(-0.5)',\n 'acos([0.1, 0.2, 0.3])',\n 'acos([[0.1, 0.2], [0.3, 0.4]])',\n ],\n },\n },\n 'cosh': {\n evaluate: unaryMathOp(val => Math.cosh(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `cosh` function computes the hyperbolic cosine of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the hyperbolic cosine of each element while preserving the original structure.',\n seeAlso: ['acosh', 'cos', 'sinh', 'tanh'],\n examples: [\n 'cosh(0)',\n 'cosh(1)',\n 'cosh(-0.5)',\n 'cosh([0.1, 0.2, 0.3])',\n 'cosh([[0.1, 0.2], [0.3, 0.4]])',\n ],\n },\n },\n 'acosh': {\n evaluate: unaryMathOp(val => Math.acosh(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `acosh` function computes the inverse hyperbolic cosine of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the inverse hyperbolic cosine of each element while preserving the original structure.',\n seeAlso: ['cosh', 'acos', 'asinh', 'atanh'],\n examples: [\n 'acosh(1)',\n 'acosh(2)',\n 'acosh(100)',\n 'acosh(50)',\n 'acosh([1, 2, 3])',\n 'acosh([[1, 2], [3, 4]])',\n ],\n },\n },\n 'tan': {\n evaluate: unaryMathOp(val => Math.tan(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `tan` function computes the tangent of an angle (in radians), working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the tangent of each element while preserving the original structure.',\n seeAlso: ['atan', 'tanh', 'sin', 'cos', 'to-rad'],\n examples: [\n 'tan(0)',\n 'tan(1)',\n 'tan(PI)',\n 'tan(-0.5)',\n 'tan([1, 2, 3])',\n 'tan([[1, 2], [3, 4]])',\n ],\n },\n },\n 'atan': {\n evaluate: unaryMathOp(val => Math.atan(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `atan` function computes the arctangent (inverse tangent) of a `number` in radians, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the arctangent of each element while preserving the original structure.',\n seeAlso: ['tan', 'atanh', 'asin', 'acos'],\n examples: [\n 'atan(0)',\n 'atan(1)',\n 'atan(-0.5)',\n 'atan([0.1, 0.2, 0.3])',\n 'atan([[0.1, 0.2], [0.3, 0.4]])',\n ],\n },\n },\n 'tanh': {\n evaluate: unaryMathOp(val => Math.tanh(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `tanh` function computes the hyperbolic tangent of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the hyperbolic tangent of each element while preserving the original structure.',\n seeAlso: ['atanh', 'tan', 'sinh', 'cosh'],\n examples: ['tanh(0)', 'tanh(1)', 'tanh(-0.5)', 'tanh(50)'],\n },\n },\n 'atanh': {\n evaluate: unaryMathOp(val => Math.atanh(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `atanh` function computes the inverse hyperbolic tangent of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the inverse hyperbolic tangent of each element while preserving the original structure.',\n seeAlso: ['tanh', 'atan', 'asinh', 'acosh'],\n examples: [\n 'atanh(0)',\n 'atanh(0.9)',\n 'atanh(-0.5)',\n 'atanh([0.1, 0.2, 0.3])',\n 'atanh([[0.1, 0.2], [0.3, 0.4]])',\n ],\n },\n },\n 'to-rad': {\n evaluate: unaryMathOp(val => (val * Math.PI) / 180),\n arity: toFixedArity(1),\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `to-rad` function converts an angle from degrees to radians, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it converts each element while preserving the original structure.',\n seeAlso: ['to-deg', 'sin', 'cos', 'tan'],\n examples: [\n 'to-rad(0)',\n 'to-rad(90)',\n 'to-rad(180)',\n 'to-rad(360)',\n 'to-rad([0, 90, 180])',\n 'to-rad([[0, 90], [180, 360]])',\n ],\n },\n },\n 'to-deg': {\n evaluate: unaryMathOp(val => (val * 180) / Math.PI),\n arity: toFixedArity(1),\n docs: {\n category: 'Math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `to-deg` function converts an angle from radians to degrees, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it converts each element while preserving the original structure.',\n seeAlso: ['to-rad'],\n examples: [\n 'to-deg(0)',\n 'to-deg(PI)',\n 'to-deg(PI / 2)',\n 'to-deg(3 * PI / 2)',\n 'to-deg([0, PI, PI / 2])',\n 'to-deg([[0, PI], [PI / 2, 3 * PI / 2]])',\n ],\n },\n },\n}\n","import { LitsError } from '../../errors'\nimport type { Any } from '../../interface'\nimport type { ModuleFunction } from '../../parser/types'\nimport type { SourceCodeInfo } from '../../tokenizer/token'\nimport { asAny, assertAny } from '../../typeGuards/lits'\nimport { assertNumber } from '../../typeGuards/number'\nimport { asStringOrNumber, assertString, assertStringOrNumber } from '../../typeGuards/string'\nimport { compare, deepEqual } from '../../utils'\nimport { toFixedArity } from '../../utils/arity'\nimport { FUNCTION_SYMBOL } from '../../utils/symbols'\nimport type { BuiltinNormalExpressions } from '../interface'\n\nfunction isEqual([first, ...rest]: unknown[], sourceCodeInfo: SourceCodeInfo | undefined) {\n const firstAny = asAny(first, sourceCodeInfo)\n for (const param of rest) {\n if (!deepEqual(firstAny, asAny(param, sourceCodeInfo), sourceCodeInfo))\n return false\n }\n return true\n}\n\nfunction isIdentical([first, ...rest]: unknown[]) {\n for (const param of rest) {\n if (param !== first)\n return false\n }\n return true\n}\n\nexport const miscNormalExpression: BuiltinNormalExpressions = {\n '==': {\n evaluate: (params, sourceCodeInfo): boolean => {\n return isEqual(params, sourceCodeInfo)\n },\n arity: { min: 1 },\n docs: {\n category: 'Misc',\n returns: { type: 'boolean' },\n args: {\n a: { type: 'any' },\n b: { type: 'any' },\n x: { type: 'any' },\n ys: { type: 'any', rest: true },\n },\n variants: [\n { argumentNames: ['x'] },\n { argumentNames: ['x', 'ys'] },\n ],\n description: 'Returns `true` if all `values` are structaul equal to each other, otherwise result is `false`.',\n seeAlso: ['≠', 'identical?'],\n examples: [\n '1 == 1',\n '[1, 2] == [1, 2]',\n `\n{\n a: 1,\n b: 2,\n} == {\n b: 2,\n a: 1,\n}`,\n '==(1, 1)',\n '==(1.01, 1)',\n '==(\"1\", 1)',\n '==(\"2\", \"2\", \"2\", \"2\")',\n '==(2, 2, 1, 2)',\n '==([1, 2], [1, 2])',\n '==({ a: 1, b: 2 }, { b: 2, a: 1 })',\n ],\n },\n },\n '≠': {\n evaluate: (params, sourceCodeInfo): boolean => {\n return !isEqual(params, sourceCodeInfo)\n },\n arity: { min: 1 },\n docs: {\n category: 'Misc',\n returns: { type: 'boolean' },\n args: {\n a: { type: 'any' },\n b: { type: 'any' },\n x: { type: 'any' },\n ys: { type: 'any', rest: true },\n },\n variants: [\n { argumentNames: ['x'] },\n { argumentNames: ['x', 'ys'] },\n ],\n description: 'Returns `true` if all `values` are not equal to each other, otherwise result is `false`. `(≠ a b c)` is same as `(! (== a b c))`.',\n seeAlso: ['==', 'identical?'],\n examples: [\n '1 ≠ 2',\n '3 ≠ 3',\n '≠(3)',\n '≠(3, 3, 2)',\n '≠(\"3\", \"2\", \"1\", \"0\",)',\n '≠(0, -0)',\n ],\n },\n },\n 'identical?': {\n evaluate: (params): boolean => {\n return isIdentical(params)\n },\n arity: { min: 1 },\n docs: {\n category: 'Misc',\n returns: { type: 'boolean' },\n args: {\n a: { type: 'any' },\n b: { type: 'any' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns true if $a and $b are referential equal.',\n seeAlso: ['==', '≠'],\n examples: [\n 'identical?({ a: 10, b: 20 }, { b: 20, a: 10 })',\n 'identical?([1, true, null], [1, true, null])',\n 'identical?(0.3, 0.1 + 0.2)',\n ],\n },\n },\n '>': {\n evaluate: ([first, ...rest], sourceCodeInfo): boolean => {\n let currentValue = asStringOrNumber(first)\n for (const param of rest) {\n if (compare(currentValue, asStringOrNumber(param), sourceCodeInfo) <= 0)\n return false\n\n currentValue = asStringOrNumber(param)\n }\n return true\n },\n arity: { min: 1 },\n docs: {\n category: 'Misc',\n returns: { type: 'boolean' },\n args: {\n a: { type: ['number', 'string'] },\n b: { type: ['number', 'string'] },\n x: { type: ['number', 'string'] },\n ys: { type: ['number', 'string'], rest: true },\n },\n variants: [\n { argumentNames: ['x'] },\n { argumentNames: ['x', 'ys'] },\n ],\n description: 'Returns `true` if $x and $ys are in decreasing order, `false` otherwise.',\n seeAlso: ['<', '>=', '<=', 'compare'],\n examples: [\n '>(1, 0)',\n '>(1.01, 1)',\n '>(1, 1)',\n '>(4, 3, 2, 1)',\n '>(3, 2, 2, 1)',\n ],\n },\n },\n\n '<': {\n evaluate: ([first, ...rest], sourceCodeInfo): boolean => {\n let currentValue = asStringOrNumber(first)\n for (const param of rest) {\n if (compare(currentValue, asStringOrNumber(param), sourceCodeInfo) >= 0)\n return false\n\n currentValue = asStringOrNumber(param)\n }\n return true\n },\n arity: { min: 1 },\n docs: {\n category: 'Misc',\n returns: { type: 'boolean' },\n args: {\n a: { type: ['number', 'string'] },\n b: { type: ['number', 'string'] },\n x: { type: ['number', 'string'] },\n ys: { type: ['number', 'string'], rest: true },\n },\n variants: [\n { argumentNames: ['x'] },\n { argumentNames: ['x', 'ys'] },\n ],\n description: 'Returns `true` if $x and $ys are in increasing order, `false` otherwise.',\n seeAlso: ['>', '>=', '<=', 'compare'],\n examples: [\n '<(0, 1)',\n '<(1, 1.01)',\n '<(1, 1)',\n '<(1, 2, 2, 3)',\n '<(\"a\", \"b\")',\n ],\n },\n },\n '>=': {\n evaluate: ([first, ...rest], sourceCodeInfo): boolean => {\n let currentValue = asStringOrNumber(first)\n for (const param of rest) {\n if (compare(currentValue, asStringOrNumber(param), sourceCodeInfo) < 0)\n return false\n\n currentValue = asStringOrNumber(param)\n }\n return true\n },\n arity: { min: 1 },\n docs: {\n category: 'Misc',\n returns: { type: 'boolean' },\n args: {\n a: { type: ['number', 'string'] },\n b: { type: ['number', 'string'] },\n x: { type: ['number', 'string'] },\n ys: { type: ['number', 'string'], rest: true },\n },\n variants: [\n { argumentNames: ['x'] },\n { argumentNames: ['x', 'ys'] },\n ],\n description: 'Returns `true` if $x and $ys are in non increasing order, `false` otherwise.',\n seeAlso: ['>', '<', '<=', 'compare'],\n examples: [\n '1 >= 1',\n '0 >= 1',\n '>=(1, 0)',\n '>=(1.01, 1)',\n '>=(1, 1)',\n '>=(4, 3, 2, 1)',\n '>=(3, 2, 2, 1)',\n ],\n },\n },\n '<=': {\n evaluate: ([first, ...rest], sourceCodeInfo): boolean => {\n let currentValue = asStringOrNumber(first)\n for (const param of rest) {\n if (compare(currentValue, asStringOrNumber(param), sourceCodeInfo) > 0)\n return false\n\n currentValue = asStringOrNumber(param)\n }\n return true\n },\n arity: { min: 1 },\n docs: {\n category: 'Misc',\n returns: { type: 'boolean' },\n args: {\n a: { type: ['number', 'string'] },\n b: { type: ['number', 'string'] },\n x: { type: ['number', 'string'] },\n ys: { type: ['number', 'string'], rest: true },\n },\n variants: [\n { argumentNames: ['x'] },\n { argumentNames: ['x', 'ys'] },\n ],\n description: 'Returns `true` if $x and $ys are in non decreasing order, `false` otherwise.',\n seeAlso: ['>', '<', '>=', 'compare'],\n examples: [\n '1 <= 1',\n '<=(0, 1)',\n '<=(1, 1.01)',\n '<=(1, 1)',\n '<=(1, 2, 3, 4)',\n '<=(1, 2, 2, 3)',\n ],\n },\n },\n '!': {\n evaluate: ([first]): boolean => !first,\n arity: toFixedArity(1),\n docs: {\n category: 'Misc',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Computes logical negation. Note that any other $x than `false`, `0`, `null` and `\\'\\'` is truthy.',\n seeAlso: ['boolean'],\n examples: [\n '!(3)',\n '!(true)',\n '!(\"A string\")',\n '!(0)',\n '!(false)',\n '!(null)',\n '!(\"\")',\n ],\n },\n },\n 'epoch->iso-date': {\n evaluate: ([ms], sourceCodeInfo): string => {\n assertNumber(ms, sourceCodeInfo)\n return new Date(ms).toISOString()\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Misc',\n returns: { type: 'string' },\n args: { ms: { type: 'number' } },\n variants: [{ argumentNames: ['ms'] }],\n description: 'Returns IOS date time string from `ms` (milliseconds elapsed since the UNIX epoch).',\n seeAlso: ['iso-date->epoch'],\n examples: [\n 'epoch->iso-date(1649756230899)',\n 'epoch->iso-date(0)',\n ],\n },\n },\n 'iso-date->epoch': {\n evaluate: ([dateTime], sourceCodeInfo): number => {\n assertString(dateTime, sourceCodeInfo)\n const ms = new Date(dateTime).valueOf()\n assertNumber(ms, sourceCodeInfo, { finite: true })\n return ms\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Misc',\n returns: { type: 'number' },\n args: { iso: { type: 'string' } },\n variants: [{ argumentNames: ['iso'] }],\n description: 'Returns milliseconds elapsed since the UNIX epoch to `iso`.',\n seeAlso: ['epoch->iso-date'],\n examples: [\n 'iso-date->epoch(\"2022-04-12T09:37:10.899Z\")',\n 'iso-date->epoch(\"1980-01-01\")',\n ],\n },\n },\n 'write!': {\n evaluate: (params, sourceCodeInfo): Any => {\n // eslint-disable-next-line no-console\n console.log(...params)\n\n if (params.length > 0)\n return asAny(params[params.length - 1], sourceCodeInfo)\n\n return null\n },\n arity: {},\n docs: {\n category: 'Misc',\n returns: { type: 'any' },\n args: { values: { type: 'any', rest: true } },\n variants: [{ argumentNames: ['values'] }],\n description: 'It logs the $values and then returns the last argument. If called with no arguments `null` is returned.',\n examples: [\n 'write!(\"A string\")',\n 'write!(100, \"items\")',\n 'write!(object(\"a\", 10))',\n 'write!([\"a\", \"b\", \"c\"])',\n 'write!(#\"^start\")',\n 'write!(null, true, false)',\n ],\n hideOperatorForm: true,\n },\n },\n 'boolean': {\n evaluate: ([value]): boolean => {\n return !!value\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Misc',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Coerces $x to boolean.',\n seeAlso: ['!', 'boolean?', 'true?', 'false?'],\n examples: [\n 'boolean(0)',\n 'boolean(1)',\n 'boolean(null)',\n 'boolean(\"Albert\")',\n ],\n },\n },\n 'compare': {\n evaluate: ([a, b], sourceCodeInfo): number => {\n assertStringOrNumber(a, sourceCodeInfo)\n assertStringOrNumber(b, sourceCodeInfo)\n return compare(a, b, sourceCodeInfo)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Misc',\n returns: { type: 'number' },\n args: {\n a: { type: ['number', 'string'] },\n b: { type: ['number', 'string'] },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Compares two values. Returns `-1` if $a < $b, `1` if $a > $b and `0` if $a and $b have the same sort order.',\n seeAlso: ['<', '>', '<=', '>=', 'sort', 'sort-by'],\n examples: [\n 'compare(0, 1)',\n 'compare(0, 0)',\n 'compare(1, 0)',\n 'compare(\"Albert\", \"Mojir\")',\n ],\n },\n },\n 'json-parse': {\n evaluate: ([first], sourceCodeInfo): Any => {\n assertString(first, sourceCodeInfo)\n // eslint-disable-next-line ts/no-unsafe-return\n return JSON.parse(first)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Misc',\n returns: { type: 'any' },\n args: { x: { type: 'string' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `JSON.parse(`$x`)`.',\n seeAlso: ['json-stringify'],\n examples: [\n 'json-parse(\"[1, 2, 3]\")',\n ],\n },\n },\n 'json-stringify': {\n evaluate: ([first, second], sourceCodeInfo): string => {\n assertAny(first, sourceCodeInfo)\n if (second === undefined)\n return JSON.stringify(first)\n\n assertNumber(second, sourceCodeInfo)\n return JSON.stringify(first, null, second)\n },\n arity: { min: 1, max: 2 },\n docs: {\n category: 'Misc',\n returns: { type: 'string' },\n args: {\n x: { type: 'any' },\n indent: { type: 'integer', description: 'Number of spaces to use for indentation.' },\n },\n variants: [\n { argumentNames: ['x'] },\n { argumentNames: ['x', 'indent'] },\n ],\n description: 'Returns `JSON.stringify(`$x`)`. If second argument is provided, returns `JSON.stringify(`$x`, null, `$indent`)`.',\n seeAlso: ['json-parse'],\n examples: [\n 'json-stringify([1, 2, 3])',\n 'json-stringify({ a: { b: 10 }}, 2)',\n ],\n hideOperatorForm: true,\n },\n },\n 'import': {\n evaluate: ([importPath], sourceCodeInfo, contextStack): ModuleFunction | Record<string, ModuleFunction> => {\n assertString(importPath, sourceCodeInfo)\n\n // Check if importing a specific function (e.g., \"Grid.row\")\n const dotIndex = importPath.indexOf('.')\n if (dotIndex !== -1) {\n const moduleName = importPath.substring(0, dotIndex)\n const functionName = importPath.substring(dotIndex + 1)\n\n const module = contextStack.getModule(moduleName)\n if (!module) {\n throw new LitsError(`Unknown module: '${moduleName}'`, sourceCodeInfo)\n }\n\n const expression = module.functions[functionName]\n\n if (!expression) {\n throw new LitsError(`Function '${functionName}' not found in module '${moduleName}'`, sourceCodeInfo)\n }\n\n return {\n [FUNCTION_SYMBOL]: true,\n sourceCodeInfo,\n functionType: 'Module',\n moduleName,\n functionName,\n arity: expression.arity,\n }\n }\n\n // Import entire module\n const moduleName = importPath\n const module = contextStack.getModule(moduleName)\n if (!module) {\n throw new LitsError(`Unknown module: '${moduleName}'`, sourceCodeInfo)\n }\n\n // Create an object where each key is a function name and value is a ModuleFunction\n const result: Record<string, ModuleFunction> = {}\n for (const [functionName, expression] of Object.entries(module.functions)) {\n result[functionName] = {\n [FUNCTION_SYMBOL]: true,\n sourceCodeInfo,\n functionType: 'Module',\n moduleName,\n functionName,\n arity: expression.arity,\n }\n }\n return result\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Misc',\n returns: { type: 'any' },\n args: {\n path: {\n type: 'string',\n description: 'The module path to import. Can be a module name (e.g., \"Vector\", \"Grid\") or a fully qualified function name (e.g., \"Vector.mean\", \"Grid.row\").',\n },\n },\n variants: [{ argumentNames: ['path'] }],\n description: 'Imports module functions. Use a module name (e.g., \"Vector\") to import all functions as an object, or a fully qualified name (e.g., \"Vector.mean\") to import a single function directly.',\n examples: [\n 'let v = import(\"Vector\"); v.mean([1, 2, 3, 4])',\n 'let sum = import(\"Vector.sum\"); sum([1, 2, 3])',\n 'let g = import(\"Grid\"); g.row([[1, 2], [3, 4]], 0)',\n ],\n },\n },\n}\n","import type { Any, Arr, Obj } from '../../interface'\nimport { assertArray, assertStringArray } from '../../typeGuards/array'\nimport { assertFunctionLike, assertObj } from '../../typeGuards/lits'\nimport { asString, assertString } from '../../typeGuards/string'\nimport { collHasKey, toAny } from '../../utils'\nimport { toFixedArity } from '../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../interface'\n\nexport const objectNormalExpression: BuiltinNormalExpressions = {\n 'keys': {\n evaluate: ([obj], sourceCodeInfo): string[] => {\n assertObj(obj, sourceCodeInfo)\n return Object.keys(obj)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Object',\n returns: { type: 'any', array: true },\n args: { obj: { type: 'object' } },\n variants: [{ argumentNames: ['obj'] }],\n description: 'Returns array of all keys in $obj.',\n seeAlso: ['vals', 'entries', 'zipmap', 'select-keys'],\n examples: [\n 'keys({})',\n 'keys({ x: 10, y: true, z: \"A string\" })',\n 'keys(object(\"x\", 10, \"y\", true, \"z\", \"A string\"))',\n ],\n },\n },\n\n 'vals': {\n evaluate: ([obj], sourceCodeInfo): Arr => {\n assertObj(obj, sourceCodeInfo)\n return Object.values(obj)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Object',\n returns: { type: 'any', array: true },\n args: { obj: { type: 'object' } },\n variants: [{ argumentNames: ['obj'] }],\n description: 'Returns array of all values in $obj.',\n seeAlso: ['keys', 'entries', 'zipmap'],\n examples: [\n 'vals({})',\n 'vals({ x: 10, y: true, z: \"A string\" })',\n 'vals(object(\"x\", 10, \"y\", true, \"z\", \"A string\"))',\n ],\n },\n },\n\n 'entries': {\n evaluate: ([obj], sourceCodeInfo): Array<[string, unknown]> => {\n assertObj(obj, sourceCodeInfo)\n return Object.entries(obj)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Object',\n returns: { type: 'array' },\n args: { obj: { type: 'object' } },\n variants: [{ argumentNames: ['obj'] }],\n description: 'Returns nested array of all key - value pairs in $obj.',\n seeAlso: ['keys', 'vals', 'zipmap', 'find'],\n examples: [\n 'entries({})',\n 'entries({ x: 10, y: true, z: \"A string\" })',\n 'entries(object(\"x\", 10, \"y\", true, \"z\", \"A string\"))',\n ],\n },\n },\n\n 'find': {\n evaluate: ([obj, key], sourceCodeInfo): [string, unknown] | null => {\n assertObj(obj, sourceCodeInfo)\n assertString(key, sourceCodeInfo)\n if (collHasKey(obj, key))\n return [key, obj[key]]\n\n return null\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Object',\n returns: { type: ['array', 'null'] },\n args: {\n a: { type: 'object' },\n b: { type: 'string' },\n obj: { type: 'object' },\n key: { type: 'string' },\n },\n variants: [{ argumentNames: ['obj', 'key'] }],\n description: 'Returns entry (key-value pair) for $key, or `null` if $key not present in $obj.',\n seeAlso: ['get', 'contains?', 'entries', 'position', 'some'],\n examples: [\n '{ a: 1, \"b\": 2 } find \"a\"',\n 'find(object(\"a\", 1, \"b\", 2), \"b\")',\n 'find(object(\"a\", 1, \"b\", 2), \"c\")',\n ],\n },\n },\n\n 'dissoc': {\n evaluate: ([obj, key], sourceCodeInfo): Any => {\n assertObj(obj, sourceCodeInfo)\n assertString(key, sourceCodeInfo)\n const newObj = { ...obj }\n delete newObj[key]\n return newObj\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Object',\n returns: { type: 'object' },\n args: {\n a: { type: 'object' },\n b: { type: 'string' },\n obj: { type: 'object' },\n key: { type: 'string' },\n },\n variants: [{ argumentNames: ['obj', 'key'] }],\n description: 'Return shallow copy of $obj with $key deleted.',\n seeAlso: ['assoc', 'select-keys'],\n examples: [\n '{ x: 10, y: 20 } dissoc \"y\"',\n 'dissoc({ x: 10, y: 20 }, \"x\")',\n 'dissoc({ x: 10 }, \"y\")',\n `\nlet o = { a: 5 };\ndissoc(o, \"a\");\no`,\n ],\n },\n },\n\n 'merge': {\n evaluate: (params, sourceCodeInfo): Any => {\n if (params.length === 0)\n return null\n\n const [first, ...rest] = params\n assertObj(first, sourceCodeInfo)\n\n return rest.reduce(\n (result: Obj, obj) => {\n assertObj(obj, sourceCodeInfo)\n return { ...result, ...obj }\n },\n { ...first },\n )\n },\n arity: { min: 0 },\n docs: {\n category: 'Object',\n returns: { type: 'object' },\n args: {\n a: { type: 'object' },\n b: { type: 'object' },\n objs: { type: 'object', rest: true },\n },\n variants: [{ argumentNames: ['objs'] }],\n description: `Returns a new object created by merging together all arguments.\n\nIf two keys appears in more than one object the value from the last object is used.\nIf no arguments are provided \\`null\\` is returned.`,\n seeAlso: ['merge-with', 'assoc'],\n examples: [\n '{ x: 10 } merge { y: 20 }',\n 'merge(object(\"x\", 10), object(\"y\", 20))',\n 'merge(object(\"x\", 10), object(\"x\", 15, \"y\", 20))',\n ],\n },\n },\n\n 'merge-with': {\n evaluate: (params: Arr, sourceCodeInfo, contextStack, { executeFunction }): Any => {\n const first = params[0]\n const fn = params.at(-1)\n const rest = params.slice(1, -1)\n\n assertObj(first, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n\n return rest.reduce(\n (result: Obj, obj) => {\n assertObj(obj, sourceCodeInfo)\n Object.entries(obj).forEach((entry) => {\n const key = asString(entry[0], sourceCodeInfo)\n const val = toAny(entry[1])\n if (collHasKey(result, key))\n result[key] = executeFunction(fn, [result[key], val], contextStack, sourceCodeInfo)\n else\n result[key] = val\n })\n return result\n },\n { ...first },\n )\n },\n arity: { min: 2 },\n docs: {\n category: 'Object',\n returns: { type: 'object' },\n args: {\n objs: { type: 'object', rest: true },\n fun: { type: 'function' },\n },\n variants: [{ argumentNames: ['objs', 'fun'] }],\n description: `\nReturns a new object created by merging together all arguments.\nIf two keys appears in more than one object $fun is used to calculate the new value.\n\nIf no arguments are provided \\`null\\` is returned.`,\n seeAlso: ['merge'],\n examples: [\n 'merge-with(object(\"x\", 10), object(\"y\", 20), +)',\n 'merge-with(object(\"x\", 10), object(\"x\", 15, \"y\", 20), +)',\n 'merge-with({ x: 10 }, { x: 20 }, { x: 30 }, { x: 40 }, -)',\n ],\n hideOperatorForm: true,\n },\n },\n\n 'zipmap': {\n evaluate: ([keys, values], sourceCodeInfo): Any => {\n assertStringArray(keys, sourceCodeInfo)\n assertArray(values, sourceCodeInfo)\n\n const length = Math.min(keys.length, values.length)\n\n const result: Obj = {}\n\n for (let i = 0; i < length; i += 1) {\n const key = asString(keys[i], sourceCodeInfo)\n result[key] = toAny(values[i])\n }\n return result\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Object',\n returns: { type: 'object' },\n args: {\n a: { type: 'array' },\n b: { type: 'array' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns a new object created by mapping $a to $b.',\n seeAlso: ['entries', 'keys', 'vals', 'interleave'],\n examples: [\n '[\"a\", \"b\", \"c\"] zipmap [1, 2, 3]',\n 'zipmap([\"a\", \"b\", \"c\"], [10, null, [1, 2, 3]])',\n 'zipmap([\"a\", \"b\", \"c\"], [1])',\n 'zipmap([], [10, null, [1, 2, 3]])',\n ],\n },\n },\n\n 'select-keys': {\n evaluate: ([obj, keys], sourceCodeInfo): Any => {\n assertStringArray(keys, sourceCodeInfo)\n assertObj(obj, sourceCodeInfo)\n\n return keys.reduce((result: Obj, key) => {\n if (collHasKey(obj, key))\n result[key] = toAny(obj[key])\n\n return result\n }, {})\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Object',\n returns: { type: 'object' },\n args: {\n a: { type: 'object' },\n b: { type: 'array' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns an object containing only those entries in $a whose key is in $b.',\n seeAlso: ['dissoc', 'keys'],\n examples: [\n '{ a: 1, b: 2, c: 3 } select-keys [\"a\", \"b\"]',\n 'select-keys({ a: 1, b: 2, c: 3 }, [\"a\", \"b\"])',\n 'select-keys({ a: 1 }, [\"a\", \"b\"])',\n ],\n },\n },\n}\n","import { isLitsFunction } from '../../typeGuards/litsFunction'\nimport { assertColl, isColl, isObj, isRegularExpression, isSeq } from '../../typeGuards/lits'\nimport { assertNumber, isNumber } from '../../typeGuards/number'\nimport type { BuiltinNormalExpressions } from '../interface'\nimport { isGrid, isMatrix, isVector } from '../../typeGuards/annotatedArrays'\nimport { EPSILON } from '../../utils'\nimport { toFixedArity } from '../../utils/arity'\n\nexport const predicatesNormalExpression: BuiltinNormalExpressions = {\n 'function?': {\n evaluate: ([first]): boolean => isLitsFunction(first),\n arity: toFixedArity(1),\n docs: {\n category: 'Predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is a function, otherwise `false`.',\n seeAlso: ['string?', 'number?', 'boolean?', 'null?', 'array?', 'object?', 'regexp?'],\n examples: [\n 'function?(+)',\n 'function?(/)',\n 'function?((x, y) -> x + y)',\n 'function?(false)',\n 'function?(\"false\")',\n 'function?([1, 2, 3])',\n ],\n },\n },\n\n 'string?': {\n evaluate: ([first]): boolean => typeof first === 'string',\n arity: toFixedArity(1),\n docs: {\n category: 'Predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is a string, otherwise `false`.',\n seeAlso: ['blank?', 'number?', 'boolean?', 'null?', 'array?', 'object?', 'regexp?', 'function?', 'coll?', 'seq?'],\n examples: [\n 'string?(\"\")',\n 'string?(\"A string\")',\n 'string?(true ? \"A string\" : false)',\n 'string?(false)',\n 'string?([1, 2, 3])',\n 'string?(100)',\n ],\n },\n },\n\n 'number?': {\n evaluate: ([first]): boolean => typeof first === 'number',\n arity: toFixedArity(1),\n docs: {\n category: 'Predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is a number, otherwise `false`.',\n seeAlso: ['integer?', 'zero?', 'pos?', 'neg?', 'finite?', 'number', 'string?', 'boolean?', 'null?', 'function?'],\n examples: [\n 'number?(0)',\n 'number?(2)',\n 'number?(-0.12)',\n 'number?(false)',\n 'number?([1, 2, 3])',\n 'number?(\"A string\")',\n ],\n },\n },\n\n 'integer?': {\n evaluate: ([first]): boolean => typeof first === 'number' && isNumber(first, { integer: true }),\n arity: toFixedArity(1),\n docs: {\n category: 'Predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is an integer, otherwise `false`.',\n seeAlso: ['number?', 'number', 'even?', 'odd?'],\n examples: [\n 'integer?(0)',\n 'integer?(-12)',\n 'integer?(42)',\n 'integer?(10.1)',\n 'integer?((x, y) -> x + y)',\n 'integer?(false)',\n 'integer?(\"false\")',\n 'integer?([1, 2, 3])',\n ],\n },\n },\n\n 'boolean?': {\n evaluate: ([first]): boolean => typeof first === 'boolean',\n arity: toFixedArity(1),\n docs: {\n category: 'Predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is a `boolean`, otherwise `false`.',\n seeAlso: ['true?', 'false?', 'boolean', 'string?', 'number?', 'null?', 'function?'],\n examples: [\n 'boolean?(true)',\n 'boolean?(false)',\n 'boolean?([1, 2, 3])',\n 'boolean?(0)',\n 'boolean?(\"A string\")',\n ],\n },\n },\n\n 'null?': {\n evaluate: ([first]): boolean => first === null || first === undefined,\n arity: toFixedArity(1),\n docs: {\n category: 'Predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is `null`, otherwise `false`.',\n seeAlso: ['empty?', 'not-empty?', 'string?', 'number?', 'boolean?', 'function?'],\n examples: [\n 'null?(null)',\n 'null?(false)',\n 'null?([1, 2, 3])',\n 'null?(0)',\n 'null?(\"A string\")',\n ],\n },\n },\n\n 'zero?': {\n evaluate: ([value], sourceCodeInfo): boolean => {\n assertNumber(value, sourceCodeInfo, { finite: true })\n return Math.abs(value) < EPSILON\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'number' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is `0`, otherwise `false`.',\n seeAlso: ['pos?', 'neg?', 'even?', 'number?'],\n examples: [\n 'zero?(0)',\n 'zero?(-0.0)',\n 'zero?(1)',\n 'zero?(0.1)',\n ],\n },\n },\n\n 'pos?': {\n evaluate: ([first], sourceCodeInfo): boolean => {\n assertNumber(first, sourceCodeInfo, { finite: true })\n return first > 0\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'number' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is greater than `0`, otherwise `false`.',\n seeAlso: ['neg?', 'zero?', 'number?'],\n examples: [\n 'pos?(0)',\n 'pos?(-0.0)',\n 'pos?(1)',\n 'pos?(-0.1)',\n ],\n },\n },\n\n 'neg?': {\n evaluate: ([first], sourceCodeInfo): boolean => {\n assertNumber(first, sourceCodeInfo, { finite: true })\n return first < 0\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'number' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is less than `0`, otherwise `false`.',\n seeAlso: ['pos?', 'zero?', 'number?'],\n examples: [\n 'neg?(0)',\n 'neg?(-0.0)',\n 'neg?(1)',\n 'neg?(-0.1)',\n ],\n },\n },\n\n 'even?': {\n evaluate: ([first], sourceCodeInfo): boolean => {\n assertNumber(first, sourceCodeInfo, { finite: true })\n return first % 2 === 0\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'number' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is even, otherwise `false`.',\n seeAlso: ['odd?', 'integer?', 'zero?'],\n examples: [\n 'even?(0)',\n 'even?(-0.0)',\n 'even?(-1)',\n 'even?(2.1)',\n ],\n },\n },\n\n 'odd?': {\n evaluate: ([first], sourceCodeInfo): boolean => {\n assertNumber(first, sourceCodeInfo, { finite: true })\n return isNumber(first, { integer: true }) && first % 2 !== 0\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'number' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is odd, otherwise `false`.',\n seeAlso: ['even?', 'integer?'],\n examples: [\n 'odd?(1.0)',\n 'odd?(1.001)',\n 'odd?(-1)',\n 'odd?(2.1)',\n ],\n },\n },\n\n 'array?': {\n evaluate: ([first]): boolean => {\n return Array.isArray(first)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is an array, otherwise `false`.',\n seeAlso: ['seq?', 'coll?', 'object?', 'string?', 'vector?', 'matrix?', 'grid?', 'function?'],\n examples: [\n 'array?([])',\n 'array?([1, 2, 3])',\n 'array?(object(\"a\", 10))',\n 'array?(42)',\n 'array?(10.1)',\n 'array?((x, y) -> x + y)',\n ],\n },\n },\n\n 'coll?': {\n evaluate: ([first]): boolean => {\n return isColl(first)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is a Coll i.e. an array, an object or a string, otherwise `false`.',\n seeAlso: ['seq?', 'array?', 'object?', 'string?'],\n examples: [\n 'coll?([])',\n 'coll?([1, 2, 3])',\n 'coll?(object(\"a\", 10))',\n 'coll?(\"Albert\")',\n 'coll?(42)',\n 'coll?(10.1)',\n 'coll?((x, y) -> x + y)',\n ],\n },\n },\n\n 'seq?': {\n evaluate: ([first]): boolean => {\n return isSeq(first)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is a Seq i.e. an array or a string, otherwise `false`.',\n seeAlso: ['coll?', 'array?', 'string?'],\n examples: [\n 'seq?([])',\n 'seq?([1, 2, 3])',\n 'seq?(object(\"a\", 10))',\n 'seq?(\"Albert\")',\n 'seq?(42)',\n 'seq?(10.1)',\n 'seq?((x, y) -> x + y)',\n ],\n },\n },\n\n 'object?': {\n evaluate: ([first]): boolean => isObj(first),\n arity: toFixedArity(1),\n docs: {\n category: 'Predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is an object, otherwise `false`.',\n seeAlso: ['coll?', 'array?', 'string?', 'function?'],\n examples: [\n 'object?(object(\"a\", 10))',\n 'object?(42)',\n 'object?(10.1)',\n 'object?((x, y) -> x + y)',\n 'object?(#\"^start\")',\n 'object?(\"false\")',\n 'object?([1, 2, 3])',\n ],\n },\n },\n\n 'regexp?': {\n evaluate: ([value]): boolean => isRegularExpression(value),\n arity: toFixedArity(1),\n docs: {\n category: 'Predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is a regexp, otherwise `false`.',\n seeAlso: ['regexp', 'match', 'string?', 'function?'],\n examples: [\n 'regexp?(regexp(\"^start\"))',\n 'regexp?(#\"^start\")',\n 'regexp?(-12)',\n 'regexp?({})',\n 'regexp?(10.1)',\n 'regexp?((x, y) -> x + y)',\n 'regexp?(false)',\n 'regexp?(\"false\")',\n 'regexp?([1, 2, 3])',\n ],\n },\n },\n\n 'finite?': {\n evaluate: ([value], sourceCodeInfo): boolean => {\n assertNumber(value, sourceCodeInfo)\n return Number.isFinite(value)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'number' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is finite, otherwise `false`.',\n seeAlso: ['positive-infinity?', 'negative-infinity?', 'number?'],\n examples: [\n 'finite?(1.0)',\n 'finite?(1 / 0)',\n 'finite?(-1 / 0)',\n ],\n },\n },\n\n 'positive-infinity?': {\n evaluate: ([value], sourceCodeInfo): boolean => {\n assertNumber(value, sourceCodeInfo)\n return value === Number.POSITIVE_INFINITY\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'number' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x equals positive infinity, otherwise `false`.',\n seeAlso: ['negative-infinity?', 'finite?'],\n examples: [\n 'positive-infinity?(1.0)',\n 'positive-infinity?(1 / 0)',\n 'positive-infinity?(-1 / 0)',\n ],\n },\n },\n\n 'negative-infinity?': {\n evaluate: ([value], sourceCodeInfo): boolean => {\n assertNumber(value, sourceCodeInfo)\n return value === Number.NEGATIVE_INFINITY\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'number' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x equals negative infinity, otherwise `false`.',\n seeAlso: ['positive-infinity?', 'finite?'],\n examples: [\n 'negative-infinity?(1.0)',\n 'negative-infinity?(1 / 0)',\n 'negative-infinity?(-1 / 0)',\n ],\n },\n },\n\n 'true?': {\n evaluate: ([value]): boolean => {\n return value === true\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is `true`, otherwise `false`.',\n seeAlso: ['false?', 'boolean?', 'boolean'],\n examples: [\n 'true?(false)',\n 'true?(true)',\n 'true?(1)',\n 'true?(0)',\n ],\n },\n },\n\n 'false?': {\n evaluate: ([value]): boolean => {\n return value === false\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is `true`, otherwise `false`.',\n seeAlso: ['true?', 'boolean?', 'boolean'],\n examples: [\n 'false?(false)',\n 'false?(true)',\n 'false?(1)',\n 'false?(0)',\n ],\n },\n },\n\n 'empty?': {\n evaluate: ([coll], sourceCodeInfo): boolean => {\n if (coll === null)\n return true\n\n assertColl(coll, sourceCodeInfo)\n if (typeof coll === 'string')\n return coll.length === 0\n\n if (Array.isArray(coll))\n return coll.length === 0\n\n return Object.keys(coll).length === 0\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Predicate',\n returns: { type: 'boolean' },\n args: { x: { type: ['collection', 'string', 'null'] } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is empty or `null`, otherwise `false`.',\n seeAlso: ['not-empty?', 'not-empty', 'null?', 'blank?', 'count'],\n examples: [\n 'empty?([])',\n 'empty?([1, 2, 3])',\n 'empty?({})',\n 'empty?({ a: 2 })',\n 'empty?(\"\")',\n 'empty?(\"Albert\")',\n 'empty?(null)',\n ],\n },\n },\n 'not-empty?': {\n evaluate: ([coll], sourceCodeInfo): boolean => {\n if (coll === null)\n return false\n\n assertColl(coll, sourceCodeInfo)\n if (typeof coll === 'string')\n return coll.length > 0\n\n if (Array.isArray(coll))\n return coll.length > 0\n\n return Object.keys(coll).length > 0\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Predicate',\n returns: { type: 'boolean' },\n args: { x: { type: ['collection', 'string', 'null'] } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `false` if $x is empty or `null`, otherwise `true`.',\n seeAlso: ['empty?', 'not-empty', 'null?'],\n examples: [\n 'not-empty?([])',\n 'not-empty?([1, 2, 3])',\n 'not-empty?({})',\n 'not-empty?({ a: 2 })',\n 'not-empty?(\"\")',\n 'not-empty?(\"Albert\")',\n 'not-empty?(null)',\n ],\n },\n },\n 'vector?': {\n evaluate: ([vector]): boolean => isVector(vector),\n arity: toFixedArity(1),\n docs: {\n category: 'Predicate',\n description: 'Checks if a value is a `vector`. A `vector` is an array of `numbers`.',\n seeAlso: ['matrix?', 'grid?', 'array?'],\n returns: { type: 'boolean' },\n args: { value: { type: 'any', description: 'The value to check.' } },\n variants: [{ argumentNames: ['value'] }],\n examples: [\n 'vector?(1)',\n 'vector?([1, 2, 3])',\n 'vector?([1, 2, \"3\"])',\n ],\n },\n },\n 'matrix?': {\n evaluate: ([matrix]): boolean => isMatrix(matrix),\n arity: toFixedArity(1),\n docs: {\n category: 'Predicate',\n description: 'Checks if a value is a `matrix`. A `matrix` is an array of arrays of `numbers`.',\n seeAlso: ['vector?', 'grid?', 'array?'],\n returns: { type: 'boolean' },\n args: { value: { type: 'any', description: 'The value to check.' } },\n variants: [{ argumentNames: ['value'] }],\n examples: [\n 'matrix?(1)',\n 'matrix?([1, 2, 3])',\n 'matrix?([[1, 2], [3, 4]])',\n 'matrix?([[1, 2], [3, \"4\"]])',\n 'matrix?([[1, 2], [3]])',\n ],\n },\n },\n 'grid?': {\n evaluate: ([table]): boolean => isGrid(table),\n arity: toFixedArity(1),\n docs: {\n category: 'Predicate',\n description: 'Checks if a `value` is a `grid`. A `grid` is an `array` of `arrays` where all inner `arrays` have the same length.',\n seeAlso: ['vector?', 'matrix?', 'array?'],\n returns: { type: 'boolean' },\n args: { value: { type: 'any', description: 'The value to check.' } },\n variants: [{ argumentNames: ['value'] }],\n examples: [\n 'grid?(\"1\")',\n 'grid?([\"1\", 2, 3])',\n 'grid?([[\"1\", 2], [3, 4]])',\n 'grid?([[\"1\", 2], [3, \"4\"]])',\n 'grid?([[\"1\", 2], [3]])',\n ],\n },\n },\n\n}\n","import { LitsError } from '../../errors'\nimport type { RegularExpression } from '../../parser/types'\nimport { assertRegularExpression, assertStringOrRegularExpression, isRegularExpression } from '../../typeGuards/lits'\nimport { assertString, isString } from '../../typeGuards/string'\nimport { toFixedArity } from '../../utils/arity'\nimport { REGEXP_SYMBOL } from '../../utils/symbols'\nimport type { BuiltinNormalExpressions } from '../interface'\n\nexport const regexpNormalExpression: BuiltinNormalExpressions = {\n 'regexp': {\n evaluate: ([sourceArg, flagsArg], sourceCodeInfo): RegularExpression => {\n assertString(sourceArg, sourceCodeInfo)\n const source = sourceArg || '(?:)'\n const flags = typeof flagsArg === 'string' ? flagsArg : ''\n\n try {\n // eslint-disable-next-line no-new\n new RegExp(source, flags) // Throws if invalid regexp\n }\n catch (e) {\n throw new LitsError(`Invalid regular expression: ${source} ${flags}`, sourceCodeInfo)\n }\n return {\n [REGEXP_SYMBOL]: true,\n sourceCodeInfo,\n s: source,\n f: flags,\n }\n },\n arity: { min: 1, max: 2 },\n docs: {\n category: 'Regular expression',\n returns: { type: 'regexp' },\n args: {\n pattern: { type: 'string' },\n flags: { type: 'string', description: 'Optional flags for the regular expression. Possible values are the same as Javascript RegExp takes.' },\n },\n variants: [\n { argumentNames: ['pattern'] },\n { argumentNames: ['pattern', 'flags'] },\n ],\n description: 'Creates a RegExp from $pattern and $flags.',\n examples: [\n 'regexp(\"^\\\\s*(.*)$\")',\n '#\"^\\\\s*(.*)$\"',\n 'regexp(\"albert\", \"ig\")',\n '#\"albert\"ig',\n ],\n seeAlso: ['-short-regexp', 'match', 'replace', 'replace-all', 'regexp?'],\n hideOperatorForm: true,\n },\n },\n 'match': {\n evaluate: ([text, regexp], sourceCodeInfo): string[] | null => {\n assertRegularExpression(regexp, sourceCodeInfo)\n if (!isString(text))\n return null\n\n const regExp = new RegExp(regexp.s, regexp.f)\n const match = regExp.exec(text)\n if (match)\n return [...match]\n\n return null\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Regular expression',\n returns: { type: 'any', array: true },\n args: {\n a: { type: 'regexp' },\n b: { type: 'string' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: `Matches $b against regular expression $a.\nIf $b is a string and matches the regular expression, a \\`match\\`-array is returned, otherwise \\`null\\` is returned.`,\n seeAlso: ['regexp', 'replace', 'replace-all', '-short-regexp', 'regexp?'],\n examples: [\n 'match(\" A string\", regexp(\"^\\\\\\\\s*(.*)$\"))',\n 'match(\" A string\", #\"^\\\\s*(.*)$\")',\n 'match(\"My name is Albert\", #\"albert\"i)',\n 'match(\"My name is Ben\", #\"albert\"i)',\n 'match(null, #\"albert\"i)',\n 'match(1, #\"albert\"i)',\n 'match({}, #\"albert\"i)',\n ],\n },\n },\n 'replace': {\n evaluate: ([str, regexp, value], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n assertStringOrRegularExpression(regexp, sourceCodeInfo)\n assertString(value, sourceCodeInfo)\n\n const matcher = isRegularExpression(regexp) ? new RegExp(regexp.s, `${regexp.f}`) : regexp\n return str.replace(matcher, value)\n },\n arity: toFixedArity(3),\n docs: {\n category: 'Regular expression',\n returns: { type: 'any', array: true },\n args: {\n a: { type: 'string' },\n b: { type: ['regexp', 'string'] },\n x: { type: 'string' },\n },\n variants: [{ argumentNames: ['a', 'b', 'x'] }],\n description: 'Returns a new string with first match of regular expression $b replaced by $x.',\n seeAlso: ['replace-all', 'regexp', 'match', '-short-regexp'],\n examples: [\n 'replace(\"Duck duck\", \"u\", \"i\")',\n 'replace(\"Duck duck\", #\"u\", \"i\")',\n 'replace(\"abcABC\", regexp(\"a\", \"i\"), \"-\")',\n 'replace(\"abcABC\", regexp(\"a\", \"gi\"), \"-\")',\n 'replace(\"abcABC\", #\"a\"i, \"-\")',\n 'replace(\"abcABC\", #\"a\"gi, \"-\")',\n ],\n },\n },\n 'replace-all': {\n evaluate: ([str, regexp, value], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n assertStringOrRegularExpression(regexp, sourceCodeInfo)\n assertString(value, sourceCodeInfo)\n const matcher = isRegularExpression(regexp) ? new RegExp(regexp.s, `${regexp.f.includes('g') ? regexp.f : `${regexp.f}g`}`) : regexp\n return str.replaceAll(matcher, value)\n },\n arity: toFixedArity(3),\n docs: {\n category: 'Regular expression',\n returns: { type: 'any', array: true },\n args: {\n a: { type: 'string' },\n b: { type: ['regexp', 'string'] },\n x: { type: 'string' },\n },\n variants: [{ argumentNames: ['a', 'b', 'x'] }],\n description: 'Returns a new string with all matches of regular expression $b replaced by $x.',\n seeAlso: ['replace', 'regexp', 'match', '-short-regexp'],\n examples: [\n 'replace-all(\"Duck duck\", \"u\", \"i\")',\n 'replace-all(\"Duck duck\", regexp(\"u\"), \"i\")',\n 'replace-all(\"abcABC\", regexp(\"a\", \"i\"), \"-\")',\n 'replace-all(\"abcABC\", regexp(\"a\", \"gi\"), \"-\")',\n 'replace-all(\"abcABC\", #\"a\"i, \"-\")',\n 'replace-all(\"abcABC\", #\"a\"gi, \"-\")',\n ],\n },\n },\n}\n","import { LitsError } from '../../errors'\nimport type { Arr } from '../../interface'\nimport type { SourceCodeInfo } from '../../tokenizer/token'\nimport { asNonUndefined } from '../../typeGuards'\nimport { assertArray } from '../../typeGuards/array'\nimport { assertStringOrRegularExpression, isObj } from '../../typeGuards/lits'\nimport { assertNumber } from '../../typeGuards/number'\nimport { asStringOrNumber, assertString, assertStringOrNumber } from '../../typeGuards/string'\nimport { toNonNegativeInteger } from '../../utils'\nimport { toFixedArity } from '../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../interface'\n\nconst blankRegexp = /^\\s*$/\nexport const stringNormalExpression: BuiltinNormalExpressions = {\n 'string-repeat': {\n evaluate: ([str, count], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n assertNumber(count, sourceCodeInfo, { integer: true, nonNegative: true })\n\n return str.repeat(count)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'String',\n returns: { type: 'number' },\n args: {\n a: { type: 'string' },\n b: { type: 'integer' },\n s: { type: 'string' },\n n: { type: 'integer' },\n },\n variants: [{ argumentNames: ['s', 'n'] }],\n description: 'Repeates $s $n times.',\n seeAlso: ['str', 'repeat'],\n examples: [\n '\"*\" string-repeat 10',\n 'string-repeat(\"*\", 10)',\n 'string-repeat(\"***\", 0)',\n ],\n },\n },\n\n 'str': {\n evaluate: (params: Arr) => {\n return params.reduce((result: string, param) => {\n const paramStr\n = param === undefined || param === null\n ? ''\n : isObj(param)\n ? JSON.stringify(param)\n : Array.isArray(param)\n ? JSON.stringify(param)\n : `${param}`\n return result + paramStr\n }, '')\n },\n arity: {},\n docs: {\n category: 'String',\n returns: { type: 'string' },\n args: { values: { type: 'any', rest: true } },\n variants: [{ argumentNames: ['values'] }],\n description: 'Concatenats $values into one string. If `value` equals `null` empty string is returned.',\n seeAlso: ['++', 'join', 'template', 'string-repeat', 'number'],\n examples: [\n 'str(\"A string\", \", and another string\", \" ...and more\")',\n 'str(\"Just one string\")',\n 'str()',\n 'str(0, false, true, null, #\"^kalle\", [1, 2, 3], {a: \"a\"})',\n ],\n hideOperatorForm: true,\n },\n },\n\n 'number': {\n evaluate: ([str], sourceCodeInfo): number => {\n assertString(str, sourceCodeInfo)\n const number = Number(str)\n if (Number.isNaN(number))\n throw new LitsError(`Could not convert '${str}' to a number.`, sourceCodeInfo)\n\n return number\n },\n arity: toFixedArity(1),\n docs: {\n category: 'String',\n returns: { type: 'number' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Parses $s to a number.',\n seeAlso: ['str', 'number?', 'integer?'],\n examples: [\n 'number(\"10\")',\n 'number(\"010\")',\n 'number(\"-1.01\")',\n ],\n },\n },\n\n 'from-char-code': {\n evaluate: ([num], sourceCodeInfo): string => {\n assertNumber(num, sourceCodeInfo, { finite: true })\n const int = toNonNegativeInteger(num)\n try {\n return String.fromCodePoint(int)\n }\n catch (error) {\n throw new LitsError(error as Error, sourceCodeInfo)\n }\n },\n arity: toFixedArity(1),\n docs: {\n category: 'String',\n returns: { type: 'string' },\n args: { code: { type: 'number' } },\n variants: [{ argumentNames: ['code'] }],\n description: 'Return character for code point $code.',\n seeAlso: ['to-char-code'],\n examples: [\n 'from-char-code(65)',\n 'from-char-code(0)',\n ],\n },\n },\n\n 'to-char-code': {\n evaluate: ([str], sourceCodeInfo): number => {\n assertString(str, sourceCodeInfo, { nonEmpty: true })\n return asNonUndefined(str.codePointAt(0), sourceCodeInfo)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'String',\n returns: { type: 'number' },\n args: { c: { type: 'string' } },\n variants: [{ argumentNames: ['c'] }],\n description: 'Return code point for first character in $c.',\n seeAlso: ['from-char-code'],\n examples: [\n 'to-char-code(\"A\")',\n 'to-char-code(\"Albert\")',\n ],\n },\n },\n\n 'lower-case': {\n evaluate: ([str], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n return str.toLowerCase()\n },\n arity: toFixedArity(1),\n docs: {\n category: 'String',\n returns: { type: 'string' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Returns $s converted to lower case.',\n seeAlso: ['upper-case', 'capitalize'],\n examples: [\n 'lower-case(\"Albert\")',\n 'lower-case(\"\")',\n ],\n },\n },\n\n 'upper-case': {\n evaluate: ([str], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n return str.toUpperCase()\n },\n arity: toFixedArity(1),\n docs: {\n category: 'String',\n returns: { type: 'string' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Returns $s converted to upper case.',\n seeAlso: ['lower-case', 'capitalize'],\n examples: [\n 'upper-case(\"Albert\")',\n 'upper-case(\"\")',\n ],\n },\n },\n\n 'trim': {\n evaluate: ([str], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n return str.trim()\n },\n arity: toFixedArity(1),\n docs: {\n category: 'String',\n returns: { type: 'string' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Returns a new string with leading and trailing whitespaces removed.',\n seeAlso: ['trim-left', 'trim-right', 'blank?'],\n examples: [\n 'trim(\" Albert \")',\n 'trim(\" \")',\n 'trim(\"\")',\n ],\n },\n },\n\n 'trim-left': {\n evaluate: ([str], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n return str.replace(/^\\s+/, '')\n },\n arity: toFixedArity(1),\n docs: {\n category: 'String',\n returns: { type: 'string' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Returns a new string with leading whitespaces removed.',\n seeAlso: ['trim', 'trim-right'],\n examples: [\n 'trim-left(\" Albert \")',\n 'trim-left(\" \")',\n 'trim-left(\"\")',\n ],\n },\n },\n\n 'trim-right': {\n evaluate: ([str], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n return str.replace(/\\s+$/, '')\n },\n arity: toFixedArity(1),\n docs: {\n category: 'String',\n returns: { type: 'string' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Returns a new string with trailing whitespaces removed.',\n seeAlso: ['trim', 'trim-left'],\n examples: [\n 'trim-right(\" Albert \")',\n 'trim-right(\" \")',\n 'trim-right(\"\")',\n ],\n },\n },\n\n 'join': {\n evaluate: ([stringList, delimiter], sourceCodeInfo): string => {\n assertArray(stringList, sourceCodeInfo)\n stringList.forEach(str => assertStringOrNumber(str, sourceCodeInfo))\n assertString(delimiter, sourceCodeInfo)\n return stringList.join(delimiter)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'String',\n returns: { type: 'string' },\n args: {\n a: { type: 'array' },\n b: { type: 'string' },\n arr: { type: 'array' },\n delimiter: { type: 'string' },\n },\n variants: [{ argumentNames: ['arr', 'delimiter'] }],\n description: 'Returns a new string by concatenating all of the elements in $arr, separated by $delimiter.',\n seeAlso: ['split', 'str', '++', 'interpose'],\n examples: [\n 'map([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], str) join \", \"',\n '([0, 1, 2, 3, 4, 5, 6, 7, 8, 9] map str) join \", \"',\n 'join([\"Albert\", 10], \", \")',\n 'join([\"Albert\", \"Mojir\"], \" \")',\n 'join(map([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], str), \", \")',\n ],\n },\n },\n\n 'split': {\n evaluate: ([str, stringOrRegExpValue, limit], sourceCodeInfo): string[] => {\n assertString(str, sourceCodeInfo)\n assertStringOrRegularExpression(stringOrRegExpValue, sourceCodeInfo)\n if (limit !== undefined)\n assertNumber(limit, sourceCodeInfo, { integer: true, nonNegative: true })\n\n const delimiter\n = typeof stringOrRegExpValue === 'string'\n ? stringOrRegExpValue\n : new RegExp(stringOrRegExpValue.s, stringOrRegExpValue.f)\n return str.split(delimiter, limit)\n },\n arity: { min: 2, max: 3 },\n docs: {\n category: 'String',\n returns: { type: 'string' },\n args: {\n a: { type: 'string' },\n b: { type: 'string' },\n s: { type: 'string' },\n delimiter: { type: 'string' },\n limit: { type: 'integer' },\n },\n variants: [\n { argumentNames: ['s', 'delimiter'] },\n { argumentNames: ['s', 'delimiter', 'limit'] },\n ],\n description: 'Divides $s into an array of substrings. The division is done by searching for `delimiter`. If `limit` as provided, at most `limit` number of substrings are returned.',\n seeAlso: ['join', 'split-lines'],\n examples: [\n '\"Albert Mojir\" split \" \"',\n 'split(\"Albert Mojir\", \" \")',\n 'split(\"abcdefghijklmnopqrstuvw\", #\"[aoueiy]\")',\n 'split(\"0123456789\", \"\")',\n 'split(\"0123456789\", \"\", 5) map number',\n ],\n },\n },\n 'split-lines': {\n evaluate: ([str], sourceCodeInfo): string[] => {\n assertString(str, sourceCodeInfo)\n return str.split((/\\r\\n|\\n|\\r/)).filter(line => line !== '')\n },\n arity: toFixedArity(1),\n docs: {\n category: 'String',\n returns: { type: 'string' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Divides $s into an array of substrings, each representing a line.',\n seeAlso: ['split'],\n examples: [\n 'split-lines(\"Albert\\nMojir\\n\")',\n 'split-lines(\"Albert\\n\\nMojir\")',\n 'split-lines(\"Albert\\nMojir\\n\\n\")',\n 'split-lines(\"\")',\n ],\n },\n },\n\n 'pad-left': {\n evaluate: ([str, length, padString], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n assertNumber(length, sourceCodeInfo, { integer: true })\n\n if (padString !== undefined)\n assertString(padString, sourceCodeInfo)\n\n return str.padStart(length, padString)\n },\n arity: { min: 2, max: 3 },\n docs: {\n category: 'String',\n returns: { type: 'string' },\n args: {\n a: { type: 'string' },\n b: { type: 'integer' },\n s: { type: 'string' },\n length: { type: 'integer' },\n padString: { type: 'string' },\n },\n variants: [\n { argumentNames: ['s', 'length'] },\n { argumentNames: ['s', 'length', 'padString'] },\n ],\n description: 'Pads from the start of $s with `padString` (multiple times, if needed) until the resulting string reaches the given $length.',\n seeAlso: ['pad-right'],\n examples: [\n '\"Albert\" pad-left 20',\n 'pad-left(\"Albert\", 20)',\n 'pad-left(\"Albert\", 20, \"-*-\")',\n 'pad-left(\"Albert\", 5)',\n 'pad-left(\"Albert\", -1)',\n ],\n },\n },\n\n 'pad-right': {\n evaluate: ([str, length, padString], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n assertNumber(length, sourceCodeInfo, { integer: true })\n\n if (padString !== undefined)\n assertString(padString, sourceCodeInfo)\n\n return str.padEnd(length, padString)\n },\n arity: { min: 2, max: 3 },\n docs: {\n category: 'String',\n returns: { type: 'string' },\n args: {\n a: { type: 'string' },\n b: { type: 'integer' },\n s: { type: 'string' },\n length: { type: 'integer' },\n padString: { type: 'string' },\n },\n variants: [\n { argumentNames: ['s', 'length'] },\n { argumentNames: ['s', 'length', 'padString'] },\n ],\n description: 'Pads from the start of $s with `padString` (multiple times, if needed) until the resulting string reaches the given `length`.',\n seeAlso: ['pad-left'],\n examples: [\n '\"Albert\" pad-right 20',\n 'pad-right(\"Albert\", 20)',\n 'pad-right(\"Albert\", 20, \"-*-\")',\n 'pad-right(\"Albert\", 5)',\n 'pad-right(\"Albert\", -1)',\n ],\n },\n },\n\n 'template': {\n evaluate: ([templateString, ...placeholders], sourceCodeInfo): string => {\n assertString(templateString, sourceCodeInfo)\n assertArray(placeholders, sourceCodeInfo)\n const templateStrings = templateString.split('||||')\n if (templateStrings.length <= 1) {\n return applyPlaceholders(templateStrings[0] as string, placeholders, sourceCodeInfo)\n }\n else {\n // Pluralisation\n const count = placeholders[0]\n assertNumber(count, sourceCodeInfo, { integer: true, nonNegative: true })\n const stringPlaceholders = [`${count}`, ...placeholders.slice(1)] as string[]\n if (templateStrings.length === 2) {\n // Exactly two valiants.\n // First variant (singular) for count = 1, Second variant (plural) for count = 0 or count > 1\n\n const placehoder = templateStrings[count === 1 ? 0 : 1] as string\n return applyPlaceholders(placehoder, stringPlaceholders, sourceCodeInfo)\n }\n else {\n // More than two variant:\n // Use count as index\n // If count >= number of variants, use last variant\n\n const placehoder = templateStrings[Math.min(count, templateStrings.length - 1)] as string\n return applyPlaceholders(placehoder, stringPlaceholders, sourceCodeInfo)\n }\n }\n },\n arity: { min: 1, max: 10 },\n docs: {\n category: 'String',\n returns: { type: 'string' },\n args: {\n s: { type: 'string' },\n params: { type: 'any', rest: true },\n },\n variants: [{ argumentNames: ['s', 'params'] }],\n description: 'Applies placeholders to a string. Support for basic pluralization - see examples. If pluralization is used, first placeholder must be a number.',\n seeAlso: ['str'],\n examples: [\n 'template(\"Hi, $1 and $2\", \"Carl\", \"Larry\")',\n 'template(\"Hi $1, $2, $3, $4, $5, $6, $7, $8 and $9\", \"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\", \"I\")',\n 'template(\"$1 book||||$1 books\", 0)',\n 'template(\"$1 book||||$1 books\", 1)',\n 'template(\"$1 book||||$1 books\", 2)',\n 'template(\"No book||||$1 book||||$1 books\", 0)',\n 'template(\"No book||||$1 book||||$1 books\", 1)',\n 'template(\"No book||||$1 book||||$1 books\", 10)',\n 'template(\"No book||||One book||||Two books||||Three books||||$1 books\", 0)',\n 'template(\"No book||||One book||||Two books||||Three books||||$1 books\", 1)',\n 'template(\"No book||||One book||||Two books||||Three books||||$1 books\", 2)',\n 'template(\"No book||||One book||||Two books||||Three books||||$1 books\", 3)',\n 'template(\"No book||||One book||||Two books||||Three books||||$1 books\", 4)',\n ],\n hideOperatorForm: true,\n },\n },\n\n 'encode-base64': {\n evaluate: ([value], sourceCodeInfo): string => {\n assertString(value, sourceCodeInfo)\n return btoa(\n encodeURIComponent(value).replace(/%([0-9A-F]{2})/g, (_match, p1) => {\n // eslint-disable-next-line ts/no-unsafe-argument\n return String.fromCharCode(Number.parseInt(p1, 16))\n }),\n )\n },\n arity: toFixedArity(1),\n docs: {\n category: 'String',\n returns: { type: 'string' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Returns a Base64 encoded string from $s.',\n seeAlso: ['decode-base64'],\n examples: [\n 'encode-base64(\"Albert\")',\n ],\n },\n },\n\n 'decode-base64': {\n evaluate: ([value], sourceCodeInfo): string => {\n assertString(value, sourceCodeInfo)\n try {\n return decodeURIComponent(\n Array.prototype.map\n .call(atob(value), (c) => {\n // eslint-disable-next-line ts/no-unsafe-call, ts/no-unsafe-member-access\n return `%${(`00${c.charCodeAt(0).toString(16)}`).slice(-2)}`\n })\n .join(''),\n )\n }\n catch (error) {\n throw new LitsError(error as Error, sourceCodeInfo)\n }\n },\n arity: toFixedArity(1),\n docs: {\n category: 'String',\n returns: { type: 'string' },\n args: { base64string: { type: 'string' } },\n variants: [{ argumentNames: ['base64string'] }],\n description: 'Returns a Base64 decoded string from $base64string.',\n seeAlso: ['encode-base64'],\n examples: [\n 'decode-base64(\"QWxiZXJ0IPCfkLs=\")',\n ],\n },\n },\n\n 'encode-uri-component': {\n evaluate: ([value], sourceCodeInfo): string => {\n assertString(value, sourceCodeInfo)\n return encodeURIComponent(value)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'String',\n returns: { type: 'string' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Returns an escaped `URI` string.',\n seeAlso: ['decode-uri-component'],\n examples: [\n 'encode-uri-component(\"Hi everyone!?\")',\n ],\n },\n },\n\n 'decode-uri-component': {\n evaluate: ([value], sourceCodeInfo): string => {\n assertString(value, sourceCodeInfo)\n try {\n return decodeURIComponent(value)\n }\n catch (error) {\n throw new LitsError(error as Error, sourceCodeInfo)\n }\n },\n arity: toFixedArity(1),\n docs: {\n category: 'String',\n returns: { type: 'string' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Returns an un-escaped `URI` string.',\n seeAlso: ['encode-uri-component'],\n examples: [\n 'decode-uri-component(\"Hi%20everyone!%3F%20%F0%9F%91%8D\")',\n ],\n },\n },\n 'capitalize': {\n evaluate: ([str], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase()\n },\n arity: toFixedArity(1),\n docs: {\n category: 'String',\n returns: { type: 'string' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Returns $s with the first character converted to uppercase and the rest to lowercase.',\n seeAlso: ['lower-case', 'upper-case'],\n examples: [\n 'capitalize(\"albert\")',\n 'capitalize(\"ALBERT\")',\n 'capitalize(\"aLBERT\")',\n 'capitalize(\"\")',\n ],\n },\n },\n 'blank?': {\n evaluate: ([value], sourceCodeInfo): boolean => {\n if (value === null) {\n return true\n }\n assertString(value, sourceCodeInfo)\n return blankRegexp.test(value)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'String',\n returns: { type: 'boolean' },\n args: { s: { type: ['string', 'null'] } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Returns true if $s is null or only contains whitespace characters.',\n seeAlso: ['trim', 'empty?', 'string?'],\n examples: [\n 'blank?(\"\")',\n 'blank?(null)',\n 'blank?(\"\\n\")',\n 'blank?(\" \")',\n 'blank?(\".\")',\n ],\n },\n },\n}\n\nconst doubleDollarRegexp = /\\$\\$/g\nfunction applyPlaceholders(templateString: string, placeholders: unknown[], sourceCodeInfo?: SourceCodeInfo): string {\n for (let i = 0; i < 9; i += 1) {\n // Matches $1, $2, ..., $9\n // Does not match $$1\n // But does match $$$1, (since the two first '$' will later be raplaced with a single '$'\n const re = new RegExp(`(\\\\$\\\\$|[^$]|^)\\\\$${i + 1}`, 'g')\n if (re.test(templateString)) {\n const placeHolder = asStringOrNumber(placeholders[i], sourceCodeInfo)\n templateString = templateString.replace(re, `$1${placeHolder}`)\n }\n }\n templateString = templateString.replace(doubleDollarRegexp, '$')\n return templateString\n}\n","import type { Any, Arr } from '../../interface'\nimport type {\n CompFunction,\n ComplementFunction,\n ConstantlyFunction,\n EveryPredFunction,\n FNullFunction,\n FunctionLike,\n JuxtFunction,\n SomePredFunction,\n} from '../../parser/types'\nimport { toAny } from '../../utils'\nimport { getArityFromFunction, getCommonArityFromFunctions, toFixedArity } from '../../utils/arity'\nimport { FUNCTION_SYMBOL } from '../../utils/symbols'\nimport type { BuiltinNormalExpressions } from '../interface'\nimport { assertArray } from '../../typeGuards/array'\nimport { asFunctionLike, assertFunctionLike } from '../../typeGuards/lits'\nimport { LitsError } from '../../errors'\n\nexport const functionalNormalExpression: BuiltinNormalExpressions = {\n '|>': {\n evaluate: ([value, func], sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertFunctionLike(func, sourceCodeInfo)\n return executeFunction(func, [value], contextStack, sourceCodeInfo)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'Functional',\n returns: { type: 'any' },\n args: {\n a: { type: 'any' },\n b: { type: 'function' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Takes a value $a and a function $b, and returns the result of applying $b to $a.',\n seeAlso: ['apply', 'comp'],\n examples: [\n `\n1 |> inc |> inc`,\n `range(10)\n |> map(_, -> $ ^ 2) // [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]\n |> filter(_, odd?) // [1, 9, 25, 49, 81]\n |> reduce(_, +, 0) // 165\n |> sqrt // 12.84523257866513\n |> round(_, 2)`,\n ],\n },\n },\n 'apply': {\n evaluate: ([func, ...params]: Arr, sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertFunctionLike(func, sourceCodeInfo)\n const paramsLength = params.length\n const last = params[paramsLength - 1]\n assertArray(last, sourceCodeInfo)\n const applyArray = [...params.slice(0, -1), ...last]\n return executeFunction(func, applyArray, contextStack, sourceCodeInfo)\n },\n arity: { min: 2 },\n docs: {\n category: 'Functional',\n returns: { type: 'any' },\n args: {\n a: { type: 'function' },\n b: { type: 'array' },\n fun: { type: 'function' },\n args: { type: 'array' },\n },\n variants: [{ argumentNames: ['fun', 'args'] }],\n description: 'Call supplied function $fun with specified arguments $args.',\n seeAlso: ['|>'],\n examples: [\n `\napply(+, [1, 2, 3])`,\n `\napply(\n (x, y) -> sqrt(x ^ 2 + y ^ 2),\n [3, 4]\n)`,\n `\n(x, y) -> sqrt(x ^ 2 + y ^ 2) apply [3, 4]`,\n ],\n },\n },\n\n 'identity': {\n evaluate: ([value]): Any => {\n return toAny(value)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Functional',\n returns: { type: 'any' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns $x.',\n seeAlso: ['constantly', 'fnull'],\n examples: ['identity(1)', 'identity(\"Albert\")', 'identity({ a: 1 })', 'identity(null)'],\n },\n },\n\n 'comp': {\n evaluate: (params, sourceCodeInfo): CompFunction => {\n params.forEach(param => assertFunctionLike(param, sourceCodeInfo))\n return {\n [FUNCTION_SYMBOL]: true,\n sourceCodeInfo,\n functionType: 'Comp',\n params,\n arity: params.length > 0 ? getArityFromFunction(params.at(-1) as FunctionLike) : { min: 1, max: 1 },\n }\n },\n arity: {},\n docs: {\n category: 'Functional',\n returns: { type: 'function' },\n args: {\n a: { type: 'function' },\n b: { type: 'function' },\n fns: { type: 'function', rest: true },\n },\n variants: [{ argumentNames: ['fns'] }],\n description: `Takes a variable number of functions and returns a function that is the composition of those.\n\n The returned function takes a variable number of arguments,\n applies the rightmost function to the args,\n the next function (right-to-left) to the result, etc.`,\n seeAlso: ['|>', 'juxt', 'complement'],\n examples: [\n `\nlet negative-quotient = comp(-, /);\nnegative-quotient(9, 3)`,\n `\nlet x = { bar: { foo: 42 } };\ncomp(\"foo\", \"bar\")(x)`,\n ],\n },\n },\n\n 'constantly': {\n evaluate: ([value], sourceCodeInfo): ConstantlyFunction => {\n return {\n [FUNCTION_SYMBOL]: true,\n sourceCodeInfo,\n functionType: 'Constantly',\n value: toAny(value),\n arity: {},\n }\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Functional',\n returns: { type: 'function' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns a function that takes any number of arguments and always returns $x.',\n seeAlso: ['identity', 'fnull'],\n examples: [\n `\nlet always-true = constantly(true);\nalways-true(9, 3)`,\n ],\n },\n },\n\n 'juxt': {\n evaluate: (params, sourceCodeInfo): JuxtFunction => {\n params.forEach(param => assertFunctionLike(param, sourceCodeInfo))\n const arity = getCommonArityFromFunctions(params as FunctionLike[])\n if (arity === null) {\n throw new LitsError('All functions must accept the same number of arguments', sourceCodeInfo)\n }\n return {\n [FUNCTION_SYMBOL]: true,\n sourceCodeInfo,\n functionType: 'Juxt',\n params,\n arity,\n }\n },\n arity: { min: 1 },\n docs: {\n category: 'Functional',\n returns: { type: 'function' },\n args: {\n a: { type: 'function' },\n b: { type: 'function' },\n fun: { type: 'function' },\n fns: { type: 'function', rest: true },\n },\n variants: [\n { argumentNames: ['fun'] },\n { argumentNames: ['fun', 'fns'] },\n ],\n description: `Takes one or many function and returns a function that is the juxtaposition of those functions.\nThe returned function takes a variable number of args,\nand returns a vector containing the result of applying each function to the args (left-to-right).`,\n seeAlso: ['comp'],\n examples: [\n `\njuxt(+, *, min, max)(\n 3,\n 4,\n 6,\n)`,\n `\njuxt(\"a\", \"b\")(\n {\n a: 1,\n b: 2,\n c: 3,\n d: 4\n }\n)`,\n `\njuxt(+, *, min, max) apply range(1, 11)`,\n ],\n },\n },\n\n 'complement': {\n evaluate: ([fn], sourceCodeInfo): ComplementFunction => {\n const fun = asFunctionLike(fn, sourceCodeInfo)\n return {\n [FUNCTION_SYMBOL]: true,\n sourceCodeInfo,\n functionType: 'Complement',\n function: fun,\n arity: getArityFromFunction(fun),\n }\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Functional',\n returns: { type: 'function' },\n args: { fun: { type: 'function' } },\n variants: [{ argumentNames: ['fun'] }],\n description: 'Takes a function $fun and returns a new function that takes the same arguments as f, has the same effects, if any, and returns the opposite truth value.',\n seeAlso: ['comp', 'every-pred', 'some-pred'],\n examples: [\n 'complement(>)(1, 3)',\n 'complement(<)(1, 3)',\n 'complement(+)(1, 3)',\n 'complement(+)(0, 0)',\n ],\n },\n },\n\n 'every-pred': {\n evaluate: (params, sourceCodeInfo): EveryPredFunction => {\n return {\n [FUNCTION_SYMBOL]: true,\n sourceCodeInfo,\n functionType: 'EveryPred',\n params,\n arity: { min: 1, max: 1 },\n }\n },\n arity: { min: 1 },\n docs: {\n category: 'Functional',\n returns: { type: 'function' },\n args: {\n fun: { type: 'function' },\n fns: { type: 'function', rest: true },\n },\n variants: [\n { argumentNames: ['fun'] },\n { argumentNames: ['fun', 'fns'] },\n ],\n description: `\nTakes a number of predicates and returns a function that returns \\`true\\` if all predicates\nreturn a truthy value against all of its arguments, else it returns \\`false\\`.`,\n seeAlso: ['some-pred', 'complement', 'every?'],\n examples: [\n `\nevery-pred(string?, -> count($) > 3)(\n \"Albert\",\n \"Mojir\"\n)`,\n `\n(string? every-pred -> count($) > 3)(\n \"Albert\",\n \"M\"\n)`,\n ],\n hideOperatorForm: true,\n },\n },\n\n 'some-pred': {\n evaluate: (params, sourceCodeInfo): SomePredFunction => {\n return {\n [FUNCTION_SYMBOL]: true,\n sourceCodeInfo,\n functionType: 'SomePred',\n params,\n arity: { min: 1, max: 1 },\n }\n },\n arity: { min: 1 },\n docs: {\n category: 'Functional',\n returns: { type: 'function' },\n args: {\n fun: { type: 'function' },\n fns: { type: 'function', rest: true },\n },\n variants: [\n { argumentNames: ['fun'] },\n { argumentNames: ['fun', 'fns'] },\n ],\n description: 'Takes a number of `predicates` and returns a function that returns `true` if at least one of the `predicates` return a truthy `true` value against at least one of its arguments, else it returns `false`.',\n seeAlso: ['every-pred', 'complement', 'any?'],\n examples: [\n 'some-pred(string?, -> count($) > 3)(\"Albert\", \"Mojir\")',\n 'some-pred(string?, -> count($) > 3)(\"a\", \"M\")',\n 'some-pred(string?, -> count($) > 3)(\"a\", [1, 2, 3])',\n 'some-pred(string?, -> count($) > 3)([1, 2, 3], [2])',\n ],\n hideOperatorForm: true,\n },\n },\n\n 'fnull': {\n evaluate: ([fn, ...params], sourceCodeInfo): FNullFunction => {\n const fun = asFunctionLike(fn, sourceCodeInfo)\n return {\n [FUNCTION_SYMBOL]: true,\n sourceCodeInfo,\n functionType: 'Fnull',\n function: fun,\n params,\n arity: getArityFromFunction(fun),\n }\n },\n arity: { min: 2 },\n docs: {\n category: 'Functional',\n returns: { type: 'function' },\n args: {\n a: { type: 'function' },\n b: { type: 'any' },\n fun: { type: 'function' },\n arg: { type: 'any' },\n args: { type: 'any', rest: true },\n },\n variants: [\n { argumentNames: ['fun', 'arg'] },\n { argumentNames: ['fun', 'arg', 'args'] },\n ],\n description: 'Takes a function $fun, and returns a function that calls $fun, replacing a null argument to the corresponding argument.',\n seeAlso: ['identity', 'constantly'],\n examples: [\n 'fnull(inc, 0)(1)',\n 'fnull(inc, 0)(null)',\n '(inc fnull 0)(null)',\n 'fnull(+, 1, 2)(null, 0)',\n 'fnull(+, 1, 2)(0, null)',\n 'fnull(+, 1, 2)(null, null)',\n 'fnull(+, 1, 2)(null, null, 3, 4)',\n ],\n },\n },\n}\n","import { smartTrim } from '..'\nimport type { Argument, FunctionReference, TypedValue } from '../../../reference'\n\nexport function generateDocString(reference: FunctionReference): string {\n return smartTrim(`\n ${reference.title}\n\n ${reference.description\n .replace(/`(.+?)`/g, '$1')\n .replace(/\\$(\\w+)/g, '$1')\n .replace(/\\*\\*\\*(.+)\\*\\*\\*/g, '$1')\n .replace(/\\*\\*(.+)\\*\\*/g, '$1')\n }\n\n Signature:\n ${signature(reference).join('\\n ')}\n\n Arguments:\n ${argStrings(reference).join('\\n ')}\n\n Examples:\n${reference.examples.map(example => smartTrim(example, 4)).join('\\n\\n')}`)\n}\n\nfunction signature({ title, variants, args, returns, _isOperator }: FunctionReference): string[] {\n const functionForms = variants.map((variant) => {\n const form = ` ${title}(${variant.argumentNames.map((argName) => {\n let result = ''\n const arg = args[argName]!\n if (arg.rest) {\n result += '...'\n }\n result += argName\n return result\n }).join(', ')})`\n\n return `${form} -> ${type(returns)}`\n })\n\n const operatorForm = _isOperator ? ['', 'Operator:', ` a ${title} b -> ${type(returns)}`] : []\n\n return [\n ...functionForms,\n ...operatorForm,\n ]\n}\n\nfunction type(arg: Argument | TypedValue) {\n const argType = arg.type\n const types = Array.isArray(argType) ? argType : [argType]\n const typeString = types.join(' | ')\n return arg.array || arg.rest ? `Array<${typeString}>` : typeString\n}\n\nfunction argStrings(reference: FunctionReference): string[] {\n return Object.entries(reference.args).map(([argName, arg]) => `${argName}: ${type(arg)}`)\n}\n","import type { FunctionReference } from '../../../reference'\nimport { assertNonUndefined } from '../../typeGuards'\nimport { assertFunctionLike } from '../../typeGuards/lits'\nimport { isLitsFunction } from '../../typeGuards/litsFunction'\nimport { toFixedArity } from '../../utils/arity'\nimport { generateDocString } from '../../utils/docString/generateDocString'\nimport type { Arity, BuiltinNormalExpressions } from '../interface'\n\nexport function getMetaNormalExpression(normalExpressionReference: Record<string, FunctionReference>): BuiltinNormalExpressions {\n return {\n doc: {\n evaluate: ([fn], sourceCodeInfo): string => {\n assertNonUndefined(normalExpressionReference)\n assertFunctionLike(fn, sourceCodeInfo)\n if (!isLitsFunction(fn)) {\n return ''\n }\n if (fn.functionType === 'Builtin') {\n const reference = normalExpressionReference[fn.name]\n return reference ? generateDocString(reference) : ''\n }\n if (fn.functionType === 'UserDefined' || fn.functionType === 'NativeJsFunction') {\n return fn.docString\n }\n return ''\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Meta',\n returns: { type: 'string' },\n args: { fun: { type: 'function' } },\n variants: [{ argumentNames: ['fun'] }],\n description: 'Returns documentation string of the $fun.',\n seeAlso: ['arity'],\n examples: [\n 'doc(+)',\n `\nlet add = (x, y) -> do\n \"\"\"\n Adds two numbers.\n Args:\n x: First number.\n y: Second number.\n Returns:\n Sum of x and y.\n \"\"\"\n x + y;\nend;\n\ndoc(add)`,\n ],\n },\n },\n arity: {\n evaluate: ([fn], sourceCodeInfo): Arity => {\n assertFunctionLike(fn, sourceCodeInfo)\n return isLitsFunction(fn) ? fn.arity : toFixedArity(1)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'Meta',\n returns: { type: 'object' },\n args: { fun: { type: 'function' } },\n variants: [{ argumentNames: ['fun'] }],\n description: 'Returns arity of the $fun. The arity is an object with the properties: `min` and `max`. If the function has fixed arity, `min` and `max` are equal to the number of required parameters. If no restrictions apply, empty object is returned.',\n seeAlso: ['doc'],\n examples: [\n 'arity(+)',\n 'arity(defined?)',\n `\nlet add = (x, y = 0) -> do\n x + y;\nend;\n\narity(add)`,\n `\nlet foo = (k, ...x) -> do\n k + x;\nend;\n arity(foo)`,\n ],\n },\n },\n }\n}\n","import type { BuiltinNormalExpression, BuiltinNormalExpressions } from '../interface'\nimport type { Any } from '../../interface'\nimport type { FunctionReference } from '../../../reference'\nimport type { CoreNormalExpressionName } from '../../../reference/api'\n\n// Core categories - always available\nimport { bitwiseNormalExpression } from '../core/bitwise'\nimport { collectionNormalExpression } from '../core/collection'\nimport { arrayNormalExpression } from '../core/array'\nimport { sequenceNormalExpression } from '../core/sequence'\nimport { mathNormalExpression } from '../core/math'\nimport { miscNormalExpression } from '../core/misc'\nimport { objectNormalExpression } from '../core/object'\nimport { predicatesNormalExpression } from '../core/predicates'\nimport { regexpNormalExpression } from '../core/regexp'\nimport { stringNormalExpression } from '../core/string'\nimport { functionalNormalExpression } from '../core/functional'\nimport { getMetaNormalExpression } from '../core/meta'\n\nconst normalExpressionReference: Record<string, FunctionReference> = {}\n\nexport function setNormalExpressionReference(reference: Record<CoreNormalExpressionName, FunctionReference>) {\n Object.assign(normalExpressionReference, reference)\n}\n\nconst expressions: BuiltinNormalExpressions = {\n // Core categories\n ...bitwiseNormalExpression,\n ...collectionNormalExpression,\n ...arrayNormalExpression,\n ...sequenceNormalExpression,\n ...mathNormalExpression,\n ...getMetaNormalExpression(normalExpressionReference),\n ...miscNormalExpression,\n ...objectNormalExpression,\n ...predicatesNormalExpression,\n ...regexpNormalExpression,\n ...stringNormalExpression,\n ...functionalNormalExpression,\n}\n\nObject.entries(expressions).forEach(([name, expression]) => {\n expression.name = name\n})\n\nexport const normalExpressions: BuiltinNormalExpressions = {\n ...expressions,\n}\n\nexport const normalExpressionTypes: Record<string, number> = {}\nexport const allNormalExpressions: BuiltinNormalExpression<Any>[] = []\n\nObject.entries(normalExpressions).forEach(([key, value], index) => {\n normalExpressionTypes[key] = index\n allNormalExpressions.push(value)\n})\n","import type { Any } from '../../interface'\nimport type { Node, SpecialExpressionNode } from '../../parser/types'\nimport { asAny } from '../../typeGuards/lits'\nimport type { BuiltinSpecialExpression, FunctionDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type AndNode = SpecialExpressionNode<[typeof specialExpressionTypes['&&'], Node[]]>\n\nconst docs: FunctionDocs = {\n category: 'Special expression',\n returns: {\n type: 'any',\n },\n args: {\n a: { type: 'any' },\n b: { type: 'any' },\n c: {\n type: 'any',\n rest: true,\n },\n },\n variants: [\n { argumentNames: ['a', 'b'] },\n { argumentNames: ['a', 'b', 'c'] },\n ],\n description: `\nComputes logical \\`and\\`. Evaluation of expressions starts from left.\nAs soon as an \\`expression\\` evaluates to a falsy value, the result is returned.\n\nIf all expressions evaluate to truthy values, the value of the last expression is returned.`,\n examples: [\n 'true && 1',\n '&&(1, 1)',\n '&&(3 > 2, \"string\")',\n '&&(3 < 2, \"string\")',\n '&&(true, true, true, true)',\n '&&(true, true, 0, true)',\n ],\n}\n\nexport const andSpecialExpression: BuiltinSpecialExpression<Any, AndNode> = {\n arity: {},\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n let value: Any = true\n\n for (const param of node[1][1]) {\n value = evaluateNode(param, contextStack)\n if (!value)\n break\n }\n\n return value\n },\n evaluateAsNormalExpression: (params, sourceCodeInfo) => {\n let value: Any = true\n for (const param of params) {\n value = asAny(param, sourceCodeInfo)\n if (!value)\n break\n }\n return value\n },\n\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => getUndefinedSymbols(node[1][1], contextStack, builtin, evaluateNode),\n}\n"],"names":["getCodeMarker","sourceCodeInfo","position","code","leftPadding","column","rightPadding","length","repeat","Math","max","RecurSignal","Error","params","constructor","super","Object","setPrototypeOf","this","prototype","name","LitsError","shortMessage","err","message","location","line","filePath","getLitsErrorMessage","UserDefinedError","userMessage","UndefinedSymbolError","symbol","symbolName","isLitsError","error","NodeTypes","Number","String","NormalExpression","SpecialExpression","UserDefinedSymbol","NormalBuiltinSymbol","SpecialBuiltinSymbol","ReservedSymbol","Binding","Spread","NodeTypesSet","Set","values","getNodeTypeName","type","keys","find","key","functionTypeSet","FUNCTION_SYMBOL","REGEXP_SYMBOL","isLitsFunction","func","has","isFunctionType","functionType","isNode","value","Array","isArray","isNodeType","valueToString","RegExp","toString","JSON","stringify","getSourceCodeInfo","anyValue","getAssertionError","typeName","asNonUndefined","assertNonUndefined","undefined","isNonUndefined","isUnknownRecord","asLitsFunction","assertLitsFunction","isUserDefinedFunction","asUserDefinedFunction","assertUserDefinedFunction","isNativeJsFunction","asNativeJsFunction","assertNativeJsFunction","isBuiltinFunction","isNumber","options","isNaN","integer","isInteger","finite","isFinite","zero","nonZero","positive","negative","nonPositive","nonNegative","gt","gte","lt","lte","assertNumber","sign","getSignString","numberType","range","getRangeString","filter","x","join","getNumberTypeName","asNumber","isAny","asAny","assertAny","isSeq","asSeq","assertSeq","isObj","isRegularExpression","assertObj","isColl","asColl","assertColl","regexp","assertStringOrRegularExpression","isStringOrRegularExpression","asFunctionLike","assertFunctionLike","isFunctionLike","arityAcceptsMin","arity","nbrOfParams","min","getArityFromFunction","param","toFixedArity","assertNumberOfParams","bitwiseNormalExpression","evaluate","num","count","first","rest","reduce","result","index","isString","nonEmpty","char","assertString","asString","asStringOrNumber","assertStringOrNumber","coll","getOwnPropertyDescriptor","compare","a","b","deepEqual","epsilon","EPSILON","diff","abs","absA","absB","i","s","f","aKeys","bKeys","toNonNegativeInteger","ceil","toAny","clone","entries","entry","val","map","item","cloneColl","joinSets","results","symbols","add","addToSet","target","source","smartTrim","minIndent","lines","str","split","match","shift","pop","indent","acc","lineIndent","slice","trimEnd","assertArray","assertStringArray","every","v","isStringArray","originalColl","resultColl","newResultColl","collHasKey","parent","get","contextStack","executeFunction","fn","intKey","elem","assoc","copy","collectionNormalExpression","filteri","at","colls","forEach","obj","objKeys","includes","push","mapObjects","seqs","isStr","len","seq","paramArray","mapped","p","mapi","initial","reducei","reduceRight","reductions","resultArray","newVal","reductionsi","defaultValue","nextValue","innerCollMeta","cloneAndGetMeta","lastKey","parentKey","update","arr","concat","isStringOrNumber","assign","some","arrayNormalExpression","second","third","from","to","step","flatten","actualDepth","depth","POSITIVE_INFINITY","flat","mapcat","windowSize","subArr","sequenceNormalExpression","nth","array","last","findIndex","indexOf","substring","next","reverse","splice","start","deleteCount","compareValue","sort","comparer","keyfn","defaultComparer","aKey","bKey","take","input","n","drop","charArray","unshift","assertCharArray","distinct","existingItem","remove","_","pos","seqIsArray","frequencies","partition","pad","asArray","isStringSeq","oldValue","search","endsWith","startsWith","interleave","seqsArr","maxLength","outer","innerArr","padIndex","annotatedArrays","WeakSet","annotate","vector","grids","grid","row","nbrOfCols","isMatrix","matrix","isVector","hasVector","hasMatrix","rows","cold","unaryMathOp","operation","operands","getNumberVectorOrMatrixOperation","binaryMathOp","j","reduceMathOp","identity","m","mathNormalExpression","inc","dec","firstVector","firstMatrix","mod","floor","sqrt","cbrt","decimals","round","factor","trunc","ln","log","log2","log10","sin","asin","sinh","asinh","cos","acos","cosh","acosh","tan","atan","tanh","atanh","PI","isEqual","firstAny","isIdentical","currentValue","ms","Date","toISOString","dateTime","valueOf","console","boolean","parse","import","importPath","dotIndex","moduleName","functionName","module","getModule","expression","functions","vals","dissoc","newObj","merge","zipmap","predicatesNormalExpression","NEGATIVE_INFINITY","table","isGrid","sourceArg","flagsArg","flags","e","text","assertRegularExpression","exec","replace","matcher","replaceAll","blankRegexp","stringNormalExpression","number","fromCodePoint","int","codePointAt","toLowerCase","toUpperCase","trim","stringList","delimiter","limit","padString","padStart","padEnd","template","templateString","placeholders","templateStrings","applyPlaceholders","stringPlaceholders","encodeURIComponent","_match","fromCharCode","parseInt","p1","decodeURIComponent","call","atob","c","charCodeAt","capitalize","charAt","test","doubleDollarRegexp","re","placeHolder","functionalNormalExpression","comp","constantly","juxt","aMin","aMax","bMin","bMax","getCommonArityFromFunctions","fun","function","fnull","generateDocString","reference","title","description","variants","args","returns","_isOperator","functionForms","variant","argumentNames","argName","operatorForm","signature","arg","argStrings","examples","example","typeString","argType","expressions","normalExpressionReference","doc","docString","getMetaNormalExpression","miscNormalExpression","objectNormalExpression","regexpNormalExpression","andSpecialExpression","evaluateNode","node","evaluateAsNormalExpression","getUndefinedSymbols","builtin","isSymbolNode","nodeType","asUserDefinedSymbolNode","isUserDefinedSymbolNode","assertUserDefinedSymbolNode","isSpecialBuiltinSymbolNode","isNormalExpressionNodeWithName","isNormalExpressionNode","definedSpecialExpression","assertSymbolNode","symbolNode","lookUp","bindingTargetTypes","walkDefaults","onDefault","bindingTarget","element","evalueateBindingNodeValues","record","createRecord","assertUnknownRecord","capturedKeys","restElement","restValues","restIndex","getAllBindingTargetNames","names","getNamesFromBindingTarget","defSpecialExpression","bindingNode","bindingValue","Node","exportValues","bindingResult","defaultNode","addValues","lambdaSpecialExpression","evaluatedFunction","functionContext","context","ctx","undefinedSymbols","new","getValue","evaluateFunction","evaluatedfunction","newContext","self","create","overloadResult","newContextStack","getFunctionUnresolvedSymbols","bindingNodes","bindingContext","valueRecord","body","addToContext","bindings","returnResult","loopNode","loopBindings","bindingIndex","letBindings","whenNode","whileNode","targetNode","valueNode","skip","abort","bindingIndices","bindingsLoop","loopBindingNode","letBindingNode","letTarget","letValue","helpers","evaluateLoop","analyze","doseqSpecialExpression","qqSpecialExpression","paramNode","evaluatedParams","trySpecialExpression","catchExpression","tryExpression","errorSymbol","tryResult","isSpreadNode","spreadValue","objectSpecialExpression","keyNode","spreadObject","specialExpressionTypes","for","if","let","loop","object","recur","throw","unless","specialExpressions","form","forSpecialExpression","trueNode","falseNode","conditionNode","loopSpecialExpression","recurSpecialExpression","switchValueNode","cases","switchValue","throwSpecialExpression","normalExpressionKeys","normalExpressions","specialExpressionKeys","ast","block","unresolvedSymbols","nodes","findUnresolvedSymbolsInNode","subNode","normalExpressionNode","expressionNode","specialExpressionNode","specialExpressionType","phi","numberReservedSymbolRecord","E","MAX_SAFE_INTEGER","MIN_SAFE_INTEGER","MAX_VALUE","MIN_VALUE","NaN","true","null","do","else","case","each","export","as","then","end","nativeFn","nbrOfNonRestArgs","restArgument","newContextStack2","Partial","actualParams","paramsCopy","placeholderIndex","Constantly","Complement","Fnull","fnulledParams","Builtin","allNormalExpressions","normalBuitinSymbolType","SpecialBuiltin","specialBuiltinSymbolType","specialExpression","Module","evaluateString","evaluateSymbol","reservedName","reservedSymbolRecord","evaluateReservedSymbol","paramNodes","nameSymbol","isNormalBuiltinSymbolNode","evaluateNormalExpression","evaluateArrayAsFunction","evalueateObjectAsFunction","evaluateStringAsFunction","evaluateNumberAsFunction","ContextStackImpl","contexts","globalContext","nativeJsFunctions","modules","hostValues","Map","currentContext","contextEntry","nativeJsFunction","hostValue","normalExpression","lookUpResult","jsFunctions","identifier","identifierParts","warn","scope","part","isJsFunction","TypeError","assertJsFunction","natifeFn","checkNotDefined","globalModuleScope","binaryOperators","symbolicOperators","nonFunctionOperatorSet","isFunctionOperator","operator","binaryOperatorSet","isBinaryOperator","illegalSymbolCharacters","illegalSymbolCharacterSet","illegalFirstSymbolCharacterSet","illegalFirstSymbolCharacters","whitespaceRegExp","NO_MATCH","tokenizeString","escaping","tokenizeToken","decimalNumberRegExp","octalNumberRegExp","hexNumberRegExp","binaryNumberRegExp","postNumberRegExp","tokenizeSymbol","initialPosition","tokenizers","symbolMeta","nextThreeChars","stringLength","token","baseChar","nextChar","negate","plusPrefix","hasExponent","hasDecimalPoint","isSymbolicOperator","threeChars","twoChars","oneChar","lastLine","lineNbr","getSourceCodeLine","getCurrentToken","tokenizeShebang","nbrOfCharacters","tokenizer","isSymbolToken","asSymbolToken","assertSymbolToken","isReservedSymbolToken","throwUnexpectedToken","assertReservedSymbolToken","isOperatorToken","operatorName","isLParenToken","assertLParenToken","assertRParenToken","isRParenToken","isLBracketToken","asLBracketToken","assertLBracketToken","asLBraceToken","isLBraceToken","assertLBraceToken","isRBraceToken","isStringToken","expected","expectedValue","actual","actualOutput","tokenStream","removeWhiteSpace","tokens","isWhitespaceToken","normalExpressionNames","normalExpressionTypes","specialExpressionNames","getSymbolName","placeholderRegexp","withSourceCodeInfo","getPrecedence","operatorSign","createAccessorNode","left","right","fromBinaryOperatorToNode","createNamedNormalExpressionNode","Parser","parseState","peek","peekSourceCodeInfo","currentToken","peekAhead","advance","isAtEnd","parseExpression","precedence","moduleScope","firstToken","parseLet","parseIfOrUnless","parseSwitch","parseForOrDoseq","parseLoop","parseTry","parseExport","parseOperand","isAtExpressionEnd","isA_BinaryOperatorToken","newPrecedece","operatorSymbol","parseSymbol","asToken","operand","parseOperandPart","symbolToken","isRBracketToken","parseFunctionCall","positionBefore","lamdaFunction","parseLambdaFunction","parseShorthandLamdaFunction","parseObject","parseArray","tokenType","parseNumber","parseString","parseReservedSymbol","parseRegexpShorthand","stringNode","stringFromQuotedSymbol","assertRBracketToken","assertOperatorToken","nextToken","functionArguments","parseFunctionArguments","parsedBlock","parseBlock","defaults","parseBindingTarget","endPos","dollar1","startPos","parseOptionalDefaulValue","requireDefaultValue","noRest","elements","keySymbol","keyName","allowDocString","asReservedSymbolToken","isDocStringToken","parseDocString","parseImplicitBlock","ends","isImplicitBlockEnd","assertImplicitBlockEnd","try","isDoseq","loopBinding","parseForLoopBinding","existingBoundNames","forLoopBindings","flatMap","newBoundNames","doseq","parseBinding","modifiers","letNode","assertInternalLoopBindingDelimiter","isInternalLoopBindingDelimiter","symbolsString","thenExpression","elseExpression","isUnless","condition","caseExpression","cond","valueExpression","switch","stringToSymbolNode","backslash","singleQuote","normalChar","numberString","stringToken","doubleQuote","newline","tab","carriageReturn","backspace","formFeed","endStringPosition","lastIndexOf","regexpString","optionsString","optionsNode","litsCommands","AutoCompleter","originalPosition","suffixProgram","suggestions","originalProgram","lits","partialProgram","lastToken","searchString","prefixProgram","generateSuggestions","getNextSuggestion","getAutoCompleteSuggestionResult","getPreviousSuggestionSymbol","program","suggestion","getNextSuggestionSymbol","suggestionIndex","getSuggestions","getSearchString","startsWithCaseSensitive","generateWithPredicate","blacklist","startsWithCaseInsensitive","includesCaseSensitive","includesCaseInsensitive","shouldInclude","localeCompare","cache","firstEntry","lastEntry","maxSize","_size","set","newEntry","nextEntry","size","dropFirstEntry","Lits","astCache","astCacheSize","debug","config","Cache","initialCache","cacheEntry","nsList","ns","programOrAst","generateAst","createContextStack","tokenize","tokenizeParams","createSourceCodeInfo","tokenDescriptor","minify","minifyTokenStream","hasDebugData","tokenStram","transformer","untokenize","apply","fnParams","fnName","generateApplyFunctionCall","paramsString","cachedAst","getAutoCompleter"],"mappings":"AAEM,SAAUA,EAAcC,GAC5B,IAAKA,EAAeC,WAAaD,EAA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|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/utils/debug/getCodeMarker.ts","../src/errors.ts","../src/constants/constants.ts","../src/utils/symbols.ts","../src/utils/debug/debugTools.ts","../src/utils/debug/getSourceCodeInfo.ts","../src/utils/getAssertionError.ts","../src/typeGuards/index.ts","../src/typeGuards/litsFunction.ts","../src/typeGuards/number.ts","../src/typeGuards/lits.ts","../src/utils/arity.ts","../src/builtin/core/bitwise.ts","../src/typeGuards/string.ts","../src/utils/index.ts","../src/typeGuards/array.ts","../src/builtin/core/collection.ts","../src/builtin/core/array.ts","../src/builtin/core/sequence.ts","../src/typeGuards/annotatedArrays.ts","../src/builtin/core/math.ts","../src/builtin/core/misc.ts","../src/builtin/core/object.ts","../src/builtin/core/predicates.ts","../src/builtin/core/regexp.ts","../src/builtin/core/string.ts","../src/builtin/core/functional.ts","../src/builtin/core/meta.ts","../src/builtin/core/vector.ts","../src/utils/docString/generateDocString.ts","../src/builtin/normalExpressions/index.ts","../src/builtin/specialExpressions/and.ts","../src/builtin/specialExpressions/cond.ts","../src/builtin/specialExpressions/switch.ts","../src/typeGuards/astNode.ts","../src/builtin/specialExpressions/defined.ts","../src/parser/types.ts","../src/builtin/bindingNode.ts","../src/builtin/specialExpressions/def.ts","../src/builtin/specialExpressions/block.ts","../src/builtin/specialExpressions/functions.ts","../src/builtin/specialExpressions/if.ts","../src/builtin/specialExpressions/unless.ts","../src/builtin/specialExpressions/let.ts","../src/builtin/specialExpressions/loop.ts","../src/builtin/specialExpressions/loops.ts","../src/builtin/specialExpressions/or.ts","../src/builtin/specialExpressions/qq.ts","../src/builtin/specialExpressions/recur.ts","../src/builtin/specialExpressions/throw.ts","../src/builtin/specialExpressions/try.ts","../src/builtin/specialExpressions/array.ts","../src/builtin/specialExpressions/object.ts","../src/builtin/specialExpressionTypes.ts","../src/builtin/index.ts","../src/getUndefinedSymbols/index.ts","../src/tokenizer/reservedNames.ts","../src/evaluator/functionExecutors.ts","../src/evaluator/index.ts"],"sourcesContent":["import type { SourceCodeInfo } from '../../tokenizer/token'\n\nexport function getCodeMarker(sourceCodeInfo: SourceCodeInfo): string {\n if (!sourceCodeInfo.position || !sourceCodeInfo.code)\n return ''\n\n const leftPadding = sourceCodeInfo.position.column - 1\n const rightPadding = sourceCodeInfo.code.length - leftPadding - 1\n return `${' '.repeat(Math.max(leftPadding, 0))}^${' '.repeat(Math.max(rightPadding, 0))}`\n}\n","import { getCodeMarker } from '../src/utils/debug/getCodeMarker'\nimport type { Arr } from './interface'\nimport type { SourceCodeInfo } from './tokenizer/token'\n\nfunction getLitsErrorMessage(message: string, sourceCodeInfo?: SourceCodeInfo) {\n if (!sourceCodeInfo) {\n return message\n }\n const location = `${sourceCodeInfo.position.line}:${sourceCodeInfo.position.column}`\n const filePathLine = sourceCodeInfo.filePath\n ? `\\n${sourceCodeInfo.filePath}:${location}`\n : `\\nLocation ${location}`\n const codeLine = `\\n${sourceCodeInfo.code}`\n const codeMarker = `\\n${getCodeMarker(sourceCodeInfo)}`\n return `${message}${filePathLine}${codeLine}${codeMarker}`\n}\n\nexport class RecurSignal extends Error {\n public params: Arr\n constructor(params: Arr) {\n super(`recur, params: ${params}`)\n Object.setPrototypeOf(this, RecurSignal.prototype)\n this.name = 'RecurSignal'\n this.params = params\n }\n}\n\nexport class LitsError extends Error {\n public readonly sourceCodeInfo?: SourceCodeInfo\n public readonly shortMessage: string\n constructor(err: unknown, sourceCodeInfo: SourceCodeInfo | undefined) {\n const message = err instanceof Error\n ? err.message\n : `${err}`\n\n super(getLitsErrorMessage(message, sourceCodeInfo))\n this.shortMessage = message\n this.sourceCodeInfo = sourceCodeInfo\n Object.setPrototypeOf(this, LitsError.prototype)\n this.name = 'LitsError'\n }\n\n public getCodeMarker(): string | undefined {\n return this.sourceCodeInfo && getCodeMarker(this.sourceCodeInfo)\n }\n}\n\nexport class UserDefinedError extends LitsError {\n public userMessage: string\n constructor(message: string, sourceCodeInfo?: SourceCodeInfo) {\n super(message, sourceCodeInfo)\n this.userMessage = message\n Object.setPrototypeOf(this, UserDefinedError.prototype)\n this.name = 'UserDefinedError'\n }\n}\n\nexport class AssertionError extends LitsError {\n constructor(message: string | Error, sourceCodeInfo?: SourceCodeInfo) {\n super(message, sourceCodeInfo)\n Object.setPrototypeOf(this, AssertionError.prototype)\n this.name = 'AssertionError'\n }\n}\n\nexport class UndefinedSymbolError extends LitsError {\n public symbol: string\n constructor(symbolName: string, sourceCodeInfo?: SourceCodeInfo) {\n const message = `Undefined symbol '${symbolName}'.`\n super(message, sourceCodeInfo)\n this.symbol = symbolName\n Object.setPrototypeOf(this, UndefinedSymbolError.prototype)\n this.name = 'UndefinedSymbolError'\n }\n}\n\nexport function isLitsError(error: unknown): error is LitsError {\n return error instanceof LitsError\n}\n","export const NodeTypes = {\n Number: 1,\n String: 2,\n NormalExpression: 3,\n SpecialExpression: 4,\n UserDefinedSymbol: 5,\n NormalBuiltinSymbol: 6,\n SpecialBuiltinSymbol: 7,\n ReservedSymbol: 8,\n Binding: 9,\n Spread: 10,\n} as const\n\nconst NodeTypesSet = new Set(Object.values(NodeTypes))\n\nexport type NodeType = typeof NodeTypes[keyof typeof NodeTypes]\n\nexport function getNodeTypeName(type: NodeType): keyof typeof NodeTypes {\n return Object.keys(NodeTypes).find(key => NodeTypes[key as keyof typeof NodeTypes] === type) as keyof typeof NodeTypes\n}\n\n// TODO, is this needed?\nexport function isNodeType(type: unknown): type is NodeType {\n return typeof type === 'number' && NodeTypesSet.has(type as NodeType)\n}\n\nconst functionTypes = [\n 'UserDefined',\n 'Partial',\n 'Comp',\n 'Constantly',\n 'Juxt',\n 'Complement',\n 'EveryPred',\n 'SomePred',\n 'Fnull',\n 'Builtin',\n 'SpecialBuiltin',\n 'NativeJsFunction',\n 'Module',\n] as const\n\nconst functionTypeSet = new Set(functionTypes)\n\nexport type FunctionType = typeof functionTypes[number]\n\nexport function isFunctionType(type: unknown): type is FunctionType {\n return typeof type === 'string' && functionTypeSet.has(type as FunctionType)\n}\n","export const FUNCTION_SYMBOL = '^^fn^^'\nexport const REGEXP_SYMBOL = '^^re^^'\n","import { getNodeTypeName, isFunctionType, isNodeType } from '../../constants/constants'\nimport type { LitsFunction, Node } from '../../parser/types'\nimport { FUNCTION_SYMBOL } from '../symbols'\n\nfunction isLitsFunction(func: unknown): func is LitsFunction {\n if (func === null || typeof func !== 'object')\n return false\n\n return FUNCTION_SYMBOL in func && 'functionType' in func && isFunctionType(func.functionType)\n}\n\nfunction isNode(value: unknown): value is Node {\n if (!Array.isArray(value) || value.length < 2)\n return false\n return isNodeType(value[0])\n}\n\nexport function valueToString(value: unknown): string {\n if (isLitsFunction(value))\n // eslint-disable-next-line ts/no-unsafe-member-access\n return `<function ${(value as any).name || '\\u03BB'}>`\n\n if (isNode(value))\n return `${getNodeTypeName(value[0])}-node`\n\n if (value === null)\n return 'null'\n\n if (typeof value === 'object' && value instanceof RegExp)\n return `${value}`\n\n if (typeof value === 'object' && value instanceof Error)\n return value.toString()\n\n return JSON.stringify(value)\n}\n","import type { SourceCodeInfo } from '../../tokenizer/token'\n\nexport function getSourceCodeInfo(anyValue: any, sourceCodeInfo: SourceCodeInfo | undefined): SourceCodeInfo | undefined {\n // eslint-disable-next-line ts/no-unsafe-return, ts/no-unsafe-member-access\n return anyValue?.sourceCodeInfo ?? sourceCodeInfo\n}\n","import { LitsError } from '../errors'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { valueToString } from './debug/debugTools'\nimport { getSourceCodeInfo } from './debug/getSourceCodeInfo'\n\nexport function getAssertionError(typeName: string, value: unknown, sourceCodeInfo?: SourceCodeInfo): LitsError {\n return new LitsError(`Expected ${typeName}, got ${valueToString(value)}.`, getSourceCodeInfo(value, sourceCodeInfo))\n}\n","import { LitsError } from '../errors'\nimport type { UnknownRecord } from '../interface'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { valueToString } from '../utils/debug/debugTools'\nimport { getSourceCodeInfo } from '../utils/debug/getSourceCodeInfo'\n\nexport function isNonUndefined<T>(value: T | undefined): value is T {\n return value !== undefined\n}\n\nexport function asNonUndefined<T>(value: T | undefined, sourceCodeInfo?: SourceCodeInfo): T {\n assertNonUndefined(value, sourceCodeInfo)\n return value\n}\n\nexport function assertNonUndefined<T>(value: T | undefined, sourceCodeInfo?: SourceCodeInfo): asserts value is T {\n if (!isNonUndefined(value))\n throw new LitsError('Unexpected undefined', getSourceCodeInfo(value, sourceCodeInfo))\n}\n\nexport function isUnknownRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === 'object' && !Array.isArray(value)\n}\n\nexport function assertUnknownRecord(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is UnknownRecord {\n if (!isUnknownRecord(value)) {\n throw new LitsError(\n `Expected ${'UnknownRecord'}, got ${valueToString(value)}.`,\n getSourceCodeInfo(value, sourceCodeInfo),\n )\n }\n}\n\nexport function asUnknownRecord(value: unknown, sourceCodeInfo?: SourceCodeInfo): UnknownRecord {\n assertUnknownRecord(value, sourceCodeInfo)\n return value\n}\n","import type { LitsFunction, NativeJsFunction, NormalBuiltinFunction, UserDefinedFunction } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\nimport { FUNCTION_SYMBOL } from '../utils/symbols'\nimport { isUnknownRecord } from '.'\n\nexport function isLitsFunction(value: unknown): value is LitsFunction {\n if (value === null || typeof value !== 'object')\n return false\n\n return !!(value as LitsFunction)[FUNCTION_SYMBOL]\n}\nexport function asLitsFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): LitsFunction {\n assertLitsFunction(value, sourceCodeInfo)\n return value\n}\nexport function assertLitsFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is LitsFunction {\n if (!isLitsFunction(value))\n throw getAssertionError('LitsFunction', value, sourceCodeInfo)\n}\n\nexport function isUserDefinedFunction(value: unknown): value is UserDefinedFunction {\n return isLitsFunction(value) && value.functionType === 'UserDefined'\n}\nexport function asUserDefinedFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): UserDefinedFunction {\n assertUserDefinedFunction(value, sourceCodeInfo)\n return value\n}\nexport function assertUserDefinedFunction(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is UserDefinedFunction {\n if (!isUserDefinedFunction(value))\n throw getAssertionError('NativeJsFunction', value, sourceCodeInfo)\n}\n\nexport function isNativeJsFunction(value: unknown): value is NativeJsFunction {\n return isLitsFunction(value) && value.functionType === 'NativeJsFunction'\n}\nexport function asNativeJsFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): NativeJsFunction {\n assertNativeJsFunction(value, sourceCodeInfo)\n return value\n}\nexport function assertNativeJsFunction(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is NativeJsFunction {\n if (!isNativeJsFunction(value))\n throw getAssertionError('NativeJsFunction', value, sourceCodeInfo)\n}\n\nexport function isBuiltinFunction(value: unknown): value is NormalBuiltinFunction {\n return isUnknownRecord(value) && value.functionType === 'Builtin'\n}\n","import { LitsError } from '../errors'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { valueToString } from '../utils/debug/debugTools'\nimport { getSourceCodeInfo } from '../utils/debug/getSourceCodeInfo'\n\ntype SignOptions =\n | {\n positive?: true\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: true\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: true\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: true\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: true\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: true\n }\n\ntype GtOptions =\n | {\n gt?: number\n gte?: never\n }\n | {\n gt?: never\n gte?: number\n }\n\ntype LtOptions =\n | {\n lt?: number\n lte?: never\n }\n | {\n lt?: never\n lte?: number\n }\n\ntype NumberOptions = {\n integer?: true\n finite?: true\n} & SignOptions &\nGtOptions &\nLtOptions\n\nfunction getRangeString(options: NumberOptions): string {\n const hasUpperAndLowerBound\n = (typeof options.gt === 'number' || typeof options.gte === 'number')\n && (typeof options.lt === 'number' || typeof options.lte === 'number')\n if (hasUpperAndLowerBound) {\n return `${typeof options.gt === 'number' ? `${options.gt} < n ` : `${options.gte} <= n `}${\n typeof options.lt === 'number' ? `< ${options.lt}` : `<= ${options.lte}`\n }`\n }\n else if (typeof options.gt === 'number' || typeof options.gte === 'number') {\n return `${typeof options.gt === 'number' ? `n > ${options.gt}` : `n >= ${options.gte}`}`\n }\n else if (typeof options.lt === 'number' || typeof options.lte === 'number') {\n return `${typeof options.lt === 'number' ? `n < ${options.lt}` : `n <= ${options.lte}`}`\n }\n else { return '' }\n}\n\nfunction getSignString(options: NumberOptions): string {\n return options.positive\n ? 'positive'\n : options.negative\n ? 'negative'\n : options.nonNegative\n ? 'non negative'\n : options.nonPositive\n ? 'non positive'\n : options.nonZero\n ? 'non zero'\n : ''\n}\n\nfunction getNumberTypeName(options: NumberOptions): string {\n if (options.zero)\n return 'zero'\n\n const sign = getSignString(options)\n const numberType = options.integer ? 'integer' : 'number'\n const finite = options.finite ? 'finite' : ''\n const range = getRangeString(options)\n\n return [sign, finite, numberType, range].filter(x => !!x).join(' ')\n}\n\nexport function isNumber(value: unknown, options: NumberOptions = {}): value is number {\n if (typeof value !== 'number')\n return false\n\n if (Number.isNaN(value))\n return false\n\n if (options.integer && !Number.isInteger(value))\n return false\n\n if (options.finite && !Number.isFinite(value))\n return false\n\n if (options.zero && value !== 0)\n return false\n\n if (options.nonZero && value === 0)\n return false\n\n if (options.positive && value <= 0)\n return false\n\n if (options.negative && value >= 0)\n return false\n\n if (options.nonPositive && value > 0)\n return false\n\n if (options.nonNegative && value < 0)\n return false\n\n if (typeof options.gt === 'number' && value <= options.gt)\n return false\n\n if (typeof options.gte === 'number' && value < options.gte)\n return false\n\n if (typeof options.lt === 'number' && value >= options.lt)\n return false\n\n if (typeof options.lte === 'number' && value > options.lte)\n return false\n\n return true\n}\n\nexport function assertNumber(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n options: NumberOptions = {},\n): asserts value is number {\n if (!isNumber(value, options)) {\n throw new LitsError(\n `Expected ${getNumberTypeName(options)}, got ${valueToString(value)}.`,\n getSourceCodeInfo(value, sourceCodeInfo),\n )\n }\n}\n\nexport function asNumber(\n value: unknown,\n sourceCodeInfo: SourceCodeInfo | undefined,\n options: NumberOptions = {},\n): number {\n assertNumber(value, sourceCodeInfo, options)\n return value\n}\n","import type { Any, Coll, Obj, Seq } from '../interface'\nimport type { FunctionLike, RegularExpression } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\nimport { REGEXP_SYMBOL } from '../utils/symbols'\nimport { isLitsFunction } from './litsFunction'\n\nexport function isAny(value: unknown): value is Any {\n // TODO weak test\n return value !== undefined\n}\nexport function asAny(value: unknown, sourceCodeInfo?: SourceCodeInfo): Any {\n assertAny(value, sourceCodeInfo)\n return value\n}\nexport function assertAny(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Any {\n if (!isAny(value))\n throw getAssertionError('not undefined', value, sourceCodeInfo)\n}\n\nexport function isSeq(value: unknown): value is Seq {\n return Array.isArray(value) || typeof value === 'string'\n}\nexport function asSeq(value: unknown, sourceCodeInfo?: SourceCodeInfo): Seq {\n assertSeq(value, sourceCodeInfo)\n return value\n}\nexport function assertSeq(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Seq {\n if (!isSeq(value))\n throw getAssertionError('string or array', value, sourceCodeInfo)\n}\n\nexport function isObj(value: unknown): value is Obj {\n return !(\n value === null\n || typeof value !== 'object'\n || Array.isArray(value)\n || value instanceof RegExp\n || isLitsFunction(value)\n || isRegularExpression(value)\n )\n}\nexport function asObj(value: unknown, sourceCodeInfo?: SourceCodeInfo): Obj {\n assertObj(value, sourceCodeInfo)\n return value\n}\nexport function assertObj(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Obj {\n if (!isObj(value))\n throw getAssertionError('object', value, sourceCodeInfo)\n}\n\nexport function isColl(value: unknown): value is Coll {\n return isSeq(value) || isObj(value)\n}\nexport function asColl(value: unknown, sourceCodeInfo?: SourceCodeInfo): Coll {\n assertColl(value, sourceCodeInfo)\n return value\n}\nexport function assertColl(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Coll {\n if (!isColl(value))\n throw getAssertionError('string, array or object', value, sourceCodeInfo)\n}\n\nexport function isRegularExpression(regexp: unknown): regexp is RegularExpression {\n if (regexp === null || typeof regexp !== 'object')\n return false\n\n return !!(regexp as RegularExpression)[REGEXP_SYMBOL]\n}\nexport function asRegularExpression(value: unknown, sourceCodeInfo?: SourceCodeInfo): RegularExpression {\n assertRegularExpression(value, sourceCodeInfo)\n return value\n}\nexport function assertRegularExpression(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is RegularExpression {\n if (!isRegularExpression(value))\n throw getAssertionError('RegularExpression', value, sourceCodeInfo)\n}\n\nexport function isStringOrRegularExpression(value: unknown): value is string | RegularExpression {\n return isRegularExpression(value) || typeof value === 'string'\n}\nexport function asStringOrRegularExpression(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): string | RegularExpression {\n assertStringOrRegularExpression(value, sourceCodeInfo)\n return value\n}\nexport function assertStringOrRegularExpression(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is string | RegularExpression {\n if (!isStringOrRegularExpression(value))\n throw getAssertionError('string or RegularExpression', value, sourceCodeInfo)\n}\n\nexport function isFunctionLike(value: unknown): value is FunctionLike {\n if (typeof value === 'number')\n return true\n if (isColl(value))\n return true\n if (isLitsFunction(value))\n return true\n\n return false\n}\nexport function asFunctionLike(value: unknown, sourceCodeInfo?: SourceCodeInfo): FunctionLike {\n assertFunctionLike(value, sourceCodeInfo)\n return value\n}\nexport function assertFunctionLike(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is FunctionLike {\n if (!isFunctionLike(value))\n throw getAssertionError('FunctionLike', value, sourceCodeInfo)\n}\n","import type { Arity } from '../builtin/interface'\nimport { LitsError } from '../errors'\nimport type { FunctionLike } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { isColl } from '../typeGuards/lits'\nimport { valueToString } from './debug/debugTools'\n\nexport function arityAccepts(arity: Arity, nbrOfParams: number): boolean {\n const { min, max } = arity\n if (typeof min === 'number' && nbrOfParams < min) {\n return false\n }\n if (typeof max === 'number' && nbrOfParams > max) {\n return false\n }\n return true\n}\n\nexport function arityAcceptsMin(arity: Arity, nbrOfParams: number): boolean {\n const { min } = arity\n if (typeof min === 'number' && nbrOfParams < min) {\n return false\n }\n return true\n}\n\nexport function getCommonArityFromFunctions(params: FunctionLike[]): Arity | null {\n return params.reduce((acc: Arity | null, param): Arity | null => {\n if (acc === null) {\n return null\n }\n const arity: Arity = (typeof param === 'number' || isColl(param)) ? toFixedArity(1) : param.arity\n const { min: aMin, max: aMax } = arity\n const { min: bMin, max: bMax } = acc\n const min = typeof aMin === 'number' && typeof bMin === 'number'\n ? Math.max(aMin, bMin)\n : typeof aMin === 'number' ? aMin : typeof bMin === 'number' ? bMin : undefined\n const max = typeof aMax === 'number' && typeof bMax === 'number'\n ? Math.min(aMax, bMax)\n : typeof aMax === 'number' ? aMax : typeof bMax === 'number' ? bMax : undefined\n\n if (typeof min === 'number' && typeof max === 'number' && min > max) {\n return null\n }\n\n return { min, max }\n }, {})\n}\n\nexport function getArityFromFunction(param: FunctionLike): Arity {\n return (typeof param === 'number' || isColl(param)) ? toFixedArity(1) : param.arity\n}\n\nexport function assertNumberOfParams(arity: Arity, length: number, sourceCodeInfo: SourceCodeInfo | undefined): void {\n const { min, max } = arity\n if (typeof min === 'number' && length < min) {\n throw new LitsError(\n `Wrong number of arguments, expected at least ${min}, got ${valueToString(length)}.`,\n sourceCodeInfo,\n )\n }\n\n if (typeof max === 'number' && length > max) {\n throw new LitsError(\n `Wrong number of arguments, expected at most ${max}, got ${valueToString(length)}.`,\n sourceCodeInfo,\n )\n }\n}\n\nexport function canBeOperator(count: Arity): boolean {\n if (typeof count.max === 'number' && count.max < 2) {\n return false\n }\n\n if (typeof count.min === 'number' && count.min > 2) {\n return false\n }\n\n return true\n}\n\nexport function toFixedArity(arity: number): Arity {\n return { min: arity, max: arity }\n}\n","import { assertNumber } from '../../typeGuards/number'\nimport { toFixedArity } from '../../utils/arity'\nimport type { Argument, BuiltinNormalExpressions } from '../interface'\n\nfunction getOperatorArgs(a: 'integer', b: 'integer'): Record<string, Argument> {\n return { a: { type: a }, b: { type: b } }\n}\n\nexport const bitwiseNormalExpression: BuiltinNormalExpressions = {\n '<<': {\n evaluate: ([num, count], sourceCodeInfo): number => {\n assertNumber(num, sourceCodeInfo, { integer: true })\n assertNumber(count, sourceCodeInfo, { integer: true, nonNegative: true })\n\n return num << count\n },\n arity: toFixedArity(2),\n docs: {\n category: 'bitwise',\n returns: { type: 'integer' },\n args: { ...getOperatorArgs('integer', 'integer') },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Shifts $a arithmetically left by $b bit positions.',\n seeAlso: ['>>', '>>>'],\n examples: [\n '1 << 10',\n '<<(1, 10)',\n '<<(-4, 2)',\n ],\n },\n },\n '>>': {\n evaluate: ([num, count], sourceCodeInfo): number => {\n assertNumber(num, sourceCodeInfo, { integer: true })\n assertNumber(count, sourceCodeInfo, { integer: true, nonNegative: true })\n\n return num >> count\n },\n arity: toFixedArity(2),\n docs: {\n category: 'bitwise',\n returns: { type: 'integer' },\n args: { ...getOperatorArgs('integer', 'integer') },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Shifts $a arithmetically right by $b bit positions.',\n seeAlso: ['<<', '>>>'],\n examples: [\n '2048 >> 10',\n '>>(2048, 10)',\n '>>>(-16, 2)',\n '>>(4, 10)',\n ],\n },\n },\n '>>>': {\n evaluate: ([num, count], sourceCodeInfo): number => {\n assertNumber(num, sourceCodeInfo, { integer: true })\n assertNumber(count, sourceCodeInfo, { integer: true, nonNegative: true })\n\n return num >>> count\n },\n arity: toFixedArity(2),\n docs: {\n category: 'bitwise',\n returns: { type: 'integer' },\n args: { ...getOperatorArgs('integer', 'integer') },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Shifts $a arithmetically right by $b bit positions without sign extension.',\n seeAlso: ['<<', '>>'],\n examples: [\n '-16 >>> 2',\n '>>>(2048, 10)',\n '>>>(-16, 2)',\n '>>>(4, 10)',\n '>>>(-1, 10)',\n ],\n },\n },\n '&': {\n evaluate: ([first, ...rest], sourceCodeInfo): number => {\n assertNumber(first, sourceCodeInfo, { integer: true })\n\n return rest.reduce((result: number, value) => {\n assertNumber(value, sourceCodeInfo, { integer: true })\n return result & value\n }, first)\n },\n arity: { min: 2 },\n docs: {\n category: 'bitwise',\n returns: { type: 'integer' },\n args: {\n ...getOperatorArgs('integer', 'integer'),\n c: { type: 'integer', rest: true },\n },\n variants: [\n { argumentNames: ['a', 'b'] },\n { argumentNames: ['a', 'b', 'c'] },\n ],\n description: 'Returns bitwise `and` of all arguments.',\n seeAlso: ['|', 'xor', 'bitwise.bit-not', 'bitwise.bit-and-not'],\n examples: [\n '0b0011 & 0b0110',\n '&(0b0011, 0b0110)',\n '&(0b0011, 0b0110, 0b1001)',\n ],\n },\n },\n '|': {\n evaluate: ([first, ...rest], sourceCodeInfo): number => {\n assertNumber(first, sourceCodeInfo, { integer: true })\n\n return rest.reduce((result: number, value) => {\n assertNumber(value, sourceCodeInfo, { integer: true })\n return result | value\n }, first)\n },\n arity: { min: 2 },\n docs: {\n category: 'bitwise',\n returns: { type: 'integer' },\n args: {\n ...getOperatorArgs('integer', 'integer'),\n c: { type: 'integer', rest: true },\n },\n variants: [\n { argumentNames: ['a', 'b'] },\n { argumentNames: ['a', 'b', 'c'] },\n ],\n description: 'Returns bitwise `or` of all arguments.',\n seeAlso: ['&', 'xor', 'bitwise.bit-not', 'bitwise.bit-and-not'],\n examples: [\n '0b0011 | 0b0110',\n '|(0b0011, 0b0110)',\n '|(0b1000, 0b0100, 0b0010)',\n ],\n },\n },\n 'xor': {\n evaluate: ([first, ...rest], sourceCodeInfo): number => {\n assertNumber(first, sourceCodeInfo, { integer: true })\n\n return rest.reduce((result: number, value) => {\n assertNumber(value, sourceCodeInfo, { integer: true })\n return result ^ value\n }, first)\n },\n arity: { min: 2 },\n docs: {\n category: 'bitwise',\n returns: { type: 'integer' },\n args: {\n ...getOperatorArgs('integer', 'integer'),\n c: { type: 'integer', rest: true },\n },\n variants: [\n { argumentNames: ['a', 'b'] },\n { argumentNames: ['a', 'b', 'c'] },\n ],\n description: 'Returns bitwise `xor` of all arguments.',\n seeAlso: ['&', '|', 'bitwise.bit-not', 'bitwise.bit-and-not'],\n examples: [\n '0b0011 xor 0b0110',\n 'xor(0b0011, 0b0110)',\n 'xor(0b11110000, 0b00111100, 0b10101010)',\n ],\n },\n },\n}\n","import type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\n\ntype StringAssertionOptions =\n | {\n nonEmpty?: true\n char?: never\n }\n | {\n nonEmpty?: never\n char?: true\n }\n\nexport function isString(value: unknown, options: StringAssertionOptions = {}): value is string {\n if (typeof value !== 'string')\n return false\n\n if (options.nonEmpty && value.length === 0)\n return false\n\n if (options.char && value.length !== 1)\n return false\n\n return true\n}\n\nexport function assertString(\n value: unknown,\n sourceCodeInfo: SourceCodeInfo | undefined,\n options: StringAssertionOptions = {},\n): asserts value is string {\n if (!isString(value, options)) {\n throw getAssertionError(\n `${options.nonEmpty ? 'non empty string' : options.char ? 'character' : 'string'}`,\n value,\n sourceCodeInfo,\n )\n }\n}\n\nexport function asString(\n value: unknown,\n sourceCodeInfo: SourceCodeInfo | undefined,\n options: StringAssertionOptions = {},\n): string {\n assertString(value, sourceCodeInfo, options)\n return value\n}\n\nexport function isStringOrNumber(value: unknown): value is string | number {\n return typeof value === 'string' || typeof value === 'number'\n}\nexport function asStringOrNumber(value: unknown, sourceCodeInfo?: SourceCodeInfo): string | number {\n assertStringOrNumber(value, sourceCodeInfo)\n return value\n}\nexport function assertStringOrNumber(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is string | number {\n if (!isStringOrNumber(value))\n throw getAssertionError('string or number', value, sourceCodeInfo)\n}\n","import type { Any, Coll, Obj } from '../interface'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { asAny, isColl, isObj, isRegularExpression } from '../typeGuards/lits'\nimport { isNumber } from '../typeGuards/number'\nimport { asString, assertStringOrNumber } from '../typeGuards/string'\nimport { isUnknownRecord } from '../typeGuards'\nimport { LitsError } from '../errors'\n\nexport function collHasKey(coll: unknown, key: string | number): boolean {\n if (!isColl(coll))\n return false\n\n if (typeof coll === 'string' || Array.isArray(coll)) {\n if (!isNumber(key, { integer: true }))\n return false\n\n return key >= 0 && key < coll.length\n }\n return !!Object.getOwnPropertyDescriptor(coll, key)\n}\n\nexport function compare<T extends string | number>(a: T, b: T, sourceCodeInfo: SourceCodeInfo | undefined): number {\n assertStringOrNumber(a, sourceCodeInfo)\n assertStringOrNumber(b, sourceCodeInfo)\n\n if (typeof a === 'string' && typeof b === 'string') {\n return a < b ? -1 : a > b ? 1 : 0\n }\n if (typeof a === 'number' && typeof b === 'number') {\n return Math.sign((a) - (b))\n }\n throw new LitsError(`Cannot compare values of different types: ${typeof a} and ${typeof b}`, sourceCodeInfo)\n}\n\nexport function deepEqual(a: unknown, b: unknown, sourceCodeInfo?: SourceCodeInfo): boolean {\n if (a === b)\n return true\n\n if (typeof a === 'number' && typeof b === 'number')\n return approxEqual(a, b)\n\n if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length)\n return false\n\n for (let i = 0; i < a.length; i += 1) {\n if (!deepEqual(asAny(a[i], sourceCodeInfo), asAny(b[i], sourceCodeInfo), sourceCodeInfo))\n return false\n }\n return true\n }\n if (isRegularExpression(a) && isRegularExpression(b))\n return a.s === b.s && a.f === b.f\n\n if (isUnknownRecord(a) && isUnknownRecord(b)) {\n const aKeys = Object.keys(a)\n const bKeys = Object.keys(b)\n if (aKeys.length !== bKeys.length)\n return false\n\n for (let i = 0; i < aKeys.length; i += 1) {\n const key = asString(aKeys[i], sourceCodeInfo)\n if (!deepEqual(a[key], b[key], sourceCodeInfo))\n return false\n }\n return true\n }\n return false\n}\n\nexport function toNonNegativeInteger(num: number): number {\n return Math.max(0, Math.ceil(num))\n}\n\nexport function toAny(value: unknown): Any {\n return (value ?? null) as Any\n}\n\nfunction clone<T>(value: T): T {\n if (isObj(value)) {\n return Object.entries(value).reduce((result: Obj, entry) => {\n const [key, val] = entry\n result[key] = clone(val)\n return result\n }, {}) as T\n }\n if (Array.isArray(value))\n // eslint-disable-next-line ts/no-unsafe-return\n return value.map(item => clone(item)) as unknown as T\n\n return value\n}\n\nexport function cloneColl<T extends Coll>(value: T): T {\n return clone(value)\n}\n\nexport function joinSets<T>(...results: Set<T>[]): Set<T> {\n const result = new Set<T>()\n for (const symbols of results)\n symbols.forEach(symbol => result.add(symbol))\n\n return result\n}\n\nexport function addToSet<T>(target: Set<T>, source: Set<T>): void {\n source.forEach(symbol => target.add(symbol))\n}\n\nexport const EPSILON = 1e-10\n\nexport function approxEqual(a: number, b: number, epsilon: number = EPSILON): boolean {\n if (a === b) {\n return true\n }\n\n const diff = Math.abs(a - b)\n\n if (a === 0 || b === 0 || diff < epsilon) {\n // Use absolute error for values near zero\n return diff < epsilon\n }\n const absA = Math.abs(a)\n const absB = Math.abs(b)\n\n // Use relative error for larger values\n return diff / (absA + absB) < epsilon\n}\n\nexport function approxZero(value: number): boolean {\n return Math.abs(value) < EPSILON\n}\n\nexport function smartTrim(str: string, minIndent = 0): string {\n const lines = str.split('\\n')\n while (lines[0]?.match(/^\\s*$/)) {\n lines.shift() // Remove leading empty lines\n }\n while (lines[lines.length - 1]?.match(/^\\s*$/)) {\n lines.pop() // Remove trailing empty lines\n }\n const indent = lines.reduce((acc, line) => {\n if (line.match(/^\\s*$/))\n return acc // Skip empty lines\n const lineIndent = line.match(/^\\s*/)![0].length\n return Math.min(acc, lineIndent)\n }, Infinity)\n return lines.map(line => ' '.repeat(minIndent) + line.slice(indent)).join('\\n').trimEnd()\n}\n","import type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\n\n// isArray not needed, use Array.isArary\nexport function asArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): unknown[] {\n assertArray(value, sourceCodeInfo)\n return value\n}\nexport function assertArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is unknown[] {\n if (!Array.isArray(value))\n throw getAssertionError('array', value, sourceCodeInfo)\n}\n\nexport function isStringArray(value: unknown): value is string[] {\n return Array.isArray(value) && value.every(v => typeof v === 'string')\n}\nexport function asStringArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): string[] {\n assertStringArray(value, sourceCodeInfo)\n return value\n}\nexport function assertStringArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is string[] {\n if (!isStringArray(value))\n throw getAssertionError('array of strings', value, sourceCodeInfo)\n}\n\nexport function isCharArray(value: unknown): value is string[] {\n return Array.isArray(value) && value.every(v => typeof v === 'string' && v.length === 1)\n}\nexport function asCharArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): string[] {\n assertCharArray(value, sourceCodeInfo)\n return value\n}\nexport function assertCharArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is string[] {\n if (!isCharArray(value))\n throw getAssertionError('array of strings', value, sourceCodeInfo)\n}\n","import type { ContextStack } from '../../evaluator/ContextStack'\nimport type { ExecuteFunction } from '../../evaluator/interface'\nimport type { Any, Arr, Coll, Obj, Seq } from '../../interface'\nimport type { SourceCodeInfo } from '../../tokenizer/token'\nimport { collHasKey, deepEqual, toAny } from '../../utils'\nimport { asAny, asFunctionLike, assertAny, assertColl, assertFunctionLike, assertObj, assertSeq, isObj, isSeq } from '../../typeGuards/lits'\nimport type { BuiltinNormalExpressions } from '../interface'\nimport { assertArray } from '../../typeGuards/array'\nimport { assertNumber, isNumber } from '../../typeGuards/number'\nimport { assertString, assertStringOrNumber, isString, isStringOrNumber } from '../../typeGuards/string'\nimport type { FunctionLike } from '../../parser/types'\nimport { LitsError } from '../../errors'\nimport { toFixedArity } from '../../utils/arity'\n\nfunction mapObjects({\n colls,\n contextStack,\n executeFunction,\n fn,\n sourceCodeInfo,\n}: {\n colls: unknown[]\n fn: FunctionLike\n sourceCodeInfo: SourceCodeInfo | undefined\n contextStack: ContextStack\n executeFunction: ExecuteFunction\n}): Obj {\n assertObj(colls[0], sourceCodeInfo)\n const keys = Object.keys(colls[0])\n const params: Record<string, unknown[]> = {}\n colls.forEach((obj) => {\n assertObj(obj, sourceCodeInfo)\n const objKeys = Object.keys(obj)\n if (objKeys.length !== keys.length) {\n throw new LitsError(`All objects must have the same keys. Expected: ${keys.join(', ')}. Found: ${objKeys.join(', ')}`, sourceCodeInfo)\n }\n if (!objKeys.every(key => keys.includes(key))) {\n throw new LitsError(`All objects must have the same keys. Expected: ${keys.join(', ')}. Found: ${objKeys.join(', ')}`, sourceCodeInfo)\n }\n Object.entries(obj).forEach(([key, value]) => {\n if (!params[key])\n params[key] = []\n params[key].push(value)\n })\n })\n\n return keys.reduce((result: Obj, key) => {\n result[key] = executeFunction(fn, params[key]!, contextStack, sourceCodeInfo)\n return result\n }, {})\n}\n\nfunction get(coll: Coll, key: string | number): Any | undefined {\n if (isObj(coll)) {\n if (typeof key === 'string' && collHasKey(coll, key))\n return toAny(coll[key])\n }\n else {\n if (isNumber(key, { nonNegative: true, integer: true }) && key >= 0 && key < coll.length)\n return toAny(coll[key])\n }\n return undefined\n}\n\nfunction assoc(coll: Coll, key: string | number, value: Any, sourceCodeInfo?: SourceCodeInfo) {\n assertColl(coll, sourceCodeInfo)\n assertStringOrNumber(key, sourceCodeInfo)\n if (Array.isArray(coll) || typeof coll === 'string') {\n assertNumber(key, sourceCodeInfo, { integer: true })\n assertNumber(key, sourceCodeInfo, { gte: 0 })\n assertNumber(key, sourceCodeInfo, { lte: coll.length })\n if (typeof coll === 'string') {\n assertString(value, sourceCodeInfo, { char: true })\n return `${coll.slice(0, key)}${value}${coll.slice(key + 1)}`\n }\n const copy = [...coll]\n copy[key] = value\n return copy\n }\n assertString(key, sourceCodeInfo)\n const copy = { ...coll }\n copy[key] = value\n return copy\n}\n\nexport const collectionNormalExpression: BuiltinNormalExpressions = {\n 'filter': {\n evaluate: ([coll, fn]: Arr, sourceCodeInfo, contextStack, { executeFunction }): Coll => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n if (Array.isArray(coll)) {\n const result = coll.filter(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n return result\n }\n if (isString(coll)) {\n return coll\n .split('')\n .filter(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n .join('')\n }\n return Object.entries(coll)\n .filter(([, value]) => executeFunction(fn, [value], contextStack, sourceCodeInfo))\n .reduce((result: Obj, [key, value]) => {\n result[key] = value\n return result\n }, {})\n },\n arity: toFixedArity(2),\n docs: {\n category: 'collection',\n returns: { type: 'collection' },\n args: {\n a: { type: 'collection' },\n b: { type: 'function' },\n coll: { type: 'collection' },\n fun: { type: 'function' },\n },\n variants: [{ argumentNames: ['coll', 'fun'] }],\n description: 'Creates a new collection with all elements that pass the test implemented by $fun.',\n seeAlso: ['collection.filteri', 'map', 'sequence.remove'],\n examples: [\n `\nfilter(\n [\"Albert\", \"Mojir\", 160, [1, 2]],\n string?\n)`,\n `\nfilter(\n [5, 10, 15, 20],\n -> $ > 10\n)`,\n `\nfilter(\n { a: 1, b: 2 },\n odd?\n)`,\n ],\n },\n },\n 'map': {\n evaluate: (params, sourceCodeInfo, contextStack, { executeFunction }) => {\n const fn = asFunctionLike(params.at(-1), sourceCodeInfo)\n\n if (isObj(params[0])) {\n return mapObjects({\n colls: params.slice(0, -1),\n fn,\n sourceCodeInfo,\n contextStack,\n executeFunction,\n })\n }\n\n const seqs = params.slice(0, -1) as Seq[]\n assertSeq(seqs[0], sourceCodeInfo)\n\n const isStr = typeof seqs[0] === 'string'\n let len = seqs[0].length\n seqs.slice(1).forEach((seq) => {\n if (isStr) {\n assertString(seq, sourceCodeInfo)\n }\n else {\n assertArray(seq, sourceCodeInfo)\n }\n len = Math.min(len, seq.length)\n })\n\n const paramArray: unknown[][] = []\n for (let i = 0; i < len; i++) {\n paramArray.push(seqs.map(seq => seq[i]))\n }\n\n const mapped = paramArray.map(p => executeFunction(fn, p, contextStack, sourceCodeInfo))\n\n if (!isStr) {\n return mapped\n }\n mapped.forEach(char => assertString(char, sourceCodeInfo))\n return mapped.join('')\n },\n arity: { min: 2 },\n docs: {\n category: 'collection',\n returns: { type: 'collection' },\n args: {\n a: { type: 'collection' },\n b: { type: 'function' },\n colls: { type: 'collection', rest: true, description: 'At least one.' },\n fun: { type: 'function' },\n },\n variants: [{ argumentNames: ['colls', 'fun'] }],\n description: 'Creates a new collection populated with the results of calling $fun on every element in $colls.',\n seeAlso: ['collection.mapi', 'filter', 'reduce', 'mapcat', 'grid.map', 'grid.mapi'],\n examples: [\n '[1, 2, 3] map -',\n '[1, 2, 3] map -> -($)',\n 'map([\"Albert\", \"Mojir\", 42], str)',\n 'map([1, 2, 3], inc)',\n 'map([1, 2, 3], [1, 10, 100], *)',\n 'map({ a: 1, b: 2 }, inc)',\n 'map({ a: 1, b: 2 }, { a: 10, b: 20 }, +)',\n ],\n },\n },\n 'reduce': {\n evaluate: ([coll, fn, initial], sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n assertAny(initial, sourceCodeInfo)\n\n if (typeof coll === 'string') {\n assertString(initial, sourceCodeInfo)\n if (coll.length === 0)\n return initial\n\n return coll.split('').reduce((result: Any, elem) => {\n return executeFunction(fn, [result, elem], contextStack, sourceCodeInfo)\n }, initial)\n }\n else if (Array.isArray(coll)) {\n if (coll.length === 0)\n return initial\n\n return coll.reduce((result: Any, elem) => {\n return executeFunction(fn, [result, elem], contextStack, sourceCodeInfo)\n }, initial)\n }\n else {\n if (Object.keys(coll).length === 0)\n return initial\n\n return Object.entries(coll).reduce((result: Any, [, elem]) => {\n return executeFunction(fn, [result, elem], contextStack, sourceCodeInfo)\n }, initial)\n }\n },\n arity: toFixedArity(3),\n docs: {\n category: 'collection',\n returns: { type: 'any' },\n args: {\n fun: { type: 'function' },\n coll: { type: 'collection' },\n initial: { type: 'any' },\n },\n variants: [{ argumentNames: ['coll', 'fun', 'initial'] }],\n description: 'Runs $fun function on each element of the $coll, passing in the return value from the calculation on the preceding element. The final result of running the reducer across all elements of the $coll is a single value.',\n seeAlso: ['collection.reduce-right', 'collection.reducei', 'collection.reductions', 'map', 'grid.reduce', 'grid.reducei'],\n examples: [\n 'reduce([1, 2, 3], +, 0)',\n 'reduce([], +, 0)',\n 'reduce({ a: 1, b: 2 }, +, 0)',\n `\nreduce(\n [1, 2, 3, 4, 5, 6, 7, 8, 9],\n (result, value) -> result + (even?(value) ? value : 0),\n 0)`,\n ],\n },\n },\n 'get': {\n evaluate: (params, sourceCodeInfo) => {\n const [coll, key] = params\n const defaultValue = toAny(params[2])\n assertStringOrNumber(key, sourceCodeInfo)\n if (coll === null)\n return defaultValue\n\n assertColl(coll, sourceCodeInfo)\n const result = get(coll, key)\n return result === undefined ? defaultValue : result\n },\n arity: { min: 2, max: 3 },\n docs: {\n category: 'collection',\n returns: { type: 'any' },\n args: {\n 'a': { type: 'collection' },\n 'b': { type: ['string', 'integer'] },\n 'not-found': { type: 'any', description: 'Default value to return if $b is not found.' },\n },\n variants: [\n { argumentNames: ['a', 'b'] },\n { argumentNames: ['a', 'b', 'not-found'] },\n ],\n description: 'Returns value in $a mapped at $b.',\n seeAlso: ['collection.get-in', 'contains?', 'find', 'nth'],\n examples: [\n '[1, 2, 3] get 1',\n '{ a: 1 } get \"a\"',\n '\"Albert\" get \"3\"',\n `\nget(\n [1, 2, 3],\n 1, // Optional comma after last argument\n)`,\n `\nget(\n [],\n 1\n)`,\n `\nget(\n [],\n 1,\n \"default\"\n)`,\n `\nget(\n { a: 1 },\n \"a\"\n)`,\n `\nget(\n { a: 1 },\n \"b\"\n)`,\n `\nget(\n { a: 1 },\n \"b\",\n \"default\"\n)`,\n `\nget(\n null,\n \"a\"\n)`,\n `\nget(\n null,\n \"b\",\n \"default\"\n)`,\n ],\n },\n },\n 'count': {\n evaluate: ([coll], sourceCodeInfo): number => {\n if (coll === null)\n return 0\n\n if (typeof coll === 'string')\n return coll.length\n\n assertColl(coll, sourceCodeInfo)\n if (Array.isArray(coll))\n return coll.length\n\n return Object.keys(coll).length\n },\n arity: toFixedArity(1),\n docs: {\n category: 'collection',\n returns: { type: 'number' },\n args: {\n coll: { type: ['collection', 'null'] },\n },\n variants: [{ argumentNames: ['coll'] }],\n description: 'Returns number of elements in $coll.',\n seeAlso: ['empty?'],\n examples: [\n 'count([1, 2, 3])',\n 'count([])',\n 'count({ a: 1 })',\n 'count(\"\")',\n 'count(\"Albert\")',\n 'count(null)',\n ],\n },\n },\n 'contains?': {\n evaluate: ([coll, key], sourceCodeInfo): boolean => {\n if (coll === null)\n return false\n\n assertColl(coll, sourceCodeInfo)\n if (isString(coll)) {\n assertString(key, sourceCodeInfo)\n return coll.includes(key)\n }\n if (isSeq(coll)) {\n assertAny(key, sourceCodeInfo)\n return !!coll.find(elem => deepEqual(asAny(elem), key, sourceCodeInfo))\n }\n assertString(key, sourceCodeInfo)\n return key in coll\n },\n arity: toFixedArity(2),\n docs: {\n category: 'collection',\n returns: { type: 'boolean' },\n args: {\n a: { type: ['collection', 'null'] },\n b: { type: ['string', 'integer'] },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns `true` if $a contains $b, otherwise returns `false`. For strings, it checks if substring is included.',\n seeAlso: ['get', 'find', 'index-of'],\n examples: [\n '[1, 2, 3] contains? 1',\n 'null contains? 1',\n '{ a: 1, b: 2 } contains? \"a\"',\n `\ncontains?(\n [],\n 1\n)`,\n `\ncontains?(\n [1],\n 1\n)`,\n `\ncontains?(\n [1, 2, 3],\n 1\n)`,\n `\ncontains?(\n {},\n \"a\"\n)`,\n `\ncontains?(\n { a: 1, b: 2 },\n \"a\"\n)`,\n ],\n },\n },\n 'assoc': {\n evaluate: ([coll, key, value], sourceCodeInfo): Coll => {\n assertColl(coll, sourceCodeInfo)\n assertStringOrNumber(key, sourceCodeInfo)\n assertAny(value, sourceCodeInfo)\n return assoc(coll, key, value, sourceCodeInfo)\n },\n arity: toFixedArity(3),\n docs: {\n category: 'collection',\n returns: { type: 'collection' },\n args: {\n coll: { type: 'collection' },\n key: { type: ['string', 'number'] },\n value: { type: 'any' },\n kvs: { type: 'any', description: 'Key-value pairs to associate.', rest: true },\n },\n variants: [\n { argumentNames: ['coll', 'key', 'value'] },\n { argumentNames: ['coll', 'key', 'value', 'kvs'] },\n ],\n description: `\nAdd or replace the value of element $key to $value in $coll. Repeated for all key-value pairs in $kvs.\nIf $coll is an 'array', $key must be \\`number\\` satisfying \\`0 <=\\` $key \\`<= length\\`.`,\n seeAlso: ['collection.assoc-in', 'dissoc', 'merge', 'collection.update'],\n examples: [\n `\nassoc(\n [1, 2, 3],\n 1,\n \"Two\"\n)`,\n `\nassoc(\n [1, 2, 3],\n 3,\n \"Four\"\n)`,\n `\nassoc(\n { a: 1, b: 2 },\n \"a\",\n \"One\")`,\n `\nassoc(\n { a: 1, b: 2 },\n \"c\",\n \"Three\")`,\n `\nassoc(\n \"Albert\",\n 6,\n \"a\")`,\n ],\n },\n },\n '++': {\n evaluate: (params, sourceCodeInfo): Any => {\n if (!isNumber(params[0])) {\n assertColl(params[0], sourceCodeInfo)\n }\n if (Array.isArray(params[0])) {\n return params.reduce((result: Arr, arr) => {\n assertArray(arr, sourceCodeInfo)\n return result.concat(arr)\n }, [])\n }\n else if (isStringOrNumber(params[0])) {\n return params.reduce((result: string, s) => {\n assertStringOrNumber(s, sourceCodeInfo)\n return `${result}${s}`\n }, '')\n }\n else {\n return params.reduce((result: Obj, obj) => {\n assertObj(obj, sourceCodeInfo)\n return Object.assign(result, obj)\n }, {})\n }\n },\n arity: { min: 1 },\n docs: {\n category: 'collection',\n returns: { type: 'collection' },\n args: {\n a: { type: 'collection' },\n b: { type: 'collection' },\n colls: { type: 'collection', rest: true },\n },\n variants: [\n { argumentNames: ['a'] },\n { argumentNames: ['a', 'colls'] },\n ],\n description: 'Concatenates collections into one collection.',\n seeAlso: ['mapcat', 'str', 'join', 'push', 'sequence.unshift'],\n examples: [\n '\"Albert\" ++ \" \" ++ \"Mojir\"',\n '\"Albert\" ++ \"Mojir\"',\n\n '++(\"Albert\", \"-\", \"Mojir\")',\n '++(\"Albert\")',\n\n '++(\"A\", \"l\", \"b\", \"e\", \"r\", \"t\")',\n '++([1, 2], [3, 4])',\n '++([], [3, 4])',\n '++([1, 2], [])',\n '++([1, 2], [3, 4], [5, 6])',\n '++([])',\n '++({ a: 1, b: 2 }, { b: 1, c: 2 })',\n '++({}, { a: 1 })',\n ],\n },\n },\n}\n","import type { Arr } from '../../interface'\nimport { assertArray } from '../../typeGuards/array'\nimport { asNumber, assertNumber } from '../../typeGuards/number'\nimport type { BuiltinNormalExpressions } from '../interface'\nimport { assertFunctionLike } from '../../typeGuards/lits'\nimport { toFixedArity } from '../../utils/arity'\n\nexport const arrayNormalExpression: BuiltinNormalExpressions = {\n 'range': {\n evaluate: (params, sourceCodeInfo): Arr => {\n const [first, second, third] = params\n let from: number\n let to: number\n let step: number\n assertNumber(first, sourceCodeInfo, { finite: true })\n\n if (params.length === 1) {\n from = 0\n to = first\n step = to >= 0 ? 1 : -1\n }\n else if (params.length === 2) {\n assertNumber(second, sourceCodeInfo, { finite: true })\n from = first\n to = second\n step = to >= from ? 1 : -1\n }\n else {\n assertNumber(second, sourceCodeInfo, { finite: true })\n assertNumber(third, sourceCodeInfo, { finite: true })\n from = first\n to = second\n step = third\n if (to > from)\n assertNumber(step, sourceCodeInfo, { positive: true })\n else if (to < from)\n assertNumber(step, sourceCodeInfo, { negative: true })\n else\n assertNumber(step, sourceCodeInfo, { nonZero: true })\n }\n\n const result: number[] = []\n\n for (let i = from; step < 0 ? i > to : i < to; i += step)\n result.push(i)\n\n return result\n },\n arity: { min: 1, max: 3 },\n docs: {\n category: 'array',\n returns: { type: 'number', array: true },\n args: {\n a: { type: 'number' },\n b: { type: 'number' },\n step: { type: 'number' },\n },\n variants: [\n { argumentNames: ['b'] },\n { argumentNames: ['a', 'b'] },\n { argumentNames: ['a', 'b', 'step'] },\n ],\n description: `$range creates an array with a range of numbers from $a to $b (exclusive), by $step.\n\n$a defaults to 0.\n$step defaults to 1.`,\n seeAlso: ['repeat', 'vector.linspace'],\n examples: [\n 'range(4)',\n 'range(1, 4)',\n '1 range 10',\n 'range(0.4, 4.9)',\n `\nrange(\n 0.25, // start value\n 1, // end value (exclusive)\n 0.25, // step value\n)`,\n ],\n },\n },\n\n 'repeat': {\n evaluate: ([value, count], sourceCodeInfo): Arr => {\n assertNumber(count, sourceCodeInfo, { integer: true, nonNegative: true })\n const result: Arr = []\n for (let i = 0; i < count; i += 1)\n result.push(value)\n\n return result\n },\n arity: toFixedArity(2),\n docs: {\n category: 'array',\n returns: { type: 'any', array: true },\n args: {\n a: { type: 'any' },\n b: { type: 'integer' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns an array with $a repeated $b times.',\n seeAlso: ['range', 'vector.ones', 'vector.zeros', 'vector.fill', 'vector.generate', 'string.string-repeat'],\n examples: [\n 'repeat(10, 3)',\n 'repeat(10, 0)',\n '\"Albert\" repeat 5',\n ],\n },\n },\n\n 'flatten': {\n evaluate: ([seq, depth], sourceCodeInfo): Arr => {\n assertArray(seq, sourceCodeInfo)\n\n const actualDepth = depth === undefined || depth === Number.POSITIVE_INFINITY\n ? Number.POSITIVE_INFINITY\n : asNumber(depth, sourceCodeInfo, { integer: true, nonNegative: true })\n\n return seq.flat(actualDepth)\n },\n arity: { min: 1, max: 2 },\n docs: {\n category: 'array',\n returns: { type: 'any', array: true },\n args: {\n x: { type: ['array', 'any'], description: 'If $x is not an array, `[ ]` is returned.' },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'Takes a nested array $x and flattens it.',\n seeAlso: ['mapcat'],\n examples: [\n 'flatten([1, 2, [3, 4], 5])',\n `\nlet foo = \"bar\";\nflatten([\n 1,\n \" 2 A \",\n [foo, [4, [\"ABC\"]]],\n 6,\n])`,\n ],\n hideOperatorForm: true,\n },\n },\n 'mapcat': {\n evaluate: ([arr, fn], sourceCodeInfo, contextStack, { executeFunction }): Arr | string => {\n assertArray(arr, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n return arr.map(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo)).flat(1)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'array',\n returns: { type: 'collection' },\n args: {\n a: { type: 'collection' },\n b: { type: 'function' },\n colls: { type: 'collection', array: true },\n fun: { type: 'function' },\n },\n variants: [{ argumentNames: ['colls', 'fun'] }],\n description: 'Returns the result of applying concat to the result of applying map to $fun and $colls.',\n seeAlso: ['flatten', 'map', '++'],\n examples: [\n '[[3, 2, 1, 0], [6, 5, 4], [9, 8, 7]] mapcat reverse',\n 'mapcat([[3, 2, 1, 0], [6, 5, 4], [9, 8, 7]], reverse)',\n '[[3, 2, 1, 0,], [6, 5, 4,], [9, 8, 7]] mapcat reverse',\n `\nlet foo = (n) -> do\n [n - 1, n, n + 1]\nend;\n[1, 2, 3] mapcat foo`,\n `\nmapcat(\n [[1, 2], [2, 2], [2, 3]],\n -> $ filter odd?\n)`,\n ],\n },\n },\n 'moving-fn': {\n evaluate: ([arr, windowSize, fn], sourceCodeInfo, contextStack, { executeFunction }): Arr => {\n assertArray(arr, sourceCodeInfo)\n assertNumber(windowSize, sourceCodeInfo, { integer: true, lte: arr.length })\n assertFunctionLike(fn, sourceCodeInfo)\n\n const result = []\n for (let i = 0; i <= arr.length - windowSize; i++) {\n const window = arr.slice(i, i + windowSize)\n const value = executeFunction(fn, [window], contextStack, sourceCodeInfo)\n result.push(value)\n }\n return result\n },\n arity: toFixedArity(3),\n docs: {\n category: 'array',\n returns: { type: 'array' },\n args: {\n arr: { type: 'array' },\n windowSize: { type: 'number', description: 'The size of the moving window.' },\n fn: { type: 'function' },\n },\n variants: [{ argumentNames: ['arr', 'windowSize', 'fn'] }],\n description: 'Returns the result of applying $fn to each moving window of size $windowSize in $arr.',\n seeAlso: ['running-fn', 'vector.moving-mean'],\n examples: [\n 'moving-fn([1, 2, 3], 2, sum)',\n 'moving-fn([1, 2, 3], 1, sum)',\n 'moving-fn([1, 2, 3], 3, sum)',\n ],\n },\n },\n 'running-fn': {\n evaluate: ([arr, fn], sourceCodeInfo, contextStack, { executeFunction }): Arr => {\n assertArray(arr, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n\n const result = []\n for (let i = 0; i < arr.length; i += 1) {\n const subArr = arr.slice(0, i + 1)\n result.push(executeFunction(fn, [subArr], contextStack, sourceCodeInfo))\n }\n return result\n },\n arity: toFixedArity(2),\n docs: {\n category: 'array',\n returns: { type: 'array' },\n args: {\n a: { type: 'array' },\n b: { type: 'function' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns the result of applying $b to each element of $a.',\n seeAlso: ['moving-fn', 'vector.running-mean'],\n examples: [\n 'running-fn([1, 2, 3], sum)',\n 'running-fn([1, 2, 3], max)',\n 'running-fn([1, 2, 3], min)',\n ],\n },\n },\n}\n","import type { Any, Arr, Seq } from '../../interface'\nimport { assertCharArray } from '../../typeGuards/array'\nimport { asAny, assertAny, assertFunctionLike, assertSeq } from '../../typeGuards/lits'\nimport { assertNumber } from '../../typeGuards/number'\nimport { assertString, assertStringOrNumber } from '../../typeGuards/string'\nimport { compare, deepEqual, toAny } from '../../utils'\nimport { toFixedArity } from '../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../interface'\n\nexport const sequenceNormalExpression: BuiltinNormalExpressions = {\n 'nth': {\n evaluate: (params, sourceCodeInfo): Any => {\n const [seq, i] = params\n const defaultValue = toAny(params[2])\n\n assertNumber(i, sourceCodeInfo, { integer: true })\n\n if (seq === null)\n return defaultValue\n\n assertSeq(seq, sourceCodeInfo)\n if (i >= 0 && i < seq.length) {\n const result = toAny(seq[i])\n return result\n }\n else {\n return defaultValue\n }\n },\n arity: { min: 2, max: 3 },\n docs: {\n category: 'sequence',\n returns: { type: 'any' },\n args: {\n 'a': { type: 'sequence' },\n 'b': { type: 'integer' },\n 'seq': { type: ['sequence', 'null'] },\n 'n': { type: 'integer' },\n 'not-found': { type: 'any' },\n },\n variants: [\n { argumentNames: ['seq', 'n'] },\n { argumentNames: ['seq', 'n', 'not-found'] },\n ],\n description: 'Accesses element $n of $seq. Accessing out-of-bounds indices returns $not-found, if present, else `null`.',\n seeAlso: ['first', 'second', 'last', 'get', 'slice'],\n examples: [\n '[1, 2, 3] nth 1',\n '\"A string\" nth 3',\n 'nth([1, 2, 3], 1)',\n 'nth([1, 2, 3], 3)',\n 'nth([1, 2, 3], -1)',\n 'nth([1, 2, 3], 3, 99)',\n 'nth(\"A string\", 1)',\n 'nth(\"A string\", 3)',\n 'nth(\"A string\", -3)',\n 'nth(\"A string\", 30, \"X\")',\n 'nth(null, 1)',\n 'nth(null, 1, \"Default value\")',\n ],\n },\n },\n 'first': {\n evaluate: ([array], sourceCodeInfo): Any => {\n if (array === null)\n return null\n\n assertSeq(array, sourceCodeInfo)\n const result = toAny(array[0])\n\n return result\n },\n arity: toFixedArity(1),\n docs: {\n category: 'sequence',\n returns: { type: 'any' },\n args: { seq: { type: ['sequence', 'null'] } },\n variants: [{ argumentNames: ['seq'] }],\n description: 'Returns the first element of $seq. If $seq is empty or `null`, `null` is returned.',\n seeAlso: ['second', 'last', 'nth', 'rest', 'next'],\n examples: [\n 'first([\"Albert\", \"Mojir\", 160, [1, 2]])',\n 'first([])',\n 'first(null)',\n ],\n },\n },\n 'last': {\n evaluate: ([array], sourceCodeInfo): Any => {\n if (array === null)\n return null\n\n assertSeq(array, sourceCodeInfo)\n const result = toAny(array.at(-1))\n\n return result\n },\n arity: toFixedArity(1),\n docs: {\n category: 'sequence',\n returns: { type: 'any' },\n args: { seq: { type: ['sequence', 'null'] } },\n variants: [{ argumentNames: ['seq'] }],\n description: 'Returns the last element of $seq. If $seq is empty, `null` is returned.',\n seeAlso: ['first', 'second', 'nth', 'pop'],\n examples: [\n 'last([\"Albert\", \"Mojir\", 160, [1, 2]])',\n 'last([1, 2])',\n 'last([1])',\n 'last([])',\n 'last(null)',\n ],\n },\n },\n 'pop': {\n evaluate: ([seq], sourceCodeInfo): Seq => {\n assertSeq(seq, sourceCodeInfo)\n if (typeof seq === 'string') {\n return seq.substring(0, seq.length - 1)\n }\n\n return seq.slice(0, seq.length - 1)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'sequence',\n returns: { type: ['sequence', 'null'], rest: true },\n args: { seq: { type: 'sequence' } },\n variants: [{ argumentNames: ['seq'] }],\n description: 'Returns a copy of $seq with last element removed. If $seq is empty `null` is returned.',\n seeAlso: ['push', 'sequence.shift', 'last'],\n examples: [\n 'pop([1, 2, 3])',\n 'pop([])',\n ],\n },\n },\n 'index-of': {\n evaluate: ([seq, value], sourceCodeInfo): number | null => {\n assertAny(value, sourceCodeInfo)\n if (seq === null)\n return null\n\n assertSeq(seq, sourceCodeInfo)\n if (typeof seq === 'string') {\n assertString(value, sourceCodeInfo)\n const index = seq.indexOf(value)\n return index !== -1 ? index : null\n }\n else {\n const index = seq.findIndex(item => deepEqual(asAny(item, sourceCodeInfo), value), sourceCodeInfo)\n return index !== -1 ? index : null\n }\n },\n arity: toFixedArity(2),\n docs: {\n category: 'sequence',\n returns: { type: ['number', 'null'] },\n args: {\n a: { type: 'sequence' },\n b: { type: 'any' },\n seq: { type: ['sequence', 'null'] },\n x: { type: 'any' },\n },\n variants: [{ argumentNames: ['seq', 'x'] }],\n description: 'Returns the index of $x in $seq. If element is not present in $seq `null` is returned.',\n seeAlso: ['sequence.last-index-of', 'sequence.position', 'contains?'],\n examples: [\n '[[1], [2], [1], [2]] index-of [1]',\n 'index-of([\"Albert\", \"Mojir\", 160, [1, 2]], \"Mojir\")',\n 'index-of([5, 10, 15, 20], 15)',\n 'index-of([5, 10, 15, 20], 1)',\n 'index-of(null, 1)',\n ],\n },\n },\n 'push': {\n evaluate: ([seq, ...values], sourceCodeInfo): Seq => {\n assertSeq(seq, sourceCodeInfo)\n if (typeof seq === 'string') {\n assertCharArray(values, sourceCodeInfo)\n return [seq, ...values].join('')\n }\n else {\n return [...seq, ...values]\n }\n },\n arity: { min: 2 },\n docs: {\n category: 'sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'any' },\n seq: { type: 'sequence' },\n values: { type: 'any', rest: true, description: 'At least one.' },\n },\n variants: [{ argumentNames: ['seq', 'values'] }],\n description: 'Returns copy of $seq with $values added to the end of it.',\n seeAlso: ['sequence.unshift', 'pop', '++'],\n examples: [\n '[1, 2, 3] push 4',\n '\"Albert\" push \"!\"',\n 'push([1, 2, 3], 4)',\n 'push([1, 2, 3], 4, 5, 6)',\n `\nlet l = [1, 2, 3];\npush(l, 4);\nl`,\n ],\n },\n },\n 'rest': {\n evaluate: ([seq], sourceCodeInfo): Arr | string => {\n assertSeq(seq, sourceCodeInfo)\n if (Array.isArray(seq)) {\n if (seq.length <= 1)\n return []\n\n return seq.slice(1)\n }\n return seq.substring(1)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'sequence',\n returns: { type: ['sequence', 'null'] },\n args: { seq: { type: 'sequence' } },\n variants: [{ argumentNames: ['seq'] }],\n description: `If $seq is an array, returns a new array with all but the first element from $seq.\nIf $seq has less than two elements, an empty array is returned.\nFor string $seq returns all but the first characters in $seq.`,\n seeAlso: ['next', 'first', 'sequence.shift'],\n examples: [\n 'rest([\"Albert\", \"Mojir\", 160, [1, 2]])',\n 'rest([\"Albert\"])',\n 'rest([])',\n 'rest(\"Albert\")',\n 'rest(\"A\",)',\n 'rest(\"\")',\n ],\n },\n },\n 'next': {\n evaluate: ([seq], sourceCodeInfo): Arr | string | null => {\n assertSeq(seq, sourceCodeInfo)\n if (Array.isArray(seq)) {\n if (seq.length <= 1)\n return null\n\n return seq.slice(1)\n }\n if (seq.length <= 1)\n return null\n\n return seq.substring(1)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'sequence',\n returns: { type: ['sequence', 'null'] },\n args: { seq: { type: 'sequence' } },\n variants: [{ argumentNames: ['seq'] }],\n description: 'If $seq is an array, returns a new array with all but the first element from $seq. If $seq has less than two elements, `null` is returned. For string $seq returns all but the first characters in $seq. If length of string $seq is less than two, `null` is returned.',\n seeAlso: ['rest', 'first'],\n examples: [\n 'next([\"Albert\", \"Mojir\", 160, [1, 2]])',\n 'next([\"Albert\"])',\n 'next([])',\n 'next(\"Albert\")',\n 'next(\"A\",)',\n 'next(\"\")',\n ],\n },\n },\n 'reverse': {\n evaluate: ([seq], sourceCodeInfo): Any => {\n if (seq === null)\n return null\n\n assertSeq(seq, sourceCodeInfo)\n if (Array.isArray(seq)) {\n return [...seq].reverse()\n }\n\n return seq.split('').reverse().join('')\n },\n arity: toFixedArity(1),\n docs: {\n category: 'sequence',\n returns: { type: ['sequence', 'null'] },\n args: { seq: { type: ['sequence', 'null'] } },\n variants: [{ argumentNames: ['seq'] }],\n description: 'If $seq is an array, creates a new array with the elements from $seq in reversed order. If $seq is a string, returns new reversed string.',\n seeAlso: ['sort'],\n examples: [\n 'reverse([\"Albert\", \"Mojir\", 160, [1, 2]])',\n 'reverse([])',\n 'reverse(\"Albert\")',\n 'reverse(null)',\n ],\n },\n },\n 'second': {\n evaluate: ([seq], sourceCodeInfo): Any => {\n if (seq === null)\n return null\n\n assertSeq(seq, sourceCodeInfo)\n return toAny(seq[1])\n },\n arity: toFixedArity(1),\n docs: {\n category: 'sequence',\n returns: { type: 'any' },\n args: { seq: { type: ['sequence', 'null'] } },\n variants: [{ argumentNames: ['seq'] }],\n description: 'Returns the second element of $seq. If $seq has less than two elements or is `null`, `null` is returned.',\n seeAlso: ['first', 'last', 'nth'],\n examples: [\n 'second([\"Albert\", \"Mojir\", 160, [1, 2]])',\n 'second([1])',\n 'second([])',\n 'second(null)',\n ],\n },\n },\n 'slice': {\n evaluate: (params, sourceCodeInfo): Any => {\n const [seq, from, to] = params\n assertSeq(seq, sourceCodeInfo)\n assertNumber(from, sourceCodeInfo, { integer: true })\n\n if (params.length === 2) {\n if (Array.isArray(seq)) {\n return seq.slice(from)\n }\n return seq.slice(from)\n }\n\n assertNumber(to, sourceCodeInfo, { integer: true })\n if (Array.isArray(seq)) {\n return seq.slice(from, to)\n }\n return seq.slice(from, to)\n },\n arity: { min: 2, max: 3 },\n docs: {\n category: 'sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'integer' },\n seq: { type: 'sequence', rest: true },\n start: { type: 'integer', description: 'Defaults to `0`.' },\n stop: { type: 'integer', description: 'Defaults lenght of sequence + 1.' },\n },\n variants: [\n { argumentNames: ['seq'] },\n { argumentNames: ['seq', 'start'] },\n { argumentNames: ['seq', 'start', 'stop'] },\n ],\n description: 'Returns a copy of a portion of $seq from index $start (inclusive) to $stop (exclusive).',\n seeAlso: ['sequence.take', 'sequence.drop', 'sequence.splice', 'nth'],\n examples: [\n '[1, 2, 3, 4, 5] slice 2',\n 'slice([1, 2, 3, 4, 5], 2, 4)',\n 'slice([1, 2, 3, 4, 5], 2)',\n ],\n },\n },\n 'some': {\n evaluate: ([seq, fn]: Arr, sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertFunctionLike(fn, sourceCodeInfo)\n if (seq === null)\n return null\n\n assertSeq(seq, sourceCodeInfo)\n\n if (seq.length === 0)\n return null\n\n if (typeof seq === 'string')\n return seq.split('').find(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo)) ?? null\n\n return toAny(seq.find(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo)))\n },\n arity: toFixedArity(2),\n docs: {\n category: 'sequence',\n returns: { type: 'any' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'function' },\n seq: { type: ['sequence', 'null'] },\n fun: { type: 'function' },\n },\n variants: [{ argumentNames: ['seq', 'fun'] }],\n description: 'Returns the first element that passes the test implemented by $fun. I no element was found, `null` is returned.',\n seeAlso: ['sequence.position', 'collection.any?', 'find'],\n examples: [\n `\nsome(\n [\"Albert\", \"Mojir\", 160, [1, 2]],\n string?\n)`,\n `\nsome(\n [5, 10, 15, 20],\n -> $ > 10\n)`,\n `\nsome(\n [1, 2, 3, 4],\n -> $ > 10\n)`,\n `\nsome(\n [],\n -> $ > 10\n)`,\n `\nsome(\n null,\n -> $ > 10\n)`,\n ],\n },\n },\n 'sort': {\n evaluate: (params: Arr, sourceCodeInfo, contextStack, { executeFunction }): Seq => {\n const [seq] = params\n const defaultComparer = params.length === 1\n const comparer = defaultComparer ? null : params[1]\n assertSeq(seq, sourceCodeInfo)\n\n if (typeof seq === 'string') {\n const result = seq.split('')\n if (defaultComparer) {\n result.sort((a, b) => compare(a, b, sourceCodeInfo))\n }\n else {\n assertFunctionLike(comparer, sourceCodeInfo)\n result.sort((a, b) => {\n const compareValue = executeFunction(comparer, [a, b], contextStack, sourceCodeInfo)\n assertNumber(compareValue, sourceCodeInfo, { finite: true })\n return compareValue\n })\n }\n return result.join('')\n }\n\n const result = [...seq]\n if (defaultComparer) {\n result.sort((a, b) => {\n assertStringOrNumber(a, sourceCodeInfo)\n assertStringOrNumber(b, sourceCodeInfo)\n return compare(a, b, sourceCodeInfo)\n })\n }\n else {\n result.sort((a, b) => {\n assertFunctionLike(comparer, sourceCodeInfo)\n const compareValue = executeFunction(comparer, [a, b], contextStack, sourceCodeInfo)\n assertNumber(compareValue, sourceCodeInfo, { finite: true })\n return compareValue\n })\n }\n return result\n },\n arity: { min: 1, max: 2 },\n docs: {\n category: 'sequence',\n returns: { type: 'any', rest: true },\n args: {\n a: { type: 'sequence' },\n b: { type: 'function' },\n seq: { type: 'sequence' },\n fun: { type: 'function' },\n },\n variants: [\n { argumentNames: ['seq'] },\n { argumentNames: ['seq', 'fun'] },\n ],\n description: 'Returns a new sequence with the elements from $seq sorted according to $fun. If no $fun is supplied, builtin `compare` will be used.',\n seeAlso: ['sequence.sort-by', 'compare', 'reverse', 'vector.sort-indices'],\n examples: [\n '[3, 1, 2] sort (a, b) -> b - a',\n 'sort([3, 1, 2])',\n `\nsort(\n [3, 1, 2],\n (a, b) -> cond case a < b then -1 case a > b then 1 case true then -1 end\n)`,\n `\nsort(\n [3, 1, 2],\n (a, b) -> cond case a > b then -1 case a < b then 1 case true then -1 end\n)`,\n ],\n },\n },\n}\n","import { LitsError } from '../errors'\nimport type { Any } from '../interface'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { isNumber } from './number'\n\nconst annotatedArrays = new WeakSet<unknown[]>()\nconst vectors = new WeakSet<unknown[]>()\nconst notVectors = new WeakSet<unknown[]>()\nconst matrices = new WeakSet<unknown[]>()\nconst notMatrices = new WeakSet<unknown[]>()\nconst grids = new WeakSet<unknown[]>()\nconst notGrids = new WeakSet<unknown[]>()\n\nexport function annotate<T>(value: T): T {\n if (!Array.isArray(value)) {\n return value\n }\n if (annotatedArrays.has(value)) {\n return value\n }\n isVector(value)\n if (!isMatrix(value)) {\n isGrid(value)\n }\n\n return value\n}\nexport function isVector(vector: unknown): vector is number[] {\n if (!Array.isArray(vector)) {\n return false\n }\n\n if (vectors.has(vector)) {\n return true\n }\n if (notVectors.has(vector)) {\n return false\n }\n\n if (vector.every(elem => isNumber(elem))) {\n annotatedArrays.add(vector)\n vectors.add(vector)\n return true\n }\n notVectors.add(vector)\n return false\n}\n\nexport function assertVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is number[] {\n if (!isVector(vector)) {\n throw new LitsError(`Expected a vector, but got ${vector}`, sourceCodeInfo)\n }\n}\n\nexport function is2dVector(vector: unknown): vector is [number, number] {\n if (!isVector(vector)) {\n return false\n }\n return vector.length === 2\n}\nexport function assert2dVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is [number, number] {\n if (!is2dVector(vector)) {\n throw new LitsError(`Expected a 2d vector, but got ${vector}`, sourceCodeInfo)\n }\n}\n\nexport function is3dVector(vector: unknown): vector is [number, number, number] {\n if (!isVector(vector)) {\n return false\n }\n return vector.length === 3\n}\nexport function assert3dVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is [number, number, number] {\n if (!is3dVector(vector)) {\n throw new LitsError(`Expected a 3d vector, but got ${vector}`, sourceCodeInfo)\n }\n}\n\nexport function assertNonEmptyVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is number[] {\n assertVector(vector, sourceCodeInfo)\n if (vector.length === 0) {\n throw new LitsError(`Expected a non empty vector, but got ${vector}`, sourceCodeInfo)\n }\n}\n\nexport function isGrid(grid: unknown): grid is unknown[][] {\n if (!Array.isArray(grid)) {\n return false\n }\n if (grids.has(grid)) {\n return true\n }\n if (notGrids.has(grid)) {\n return false\n }\n if (grid.length === 0) {\n notGrids.add(grid)\n return false\n }\n if (!Array.isArray(grid[0])) {\n notGrids.add(grid)\n return false\n }\n const nbrOfCols = grid[0].length\n for (const row of grid.slice(1)) {\n if (!Array.isArray(row)) {\n notGrids.add(grid)\n return false\n }\n if (row.length !== nbrOfCols) {\n notGrids.add(grid)\n return false\n }\n }\n annotatedArrays.add(grid)\n grids.add(grid)\n return true\n}\n\nexport function assertGrid(grid: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts grid is Any[][] {\n if (!isGrid(grid)) {\n throw new LitsError(`Expected a grid, but got ${grid}`, sourceCodeInfo)\n }\n}\n\nexport function isMatrix(matrix: unknown): matrix is number[][] {\n if (!Array.isArray(matrix)) {\n return false\n }\n if (matrices.has(matrix)) {\n return true\n }\n if (notMatrices.has(matrix)) {\n return false\n }\n if (matrix.length === 0) {\n notMatrices.add(matrix)\n return false\n }\n if (!Array.isArray(matrix[0]) || matrix[0].length === 0) {\n notMatrices.add(matrix)\n return false\n }\n const nbrOfCols = matrix[0].length\n for (const row of matrix) {\n if (!Array.isArray(row) || row.length !== nbrOfCols || row.some(cell => !isNumber(cell))) {\n notMatrices.add(matrix)\n return false\n }\n }\n annotatedArrays.add(matrix)\n grids.add(matrix)\n matrices.add(matrix)\n return true\n}\n\nexport function assertMatrix(matrix: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts matrix is number[][] {\n if (!isMatrix(matrix)) {\n throw new LitsError(`Expected a matrix, but got ${matrix}`, sourceCodeInfo)\n }\n}\n\nexport function assertSquareMatrix(matrix: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts matrix is number[][] {\n if (!isMatrix(matrix)) {\n throw new LitsError(`Expected a matrix, but got ${matrix}`, sourceCodeInfo)\n }\n if (matrix.length !== matrix[0]!.length) {\n throw new LitsError(`Expected square matrix, but got ${matrix.length} and ${matrix[0]!.length}`, sourceCodeInfo)\n }\n}\n\nexport function isSquareMatrix(matrix: unknown): matrix is number[][] {\n if (!isMatrix(matrix)) {\n return false\n }\n if (matrix.length !== matrix[0]!.length) {\n return false\n }\n return true\n}\n","import { LitsError } from '../../errors'\nimport type { SourceCodeInfo } from '../../tokenizer/token'\nimport { assertNonEmptyVector, isMatrix, isVector } from '../../typeGuards/annotatedArrays'\nimport { assertNumber, isNumber } from '../../typeGuards/number'\nimport { toFixedArity } from '../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../interface'\n\ntype NumberVectorOrMatrix = number | number[] | number[][]\n\nfunction getNumberVectorOrMatrixOperation(\n params: unknown[],\n sourceCodeInfo: SourceCodeInfo | undefined,\n):\n | ['number', number[]]\n | ['vector', number[][]]\n | ['matrix', number[][][]] {\n let hasVector: boolean = false\n let hasMatrix: boolean = false\n for (const param of params) {\n if (isVector(param)) {\n hasVector = true\n }\n else if (isMatrix(param)) {\n hasMatrix = true\n }\n else if (!isNumber(param)) {\n throw new LitsError(`Invalid parameter type: ${typeof param}`, sourceCodeInfo)\n }\n }\n if (hasMatrix) {\n if (hasVector) {\n throw new LitsError('Cannot mix vector and matrix types', sourceCodeInfo)\n }\n let rows: number | null = null\n let cold: number | null = null\n for (const param of params) {\n if (isMatrix(param)) {\n if (rows === null) {\n rows = param.length\n cold = param[0]!.length\n }\n else {\n if (param.length !== rows || param[0]!.length !== cold) {\n throw new LitsError('Matrix dimensions do not match', sourceCodeInfo)\n }\n }\n }\n }\n const matrices = params.map((param) => {\n if (isMatrix(param)) {\n return param\n }\n return Array.from({ length: rows as number }, () => Array.from({ length: cold as number }, () => param as number))\n })\n return ['matrix', matrices]\n }\n if (hasVector) {\n let length: number | null = null\n for (const param of params) {\n if (isVector(param)) {\n if (length === null) {\n length = param.length\n }\n else {\n if (param.length !== length) {\n throw new LitsError('Vector lengths do not match', sourceCodeInfo)\n }\n }\n }\n }\n const vectors = params.map((param) => {\n if (isVector(param)) {\n return param\n }\n return Array.from({ length: length as number }, () => param as number)\n })\n\n return ['vector', vectors]\n }\n return ['number', params as number[]]\n}\n\nfunction unaryMathOp(\n fn: (val: number) => number,\n): (params: unknown[], sourceCodeInfo: SourceCodeInfo | undefined) => NumberVectorOrMatrix {\n return (params, sourceCodeInfo) => {\n const [operation, operands] = getNumberVectorOrMatrixOperation(params, sourceCodeInfo)\n if (operation === 'number') {\n return fn(operands[0]!)\n }\n else if (operation === 'vector') {\n return operands[0]!.map(val => fn(val))\n }\n else {\n return operands[0]!.map(row => row.map(val => fn(val)))\n }\n }\n}\n\nfunction binaryMathOp(\n fn: (a: number, b: number) => number,\n): (params: unknown[], sourceCodeInfo: SourceCodeInfo | undefined) => NumberVectorOrMatrix {\n return (params, sourceCodeInfo) => {\n const [operation, operands] = getNumberVectorOrMatrixOperation(params, sourceCodeInfo)\n if (operation === 'number') {\n return fn(operands[0]!, operands[1]!)\n }\n else if (operation === 'vector') {\n return operands[0]!.map((val, i) => fn(val, operands[1]![i]!))\n }\n else {\n return operands[0]!.map((row, i) => row.map((val, j) => fn(val, operands[1]![i]![j]!)))\n }\n }\n}\n\nfunction reduceMathOp(\n identity: number,\n fn: (a: number, b: number) => number,\n): (params: unknown[], sourceCodeInfo: SourceCodeInfo | undefined) => NumberVectorOrMatrix {\n return (params, sourceCodeInfo) => {\n if (params.length === 0)\n return identity\n const [operation, operands] = getNumberVectorOrMatrixOperation(params, sourceCodeInfo)\n if (operation === 'number') {\n return operands.reduce((a, b) => fn(a, b), identity)\n }\n else if (operation === 'vector') {\n const [first, ...rest] = operands\n return rest.reduce((acc, v) => acc.map((val, i) => fn(val, v[i]!)), first!)\n }\n else {\n const [first, ...rest] = operands\n return rest.reduce((acc, m) => acc.map((row, i) => row.map((val, j) => fn(val, m[i]![j]!))), first!)\n }\n }\n}\n\nexport const mathNormalExpression: BuiltinNormalExpressions = {\n 'inc': {\n evaluate: unaryMathOp(val => val + 1),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: 'number' },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `inc` function increments its argument by 1, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it increases each element by 1 while preserving the original structure.',\n seeAlso: ['dec', '+'],\n examples: [\n 'inc(0)',\n 'inc(1)',\n 'inc(100.1)',\n 'inc([1, 2, 3])',\n 'inc([[1, 2], [3, 4]])',\n ],\n },\n },\n 'dec': {\n evaluate: unaryMathOp(val => val - 1),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `dec` function decrements its argument by 1, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it decreases each element by 1 while preserving the original structure.',\n seeAlso: ['inc', '-'],\n examples: [\n 'dec(0)',\n 'dec(1)',\n 'dec(100.1)',\n 'dec([1, 2, 3])',\n 'dec([[1, 2], [3, 4]])',\n ],\n },\n },\n '+': {\n evaluate: reduceMathOp(0, (a, b) => a + b),\n arity: {},\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n a: { type: ['number', 'vector', 'matrix'] },\n b: { type: ['number', 'vector', 'matrix'] },\n xs: { type: ['number', 'vector', 'matrix'], rest: true },\n },\n variants: [{ argumentNames: ['xs'] }],\n description: 'The `+` function performs addition of numbers and element-wise addition of `vectors` and `matrices` of compatible dimensions, returning the same type as its inputs. When used with mixed types, it adds the scalar to each element of the collection.',\n seeAlso: ['-', '*', '/', 'inc'],\n examples: [\n '1 + 2',\n '1 + 20 + 30',\n '+(1, 2, 3, 4)',\n '+()',\n '+(1)',\n '[1, 2, 3] + 2',\n '[1, 2, 3] + [4, 5, 6]',\n '[[1, 2, 3], [4, 5, 6]] + [[7, 8, 9], [10, 11, 12]]',\n '[[1, 2, 3], [4, 5, 6]] + 2',\n ],\n },\n },\n '*': {\n evaluate: reduceMathOp(1, (a, b) => a * b),\n arity: {},\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n a: { type: ['number', 'vector', 'matrix'] },\n b: { type: ['number', 'vector', 'matrix'] },\n xs: { type: ['number', 'vector', 'matrix'], rest: true },\n },\n variants: [{ argumentNames: ['xs'] }],\n description: 'The `*` function performs multiplication of `numbers` and element-wise multiplication of `vectors` and `matrices` of compatible dimensions, returning the same type as its inputs. When used with mixed types, it multiplies each element of the collection by the scalar.',\n seeAlso: ['/', '+', '-', '^'],\n examples: [\n '6 * 7',\n '-1 * 4',\n '*(4, 7)',\n '*(1, 2, 3, 4, 5)',\n '*()',\n '*(8)',\n '[1, 2, 3] * 2',\n '[1, 2, 3] * [4, 5, 6]',\n '[[1, 2, 3], [4, 5, 6]] * [[7, 8, 9], [10, 11, 12]]',\n '[[1, 2, 3], [4, 5, 6]] * 2',\n ],\n },\n },\n '/': {\n evaluate: (params, sourceCodeInfo): NumberVectorOrMatrix => {\n if (params.length === 0) {\n return 1\n }\n\n const [operation, operands] = getNumberVectorOrMatrixOperation(params, sourceCodeInfo)\n\n if (operation === 'number') {\n const [first, ...rest] = operands\n if (rest.length === 0) {\n return 1 / first!\n }\n return rest.reduce((result, param) => {\n return result / param\n }, first!)\n }\n else if (operation === 'vector') {\n const firstVector = operands[0]!\n const restVectors = operands.slice(1)\n return restVectors.reduce((acc, vector) => acc.map((val, i) => val / vector[i]!), firstVector)\n }\n else {\n const firstMatrix = operands[0]!\n const restMatrices = operands.slice(1)\n return restMatrices.reduce((acc, matrix) => acc.map((row, i) => row.map((val, j) => val / matrix[i]![j]!)), firstMatrix)\n }\n },\n arity: {},\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n a: { type: ['number', 'vector', 'matrix'] },\n b: { type: ['number', 'vector', 'matrix'] },\n xs: { type: ['number', 'vector', 'matrix'], rest: true },\n },\n variants: [{ argumentNames: ['xs'] }],\n description: 'The `/` function performs division of `numbers` and element-wise division of `vectors` and `matrices` of compatible dimensions, returning the same type as its inputs. When used with mixed types, it divides each element of the collection by the scalar.',\n seeAlso: ['*', '+', '-', 'quot', 'mod', '%'],\n examples: [\n '12 / 100',\n '-1 / 4',\n '/(7, 4)',\n '/(1, 2, 4, 8)',\n '/()',\n '/(8)',\n '[1, 2, 3] / 2',\n '[1, 2, 3] / [4, 5, 6]',\n '[[1, 2, 3], [4, 5, 6]] / [[7, 8, 9], [10, 11, 12]]',\n '[[1, 2, 3], [4, 5, 6]] / 2',\n ],\n },\n },\n '-': {\n evaluate: (params, sourceCodeInfo): NumberVectorOrMatrix => {\n if (params.length === 0) {\n return 0\n }\n\n const [operation, operands] = getNumberVectorOrMatrixOperation(params, sourceCodeInfo)\n\n if (operation === 'number') {\n const [first, ...rest] = operands\n if (rest.length === 0)\n return -first!\n\n return rest.reduce((result, param) => {\n return result - param\n }, first!)\n }\n else if (operation === 'vector') {\n const firstVector = operands[0]!\n const restVectors = operands.slice(1)\n return restVectors.reduce((acc, vector) => acc.map((val, i) => val - vector[i]!), firstVector)\n }\n else {\n const firstMatrix = operands[0]!\n const restMatrices = operands.slice(1)\n return restMatrices.reduce((acc, matrix) => acc.map((row, i) => row.map((val, j) => val - matrix[i]![j]!)), firstMatrix)\n }\n },\n arity: {},\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n a: { type: ['number', 'vector', 'matrix'] },\n b: { type: ['number', 'vector', 'matrix'] },\n xs: { type: ['number', 'vector', 'matrix'], rest: true },\n },\n variants: [{ argumentNames: ['xs'] }],\n description: 'Computes difference between first value and sum of the rest. When called with only one argument, it does negation.',\n seeAlso: ['+', '*', '/', 'dec', 'abs'],\n examples: [\n '50 - 8',\n '1 - 1 - 1',\n '-()',\n '-(4, 2)',\n '-(4, 3, 2, 1,)',\n '[1, 2, 3] - 2',\n '[1, 2, 3] - [4, 5, 6]',\n '[[1, 2, 3], [4, 5, 6]] - [[7, 8, 9], [10, 11, 12]]',\n '[[1, 2, 3], [4, 5, 6]] - 2',\n ],\n },\n },\n 'quot': {\n evaluate: binaryMathOp((a, b) => Math.trunc(a / b)),\n arity: toFixedArity(2),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n a: { type: ['number', 'vector', 'matrix'] },\n b: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'The `quot` function performs integer division truncated toward zero, working on `numbers` and element-wise on `vectors` and `matrices` of compatible dimensions. When used with mixed types, it applies integer division between each element of the collection and the scalar.',\n seeAlso: ['mod', '%', '/', 'trunc'],\n examples: [\n 'quot(5, 3)',\n 'quot(5.2, 3.1)',\n 'quot(-5, 3)',\n '5 quot -3',\n '-5 quot -3',\n 'quot(5, 0)',\n 'quot(0, 5)',\n '[1, 2, 3] quot 2',\n '2 quot [1, 2, 3]',\n 'quot([1, 2, 3], [4, 5, 6])',\n '[[1, 2, 3], [4, 5, 6]] quot [[7, 8, 9], [10, 11, 12]]',\n 'quot([[1, 2, 3], [4, 5, 6]], 2)',\n '[[1, 2, 3], [4, 5, 6]] quot [[7, 8, 9], [10, 11, 12]]',\n ],\n },\n },\n 'mod': {\n evaluate: binaryMathOp((a, b) => a - b * Math.floor(a / b)),\n arity: toFixedArity(2),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n a: { type: ['number', 'vector', 'matrix'] },\n b: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'The `mod` function computes the modulo of division with the same sign as the divisor, working on `numbers` and element-wise on `vectors` and `matrices` of compatible dimensions. When used with mixed types, it applies the modulo operation between each element of the collection and the scalar.',\n seeAlso: ['%', 'quot', '/'],\n examples: [\n 'mod(5, 3)',\n 'mod(5.2, 3.1)',\n 'mod(-5, 3)',\n '5 mod -3',\n '-5 mod -3',\n '[1, 2, 3] mod 2',\n '2 mod [1, 2, 3]',\n 'mod([1, 2, 3], [4, 5, 6])',\n '[[1, 2, 3], [4, 5, 6]] mod [[7, 8, 9], [10, 11, 12]]',\n 'mod([[1, 2, 3], [4, 5, 6]], 2)',\n ],\n },\n },\n '%': {\n evaluate: binaryMathOp((a, b) => a % b),\n arity: toFixedArity(2),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n a: { type: ['number', 'vector', 'matrix'] },\n b: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'The `%` function computes the remainder of division with the same sign as the dividend, working on `numbers` and element-wise on `vectors` and `matrices` of compatible dimensions. When used with mixed types, it applies the remainder operation between each element of the collection and the scalar.',\n seeAlso: ['mod', 'quot', '/'],\n examples: [\n '5 % 3',\n '5.2 % 3.1',\n '-5 % 3',\n '%(5, -3)',\n '%(-5, -3)',\n '[1, 2, 3] % 2',\n '2 % [1, 2, 3]',\n '%([1, 2, 3], [4, 5, 6])',\n '[[1, 2, 3], [4, 5, 6]] % [[7, 8, 9], [10, 11, 12]]',\n '%([[1, 2, 3], [4, 5, 6]], 2)',\n ],\n },\n },\n 'sqrt': {\n evaluate: unaryMathOp(val => Math.sqrt(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `sqrt` function calculates the square root of `numbers` and computes element-wise square roots of `vectors` and `matrices`. When applied to collections, it returns the square root of each element while preserving the original structure.',\n seeAlso: ['cbrt', '^'],\n examples: [\n 'sqrt(0)',\n 'sqrt(9)',\n 'sqrt(2)',\n 'sqrt(0)',\n 'sqrt(9)',\n 'sqrt(2)',\n 'sqrt([1, 4, 9])',\n 'sqrt([[1, 4], [9, 16]])',\n ],\n },\n },\n 'cbrt': {\n evaluate: unaryMathOp(val => Math.cbrt(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `cbrt` function calculates the cube root of `numbers` and computes element-wise cube roots of `vectors` and `matrices`. When applied to collections, it returns the cube root of each element while preserving the original structure.',\n seeAlso: ['sqrt', '^'],\n examples: [\n 'cbrt(0)',\n 'cbrt(27)',\n 'cbrt(2)',\n 'cbrt(1)',\n 'cbrt(0)',\n 'cbrt(27)',\n 'cbrt(2)',\n 'cbrt(1)',\n 'cbrt([1, 8, 27])',\n 'cbrt([[1, 8], [27, 64]])',\n ],\n },\n },\n '^': {\n evaluate: binaryMathOp((a, b) => a ** b),\n arity: toFixedArity(2),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n a: { type: ['number', 'vector', 'matrix'] },\n b: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'The ^ function computes exponentiation, raising the first argument to the power of the second, working on `numbers` and element-wise on `vectors` and `matrices` of compatible dimensions. When used with mixed types, it applies the power operation between each element of the collection and the scalar.',\n seeAlso: ['sqrt', 'cbrt', '*', 'math.ln'],\n examples: [\n '2 ^ 3',\n '2 ^ 0',\n '2 ^ -3',\n '^(-2, 3)',\n '^(-2, -3)',\n '[1, 2, 3] ^ 2',\n '2 ^ [1, 2, 3]',\n '^([1, 2, 3], [4, 5, 6])',\n '[[1, 2, 3], [4, 5, 6]] ^ [[7, 8, 9], [10, 11, 12]]',\n '^([[1, 2, 3], [4, 5, 6]], 2)',\n ],\n },\n },\n 'round': {\n evaluate: ([value, decimals], sourceCodeInfo): NumberVectorOrMatrix => {\n const [operation, operands] = getNumberVectorOrMatrixOperation([value], sourceCodeInfo)\n if (operation === 'number') {\n if (decimals === undefined || decimals === 0) {\n return Math.round(operands[0]!)\n }\n else {\n assertNumber(decimals, sourceCodeInfo, { integer: true, positive: true })\n const factor = 10 ** decimals\n return Math.round(operands[0]! * factor) / factor\n }\n }\n else if (operation === 'vector') {\n const vector = operands[0]!\n if (decimals === undefined || decimals === 0) {\n return vector.map(val => Math.round(val))\n }\n else {\n assertNumber(decimals, sourceCodeInfo, { integer: true, positive: true })\n const factor = 10 ** decimals\n return vector.map(val => Math.round(val * factor) / factor)\n }\n }\n else {\n const matrix = operands[0]!\n if (decimals === undefined || decimals === 0) {\n return matrix.map(row => row.map(val => Math.round(val)))\n }\n else {\n assertNumber(decimals, sourceCodeInfo, { integer: true, positive: true })\n const factor = 10 ** decimals\n return matrix.map(row => row.map(val => Math.round(val * factor) / factor))\n }\n }\n },\n arity: { min: 1, max: 2 },\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n a: { type: ['number', 'vector', 'matrix'] },\n b: { type: 'integer' },\n },\n variants: [\n { argumentNames: ['a'] },\n { argumentNames: ['a', 'b'] },\n ],\n description: 'The `round` function rounds a `number` to the nearest `integer` or to a specified number of `decimal` places, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it rounds each element while preserving the original structure.',\n seeAlso: ['floor', 'ceil', 'trunc'],\n examples: [\n 'round(2)',\n 'round(2.49)',\n 'round(2.5)',\n 'round(-2.49)',\n 'round(-2.5)',\n 'round(-2.501)',\n 'round(1.23456789, 4)',\n '1.123456789 round 2',\n 'round([1.23456789, 2.3456789], 1)',\n '[1.23456789, 2.3456789] round 4',\n '[[1.23456789, 2.3456789], [3.456789, 4.56789]] round 4',\n 'round([[1.23456789, 2.3456789], [3.456789, 4.56789]], 2)',\n ],\n },\n },\n 'trunc': {\n evaluate: unaryMathOp(val => Math.trunc(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['integer', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `trunc` function truncates `numbers` toward zero (removing decimal portions without rounding), working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it truncates each element while preserving the original structure.',\n seeAlso: ['round', 'floor', 'ceil', 'quot'],\n examples: [\n 'trunc(2)',\n 'trunc(2.49)',\n 'trunc(2.5)',\n 'trunc(-2.49)',\n 'trunc(-2.5)',\n 'trunc(-2.501)',\n 'trunc([1.23456789, 2.3456789])',\n 'trunc([[1.23456789, 2.3456789], [3.456789, 4.56789]])',\n ],\n },\n },\n 'floor': {\n evaluate: unaryMathOp(val => Math.floor(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['integer', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `floor` function returns the largest `integer` less than or equal to a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the floor of each element while preserving the original structure.',\n seeAlso: ['ceil', 'round', 'trunc'],\n examples: [\n 'floor(2)',\n 'floor(2.49)',\n 'floor(2.5)',\n 'floor(-2.49)',\n 'floor(-2.5)',\n 'floor(-2.501)',\n 'floor([1.23456789, 2.3456789])',\n 'floor([[1.23456789, 2.3456789], [3.456789, 4.56789]])',\n ],\n },\n },\n 'ceil': {\n evaluate: unaryMathOp(val => Math.ceil(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['integer', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `ceil` function returns the smallest `integer` greater than or equal to a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the ceiling of each element while preserving the original structure.',\n seeAlso: ['floor', 'round', 'trunc'],\n examples: [\n 'ceil(2)',\n 'ceil(2.49)',\n 'ceil(2.5)',\n 'ceil(-2.49)',\n 'ceil(-2.5)',\n 'ceil(-2.501)',\n 'ceil([1.23456789, 2.3456789])',\n 'ceil([[1.23456789, 2.3456789], [3.456789, 4.56789]])',\n ],\n },\n },\n 'min': {\n evaluate: (params, sourceCodeInfo): number => {\n if (params.length === 1 && isVector(params[0])) {\n const vector = params[0]\n assertNonEmptyVector(vector, sourceCodeInfo)\n return vector.reduce((m, val) => Math.min(m, val), Infinity)\n }\n const [first, ...rest] = params\n assertNumber(first, sourceCodeInfo)\n return rest.reduce((m: number, value) => {\n assertNumber(value, sourceCodeInfo)\n return Math.min(m, value)\n }, first)\n },\n arity: { min: 1 },\n docs: {\n category: 'math',\n returns: { type: 'number' },\n args: {\n a: { type: 'number' },\n b: { type: 'number' },\n xs: { type: 'number', rest: true },\n vector: { type: 'vector' },\n },\n variants: [\n { argumentNames: ['xs'] },\n { argumentNames: ['vector'] },\n ],\n description: 'Returns the smallest value. Accepts either multiple numbers or a single vector of numbers.',\n seeAlso: ['max', 'vector.span', 'vector.min-index'],\n examples: [\n '2 min 3',\n 'min(2, 0, 1)',\n 'min(2, -1, 1)',\n 'min([2, 0, -1])',\n '12 min 14',\n ],\n },\n },\n 'max': {\n evaluate: (params, sourceCodeInfo): number => {\n if (params.length === 1 && isVector(params[0])) {\n const vector = params[0]\n assertNonEmptyVector(vector, sourceCodeInfo)\n return vector.reduce((m, val) => Math.max(m, val), -Infinity)\n }\n const [first, ...rest] = params\n assertNumber(first, sourceCodeInfo)\n return rest.reduce((m: number, value) => {\n assertNumber(value, sourceCodeInfo)\n return Math.max(m, value)\n }, first)\n },\n arity: { min: 1 },\n docs: {\n category: 'math',\n returns: { type: 'number' },\n args: {\n a: { type: 'number' },\n b: { type: 'number' },\n xs: { type: 'number', rest: true },\n vector: { type: 'vector' },\n },\n variants: [\n { argumentNames: ['xs'] },\n { argumentNames: ['vector'] },\n ],\n description: 'Returns the largest value. Accepts either multiple numbers or a single vector of numbers.',\n seeAlso: ['min', 'vector.span', 'vector.max-index'],\n examples: [\n '2 max 3',\n 'max(2, 0, 1)',\n 'max(2, -1, 1)',\n 'max([2, 0, -1])',\n '4 max 2',\n ],\n },\n },\n 'abs': {\n evaluate: unaryMathOp(val => Math.abs(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The abs function returns the absolute value (magnitude) of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the absolute value of each element while preserving the original structure.',\n seeAlso: ['sign', '-'],\n examples: [\n 'abs(-2.3)',\n 'abs(0)',\n 'abs(2.5)',\n 'abs([1, -2, 3])',\n 'abs([[1, -2], [3, -4]])',\n ],\n },\n },\n 'sign': {\n evaluate: unaryMathOp(val => Math.sign(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `sign` function returns the `sign` of a `number` (-1 for negative, 0 for zero, 1 for positive), working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the sign of each element while preserving the original structure.',\n seeAlso: ['abs'],\n examples: [\n 'sign(-2.3)',\n 'sign(-0)',\n 'sign(0)',\n 'sign(12312)',\n 'sign([1, -2, 3])',\n 'sign([[1, -2], [3, -4]])',\n ],\n },\n },\n}\n","import { LitsError } from '../../errors'\nimport type { Any } from '../../interface'\nimport type { ModuleFunction } from '../../parser/types'\nimport type { SourceCodeInfo } from '../../tokenizer/token'\nimport { asAny, assertAny } from '../../typeGuards/lits'\nimport { assertNumber } from '../../typeGuards/number'\nimport { asStringOrNumber, assertString, assertStringOrNumber } from '../../typeGuards/string'\nimport { compare, deepEqual } from '../../utils'\nimport { toFixedArity } from '../../utils/arity'\nimport { FUNCTION_SYMBOL } from '../../utils/symbols'\nimport type { BuiltinNormalExpressions } from '../interface'\n\nfunction isEqual([first, ...rest]: unknown[], sourceCodeInfo: SourceCodeInfo | undefined) {\n const firstAny = asAny(first, sourceCodeInfo)\n for (const param of rest) {\n if (!deepEqual(firstAny, asAny(param, sourceCodeInfo), sourceCodeInfo))\n return false\n }\n return true\n}\n\nfunction isIdentical([first, ...rest]: unknown[]) {\n for (const param of rest) {\n if (param !== first)\n return false\n }\n return true\n}\n\nexport const miscNormalExpression: BuiltinNormalExpressions = {\n '==': {\n evaluate: (params, sourceCodeInfo): boolean => {\n return isEqual(params, sourceCodeInfo)\n },\n arity: { min: 1 },\n docs: {\n category: 'misc',\n returns: { type: 'boolean' },\n args: {\n a: { type: 'any' },\n b: { type: 'any' },\n x: { type: 'any' },\n ys: { type: 'any', rest: true },\n },\n variants: [\n { argumentNames: ['x'] },\n { argumentNames: ['x', 'ys'] },\n ],\n description: 'Returns `true` if all `values` are structaul equal to each other, otherwise result is `false`.',\n seeAlso: ['≠', 'identical?'],\n examples: [\n '1 == 1',\n '[1, 2] == [1, 2]',\n `\n{\n a: 1,\n b: 2,\n} == {\n b: 2,\n a: 1,\n}`,\n '==(1, 1)',\n '==(1.01, 1)',\n '==(\"1\", 1)',\n '==(\"2\", \"2\", \"2\", \"2\")',\n '==(2, 2, 1, 2)',\n '==([1, 2], [1, 2])',\n '==({ a: 1, b: 2 }, { b: 2, a: 1 })',\n ],\n },\n },\n '≠': {\n evaluate: (params, sourceCodeInfo): boolean => {\n return !isEqual(params, sourceCodeInfo)\n },\n arity: { min: 1 },\n docs: {\n category: 'misc',\n returns: { type: 'boolean' },\n args: {\n a: { type: 'any' },\n b: { type: 'any' },\n x: { type: 'any' },\n ys: { type: 'any', rest: true },\n },\n variants: [\n { argumentNames: ['x'] },\n { argumentNames: ['x', 'ys'] },\n ],\n description: 'Returns `true` if all `values` are not equal to each other, otherwise result is `false`. `(≠ a b c)` is same as `(! (== a b c))`.',\n seeAlso: ['==', 'identical?'],\n examples: [\n '1 ≠ 2',\n '3 ≠ 3',\n '≠(3)',\n '≠(3, 3, 2)',\n '≠(\"3\", \"2\", \"1\", \"0\",)',\n '≠(0, -0)',\n ],\n },\n },\n 'identical?': {\n evaluate: (params): boolean => {\n return isIdentical(params)\n },\n arity: { min: 1 },\n docs: {\n category: 'misc',\n returns: { type: 'boolean' },\n args: {\n a: { type: 'any' },\n b: { type: 'any' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns true if $a and $b are referential equal.',\n seeAlso: ['==', '≠'],\n examples: [\n 'identical?({ a: 10, b: 20 }, { b: 20, a: 10 })',\n 'identical?([1, true, null], [1, true, null])',\n 'identical?(0.3, 0.1 + 0.2)',\n ],\n },\n },\n '>': {\n evaluate: ([first, ...rest], sourceCodeInfo): boolean => {\n let currentValue = asStringOrNumber(first)\n for (const param of rest) {\n if (compare(currentValue, asStringOrNumber(param), sourceCodeInfo) <= 0)\n return false\n\n currentValue = asStringOrNumber(param)\n }\n return true\n },\n arity: { min: 1 },\n docs: {\n category: 'misc',\n returns: { type: 'boolean' },\n args: {\n a: { type: ['number', 'string'] },\n b: { type: ['number', 'string'] },\n x: { type: ['number', 'string'] },\n ys: { type: ['number', 'string'], rest: true },\n },\n variants: [\n { argumentNames: ['x'] },\n { argumentNames: ['x', 'ys'] },\n ],\n description: 'Returns `true` if $x and $ys are in decreasing order, `false` otherwise.',\n seeAlso: ['<', '>=', '<=', 'compare'],\n examples: [\n '>(1, 0)',\n '>(1.01, 1)',\n '>(1, 1)',\n '>(4, 3, 2, 1)',\n '>(3, 2, 2, 1)',\n ],\n },\n },\n\n '<': {\n evaluate: ([first, ...rest], sourceCodeInfo): boolean => {\n let currentValue = asStringOrNumber(first)\n for (const param of rest) {\n if (compare(currentValue, asStringOrNumber(param), sourceCodeInfo) >= 0)\n return false\n\n currentValue = asStringOrNumber(param)\n }\n return true\n },\n arity: { min: 1 },\n docs: {\n category: 'misc',\n returns: { type: 'boolean' },\n args: {\n a: { type: ['number', 'string'] },\n b: { type: ['number', 'string'] },\n x: { type: ['number', 'string'] },\n ys: { type: ['number', 'string'], rest: true },\n },\n variants: [\n { argumentNames: ['x'] },\n { argumentNames: ['x', 'ys'] },\n ],\n description: 'Returns `true` if $x and $ys are in increasing order, `false` otherwise.',\n seeAlso: ['>', '>=', '<=', 'compare'],\n examples: [\n '<(0, 1)',\n '<(1, 1.01)',\n '<(1, 1)',\n '<(1, 2, 2, 3)',\n '<(\"a\", \"b\")',\n ],\n },\n },\n '>=': {\n evaluate: ([first, ...rest], sourceCodeInfo): boolean => {\n let currentValue = asStringOrNumber(first)\n for (const param of rest) {\n if (compare(currentValue, asStringOrNumber(param), sourceCodeInfo) < 0)\n return false\n\n currentValue = asStringOrNumber(param)\n }\n return true\n },\n arity: { min: 1 },\n docs: {\n category: 'misc',\n returns: { type: 'boolean' },\n args: {\n a: { type: ['number', 'string'] },\n b: { type: ['number', 'string'] },\n x: { type: ['number', 'string'] },\n ys: { type: ['number', 'string'], rest: true },\n },\n variants: [\n { argumentNames: ['x'] },\n { argumentNames: ['x', 'ys'] },\n ],\n description: 'Returns `true` if $x and $ys are in non increasing order, `false` otherwise.',\n seeAlso: ['>', '<', '<=', 'compare'],\n examples: [\n '1 >= 1',\n '0 >= 1',\n '>=(1, 0)',\n '>=(1.01, 1)',\n '>=(1, 1)',\n '>=(4, 3, 2, 1)',\n '>=(3, 2, 2, 1)',\n ],\n },\n },\n '<=': {\n evaluate: ([first, ...rest], sourceCodeInfo): boolean => {\n let currentValue = asStringOrNumber(first)\n for (const param of rest) {\n if (compare(currentValue, asStringOrNumber(param), sourceCodeInfo) > 0)\n return false\n\n currentValue = asStringOrNumber(param)\n }\n return true\n },\n arity: { min: 1 },\n docs: {\n category: 'misc',\n returns: { type: 'boolean' },\n args: {\n a: { type: ['number', 'string'] },\n b: { type: ['number', 'string'] },\n x: { type: ['number', 'string'] },\n ys: { type: ['number', 'string'], rest: true },\n },\n variants: [\n { argumentNames: ['x'] },\n { argumentNames: ['x', 'ys'] },\n ],\n description: 'Returns `true` if $x and $ys are in non decreasing order, `false` otherwise.',\n seeAlso: ['>', '<', '>=', 'compare'],\n examples: [\n '1 <= 1',\n '<=(0, 1)',\n '<=(1, 1.01)',\n '<=(1, 1)',\n '<=(1, 2, 3, 4)',\n '<=(1, 2, 2, 3)',\n ],\n },\n },\n '!': {\n evaluate: ([first]): boolean => !first,\n arity: toFixedArity(1),\n docs: {\n category: 'misc',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Computes logical negation. Note that any other $x than `false`, `0`, `null` and `\\'\\'` is truthy.',\n seeAlso: ['boolean'],\n examples: [\n '!(3)',\n '!(true)',\n '!(\"A string\")',\n '!(0)',\n '!(false)',\n '!(null)',\n '!(\"\")',\n ],\n },\n },\n 'epoch->iso-date': {\n evaluate: ([ms], sourceCodeInfo): string => {\n assertNumber(ms, sourceCodeInfo)\n return new Date(ms).toISOString()\n },\n arity: toFixedArity(1),\n docs: {\n category: 'misc',\n returns: { type: 'string' },\n args: { ms: { type: 'number' } },\n variants: [{ argumentNames: ['ms'] }],\n description: 'Returns IOS date time string from `ms` (milliseconds elapsed since the UNIX epoch).',\n seeAlso: ['iso-date->epoch'],\n examples: [\n 'epoch->iso-date(1649756230899)',\n 'epoch->iso-date(0)',\n ],\n },\n },\n 'iso-date->epoch': {\n evaluate: ([dateTime], sourceCodeInfo): number => {\n assertString(dateTime, sourceCodeInfo)\n const ms = new Date(dateTime).valueOf()\n assertNumber(ms, sourceCodeInfo, { finite: true })\n return ms\n },\n arity: toFixedArity(1),\n docs: {\n category: 'misc',\n returns: { type: 'number' },\n args: { iso: { type: 'string' } },\n variants: [{ argumentNames: ['iso'] }],\n description: 'Returns milliseconds elapsed since the UNIX epoch to `iso`.',\n seeAlso: ['epoch->iso-date'],\n examples: [\n 'iso-date->epoch(\"2022-04-12T09:37:10.899Z\")',\n 'iso-date->epoch(\"1980-01-01\")',\n ],\n },\n },\n 'write!': {\n evaluate: (params, sourceCodeInfo): Any => {\n // eslint-disable-next-line no-console\n console.log(...params)\n\n if (params.length > 0)\n return asAny(params[params.length - 1], sourceCodeInfo)\n\n return null\n },\n arity: {},\n docs: {\n category: 'misc',\n returns: { type: 'any' },\n args: { values: { type: 'any', rest: true } },\n variants: [{ argumentNames: ['values'] }],\n description: 'It logs the $values and then returns the last argument. If called with no arguments `null` is returned.',\n examples: [\n 'write!(\"A string\")',\n 'write!(100, \"items\")',\n 'write!(object(\"a\", 10))',\n 'write!([\"a\", \"b\", \"c\"])',\n 'write!(#\"^start\")',\n 'write!(null, true, false)',\n ],\n hideOperatorForm: true,\n },\n },\n 'boolean': {\n evaluate: ([value]): boolean => {\n return !!value\n },\n arity: toFixedArity(1),\n docs: {\n category: 'misc',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Coerces $x to boolean.',\n seeAlso: ['!', 'boolean?', 'true?', 'false?'],\n examples: [\n 'boolean(0)',\n 'boolean(1)',\n 'boolean(null)',\n 'boolean(\"Albert\")',\n ],\n },\n },\n 'compare': {\n evaluate: ([a, b], sourceCodeInfo): number => {\n assertStringOrNumber(a, sourceCodeInfo)\n assertStringOrNumber(b, sourceCodeInfo)\n return compare(a, b, sourceCodeInfo)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'misc',\n returns: { type: 'number' },\n args: {\n a: { type: ['number', 'string'] },\n b: { type: ['number', 'string'] },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Compares two values. Returns `-1` if $a < $b, `1` if $a > $b and `0` if $a and $b have the same sort order.',\n seeAlso: ['<', '>', '<=', '>=', 'sort', 'sequence.sort-by'],\n examples: [\n 'compare(0, 1)',\n 'compare(0, 0)',\n 'compare(1, 0)',\n 'compare(\"Albert\", \"Mojir\")',\n ],\n },\n },\n 'json-parse': {\n evaluate: ([first], sourceCodeInfo): Any => {\n assertString(first, sourceCodeInfo)\n // eslint-disable-next-line ts/no-unsafe-return\n return JSON.parse(first)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'misc',\n returns: { type: 'any' },\n args: { x: { type: 'string' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `JSON.parse(`$x`)`.',\n seeAlso: ['json-stringify'],\n examples: [\n 'json-parse(\"[1, 2, 3]\")',\n ],\n },\n },\n 'json-stringify': {\n evaluate: ([first, second], sourceCodeInfo): string => {\n assertAny(first, sourceCodeInfo)\n if (second === undefined)\n return JSON.stringify(first)\n\n assertNumber(second, sourceCodeInfo)\n return JSON.stringify(first, null, second)\n },\n arity: { min: 1, max: 2 },\n docs: {\n category: 'misc',\n returns: { type: 'string' },\n args: {\n x: { type: 'any' },\n indent: { type: 'integer', description: 'Number of spaces to use for indentation.' },\n },\n variants: [\n { argumentNames: ['x'] },\n { argumentNames: ['x', 'indent'] },\n ],\n description: 'Returns `JSON.stringify(`$x`)`. If second argument is provided, returns `JSON.stringify(`$x`, null, `$indent`)`.',\n seeAlso: ['json-parse'],\n examples: [\n 'json-stringify([1, 2, 3])',\n 'json-stringify({ a: { b: 10 }}, 2)',\n ],\n hideOperatorForm: true,\n },\n },\n 'import': {\n evaluate: ([importPath], sourceCodeInfo, contextStack): ModuleFunction | Record<string, ModuleFunction> => {\n assertString(importPath, sourceCodeInfo)\n\n // Check if importing a specific function (e.g., \"grid.row\")\n const dotIndex = importPath.indexOf('.')\n if (dotIndex !== -1) {\n const moduleName = importPath.substring(0, dotIndex)\n const functionName = importPath.substring(dotIndex + 1)\n\n const module = contextStack.getModule(moduleName)\n if (!module) {\n throw new LitsError(`Unknown module: '${moduleName}'`, sourceCodeInfo)\n }\n\n const expression = module.functions[functionName]\n\n if (!expression) {\n throw new LitsError(`Function '${functionName}' not found in module '${moduleName}'`, sourceCodeInfo)\n }\n\n return {\n [FUNCTION_SYMBOL]: true,\n sourceCodeInfo,\n functionType: 'Module',\n moduleName,\n functionName,\n arity: expression.arity,\n }\n }\n\n // Import entire module\n const moduleName = importPath\n const module = contextStack.getModule(moduleName)\n if (!module) {\n throw new LitsError(`Unknown module: '${moduleName}'`, sourceCodeInfo)\n }\n\n // Create an object where each key is a function name and value is a ModuleFunction\n const result: Record<string, ModuleFunction> = {}\n for (const [functionName, expression] of Object.entries(module.functions)) {\n result[functionName] = {\n [FUNCTION_SYMBOL]: true,\n sourceCodeInfo,\n functionType: 'Module',\n moduleName,\n functionName,\n arity: expression.arity,\n }\n }\n return result\n },\n arity: toFixedArity(1),\n docs: {\n category: 'misc',\n returns: { type: 'any' },\n args: {\n path: {\n type: 'string',\n description: 'The module path to import. Can be a module name (e.g., \"vector\", \"grid\") or a fully qualified function name (e.g., \"vector.mean\", \"grid.row\").',\n },\n },\n variants: [{ argumentNames: ['path'] }],\n description: 'Imports module functions. Use a module name (e.g., \"vector\") to import all functions as an object, or a fully qualified name (e.g., \"vector.mean\") to import a single function directly.',\n examples: [\n 'let v = import(\"vector\"); v.mean([1, 2, 3, 4])',\n 'let v-sum = import(\"vector.sum\"); v-sum([1, 2, 3])',\n 'let g = import(\"grid\"); g.row([[1, 2], [3, 4]], 0)',\n ],\n },\n },\n}\n","import type { Any, Arr, Obj } from '../../interface'\nimport { assertArray, assertStringArray } from '../../typeGuards/array'\nimport { assertFunctionLike, assertObj } from '../../typeGuards/lits'\nimport { asString, assertString } from '../../typeGuards/string'\nimport { collHasKey, toAny } from '../../utils'\nimport { toFixedArity } from '../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../interface'\n\nexport const objectNormalExpression: BuiltinNormalExpressions = {\n 'keys': {\n evaluate: ([obj], sourceCodeInfo): string[] => {\n assertObj(obj, sourceCodeInfo)\n return Object.keys(obj)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'object',\n returns: { type: 'any', array: true },\n args: { obj: { type: 'object' } },\n variants: [{ argumentNames: ['obj'] }],\n description: 'Returns array of all keys in $obj.',\n seeAlso: ['vals', 'entries', 'zipmap', 'select-keys'],\n examples: [\n 'keys({})',\n 'keys({ x: 10, y: true, z: \"A string\" })',\n 'keys(object(\"x\", 10, \"y\", true, \"z\", \"A string\"))',\n ],\n },\n },\n\n 'vals': {\n evaluate: ([obj], sourceCodeInfo): Arr => {\n assertObj(obj, sourceCodeInfo)\n return Object.values(obj)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'object',\n returns: { type: 'any', array: true },\n args: { obj: { type: 'object' } },\n variants: [{ argumentNames: ['obj'] }],\n description: 'Returns array of all values in $obj.',\n seeAlso: ['keys', 'entries', 'zipmap'],\n examples: [\n 'vals({})',\n 'vals({ x: 10, y: true, z: \"A string\" })',\n 'vals(object(\"x\", 10, \"y\", true, \"z\", \"A string\"))',\n ],\n },\n },\n\n 'entries': {\n evaluate: ([obj], sourceCodeInfo): Array<[string, unknown]> => {\n assertObj(obj, sourceCodeInfo)\n return Object.entries(obj)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'object',\n returns: { type: 'array' },\n args: { obj: { type: 'object' } },\n variants: [{ argumentNames: ['obj'] }],\n description: 'Returns nested array of all key - value pairs in $obj.',\n seeAlso: ['keys', 'vals', 'zipmap', 'find'],\n examples: [\n 'entries({})',\n 'entries({ x: 10, y: true, z: \"A string\" })',\n 'entries(object(\"x\", 10, \"y\", true, \"z\", \"A string\"))',\n ],\n },\n },\n\n 'find': {\n evaluate: ([obj, key], sourceCodeInfo): [string, unknown] | null => {\n assertObj(obj, sourceCodeInfo)\n assertString(key, sourceCodeInfo)\n if (collHasKey(obj, key))\n return [key, obj[key]]\n\n return null\n },\n arity: toFixedArity(2),\n docs: {\n category: 'object',\n returns: { type: ['array', 'null'] },\n args: {\n a: { type: 'object' },\n b: { type: 'string' },\n obj: { type: 'object' },\n key: { type: 'string' },\n },\n variants: [{ argumentNames: ['obj', 'key'] }],\n description: 'Returns entry (key-value pair) for $key, or `null` if $key not present in $obj.',\n seeAlso: ['get', 'contains?', 'entries', 'sequence.position', 'some'],\n examples: [\n '{ a: 1, \"b\": 2 } find \"a\"',\n 'find(object(\"a\", 1, \"b\", 2), \"b\")',\n 'find(object(\"a\", 1, \"b\", 2), \"c\")',\n ],\n },\n },\n\n 'dissoc': {\n evaluate: ([obj, key], sourceCodeInfo): Any => {\n assertObj(obj, sourceCodeInfo)\n assertString(key, sourceCodeInfo)\n const newObj = { ...obj }\n delete newObj[key]\n return newObj\n },\n arity: toFixedArity(2),\n docs: {\n category: 'object',\n returns: { type: 'object' },\n args: {\n a: { type: 'object' },\n b: { type: 'string' },\n obj: { type: 'object' },\n key: { type: 'string' },\n },\n variants: [{ argumentNames: ['obj', 'key'] }],\n description: 'Return shallow copy of $obj with $key deleted.',\n seeAlso: ['assoc', 'select-keys'],\n examples: [\n '{ x: 10, y: 20 } dissoc \"y\"',\n 'dissoc({ x: 10, y: 20 }, \"x\")',\n 'dissoc({ x: 10 }, \"y\")',\n `\nlet o = { a: 5 };\ndissoc(o, \"a\");\no`,\n ],\n },\n },\n\n 'merge': {\n evaluate: (params, sourceCodeInfo): Any => {\n if (params.length === 0)\n return null\n\n const [first, ...rest] = params\n assertObj(first, sourceCodeInfo)\n\n return rest.reduce(\n (result: Obj, obj) => {\n assertObj(obj, sourceCodeInfo)\n return { ...result, ...obj }\n },\n { ...first },\n )\n },\n arity: { min: 0 },\n docs: {\n category: 'object',\n returns: { type: 'object' },\n args: {\n a: { type: 'object' },\n b: { type: 'object' },\n objs: { type: 'object', rest: true },\n },\n variants: [{ argumentNames: ['objs'] }],\n description: `Returns a new object created by merging together all arguments.\n\nIf two keys appears in more than one object the value from the last object is used.\nIf no arguments are provided \\`null\\` is returned.`,\n seeAlso: ['merge-with', 'assoc'],\n examples: [\n '{ x: 10 } merge { y: 20 }',\n 'merge(object(\"x\", 10), object(\"y\", 20))',\n 'merge(object(\"x\", 10), object(\"x\", 15, \"y\", 20))',\n ],\n },\n },\n\n 'merge-with': {\n evaluate: (params: Arr, sourceCodeInfo, contextStack, { executeFunction }): Any => {\n const first = params[0]\n const fn = params.at(-1)\n const rest = params.slice(1, -1)\n\n assertObj(first, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n\n return rest.reduce(\n (result: Obj, obj) => {\n assertObj(obj, sourceCodeInfo)\n Object.entries(obj).forEach((entry) => {\n const key = asString(entry[0], sourceCodeInfo)\n const val = toAny(entry[1])\n if (collHasKey(result, key))\n result[key] = executeFunction(fn, [result[key], val], contextStack, sourceCodeInfo)\n else\n result[key] = val\n })\n return result\n },\n { ...first },\n )\n },\n arity: { min: 2 },\n docs: {\n category: 'object',\n returns: { type: 'object' },\n args: {\n objs: { type: 'object', rest: true },\n fun: { type: 'function' },\n },\n variants: [{ argumentNames: ['objs', 'fun'] }],\n description: `\nReturns a new object created by merging together all arguments.\nIf two keys appears in more than one object $fun is used to calculate the new value.\n\nIf no arguments are provided \\`null\\` is returned.`,\n seeAlso: ['merge'],\n examples: [\n 'merge-with(object(\"x\", 10), object(\"y\", 20), +)',\n 'merge-with(object(\"x\", 10), object(\"x\", 15, \"y\", 20), +)',\n 'merge-with({ x: 10 }, { x: 20 }, { x: 30 }, { x: 40 }, -)',\n ],\n hideOperatorForm: true,\n },\n },\n\n 'zipmap': {\n evaluate: ([keys, values], sourceCodeInfo): Any => {\n assertStringArray(keys, sourceCodeInfo)\n assertArray(values, sourceCodeInfo)\n\n const length = Math.min(keys.length, values.length)\n\n const result: Obj = {}\n\n for (let i = 0; i < length; i += 1) {\n const key = asString(keys[i], sourceCodeInfo)\n result[key] = toAny(values[i])\n }\n return result\n },\n arity: toFixedArity(2),\n docs: {\n category: 'object',\n returns: { type: 'object' },\n args: {\n a: { type: 'array' },\n b: { type: 'array' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns a new object created by mapping $a to $b.',\n seeAlso: ['entries', 'keys', 'vals', 'sequence.interleave'],\n examples: [\n '[\"a\", \"b\", \"c\"] zipmap [1, 2, 3]',\n 'zipmap([\"a\", \"b\", \"c\"], [10, null, [1, 2, 3]])',\n 'zipmap([\"a\", \"b\", \"c\"], [1])',\n 'zipmap([], [10, null, [1, 2, 3]])',\n ],\n },\n },\n\n 'select-keys': {\n evaluate: ([obj, keys], sourceCodeInfo): Any => {\n assertStringArray(keys, sourceCodeInfo)\n assertObj(obj, sourceCodeInfo)\n\n return keys.reduce((result: Obj, key) => {\n if (collHasKey(obj, key))\n result[key] = toAny(obj[key])\n\n return result\n }, {})\n },\n arity: toFixedArity(2),\n docs: {\n category: 'object',\n returns: { type: 'object' },\n args: {\n a: { type: 'object' },\n b: { type: 'array' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns an object containing only those entries in $a whose key is in $b.',\n seeAlso: ['dissoc', 'keys'],\n examples: [\n '{ a: 1, b: 2, c: 3 } select-keys [\"a\", \"b\"]',\n 'select-keys({ a: 1, b: 2, c: 3 }, [\"a\", \"b\"])',\n 'select-keys({ a: 1 }, [\"a\", \"b\"])',\n ],\n },\n },\n}\n","import { isLitsFunction } from '../../typeGuards/litsFunction'\nimport { assertColl, isColl, isObj, isRegularExpression, isSeq } from '../../typeGuards/lits'\nimport { assertNumber, isNumber } from '../../typeGuards/number'\nimport type { BuiltinNormalExpressions } from '../interface'\nimport { isGrid, isMatrix, isVector } from '../../typeGuards/annotatedArrays'\nimport { EPSILON } from '../../utils'\nimport { toFixedArity } from '../../utils/arity'\n\nexport const predicatesNormalExpression: BuiltinNormalExpressions = {\n 'function?': {\n evaluate: ([first]): boolean => isLitsFunction(first),\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is a function, otherwise `false`.',\n seeAlso: ['string?', 'number?', 'boolean?', 'null?', 'array?', 'object?', 'regexp?'],\n examples: [\n 'function?(+)',\n 'function?(/)',\n 'function?((x, y) -> x + y)',\n 'function?(false)',\n 'function?(\"false\")',\n 'function?([1, 2, 3])',\n ],\n },\n },\n\n 'string?': {\n evaluate: ([first]): boolean => typeof first === 'string',\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is a string, otherwise `false`.',\n seeAlso: ['blank?', 'number?', 'boolean?', 'null?', 'array?', 'object?', 'regexp?', 'function?', 'collection?', 'sequence?'],\n examples: [\n 'string?(\"\")',\n 'string?(\"A string\")',\n 'string?(true ? \"A string\" : false)',\n 'string?(false)',\n 'string?([1, 2, 3])',\n 'string?(100)',\n ],\n },\n },\n\n 'number?': {\n evaluate: ([first]): boolean => typeof first === 'number',\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is a number, otherwise `false`.',\n seeAlso: ['integer?', 'zero?', 'pos?', 'neg?', 'finite?', 'number', 'string?', 'boolean?', 'null?', 'function?'],\n examples: [\n 'number?(0)',\n 'number?(2)',\n 'number?(-0.12)',\n 'number?(false)',\n 'number?([1, 2, 3])',\n 'number?(\"A string\")',\n ],\n },\n },\n\n 'integer?': {\n evaluate: ([first]): boolean => typeof first === 'number' && isNumber(first, { integer: true }),\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is an integer, otherwise `false`.',\n seeAlso: ['number?', 'number', 'even?', 'odd?'],\n examples: [\n 'integer?(0)',\n 'integer?(-12)',\n 'integer?(42)',\n 'integer?(10.1)',\n 'integer?((x, y) -> x + y)',\n 'integer?(false)',\n 'integer?(\"false\")',\n 'integer?([1, 2, 3])',\n ],\n },\n },\n\n 'boolean?': {\n evaluate: ([first]): boolean => typeof first === 'boolean',\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is a `boolean`, otherwise `false`.',\n seeAlso: ['true?', 'false?', 'boolean', 'string?', 'number?', 'null?', 'function?'],\n examples: [\n 'boolean?(true)',\n 'boolean?(false)',\n 'boolean?([1, 2, 3])',\n 'boolean?(0)',\n 'boolean?(\"A string\")',\n ],\n },\n },\n\n 'null?': {\n evaluate: ([first]): boolean => first === null || first === undefined,\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is `null`, otherwise `false`.',\n seeAlso: ['empty?', 'not-empty?', 'string?', 'number?', 'boolean?', 'function?'],\n examples: [\n 'null?(null)',\n 'null?(false)',\n 'null?([1, 2, 3])',\n 'null?(0)',\n 'null?(\"A string\")',\n ],\n },\n },\n\n 'zero?': {\n evaluate: ([value], sourceCodeInfo): boolean => {\n assertNumber(value, sourceCodeInfo, { finite: true })\n return Math.abs(value) < EPSILON\n },\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'number' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is `0`, otherwise `false`.',\n seeAlso: ['pos?', 'neg?', 'even?', 'number?'],\n examples: [\n 'zero?(0)',\n 'zero?(-0.0)',\n 'zero?(1)',\n 'zero?(0.1)',\n ],\n },\n },\n\n 'pos?': {\n evaluate: ([first], sourceCodeInfo): boolean => {\n assertNumber(first, sourceCodeInfo, { finite: true })\n return first > 0\n },\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'number' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is greater than `0`, otherwise `false`.',\n seeAlso: ['neg?', 'zero?', 'number?'],\n examples: [\n 'pos?(0)',\n 'pos?(-0.0)',\n 'pos?(1)',\n 'pos?(-0.1)',\n ],\n },\n },\n\n 'neg?': {\n evaluate: ([first], sourceCodeInfo): boolean => {\n assertNumber(first, sourceCodeInfo, { finite: true })\n return first < 0\n },\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'number' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is less than `0`, otherwise `false`.',\n seeAlso: ['pos?', 'zero?', 'number?'],\n examples: [\n 'neg?(0)',\n 'neg?(-0.0)',\n 'neg?(1)',\n 'neg?(-0.1)',\n ],\n },\n },\n\n 'even?': {\n evaluate: ([first], sourceCodeInfo): boolean => {\n assertNumber(first, sourceCodeInfo, { finite: true })\n return first % 2 === 0\n },\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'number' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is even, otherwise `false`.',\n seeAlso: ['odd?', 'integer?', 'zero?'],\n examples: [\n 'even?(0)',\n 'even?(-0.0)',\n 'even?(-1)',\n 'even?(2.1)',\n ],\n },\n },\n\n 'odd?': {\n evaluate: ([first], sourceCodeInfo): boolean => {\n assertNumber(first, sourceCodeInfo, { finite: true })\n return isNumber(first, { integer: true }) && first % 2 !== 0\n },\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'number' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is odd, otherwise `false`.',\n seeAlso: ['even?', 'integer?'],\n examples: [\n 'odd?(1.0)',\n 'odd?(1.001)',\n 'odd?(-1)',\n 'odd?(2.1)',\n ],\n },\n },\n\n 'array?': {\n evaluate: ([first]): boolean => {\n return Array.isArray(first)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is an array, otherwise `false`.',\n seeAlso: ['sequence?', 'collection?', 'object?', 'string?', 'vector?', 'matrix?', 'grid?', 'function?'],\n examples: [\n 'array?([])',\n 'array?([1, 2, 3])',\n 'array?(object(\"a\", 10))',\n 'array?(42)',\n 'array?(10.1)',\n 'array?((x, y) -> x + y)',\n ],\n },\n },\n\n 'collection?': {\n evaluate: ([first]): boolean => {\n return isColl(first)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is a collection i.e. an array, an object or a string, otherwise `false`.',\n seeAlso: ['sequence?', 'array?', 'object?', 'string?'],\n examples: [\n 'collection?([])',\n 'collection?([1, 2, 3])',\n 'collection?(object(\"a\", 10))',\n 'collection?(\"Albert\")',\n 'collection?(42)',\n 'collection?(10.1)',\n 'collection?((x, y) -> x + y)',\n ],\n },\n },\n\n 'sequence?': {\n evaluate: ([first]): boolean => {\n return isSeq(first)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is a sequence i.e. an array or a string, otherwise `false`.',\n seeAlso: ['collection?', 'array?', 'string?'],\n examples: [\n 'sequence?([])',\n 'sequence?([1, 2, 3])',\n 'sequence?(object(\"a\", 10))',\n 'sequence?(\"Albert\")',\n 'sequence?(42)',\n 'sequence?(10.1)',\n 'sequence?((x, y) -> x + y)',\n ],\n },\n },\n\n 'object?': {\n evaluate: ([first]): boolean => isObj(first),\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is an object, otherwise `false`.',\n seeAlso: ['collection?', 'array?', 'string?', 'function?'],\n examples: [\n 'object?(object(\"a\", 10))',\n 'object?(42)',\n 'object?(10.1)',\n 'object?((x, y) -> x + y)',\n 'object?(#\"^start\")',\n 'object?(\"false\")',\n 'object?([1, 2, 3])',\n ],\n },\n },\n\n 'regexp?': {\n evaluate: ([value]): boolean => isRegularExpression(value),\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is a regexp, otherwise `false`.',\n seeAlso: ['regexp', 'match', 'string?', 'function?'],\n examples: [\n 'regexp?(regexp(\"^start\"))',\n 'regexp?(#\"^start\")',\n 'regexp?(-12)',\n 'regexp?({})',\n 'regexp?(10.1)',\n 'regexp?((x, y) -> x + y)',\n 'regexp?(false)',\n 'regexp?(\"false\")',\n 'regexp?([1, 2, 3])',\n ],\n },\n },\n\n 'finite?': {\n evaluate: ([value], sourceCodeInfo): boolean => {\n assertNumber(value, sourceCodeInfo)\n return Number.isFinite(value)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'number' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is finite, otherwise `false`.',\n seeAlso: ['positive-infinity?', 'negative-infinity?', 'number?'],\n examples: [\n 'finite?(1.0)',\n 'finite?(1 / 0)',\n 'finite?(-1 / 0)',\n ],\n },\n },\n\n 'positive-infinity?': {\n evaluate: ([value], sourceCodeInfo): boolean => {\n assertNumber(value, sourceCodeInfo)\n return value === Number.POSITIVE_INFINITY\n },\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'number' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x equals positive infinity, otherwise `false`.',\n seeAlso: ['negative-infinity?', 'finite?'],\n examples: [\n 'positive-infinity?(1.0)',\n 'positive-infinity?(1 / 0)',\n 'positive-infinity?(-1 / 0)',\n ],\n },\n },\n\n 'negative-infinity?': {\n evaluate: ([value], sourceCodeInfo): boolean => {\n assertNumber(value, sourceCodeInfo)\n return value === Number.NEGATIVE_INFINITY\n },\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'number' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x equals negative infinity, otherwise `false`.',\n seeAlso: ['positive-infinity?', 'finite?'],\n examples: [\n 'negative-infinity?(1.0)',\n 'negative-infinity?(1 / 0)',\n 'negative-infinity?(-1 / 0)',\n ],\n },\n },\n\n 'true?': {\n evaluate: ([value]): boolean => {\n return value === true\n },\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is `true`, otherwise `false`.',\n seeAlso: ['false?', 'boolean?', 'boolean'],\n examples: [\n 'true?(false)',\n 'true?(true)',\n 'true?(1)',\n 'true?(0)',\n ],\n },\n },\n\n 'false?': {\n evaluate: ([value]): boolean => {\n return value === false\n },\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is `true`, otherwise `false`.',\n seeAlso: ['true?', 'boolean?', 'boolean'],\n examples: [\n 'false?(false)',\n 'false?(true)',\n 'false?(1)',\n 'false?(0)',\n ],\n },\n },\n\n 'empty?': {\n evaluate: ([coll], sourceCodeInfo): boolean => {\n if (coll === null)\n return true\n\n assertColl(coll, sourceCodeInfo)\n if (typeof coll === 'string')\n return coll.length === 0\n\n if (Array.isArray(coll))\n return coll.length === 0\n\n return Object.keys(coll).length === 0\n },\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: ['collection', 'string', 'null'] } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is empty or `null`, otherwise `false`.',\n seeAlso: ['not-empty?', 'collection.not-empty', 'null?', 'blank?', 'count'],\n examples: [\n 'empty?([])',\n 'empty?([1, 2, 3])',\n 'empty?({})',\n 'empty?({ a: 2 })',\n 'empty?(\"\")',\n 'empty?(\"Albert\")',\n 'empty?(null)',\n ],\n },\n },\n 'not-empty?': {\n evaluate: ([coll], sourceCodeInfo): boolean => {\n if (coll === null)\n return false\n\n assertColl(coll, sourceCodeInfo)\n if (typeof coll === 'string')\n return coll.length > 0\n\n if (Array.isArray(coll))\n return coll.length > 0\n\n return Object.keys(coll).length > 0\n },\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: ['collection', 'string', 'null'] } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `false` if $x is empty or `null`, otherwise `true`.',\n seeAlso: ['empty?', 'collection.not-empty', 'null?'],\n examples: [\n 'not-empty?([])',\n 'not-empty?([1, 2, 3])',\n 'not-empty?({})',\n 'not-empty?({ a: 2 })',\n 'not-empty?(\"\")',\n 'not-empty?(\"Albert\")',\n 'not-empty?(null)',\n ],\n },\n },\n 'vector?': {\n evaluate: ([vector]): boolean => isVector(vector),\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n description: 'Checks if a value is a `vector`. A `vector` is an array of `numbers`.',\n seeAlso: ['matrix?', 'grid?', 'array?'],\n returns: { type: 'boolean' },\n args: { value: { type: 'any', description: 'The value to check.' } },\n variants: [{ argumentNames: ['value'] }],\n examples: [\n 'vector?(1)',\n 'vector?([1, 2, 3])',\n 'vector?([1, 2, \"3\"])',\n ],\n },\n },\n 'matrix?': {\n evaluate: ([matrix]): boolean => isMatrix(matrix),\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n description: 'Checks if a value is a `matrix`. A `matrix` is an array of arrays of `numbers`.',\n seeAlso: ['vector?', 'grid?', 'array?'],\n returns: { type: 'boolean' },\n args: { value: { type: 'any', description: 'The value to check.' } },\n variants: [{ argumentNames: ['value'] }],\n examples: [\n 'matrix?(1)',\n 'matrix?([1, 2, 3])',\n 'matrix?([[1, 2], [3, 4]])',\n 'matrix?([[1, 2], [3, \"4\"]])',\n 'matrix?([[1, 2], [3]])',\n ],\n },\n },\n 'grid?': {\n evaluate: ([table]): boolean => isGrid(table),\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n description: 'Checks if a `value` is a `grid`. A `grid` is an `array` of `arrays` where all inner `arrays` have the same length.',\n seeAlso: ['vector?', 'matrix?', 'array?'],\n returns: { type: 'boolean' },\n args: { value: { type: 'any', description: 'The value to check.' } },\n variants: [{ argumentNames: ['value'] }],\n examples: [\n 'grid?(\"1\")',\n 'grid?([\"1\", 2, 3])',\n 'grid?([[\"1\", 2], [3, 4]])',\n 'grid?([[\"1\", 2], [3, \"4\"]])',\n 'grid?([[\"1\", 2], [3]])',\n ],\n },\n },\n\n}\n","import { LitsError } from '../../errors'\nimport type { RegularExpression } from '../../parser/types'\nimport { assertRegularExpression, assertStringOrRegularExpression, isRegularExpression } from '../../typeGuards/lits'\nimport { assertString, isString } from '../../typeGuards/string'\nimport { toFixedArity } from '../../utils/arity'\nimport { REGEXP_SYMBOL } from '../../utils/symbols'\nimport type { BuiltinNormalExpressions } from '../interface'\n\nexport const regexpNormalExpression: BuiltinNormalExpressions = {\n 'regexp': {\n evaluate: ([sourceArg, flagsArg], sourceCodeInfo): RegularExpression => {\n assertString(sourceArg, sourceCodeInfo)\n const source = sourceArg || '(?:)'\n const flags = typeof flagsArg === 'string' ? flagsArg : ''\n\n try {\n // eslint-disable-next-line no-new\n new RegExp(source, flags) // Throws if invalid regexp\n }\n catch (e) {\n throw new LitsError(`Invalid regular expression: ${source} ${flags}`, sourceCodeInfo)\n }\n return {\n [REGEXP_SYMBOL]: true,\n sourceCodeInfo,\n s: source,\n f: flags,\n }\n },\n arity: { min: 1, max: 2 },\n docs: {\n category: 'regular-expression',\n returns: { type: 'regexp' },\n args: {\n pattern: { type: 'string' },\n flags: { type: 'string', description: 'Optional flags for the regular expression. Possible values are the same as Javascript RegExp takes.' },\n },\n variants: [\n { argumentNames: ['pattern'] },\n { argumentNames: ['pattern', 'flags'] },\n ],\n description: 'Creates a RegExp from $pattern and $flags.',\n examples: [\n 'regexp(\"^\\\\s*(.*)$\")',\n '#\"^\\\\s*(.*)$\"',\n 'regexp(\"albert\", \"ig\")',\n '#\"albert\"ig',\n ],\n seeAlso: ['-short-regexp', 'match', 'replace', 'replace-all', 'regexp?'],\n hideOperatorForm: true,\n },\n },\n 'match': {\n evaluate: ([text, regexp], sourceCodeInfo): string[] | null => {\n assertRegularExpression(regexp, sourceCodeInfo)\n if (!isString(text))\n return null\n\n const regExp = new RegExp(regexp.s, regexp.f)\n const match = regExp.exec(text)\n if (match)\n return [...match]\n\n return null\n },\n arity: toFixedArity(2),\n docs: {\n category: 'regular-expression',\n returns: { type: 'any', array: true },\n args: {\n a: { type: 'regexp' },\n b: { type: 'string' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: `Matches $b against regular expression $a.\nIf $b is a string and matches the regular expression, a \\`match\\`-array is returned, otherwise \\`null\\` is returned.`,\n seeAlso: ['regexp', 'replace', 'replace-all', '-short-regexp', 'regexp?'],\n examples: [\n 'match(\" A string\", regexp(\"^\\\\\\\\s*(.*)$\"))',\n 'match(\" A string\", #\"^\\\\s*(.*)$\")',\n 'match(\"My name is Albert\", #\"albert\"i)',\n 'match(\"My name is Ben\", #\"albert\"i)',\n 'match(null, #\"albert\"i)',\n 'match(1, #\"albert\"i)',\n 'match({}, #\"albert\"i)',\n ],\n },\n },\n 'replace': {\n evaluate: ([str, regexp, value], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n assertStringOrRegularExpression(regexp, sourceCodeInfo)\n assertString(value, sourceCodeInfo)\n\n const matcher = isRegularExpression(regexp) ? new RegExp(regexp.s, `${regexp.f}`) : regexp\n return str.replace(matcher, value)\n },\n arity: toFixedArity(3),\n docs: {\n category: 'regular-expression',\n returns: { type: 'any', array: true },\n args: {\n a: { type: 'string' },\n b: { type: ['regexp', 'string'] },\n x: { type: 'string' },\n },\n variants: [{ argumentNames: ['a', 'b', 'x'] }],\n description: 'Returns a new string with first match of regular expression $b replaced by $x.',\n seeAlso: ['replace-all', 'regexp', 'match', '-short-regexp'],\n examples: [\n 'replace(\"Duck duck\", \"u\", \"i\")',\n 'replace(\"Duck duck\", #\"u\", \"i\")',\n 'replace(\"abcABC\", regexp(\"a\", \"i\"), \"-\")',\n 'replace(\"abcABC\", regexp(\"a\", \"gi\"), \"-\")',\n 'replace(\"abcABC\", #\"a\"i, \"-\")',\n 'replace(\"abcABC\", #\"a\"gi, \"-\")',\n ],\n },\n },\n 'replace-all': {\n evaluate: ([str, regexp, value], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n assertStringOrRegularExpression(regexp, sourceCodeInfo)\n assertString(value, sourceCodeInfo)\n const matcher = isRegularExpression(regexp) ? new RegExp(regexp.s, `${regexp.f.includes('g') ? regexp.f : `${regexp.f}g`}`) : regexp\n return str.replaceAll(matcher, value)\n },\n arity: toFixedArity(3),\n docs: {\n category: 'regular-expression',\n returns: { type: 'any', array: true },\n args: {\n a: { type: 'string' },\n b: { type: ['regexp', 'string'] },\n x: { type: 'string' },\n },\n variants: [{ argumentNames: ['a', 'b', 'x'] }],\n description: 'Returns a new string with all matches of regular expression $b replaced by $x.',\n seeAlso: ['replace', 'regexp', 'match', '-short-regexp'],\n examples: [\n 'replace-all(\"Duck duck\", \"u\", \"i\")',\n 'replace-all(\"Duck duck\", regexp(\"u\"), \"i\")',\n 'replace-all(\"abcABC\", regexp(\"a\", \"i\"), \"-\")',\n 'replace-all(\"abcABC\", regexp(\"a\", \"gi\"), \"-\")',\n 'replace-all(\"abcABC\", #\"a\"i, \"-\")',\n 'replace-all(\"abcABC\", #\"a\"gi, \"-\")',\n ],\n },\n },\n}\n","import { LitsError } from '../../errors'\nimport type { Arr } from '../../interface'\nimport { assertArray } from '../../typeGuards/array'\nimport { assertStringOrRegularExpression, isObj } from '../../typeGuards/lits'\nimport { assertNumber } from '../../typeGuards/number'\nimport { assertString, assertStringOrNumber } from '../../typeGuards/string'\nimport { toFixedArity } from '../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../interface'\n\nconst blankRegexp = /^\\s*$/\nexport const stringNormalExpression: BuiltinNormalExpressions = {\n 'str': {\n evaluate: (params: Arr) => {\n return params.reduce((result: string, param) => {\n const paramStr\n = param === undefined || param === null\n ? ''\n : isObj(param)\n ? JSON.stringify(param)\n : Array.isArray(param)\n ? JSON.stringify(param)\n : `${param}`\n return result + paramStr\n }, '')\n },\n arity: {},\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: { values: { type: 'any', rest: true } },\n variants: [{ argumentNames: ['values'] }],\n description: 'Concatenats $values into one string. If `value` equals `null` empty string is returned.',\n seeAlso: ['++', 'join', 'string.template', 'string.string-repeat', 'number'],\n examples: [\n 'str(\"A string\", \", and another string\", \" ...and more\")',\n 'str(\"Just one string\")',\n 'str()',\n 'str(0, false, true, null, #\"^kalle\", [1, 2, 3], {a: \"a\"})',\n ],\n hideOperatorForm: true,\n },\n },\n\n 'number': {\n evaluate: ([str], sourceCodeInfo): number => {\n assertString(str, sourceCodeInfo)\n const number = Number(str)\n if (Number.isNaN(number))\n throw new LitsError(`Could not convert '${str}' to a number.`, sourceCodeInfo)\n\n return number\n },\n arity: toFixedArity(1),\n docs: {\n category: 'string',\n returns: { type: 'number' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Parses $s to a number.',\n seeAlso: ['str', 'number?', 'integer?'],\n examples: [\n 'number(\"10\")',\n 'number(\"010\")',\n 'number(\"-1.01\")',\n ],\n },\n },\n\n 'lower-case': {\n evaluate: ([str], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n return str.toLowerCase()\n },\n arity: toFixedArity(1),\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Returns $s converted to lower case.',\n seeAlso: ['upper-case', 'string.capitalize'],\n examples: [\n 'lower-case(\"Albert\")',\n 'lower-case(\"\")',\n ],\n },\n },\n\n 'upper-case': {\n evaluate: ([str], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n return str.toUpperCase()\n },\n arity: toFixedArity(1),\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Returns $s converted to upper case.',\n seeAlso: ['lower-case', 'string.capitalize'],\n examples: [\n 'upper-case(\"Albert\")',\n 'upper-case(\"\")',\n ],\n },\n },\n\n 'trim': {\n evaluate: ([str], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n return str.trim()\n },\n arity: toFixedArity(1),\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Returns a new string with leading and trailing whitespaces removed.',\n seeAlso: ['string.trim-left', 'string.trim-right', 'blank?'],\n examples: [\n 'trim(\" Albert \")',\n 'trim(\" \")',\n 'trim(\"\")',\n ],\n },\n },\n\n 'join': {\n evaluate: ([stringList, delimiter], sourceCodeInfo): string => {\n assertArray(stringList, sourceCodeInfo)\n stringList.forEach(str => assertStringOrNumber(str, sourceCodeInfo))\n assertString(delimiter, sourceCodeInfo)\n return stringList.join(delimiter)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: {\n a: { type: 'array' },\n b: { type: 'string' },\n arr: { type: 'array' },\n delimiter: { type: 'string' },\n },\n variants: [{ argumentNames: ['arr', 'delimiter'] }],\n description: 'Returns a new string by concatenating all of the elements in $arr, separated by $delimiter.',\n seeAlso: ['split', 'str', '++', 'sequence.interpose'],\n examples: [\n 'map([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], str) join \", \"',\n '([0, 1, 2, 3, 4, 5, 6, 7, 8, 9] map str) join \", \"',\n 'join([\"Albert\", 10], \", \")',\n 'join([\"Albert\", \"Mojir\"], \" \")',\n 'join(map([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], str), \", \")',\n ],\n },\n },\n\n 'split': {\n evaluate: ([str, stringOrRegExpValue, limit], sourceCodeInfo): string[] => {\n assertString(str, sourceCodeInfo)\n assertStringOrRegularExpression(stringOrRegExpValue, sourceCodeInfo)\n if (limit !== undefined)\n assertNumber(limit, sourceCodeInfo, { integer: true, nonNegative: true })\n\n const delimiter\n = typeof stringOrRegExpValue === 'string'\n ? stringOrRegExpValue\n : new RegExp(stringOrRegExpValue.s, stringOrRegExpValue.f)\n return str.split(delimiter, limit)\n },\n arity: { min: 2, max: 3 },\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: {\n a: { type: 'string' },\n b: { type: 'string' },\n s: { type: 'string' },\n delimiter: { type: 'string' },\n limit: { type: 'integer' },\n },\n variants: [\n { argumentNames: ['s', 'delimiter'] },\n { argumentNames: ['s', 'delimiter', 'limit'] },\n ],\n description: 'Divides $s into an array of substrings. The division is done by searching for `delimiter`. If `limit` as provided, at most `limit` number of substrings are returned.',\n seeAlso: ['join', 'string.split-lines'],\n examples: [\n '\"Albert Mojir\" split \" \"',\n 'split(\"Albert Mojir\", \" \")',\n 'split(\"abcdefghijklmnopqrstuvw\", #\"[aoueiy]\")',\n 'split(\"0123456789\", \"\")',\n 'split(\"0123456789\", \"\", 5) map number',\n ],\n },\n },\n 'blank?': {\n evaluate: ([value], sourceCodeInfo): boolean => {\n if (value === null) {\n return true\n }\n assertString(value, sourceCodeInfo)\n return blankRegexp.test(value)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'string',\n returns: { type: 'boolean' },\n args: { s: { type: ['string', 'null'] } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Returns true if $s is null or only contains whitespace characters.',\n seeAlso: ['trim', 'empty?', 'string?'],\n examples: [\n 'blank?(\"\")',\n 'blank?(null)',\n 'blank?(\"\\n\")',\n 'blank?(\" \")',\n 'blank?(\".\")',\n ],\n },\n },\n}\n","import type { Any, Arr } from '../../interface'\nimport type {\n CompFunction,\n ConstantlyFunction,\n FunctionLike,\n} from '../../parser/types'\nimport { toAny } from '../../utils'\nimport { getArityFromFunction, toFixedArity } from '../../utils/arity'\nimport { FUNCTION_SYMBOL } from '../../utils/symbols'\nimport type { BuiltinNormalExpressions } from '../interface'\nimport { assertArray } from '../../typeGuards/array'\nimport { assertFunctionLike } from '../../typeGuards/lits'\n\nexport const functionalNormalExpression: BuiltinNormalExpressions = {\n '|>': {\n evaluate: ([value, func], sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertFunctionLike(func, sourceCodeInfo)\n return executeFunction(func, [value], contextStack, sourceCodeInfo)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'functional',\n returns: { type: 'any' },\n args: {\n a: { type: 'any' },\n b: { type: 'function' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Takes a value $a and a function $b, and returns the result of applying $b to $a.',\n seeAlso: ['apply', 'comp'],\n examples: [\n `\n1 |> inc |> inc`,\n `range(10)\n |> map(_, -> $ ^ 2) // [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]\n |> filter(_, odd?) // [1, 9, 25, 49, 81]\n |> reduce(_, +, 0) // 165\n |> sqrt // 12.84523257866513\n |> round(_, 2)`,\n ],\n },\n },\n 'apply': {\n evaluate: ([func, ...params]: Arr, sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertFunctionLike(func, sourceCodeInfo)\n const paramsLength = params.length\n const last = params[paramsLength - 1]\n assertArray(last, sourceCodeInfo)\n const applyArray = [...params.slice(0, -1), ...last]\n return executeFunction(func, applyArray, contextStack, sourceCodeInfo)\n },\n arity: { min: 2 },\n docs: {\n category: 'functional',\n returns: { type: 'any' },\n args: {\n a: { type: 'function' },\n b: { type: 'array' },\n fun: { type: 'function' },\n args: { type: 'array' },\n },\n variants: [{ argumentNames: ['fun', 'args'] }],\n description: 'Call supplied function $fun with specified arguments $args.',\n seeAlso: ['|>'],\n examples: [\n `\napply(+, [1, 2, 3])`,\n `\napply(\n (x, y) -> sqrt(x ^ 2 + y ^ 2),\n [3, 4]\n)`,\n `\n(x, y) -> sqrt(x ^ 2 + y ^ 2) apply [3, 4]`,\n ],\n },\n },\n\n 'identity': {\n evaluate: ([value]): Any => {\n return toAny(value)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'functional',\n returns: { type: 'any' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns $x.',\n seeAlso: ['constantly', 'functional.fnull'],\n examples: ['identity(1)', 'identity(\"Albert\")', 'identity({ a: 1 })', 'identity(null)'],\n },\n },\n\n 'comp': {\n evaluate: (params, sourceCodeInfo): CompFunction => {\n params.forEach(param => assertFunctionLike(param, sourceCodeInfo))\n return {\n [FUNCTION_SYMBOL]: true,\n sourceCodeInfo,\n functionType: 'Comp',\n params,\n arity: params.length > 0 ? getArityFromFunction(params.at(-1) as FunctionLike) : { min: 1, max: 1 },\n }\n },\n arity: {},\n docs: {\n category: 'functional',\n returns: { type: 'function' },\n args: {\n a: { type: 'function' },\n b: { type: 'function' },\n fns: { type: 'function', rest: true },\n },\n variants: [{ argumentNames: ['fns'] }],\n description: `Takes a variable number of functions and returns a function that is the composition of those.\n\n The returned function takes a variable number of arguments,\n applies the rightmost function to the args,\n the next function (right-to-left) to the result, etc.`,\n seeAlso: ['|>', 'functional.juxt', 'functional.complement'],\n examples: [\n `\nlet negative-quotient = comp(-, /);\nnegative-quotient(9, 3)`,\n `\nlet x = { bar: { foo: 42 } };\ncomp(\"foo\", \"bar\")(x)`,\n ],\n },\n },\n\n 'constantly': {\n evaluate: ([value], sourceCodeInfo): ConstantlyFunction => {\n return {\n [FUNCTION_SYMBOL]: true,\n sourceCodeInfo,\n functionType: 'Constantly',\n value: toAny(value),\n arity: {},\n }\n },\n arity: toFixedArity(1),\n docs: {\n category: 'functional',\n returns: { type: 'function' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns a function that takes any number of arguments and always returns $x.',\n seeAlso: ['identity', 'functional.fnull'],\n examples: [\n `\nlet always-true = constantly(true);\nalways-true(9, 3)`,\n ],\n },\n },\n\n}\n","import type { FunctionReference } from '../../../reference'\nimport { assertNonUndefined } from '../../typeGuards'\nimport { assertFunctionLike } from '../../typeGuards/lits'\nimport { isLitsFunction } from '../../typeGuards/litsFunction'\nimport { toFixedArity } from '../../utils/arity'\nimport { generateDocString } from '../../utils/docString/generateDocString'\nimport type { Arity, BuiltinNormalExpressions } from '../interface'\n\nexport function getMetaNormalExpression(normalExpressionReference: Record<string, FunctionReference>): BuiltinNormalExpressions {\n return {\n doc: {\n evaluate: ([fn], sourceCodeInfo): string => {\n assertNonUndefined(normalExpressionReference)\n assertFunctionLike(fn, sourceCodeInfo)\n if (!isLitsFunction(fn)) {\n return ''\n }\n if (fn.functionType === 'Builtin') {\n const reference = normalExpressionReference[fn.name]\n return reference ? generateDocString(reference) : ''\n }\n if (fn.functionType === 'UserDefined' || fn.functionType === 'NativeJsFunction') {\n return fn.docString\n }\n return ''\n },\n arity: toFixedArity(1),\n docs: {\n category: 'meta',\n returns: { type: 'string' },\n args: { fun: { type: 'function' } },\n variants: [{ argumentNames: ['fun'] }],\n description: 'Returns documentation string of the $fun.',\n seeAlso: ['arity'],\n examples: [\n 'doc(+)',\n `\nlet add = (x, y) -> do\n \"\"\"\n Adds two numbers.\n Args:\n x: First number.\n y: Second number.\n Returns:\n Sum of x and y.\n \"\"\"\n x + y;\nend;\n\ndoc(add)`,\n ],\n },\n },\n arity: {\n evaluate: ([fn], sourceCodeInfo): Arity => {\n assertFunctionLike(fn, sourceCodeInfo)\n return isLitsFunction(fn) ? fn.arity : toFixedArity(1)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'meta',\n returns: { type: 'object' },\n args: { fun: { type: 'function' } },\n variants: [{ argumentNames: ['fun'] }],\n description: 'Returns arity of the $fun. The arity is an object with the properties: `min` and `max`. If the function has fixed arity, `min` and `max` are equal to the number of required parameters. If no restrictions apply, empty object is returned.',\n seeAlso: ['doc'],\n examples: [\n 'arity(+)',\n 'arity(defined?)',\n `\nlet add = (x, y = 0) -> do\n x + y;\nend;\n\narity(add)`,\n `\nlet foo = (k, ...x) -> do\n k + x;\nend;\n arity(foo)`,\n ],\n },\n },\n }\n}\n","import { assertNonEmptyVector, assertVector } from '../../typeGuards/annotatedArrays'\nimport { toFixedArity } from '../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../interface'\n\nfunction calcMedian(vector: number[]): number {\n const sorted = [...vector].sort((a, b) => a - b)\n const mid = Math.floor(sorted.length / 2)\n return sorted.length % 2 === 0\n ? (sorted[mid - 1]! + sorted[mid]!) / 2\n : sorted[mid]!\n}\n\nexport const vectorNormalExpression: BuiltinNormalExpressions = {\n sum: {\n evaluate: ([vector], sourceCodeInfo): number => {\n assertVector(vector, sourceCodeInfo)\n return vector.reduce((acc, val) => acc + val, 0)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'vector',\n returns: { type: 'number' },\n args: {\n vector: { type: 'vector', description: 'The vector to sum.' },\n },\n variants: [{ argumentNames: ['vector'] }],\n description: 'Returns the **sum** of all elements in the `vector`. Returns `0` for an empty vector.',\n seeAlso: ['prod', 'mean', 'median', 'vector.sum'],\n examples: [\n 'sum([1, 2, 3, 4, 5])',\n 'sum([1, -2, 3])',\n 'sum([])',\n ],\n },\n },\n\n prod: {\n evaluate: ([vector], sourceCodeInfo): number => {\n assertVector(vector, sourceCodeInfo)\n return vector.reduce((acc, val) => acc * val, 1)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'vector',\n returns: { type: 'number' },\n args: {\n vector: { type: 'vector', description: 'The vector to multiply.' },\n },\n variants: [{ argumentNames: ['vector'] }],\n description: 'Returns the **product** of all elements in the `vector`. Returns `1` for an empty vector.',\n seeAlso: ['sum', 'mean', 'median', 'vector.prod'],\n examples: [\n 'prod([1, 2, 3, 4, 5])',\n 'prod([1, -2, 3])',\n 'prod([])',\n ],\n },\n },\n\n mean: {\n evaluate: ([vector], sourceCodeInfo): number => {\n assertNonEmptyVector(vector, sourceCodeInfo)\n return vector.reduce((acc, val) => acc + val, 0) / vector.length\n },\n arity: toFixedArity(1),\n docs: {\n category: 'vector',\n returns: { type: 'number' },\n args: {\n vector: { type: 'vector', description: 'The vector to calculate the mean of.' },\n },\n variants: [{ argumentNames: ['vector'] }],\n description: 'Returns the arithmetic **mean** of all elements in the `vector`. Throws for an empty vector.',\n seeAlso: ['median', 'sum', 'prod', 'vector.mean'],\n examples: [\n 'mean([1, 2, 3, 4, 5])',\n 'mean([1, -2, 3])',\n ],\n },\n },\n\n median: {\n evaluate: ([vector], sourceCodeInfo): number => {\n assertNonEmptyVector(vector, sourceCodeInfo)\n return calcMedian(vector)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'vector',\n returns: { type: 'number' },\n args: {\n vector: { type: 'vector', description: 'The vector to calculate the median of.' },\n },\n variants: [{ argumentNames: ['vector'] }],\n description: 'Returns the **median** of all elements in the `vector`. For even-length vectors, returns the average of the two middle values. Throws for an empty vector.',\n seeAlso: ['mean', 'sum', 'prod', 'vector.median'],\n examples: [\n 'median([1, 2, 3, 4, 5])',\n 'median([1, 2, 3, 4])',\n 'median([3, 1, 4, 1, 5])',\n ],\n },\n },\n}\n","import { smartTrim } from '..'\nimport type { Argument, FunctionReference, TypedValue } from '../../../reference'\n\nexport function generateDocString(reference: FunctionReference): string {\n return smartTrim(`\n ${reference.title}\n\n ${reference.description\n .replace(/`(.+?)`/g, '$1')\n .replace(/\\$(\\w+)/g, '$1')\n .replace(/\\*\\*\\*(.+)\\*\\*\\*/g, '$1')\n .replace(/\\*\\*(.+)\\*\\*/g, '$1')\n }\n\n Signature:\n ${signature(reference).join('\\n ')}\n\n Arguments:\n ${argStrings(reference).join('\\n ')}\n\n Examples:\n${reference.examples.map(example => smartTrim(example, 4)).join('\\n\\n')}`)\n}\n\nfunction signature({ title, variants, args, returns, _isOperator }: FunctionReference): string[] {\n const functionForms = variants.map((variant) => {\n const form = ` ${title}(${variant.argumentNames.map((argName) => {\n let result = ''\n const arg = args[argName]!\n if (arg.rest) {\n result += '...'\n }\n result += argName\n return result\n }).join(', ')})`\n\n return `${form} -> ${type(returns)}`\n })\n\n const operatorForm = _isOperator ? ['', 'Operator:', ` a ${title} b -> ${type(returns)}`] : []\n\n return [\n ...functionForms,\n ...operatorForm,\n ]\n}\n\nfunction type(arg: Argument | TypedValue) {\n const argType = arg.type\n const types = Array.isArray(argType) ? argType : [argType]\n const typeString = types.join(' | ')\n return arg.array || arg.rest ? `Array<${typeString}>` : typeString\n}\n\nfunction argStrings(reference: FunctionReference): string[] {\n return Object.entries(reference.args).map(([argName, arg]) => `${argName}: ${type(arg)}`)\n}\n","import type { BuiltinNormalExpression, BuiltinNormalExpressions } from '../interface'\nimport type { Any } from '../../interface'\nimport type { FunctionReference } from '../../../reference'\nimport type { CoreNormalExpressionName } from '../../../reference/api'\n\n// Core categories - always available\nimport { bitwiseNormalExpression } from '../core/bitwise'\nimport { collectionNormalExpression } from '../core/collection'\nimport { arrayNormalExpression } from '../core/array'\nimport { sequenceNormalExpression } from '../core/sequence'\nimport { mathNormalExpression } from '../core/math'\nimport { miscNormalExpression } from '../core/misc'\nimport { objectNormalExpression } from '../core/object'\nimport { predicatesNormalExpression } from '../core/predicates'\nimport { regexpNormalExpression } from '../core/regexp'\nimport { stringNormalExpression } from '../core/string'\nimport { functionalNormalExpression } from '../core/functional'\nimport { getMetaNormalExpression } from '../core/meta'\nimport { vectorNormalExpression } from '../core/vector'\n\nconst normalExpressionReference: Record<string, FunctionReference> = {}\n\nexport function setNormalExpressionReference(reference: Record<CoreNormalExpressionName, FunctionReference>) {\n Object.assign(normalExpressionReference, reference)\n}\n\nconst expressions: BuiltinNormalExpressions = {\n // Core categories\n ...bitwiseNormalExpression,\n ...collectionNormalExpression,\n ...arrayNormalExpression,\n ...sequenceNormalExpression,\n ...mathNormalExpression,\n ...getMetaNormalExpression(normalExpressionReference),\n ...miscNormalExpression,\n ...objectNormalExpression,\n ...predicatesNormalExpression,\n ...regexpNormalExpression,\n ...stringNormalExpression,\n ...functionalNormalExpression,\n ...vectorNormalExpression,\n}\n\nObject.entries(expressions).forEach(([name, expression]) => {\n expression.name = name\n})\n\nexport const normalExpressions: BuiltinNormalExpressions = {\n ...expressions,\n}\n\nexport const normalExpressionTypes: Record<string, number> = {}\nexport const allNormalExpressions: BuiltinNormalExpression<Any>[] = []\n\nObject.entries(normalExpressions).forEach(([key, value], index) => {\n normalExpressionTypes[key] = index\n allNormalExpressions.push(value)\n})\n","import type { Any } from '../../interface'\nimport type { Node, SpecialExpressionNode } from '../../parser/types'\nimport { asAny } from '../../typeGuards/lits'\nimport type { BuiltinSpecialExpression, FunctionDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type AndNode = SpecialExpressionNode<[typeof specialExpressionTypes['&&'], Node[]]>\n\nconst docs: FunctionDocs = {\n category: 'special-expression',\n returns: {\n type: 'any',\n },\n args: {\n a: { type: 'any' },\n b: { type: 'any' },\n c: {\n type: 'any',\n rest: true,\n },\n },\n variants: [\n { argumentNames: ['a', 'b'] },\n { argumentNames: ['a', 'b', 'c'] },\n ],\n description: `\nComputes logical \\`and\\`. Evaluation of expressions starts from left.\nAs soon as an \\`expression\\` evaluates to a falsy value, the result is returned.\n\nIf all expressions evaluate to truthy values, the value of the last expression is returned.`,\n examples: [\n 'true && 1',\n '&&(1, 1)',\n '&&(3 > 2, \"string\")',\n '&&(3 < 2, \"string\")',\n '&&(true, true, true, true)',\n '&&(true, true, 0, true)',\n ],\n}\n\nexport const andSpecialExpression: BuiltinSpecialExpression<Any, AndNode> = {\n arity: {},\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n let value: Any = true\n\n for (const param of node[1][1]) {\n value = evaluateNode(param, contextStack)\n if (!value)\n break\n }\n\n return value\n },\n evaluateAsNormalExpression: (params, sourceCodeInfo) => {\n let value: Any = true\n for (const param of params) {\n value = asAny(param, sourceCodeInfo)\n if (!value)\n break\n }\n return value\n },\n\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => getUndefinedSymbols(node[1][1], contextStack, builtin, evaluateNode),\n}\n","import type { Any } from '../../interface'\nimport type { Node, SpecialExpressionNode } from '../../parser/types'\nimport type { BuiltinSpecialExpression, CustomDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type CondNode = SpecialExpressionNode<[typeof specialExpressionTypes['cond'], [Node, Node][]]>\n\nconst docs: CustomDocs = {\n category: 'special-expression',\n customVariants: ['cond cond-branch cond-branch ... end'],\n details: [\n ['cond-branch', 'case test then body', 'A branch of the cond expression.'],\n ['test', 'expression', 'The condition to test.'],\n ['body', 'expressions', 'The expressions to evaluate if the test is truthy.'],\n ],\n description: 'Used for branching. `cond-branches` are tested sequentially from the top. If no branch is tested truthy, `null` is returned.',\n examples: [\n `\ncond\n case false then write!(\"FALSE\")\n case true then write!(\"TRUE\")\nend`,\n `\ncond\n case false then write!(\"FALSE\")\n case null then write!(\"null\")\nend ?? write!(\"TRUE\")`,\n `\ncond\n case false then write!(\"FALSE\")\n case null then write!(\"null\")\nend ?? write!(\"TRUE\")`,\n ],\n}\n\nexport const condSpecialExpression: BuiltinSpecialExpression<Any, CondNode> = {\n arity: {},\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n const params = node[1][1]\n for (const [test, form] of params) {\n const value = evaluateNode(test, contextStack)\n if (!value)\n continue\n\n return evaluateNode(form, contextStack)\n }\n return null\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => getUndefinedSymbols(node[1][1].flat(), contextStack, builtin, evaluateNode),\n}\n","import type { Any } from '../../interface'\nimport type { Node, SpecialExpressionNode } from '../../parser/types'\nimport type { BuiltinSpecialExpression, CustomDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type SwitchNode = SpecialExpressionNode<[typeof specialExpressionTypes['switch'], Node, [Node, Node][]]>\n\nconst docs: CustomDocs = {\n category: 'special-expression',\n customVariants: ['switch value switch-branch switch-branch ... end'],\n details: [\n ['value', 'any', 'The value to test.'],\n ['switch-branch', 'case test then body', 'A branch of the switch expression.'],\n ['test', 'expression', 'The condition to test.'],\n ['body', 'expressions', 'The expressions to evaluate if the test is truthy.'],\n ],\n description: 'Used for branching. `switch-branches` are tested sequentially from the top against `value`. If no branch is tested truthy, `null` is returned.',\n examples: [\n `\nswitch 1\n case 1 then write!(\"One\")\n case 2 then write!(\"Two\")\nend`,\n `\nswitch 2\n case 1 then write!(\"One\")\n case 2 then write!(\"Two\")\nend`,\n `\nswitch 3\n case 1 then write!(\"One\")\n case 2 then write!(\"Two\")\nend`,\n ],\n}\n\nexport const switchSpecialExpression: BuiltinSpecialExpression<Any, SwitchNode> = {\n arity: {},\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n const [, switchValueNode, cases] = node[1]\n const switchValue = evaluateNode(switchValueNode, contextStack)\n for (const [test, form] of cases) {\n const value = evaluateNode(test, contextStack)\n if (value === switchValue) {\n return evaluateNode(form, contextStack)\n }\n }\n return null\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => getUndefinedSymbols([node[1][1], ...node[1][2].flat()], contextStack, builtin, evaluateNode),\n}\n","import { NodeTypes } from '../constants/constants'\nimport type {\n ExpressionNode,\n Node,\n NormalBuiltinSymbolNode,\n NormalExpressionNode,\n NormalExpressionNodeWithName,\n SpecialBuiltinSymbolNode,\n SpreadNode,\n SymbolNode,\n UserDefinedSymbolNode,\n} from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\n\nexport function isSymbolNode(node: Node): node is SymbolNode {\n const nodeType = node[0]\n return NodeTypes.UserDefinedSymbol === nodeType\n || NodeTypes.NormalBuiltinSymbol === nodeType\n || NodeTypes.SpecialBuiltinSymbol === nodeType\n}\nexport function asSymbolNode(node: Node, sourceCodeInfo?: SourceCodeInfo): SymbolNode {\n assertSymbolNode(node, sourceCodeInfo)\n return node\n}\nexport function assertSymbolNode(node: Node, sourceCodeInfo?: SourceCodeInfo): asserts node is SymbolNode {\n if (!isSymbolNode(node))\n throw getAssertionError('SymbolNode', node, sourceCodeInfo)\n}\n\nexport function isUserDefinedSymbolNode(node: Node): node is UserDefinedSymbolNode {\n return NodeTypes.UserDefinedSymbol === node[0]\n}\nexport function asUserDefinedSymbolNode(node: Node, sourceCodeInfo?: SourceCodeInfo): UserDefinedSymbolNode {\n assertUserDefinedSymbolNode(node, sourceCodeInfo)\n return node\n}\nexport function assertUserDefinedSymbolNode(node: Node, sourceCodeInfo?: SourceCodeInfo): asserts node is UserDefinedSymbolNode {\n if (!isUserDefinedSymbolNode(node))\n throw getAssertionError('UserDefinedSymbolNode', node, sourceCodeInfo)\n}\n\nexport function isNormalBuiltinSymbolNode(node: Node): node is NormalBuiltinSymbolNode {\n return NodeTypes.NormalBuiltinSymbol === node[0]\n}\n\nexport function isSpecialBuiltinSymbolNode(node: Node): node is SpecialBuiltinSymbolNode {\n return NodeTypes.SpecialBuiltinSymbol === node[0]\n}\n\nexport function isNormalExpressionNode(node: Node): node is NormalExpressionNode {\n return node[0] === NodeTypes.NormalExpression\n}\nexport function asNormalExpressionNode(node: Node, sourceCodeInfo?: SourceCodeInfo): NormalExpressionNode {\n assertNormalExpressionNode(node, sourceCodeInfo)\n return node\n}\nexport function assertNormalExpressionNode(\n node: Node,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts node is NormalExpressionNode {\n if (!isNormalExpressionNode(node))\n throw getAssertionError('NormalExpressionNode', node, sourceCodeInfo)\n}\n\nexport function isNormalExpressionNodeWithName(node: Node): node is NormalExpressionNodeWithName {\n if (!isNormalExpressionNode(node)) {\n return false\n }\n return isSymbolNode(node[1][0])\n}\nexport function asNormalExpressionNodeWithName(\n node: Node,\n sourceCodeInfo?: SourceCodeInfo,\n): NormalExpressionNodeWithName {\n assertNormalExpressionNodeWithName(node, sourceCodeInfo)\n return node\n}\nexport function assertNormalExpressionNodeWithName(\n node: Node,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts node is NormalExpressionNodeWithName {\n if (!isNormalExpressionNodeWithName(node))\n throw getAssertionError('NormalExpressionNodeWithName', node, sourceCodeInfo)\n}\n\nexport function isExpressionNode(node: Node): node is ExpressionNode {\n return isNormalExpressionNode(node)\n || node[0] === NodeTypes.SpecialExpression\n || node[0] === NodeTypes.Number\n || node[0] === NodeTypes.String\n}\nexport function asExpressionNode(node: Node, sourceCodeInfo?: SourceCodeInfo): ExpressionNode {\n assertExpressionNode(node, sourceCodeInfo)\n return node\n}\nexport function assertExpressionNode(node: Node, sourceCodeInfo?: SourceCodeInfo): asserts node is ExpressionNode {\n if (!isExpressionNode(node))\n throw getAssertionError('ExpressionNode', node, sourceCodeInfo)\n}\n\nexport function isSpreadNode(node: Node): node is SpreadNode {\n return node[0] === NodeTypes.Spread\n}\n","import type { SpecialExpressionNode, SymbolNode } from '../../parser/types'\nimport { assertSymbolNode, isUserDefinedSymbolNode } from '../../typeGuards/astNode'\nimport { toFixedArity } from '../../utils/arity'\nimport type { BuiltinSpecialExpression, FunctionDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type DefinedNode = SpecialExpressionNode<[typeof specialExpressionTypes['defined?'], SymbolNode]>\n\nconst docs: FunctionDocs = {\n category: 'special-expression',\n returns: {\n type: 'boolean',\n },\n args: {\n symbol: { type: 'any' },\n },\n variants: [\n { argumentNames: ['symbol'] },\n ],\n description: `Returns \\`true\\` if \\`symbol\\` is defined, \\`false\\` otherwise.\n\nBuilt-in symbols are always considered defined. For user-defined symbols, checks if the symbol exists in the current scope.`,\n examples: [\n 'let x = 42; defined?(x)',\n 'defined?(x)',\n 'defined?(+)',\n ],\n}\n\nexport const definedSpecialExpression: BuiltinSpecialExpression<boolean, DefinedNode> = {\n arity: toFixedArity(1),\n docs,\n evaluate: (node, contextStack) => {\n const symbolNode = node[1][1]\n assertSymbolNode(symbolNode)\n if (!isUserDefinedSymbolNode(symbolNode)) {\n return true // If the symbol is not a user defined symbol, it is defined. normal or special builtin\n }\n const lookUpResult = contextStack.lookUp(symbolNode)\n return lookUpResult !== null\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => getUndefinedSymbols([node[1][1]], contextStack, builtin, evaluateNode),\n}\n","import type { JsFunction } from '../Lits/Lits'\nimport type { SpecialExpressionType } from '../builtin'\nimport type { Arity } from '../builtin/interface'\nimport type { specialExpressionTypes } from '../builtin/specialExpressionTypes'\nimport type { FunctionType, NodeType, NodeTypes } from '../constants/constants'\nimport type { Context } from '../evaluator/interface'\nimport type { Any, Arr, Coll } from '../interface'\nimport type { ReservedSymbol } from '../tokenizer/reservedNames'\nimport type { SourceCodeInfo, Token } from '../tokenizer/token'\nimport type { FUNCTION_SYMBOL, REGEXP_SYMBOL } from '../utils/symbols'\n\nexport interface ParseState {\n position: number\n}\n\nexport type EvaluatedFunction = [BindingTarget[], Node[], Context]\n\ninterface GenericLitsFunction {\n [FUNCTION_SYMBOL]: true\n sourceCodeInfo?: SourceCodeInfo\n functionType: FunctionType\n arity: Arity\n}\n\nexport interface RegularExpression {\n [REGEXP_SYMBOL]: true\n sourceCodeInfo?: SourceCodeInfo\n s: string\n f: string\n}\n\nexport interface NativeJsFunction extends GenericLitsFunction {\n functionType: 'NativeJsFunction'\n name: string | undefined // name\n nativeFn: JsFunction\n docString: string // documentation string\n}\n\nexport function isJsFunction(fn: unknown): fn is JsFunction {\n return typeof fn === 'object' && fn !== null && 'fn' in fn && typeof (fn as JsFunction).fn === 'function'\n}\n\nexport function assertJsFunction(fn: unknown): asserts fn is JsFunction {\n if (!isJsFunction(fn)) {\n throw new TypeError('Expected a NativeJsFunction')\n }\n}\n\nexport interface NativeJsModule {\n [key: string]: NativeJsFunction | NativeJsModule\n}\n\nexport interface UserDefinedFunction extends GenericLitsFunction {\n functionType: 'UserDefined'\n name: string | undefined // name\n evaluatedfunction: EvaluatedFunction\n docString: string // documentation string\n}\n\nexport interface PartialFunction extends GenericLitsFunction {\n functionType: 'Partial'\n function: FunctionLike\n params: Arr\n placeholders: number[] // indexes of the placeholders\n}\n\nexport interface CompFunction extends GenericLitsFunction {\n functionType: 'Comp'\n params: Arr\n}\n\nexport interface ConstantlyFunction extends GenericLitsFunction {\n functionType: 'Constantly'\n value: Any\n}\n\nexport interface JuxtFunction extends GenericLitsFunction {\n functionType: 'Juxt'\n params: Arr\n}\n\nexport interface ComplementFunction extends GenericLitsFunction {\n functionType: 'Complement'\n function: FunctionLike\n}\n\nexport interface EveryPredFunction extends GenericLitsFunction {\n functionType: 'EveryPred'\n params: Arr\n}\n\nexport interface SomePredFunction extends GenericLitsFunction {\n functionType: 'SomePred'\n params: Arr\n}\n\nexport interface FNullFunction extends GenericLitsFunction {\n functionType: 'Fnull'\n function: FunctionLike\n params: Arr\n}\n\nexport interface NormalBuiltinFunction extends GenericLitsFunction {\n functionType: 'Builtin'\n normalBuiltinSymbolType: number\n name: string\n}\n\nexport interface SpecialBuiltinFunction extends GenericLitsFunction {\n functionType: 'SpecialBuiltin'\n specialBuiltinSymbolType:\n | typeof specialExpressionTypes['&&']\n | typeof specialExpressionTypes['||']\n | typeof specialExpressionTypes['array']\n | typeof specialExpressionTypes['object']\n | typeof specialExpressionTypes['defined?']\n | typeof specialExpressionTypes['recur']\n | typeof specialExpressionTypes['throw']\n | typeof specialExpressionTypes['??']\n}\n\nexport interface ModuleFunction extends GenericLitsFunction {\n functionType: 'Module'\n moduleName: string\n functionName: string\n}\n\nexport type LitsFunction =\n | NativeJsFunction\n | UserDefinedFunction\n | NormalBuiltinFunction\n | SpecialBuiltinFunction\n | ModuleFunction\n | PartialFunction\n | CompFunction\n | ConstantlyFunction\n | JuxtFunction\n | ComplementFunction\n | EveryPredFunction\n | SomePredFunction\n | FNullFunction\n\nexport type LitsFunctionType = LitsFunction['functionType']\n\nexport type FunctionLike = LitsFunction | Coll | number\n\nexport type DebugData = {\n token: Token\n nameToken?: Token\n}\nexport type Node<T extends NodeType = NodeType, Payload = unknown> = [T, Payload] | [T, Payload, SourceCodeInfo]\n\nexport type ExpressionNode = NormalExpressionNode | SpecialExpressionNode | NumberNode | StringNode\n\nexport type SpreadNode = Node<typeof NodeTypes.Spread, Node> // Payload should be array or object depending on context\nexport type NumberNode = Node<typeof NodeTypes.Number, number>\nexport type StringNode = Node<typeof NodeTypes.String, string>\nexport type UserDefinedSymbolNode = Node<typeof NodeTypes.UserDefinedSymbol, string>\nexport type NormalBuiltinSymbolNode = Node<typeof NodeTypes.NormalBuiltinSymbol, number>\nexport type SpecialBuiltinSymbolNode = Node<typeof NodeTypes.SpecialBuiltinSymbol, SpecialExpressionType>\nexport type SymbolNode = UserDefinedSymbolNode | NormalBuiltinSymbolNode | SpecialBuiltinSymbolNode\nexport type ReservedSymbolNode = Node<typeof NodeTypes.ReservedSymbol, ReservedSymbol>\nexport type SpecialExpressionNode<T extends [SpecialExpressionType, ...unknown[]] = [SpecialExpressionType, ...unknown[]]> = Node<typeof NodeTypes.SpecialExpression, T> // [name, params]\n\nexport type NormalExpressionNodeWithName = Node<typeof NodeTypes.NormalExpression, [NormalBuiltinSymbolNode | UserDefinedSymbolNode, Node[]]> // [params, name]\nexport type NormalExpressionNodeExpression = Node<typeof NodeTypes.NormalExpression, [Node, Node[]]> // [name, node as function] node can be string number object or array\nexport type NormalExpressionNode = NormalExpressionNodeWithName | NormalExpressionNodeExpression\nexport const bindingTargetTypes = {\n symbol: 11,\n rest: 12,\n object: 13,\n array: 14,\n} as const\n\nexport type BindingTargetType = typeof bindingTargetTypes[keyof typeof bindingTargetTypes]\n\ntype GenericTarget<T extends BindingTargetType, Payload extends unknown[]> = [T, Payload] | [T, Payload, SourceCodeInfo]\n\nexport type SymbolBindingTarget = GenericTarget<typeof bindingTargetTypes.symbol, [SymbolNode, Node | undefined /* default value */]>\nexport type RestBindingTarget = GenericTarget<typeof bindingTargetTypes.rest, [string, Node | undefined /* default value */]>\nexport type ObjectBindingTarget = GenericTarget<typeof bindingTargetTypes.object, [Record<string, BindingTarget>, Node | undefined /* default value */]>\nexport type ArrayBindingTarget = GenericTarget<typeof bindingTargetTypes.array, [(BindingTarget | null)[], Node | undefined /* default value */]>\n\nexport type BindingTarget = SymbolBindingTarget | RestBindingTarget | ObjectBindingTarget | ArrayBindingTarget\n\nexport type BindingNode = Node<typeof NodeTypes.Binding, [BindingTarget, Node]> // [target, value]\n\ntype AstBody = Node[]\nexport interface Ast {\n body: AstBody // body\n hasDebugData: boolean\n}\n","import { LitsError } from '../errors'\nimport type { Any } from '../interface'\nimport { type BindingTarget, type Node, type RestBindingTarget, type UserDefinedSymbolNode, bindingTargetTypes } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { assertUnknownRecord } from '../typeGuards'\nimport { assertArray } from '../typeGuards/array'\nimport { asAny, assertAny } from '../typeGuards/lits'\n\nexport function walkDefaults(\n bindingTarget: BindingTarget,\n onDefault: (Node: Node) => void,\n): void {\n if (bindingTarget[0] === bindingTargetTypes.object) {\n Object.values(bindingTarget[1][0]).forEach((element) => {\n if (element[1][1]) {\n onDefault(element[1][1])\n }\n walkDefaults(element, onDefault)\n })\n }\n else if (bindingTarget[0] === bindingTargetTypes.array) {\n for (let index = 0; index < bindingTarget[1][0].length; index += 1) {\n const element = bindingTarget[1][0][index] ?? null\n if (element === null) {\n continue\n }\n if (element[1][1]) {\n onDefault(element[1][1])\n }\n walkDefaults(element, onDefault)\n }\n }\n}\n\nexport function evaluateBindingNodeValues(\n target: BindingTarget,\n value: Any,\n evaluate: (Node: Node) => Any,\n): Record<string, Any> {\n const sourceCodeInfo = target[2]\n const record: Record<string, Any> = {}\n createRecord(target, value, evaluate, sourceCodeInfo, record)\n return record\n}\n\nfunction createRecord(\n bindingTarget: BindingTarget,\n value: Any,\n evaluate: (Node: Node) => Any,\n sourceCodeInfo: SourceCodeInfo | undefined,\n record: Record<string, Any>,\n): void {\n if (bindingTarget[0] === bindingTargetTypes.object) {\n assertUnknownRecord(value, sourceCodeInfo)\n const capturedKeys = new Set<string>()\n let restElement: RestBindingTarget | undefined\n Object.entries(bindingTarget[1][0]).forEach(([key, element]) => {\n if (element[0] === bindingTargetTypes.rest) {\n restElement = element\n return\n }\n capturedKeys.add(key)\n const val = (value[key] !== undefined ? value[key] : element[1][1] && evaluate(element[1][1])) ?? null\n assertAny(val, sourceCodeInfo)\n createRecord(element, val, evaluate, sourceCodeInfo, record)\n })\n if (restElement) {\n const restValues = Object.entries(value)\n .filter(([key]) => !capturedKeys.has(key))\n .reduce((acc: Record<string, Any>, [key, val]) => {\n acc[key] = asAny(val)\n return acc\n }, {})\n\n record[restElement[1][0]] = restValues\n }\n }\n else if (bindingTarget[0] === bindingTargetTypes.array) {\n let restIndex: number | null = null\n assertArray(value, sourceCodeInfo)\n for (let index = 0; index < bindingTarget[1][0].length; index += 1) {\n const element = bindingTarget[1][0][index] ?? null\n if (element === null) {\n continue\n }\n if (element[0] === bindingTargetTypes.rest) {\n restIndex = index\n break\n }\n const val = (value[index] !== undefined ? value[index] : element[1][1] && evaluate(element[1][1])) ?? null\n assertAny(val, sourceCodeInfo)\n createRecord(element, val, evaluate, sourceCodeInfo, record)\n }\n if (restIndex !== null) {\n const restValues = value.slice(restIndex)\n const restElement = bindingTarget[1][0][restIndex]! as RestBindingTarget\n record[restElement[1][0]] = restValues\n }\n }\n else if (bindingTarget[0] === bindingTargetTypes.rest) {\n record[bindingTarget[1][0]] = asAny(value)\n }\n else {\n record[(bindingTarget[1][0] as UserDefinedSymbolNode)[1]] = asAny(value)\n }\n}\n\nexport function getAllBindingTargetNames(bindingTarget: BindingTarget): Record<string, true> {\n const names: Record<string, true> = {}\n getNamesFromBindingTarget(bindingTarget, names)\n return names\n}\n\nfunction getNamesFromBindingTarget(target: BindingTarget | null, names: Record<string, true>): void {\n if (target === null) {\n return\n }\n if (target[0] === bindingTargetTypes.array) {\n for (const element of target[1][0]) {\n getNamesFromBindingTarget(element, names)\n }\n }\n else if (target[0] === bindingTargetTypes.object) {\n for (const element of Object.values(target[1][0])) {\n getNamesFromBindingTarget(element, names)\n }\n }\n else if (target[0] === bindingTargetTypes.rest) {\n if (names[target[1][0]]) {\n throw new LitsError(`Duplicate binding name: ${target[1][0]}`, target[2])\n }\n names[target[1][0]] = true\n }\n else {\n if (names[target[1][0][1]]) {\n throw new LitsError(`Duplicate binding name: ${target[1][0]}`, target[2])\n }\n names[target[1][0][1]] = true\n }\n}\n","import type { Any } from '../../interface'\nimport type { BindingNode, SpecialExpressionNode } from '../../parser/types'\nimport { addToSet } from '../../utils'\nimport { evaluateBindingNodeValues as evaluateBindingTargetValues, getAllBindingTargetNames, walkDefaults } from '../bindingNode'\nimport type { BuiltinSpecialExpression } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type DefNode = SpecialExpressionNode<[typeof specialExpressionTypes['0_def'], BindingNode]> // binding, value\n\nexport const defSpecialExpression: BuiltinSpecialExpression<Any, DefNode> = {\n arity: {},\n evaluate: (node, contextStack, { evaluateNode }) => {\n const bindingNode: BindingNode = node[1][1]\n const target = bindingNode[1][0]\n const value = bindingNode[1][1]\n const bindingValue = evaluateNode(value, contextStack)\n const values = evaluateBindingTargetValues(target, bindingValue, Node => evaluateNode(Node, contextStack))\n contextStack.exportValues(values, target[2])\n return bindingValue\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => {\n const bindingNode: BindingNode = node[1][1]\n const target = bindingNode[1][0]\n const value = bindingNode[1][1]\n const bindingResult = getUndefinedSymbols([value], contextStack, builtin, evaluateNode)\n walkDefaults(target, (defaultNode) => {\n addToSet(bindingResult, getUndefinedSymbols([defaultNode], contextStack, builtin, evaluateNode))\n })\n contextStack.addValues(getAllBindingTargetNames(target), target[2])\n return bindingResult\n },\n}\n","import type { Context } from '../../evaluator/interface'\nimport type { Any } from '../../interface'\nimport type { Node, SpecialExpressionNode } from '../../parser/types'\nimport type { BuiltinSpecialExpression, CustomDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type DoNode = SpecialExpressionNode<[typeof specialExpressionTypes['block'], Node[]]>\n\nconst docs: CustomDocs = {\n category: 'special-expression',\n customVariants: ['do body end'],\n details: [\n ['body', 'expressions', 'The expressions to evaluate.'],\n ],\n description: 'Evaluates `body`. Resulting value is the value of the last expression.',\n examples: [\n `\ndo\n let a = 1 + 2 + 3 + 4;\n let b = -> $ * ( $ + 1 );\n b(a)\nend`,\n ],\n}\n\nexport const doSpecialExpression: BuiltinSpecialExpression<Any, DoNode> = {\n arity: {},\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n const newContext: Context = {}\n\n const newContextStack = contextStack.create(newContext)\n let result: Any = null\n for (const form of node[1][1])\n result = evaluateNode(form, newContextStack)\n\n return result\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => {\n return getUndefinedSymbols(node[1][1], contextStack.create({}), builtin, evaluateNode)\n },\n}\n","import type { ContextStack } from '../../evaluator/ContextStack'\nimport type { Context, EvaluateNode } from '../../evaluator/interface'\nimport type { GetUndefinedSymbols, UndefinedSymbols } from '../../getUndefinedSymbols'\nimport {\n type EvaluatedFunction,\n type LitsFunction,\n type SpecialExpressionNode,\n bindingTargetTypes,\n} from '../../parser/types'\nimport { isAny } from '../../typeGuards/lits'\nimport { addToSet } from '../../utils'\nimport { FUNCTION_SYMBOL } from '../../utils/symbols'\nimport { getAllBindingTargetNames, walkDefaults } from '../bindingNode'\nimport type { Builtin, BuiltinSpecialExpression } from '../interface'\nimport type { Function } from '../utils'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type LambdaNode = SpecialExpressionNode<[typeof specialExpressionTypes['0_lambda'], Function, string]>\n\nexport const lambdaSpecialExpression: BuiltinSpecialExpression<LitsFunction, LambdaNode> = {\n arity: {},\n evaluate: (node, contextStack, { builtin, getUndefinedSymbols, evaluateNode }) => {\n const fn = node[1][1]\n const docString = node[1][2]\n const evaluatedFunction = evaluateFunction(fn, contextStack, builtin, getUndefinedSymbols, evaluateNode)\n\n const min = evaluatedFunction[0].filter(arg => arg[0] !== bindingTargetTypes.rest && arg[1][1] === undefined).length\n const max = evaluatedFunction[0].some(arg => arg[0] === bindingTargetTypes.rest) ? undefined : evaluatedFunction[0].length\n const arity = { min: min > 0 ? min : undefined, max }\n\n const litsFunction: LitsFunction = {\n [FUNCTION_SYMBOL]: true,\n sourceCodeInfo: node[2],\n functionType: 'UserDefined',\n name: undefined,\n evaluatedfunction: evaluatedFunction,\n arity,\n docString,\n }\n\n return litsFunction\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => {\n const fn = node[1][1]\n return getFunctionUnresolvedSymbols(fn, contextStack, getUndefinedSymbols, builtin, evaluateNode)\n },\n\n}\n\nfunction evaluateFunction(\n fn: Function,\n contextStack: ContextStack,\n builtin: Builtin,\n getUndefinedSymbols: GetUndefinedSymbols,\n evaluateNode: EvaluateNode,\n): EvaluatedFunction {\n const functionContext: Context = {}\n\n const context = fn[0].reduce((ctx: Context, arg) => {\n Object.keys(getAllBindingTargetNames(arg)).forEach((name) => {\n ctx[name] = { value: null }\n })\n return ctx\n }, {})\n const undefinedSymbols = getUndefinedSymbols(fn[1], contextStack.new(context), builtin, evaluateNode)\n undefinedSymbols.forEach((name) => {\n const value = contextStack.getValue(name)\n if (isAny(value)) {\n functionContext[name] = { value }\n }\n })\n\n const evaluatedFunction: EvaluatedFunction = [\n fn[0],\n fn[1],\n functionContext,\n ]\n\n return evaluatedFunction\n}\n\nfunction getFunctionUnresolvedSymbols(\n fn: Function,\n contextStack: ContextStack,\n getUndefinedSymbols: GetUndefinedSymbols,\n builtin: Builtin,\n evaluateNode: EvaluateNode,\n): UndefinedSymbols {\n const result = new Set<string>()\n const newContext: Context = { self: { value: null } }\n\n fn[0].forEach((arg) => {\n Object.assign(newContext, getAllBindingTargetNames(arg))\n\n walkDefaults(arg, (defaultNode) => {\n addToSet(result, getUndefinedSymbols([defaultNode], contextStack, builtin, evaluateNode))\n })\n })\n\n const newContextStack = contextStack.create(newContext)\n const overloadResult = getUndefinedSymbols(fn[1], newContextStack, builtin, evaluateNode)\n addToSet(result, overloadResult)\n return result\n}\n","import type { Any } from '../../interface'\nimport type { Node, SpecialExpressionNode } from '../../parser/types'\nimport type { BuiltinSpecialExpression, CustomDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type IfNode = SpecialExpressionNode<[typeof specialExpressionTypes['if'], [Node, Node, Node?]]>\n\nconst docs: CustomDocs = {\n category: 'special-expression',\n customVariants: ['if test then true-expr else false-expr', 'if test then true-expr'],\n details: [\n ['test', 'expression', 'The condition to test.'],\n ['true-expr', 'expression', 'The expression to evaluate if the test is truthy.'],\n ['false-expr', 'expression', 'The expression to evaluate if the test is falsy.'],\n ],\n description: 'Either `true-expr` or `false-expr` branch is taken. `true-expr` is selected when $test is truthy. If $test is falsy `false-expr` is executed, if no `false-expr` exists, `null` is returned.',\n examples: [\n `\nif true then\n write!(\"TRUE\")\nelse\n write!(\"FALSE\")\nend`,\n 'if false then write!(\"TRUE\") else write!(\"FALSE\") end',\n 'if true then write!(\"TRUE\") end',\n 'if false then write!(\"TRUE\") end',\n ],\n}\n\nexport const ifSpecialExpression: BuiltinSpecialExpression<Any, IfNode> = {\n arity: { min: 2, max: 3 },\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n const [conditionNode, trueNode, falseNode] = node[1][1]\n if (evaluateNode(conditionNode, contextStack)) {\n return evaluateNode(trueNode, contextStack)\n }\n else if (falseNode) {\n return evaluateNode(falseNode, contextStack)\n }\n return null\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) =>\n getUndefinedSymbols(node[1][1].filter(n => !!n), contextStack, builtin, evaluateNode),\n}\n","import type { Any } from '../../interface'\nimport type { Node, SpecialExpressionNode } from '../../parser/types'\nimport type { BuiltinSpecialExpression, CustomDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type UnlessNode = SpecialExpressionNode<[typeof specialExpressionTypes['unless'], [Node, Node, Node?]]>\n\nconst docs: CustomDocs = {\n category: 'special-expression',\n customVariants: ['unless test then true-expr else false-expr end', 'unless test true-expr end'],\n details: [\n ['test', 'expression', 'The condition to test.'],\n ['true-expr', 'expression', 'The expressions to evaluate if the test is falsy.'],\n ['false-expr', 'expression', 'The expressions to evaluate if the test is truthy.'],\n ],\n description: 'Either `true-expr` or `false-expr` branch is taken. `true-expr` is selected when $test is falsy. If $test is truthy `false-expr` is executed, if no `false-expr` exists, `null` is returned.',\n examples: [\n `\nunless true then\n write!(\"TRUE\")\nelse\n write!(\"FALSE\")\nend`,\n 'unless false then write!(\"TRUE\") else write!(\"FALSE\") end',\n 'unless true then write!(\"TRUE\") end',\n 'unless false then write!(\"TRUE\") end',\n ],\n}\n\nexport const unlessSpecialExpression: BuiltinSpecialExpression<Any, UnlessNode> = {\n arity: {},\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n const [conditionNode, trueNode, falseNode] = node[1][1]\n if (!evaluateNode(conditionNode, contextStack)) {\n return evaluateNode(trueNode, contextStack)\n }\n else if (falseNode) {\n return evaluateNode(falseNode, contextStack)\n }\n return null\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) =>\n getUndefinedSymbols(node[1][1].filter(n => !!n), contextStack, builtin, evaluateNode),\n}\n","import type { Any } from '../../interface'\nimport type { BindingNode, SpecialExpressionNode } from '../../parser/types'\nimport { addToSet } from '../../utils'\nimport { toFixedArity } from '../../utils/arity'\nimport { evaluateBindingNodeValues, getAllBindingTargetNames, walkDefaults } from '../bindingNode'\nimport type { BuiltinSpecialExpression, CustomDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type LetNode = SpecialExpressionNode<[typeof specialExpressionTypes['let'], BindingNode]>\n\nconst docs: CustomDocs = {\n category: 'special-expression',\n customVariants: ['let s = value;'],\n details: [\n ['s', 'symbol', 'The name of the variable to bind.'],\n ['value', 'any', 'The value to bind to the variable.'],\n ],\n description: `\n Binds local variables s to \\`value\\`. \\`value\\` can be any expression. The scope of the variables is the body of the let expression.`,\n examples: [`\nlet a = 1 + 2 + 3 + 4;\nlet b = -> $ * ( $ + 1 );\nwrite!(\"a\", a, \"b\", b)`],\n}\n\nexport const letSpecialExpression: BuiltinSpecialExpression<Any, LetNode> = {\n arity: toFixedArity(0),\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n const bindingNode = node[1][1]\n const target = bindingNode[1][0]\n const value = bindingNode[1][1]\n const bindingValue = evaluateNode(value, contextStack)\n const values = evaluateBindingNodeValues(target, bindingValue, Node => evaluateNode(Node, contextStack))\n contextStack.addValues(values, target[2])\n return bindingValue\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => {\n const bindingNode = node[1][1]\n const target = bindingNode[1][0]\n const value = bindingNode[1][1]\n const bindingResult = getUndefinedSymbols([value], contextStack, builtin, evaluateNode)\n walkDefaults(target, (defaultNode) => {\n addToSet(bindingResult, getUndefinedSymbols([defaultNode], contextStack, builtin, evaluateNode))\n })\n contextStack.addValues(getAllBindingTargetNames(target), target[2])\n return bindingResult\n },\n}\n","import { LitsError, RecurSignal } from '../../errors'\nimport type { Context } from '../../evaluator/interface'\nimport type { Any } from '../../interface'\nimport type { BindingNode, Node, SpecialExpressionNode } from '../../parser/types'\nimport { asAny } from '../../typeGuards/lits'\nimport { joinSets } from '../../utils'\nimport { valueToString } from '../../utils/debug/debugTools'\nimport { evaluateBindingNodeValues, getAllBindingTargetNames } from '../bindingNode'\nimport type { BuiltinSpecialExpression, CustomDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type LoopNode = SpecialExpressionNode<[typeof specialExpressionTypes['loop'], BindingNode[], Node]> // bindings, body\n\nconst docs: CustomDocs = {\n category: 'special-expression',\n customVariants: ['loop (bindings) -> body'],\n details: [\n ['bindings', 'binding pairs', 'Comma-separated bindings with initial values, e.g. `n = 10, acc = 0`.'],\n ['body', 'expression', 'The expression to evaluate repeatedly. Use `recur` to loop back with new values.'],\n ],\n description: `Creates a loop with initial bindings. Use \\`recur\\` inside the body to jump back to the loop head with new binding values.\n\nIf \\`recur\\` is not called, the loop terminates and returns the value of the body expression.`,\n examples: [\n `loop (n = 10, acc = 0) -> do\n if n == 0 then\n acc\n else\n recur(n - 1, acc + n)\n end\nend`,\n `loop (n = 5, acc = 1) -> do\n if n <= 1 then\n acc\n else\n recur(n - 1, acc * n)\n end\nend`,\n ],\n}\n\nexport const loopSpecialExpression: BuiltinSpecialExpression<Any, LoopNode> = {\n arity: {},\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n const bindingNodes = node[1][1]\n const bindingContext: Context = bindingNodes.reduce((result: Context, bindingNode) => {\n const val = evaluateNode(bindingNode[1][1], contextStack.create(result))\n const valueRecord = evaluateBindingNodeValues(bindingNode[1][0], val, Node => evaluateNode(Node, contextStack))\n Object.entries(valueRecord).forEach(([name, value]) => {\n result[name] = { value }\n })\n return result\n }, {})\n const newContextStack = contextStack.create(bindingContext)\n\n const body = node[1][2]\n for (;;) {\n let result: Any = null\n try {\n result = evaluateNode(body, newContextStack)\n }\n catch (error) {\n if (error instanceof RecurSignal) {\n const params = error.params\n if (params.length !== bindingNodes.length) {\n throw new LitsError(\n `recur expected ${bindingNodes.length} parameters, got ${valueToString(params.length)}`,\n node[2],\n )\n }\n bindingNodes.forEach((bindingNode, index) => {\n const valueRecord = evaluateBindingNodeValues(bindingNode[1][0], asAny(params[index]), Node => evaluateNode(Node, contextStack))\n for (const [name, value] of Object.entries(valueRecord)) {\n bindingContext[name]!.value = value\n }\n })\n continue\n }\n throw error\n }\n return result\n }\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => {\n const bindingNodes = node[1][1]\n\n const newContext = bindingNodes\n .reduce((context: Context, bindingNode) => {\n const names = getAllBindingTargetNames(bindingNode[1][0])\n\n Object.keys(names).forEach((name) => {\n context[name] = { value: true }\n })\n return context\n }, {})\n\n const bindingValueNodes = bindingNodes.map(bindingNode => bindingNode[1][1])\n const bindingsResult = getUndefinedSymbols(bindingValueNodes, contextStack, builtin, evaluateNode)\n const paramsResult = getUndefinedSymbols([node[1][2]], contextStack.create(newContext), builtin, evaluateNode)\n return joinSets(bindingsResult, paramsResult)\n },\n}\n","import type { GetUndefinedSymbols, UndefinedSymbols } from '../../getUndefinedSymbols'\nimport type { ContextStack } from '../../evaluator/ContextStack'\nimport type { Context, EvaluateNode } from '../../evaluator/interface'\nimport type { Any, Arr } from '../../interface'\nimport type { BindingNode, Node, SpecialExpressionNode } from '../../parser/types'\nimport { asNonUndefined } from '../../typeGuards'\nimport { asAny, asColl, isSeq } from '../../typeGuards/lits'\nimport type { Builtin, BuiltinSpecialExpression, CustomDocs } from '../interface'\nimport { evaluateBindingNodeValues, getAllBindingTargetNames } from '../bindingNode'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\nimport { toFixedArity } from '../../utils/arity'\n\nexport type LoopBindingNode = [BindingNode, BindingNode[], Node?, Node?] // Binding, Let-Bindings, When, While\n\nexport type ForNode = SpecialExpressionNode<[typeof specialExpressionTypes['for'], LoopBindingNode[], Node]> // LoopBindings, body\nexport type DoSeqNode = SpecialExpressionNode<[typeof specialExpressionTypes['doseq'], LoopBindingNode[], Node]> // LoopBindings, body\n\ntype LoopNode = ForNode | DoSeqNode\n\nfunction addToContext(\n bindings: BindingNode[],\n context: Context,\n contextStack: ContextStack,\n evaluateNode: EvaluateNode,\n) {\n for (const bindingNode of bindings) {\n const [target, bindingValue] = bindingNode[1]\n const val = evaluateNode(bindingValue, contextStack)\n const valueRecord = evaluateBindingNodeValues(target, val, Node => evaluateNode(Node, contextStack))\n Object.entries(valueRecord).forEach(([name, value]) => {\n context[name] = { value }\n })\n }\n}\n\nfunction evaluateLoop(\n returnResult: boolean,\n loopNode: LoopNode,\n contextStack: ContextStack,\n evaluateNode: EvaluateNode,\n) {\n const sourceCodeInfo = loopNode[2]\n const [, loopBindings, body] = loopNode[1]\n\n const result: Arr = []\n\n const bindingIndices = loopBindings.map(() => 0)\n let abort = false\n while (!abort) {\n const context: Context = {}\n const newContextStack = contextStack.create(context)\n let skip = false\n bindingsLoop: for (let bindingIndex = 0; bindingIndex < loopBindings.length; bindingIndex += 1) {\n const [bindingNode, letBindings, whenNode, whileNode] = loopBindings[bindingIndex]!\n const [targetNode, valueNode] = bindingNode[1]\n const coll = asColl(evaluateNode(valueNode, newContextStack), sourceCodeInfo)\n const seq = isSeq(coll) ? coll : Object.entries(coll)\n if (seq.length === 0) {\n skip = true\n abort = true\n break\n }\n const index = asNonUndefined(bindingIndices[bindingIndex], sourceCodeInfo)\n if (index >= seq.length) {\n skip = true\n if (bindingIndex === 0) {\n abort = true\n break\n }\n bindingIndices[bindingIndex] = 0\n bindingIndices[bindingIndex - 1] = asNonUndefined(bindingIndices[bindingIndex - 1], sourceCodeInfo) + 1\n break\n }\n\n const val = asAny(seq[index], sourceCodeInfo)\n const valueRecord = evaluateBindingNodeValues(targetNode, val, Node => evaluateNode(Node, newContextStack))\n Object.entries(valueRecord).forEach(([name, value]) => {\n context[name] = { value }\n })\n if (letBindings) {\n addToContext(\n letBindings,\n context,\n newContextStack,\n evaluateNode,\n )\n }\n if (whenNode && !evaluateNode(whenNode, newContextStack)) {\n bindingIndices[bindingIndex] = asNonUndefined(bindingIndices[bindingIndex], sourceCodeInfo) + 1\n skip = true\n break bindingsLoop\n }\n if (whileNode && !evaluateNode(whileNode, newContextStack)) {\n bindingIndices[bindingIndex] = Number.POSITIVE_INFINITY\n skip = true\n break bindingsLoop\n }\n }\n if (!skip) {\n const value: Any = evaluateNode(body, newContextStack)\n if (returnResult)\n result.push(value)\n\n if (bindingIndices.length > 0)\n bindingIndices[bindingIndices.length - 1]! += 1\n }\n }\n\n return returnResult ? result : null\n}\n\nfunction analyze(\n loopNode: LoopNode,\n contextStack: ContextStack,\n getUndefinedSymbols: GetUndefinedSymbols,\n builtin: Builtin,\n evaluateNode: EvaluateNode,\n): UndefinedSymbols {\n const result = new Set<string>()\n const newContext: Context = {}\n const [, loopBindings, body] = loopNode[1]\n loopBindings.forEach((loopBindingNode) => {\n const [bindingNode, letBindings, whenNode, whileNode] = loopBindingNode\n const [target, value] = bindingNode[1]\n getUndefinedSymbols([value], contextStack.create(newContext), builtin, evaluateNode).forEach(symbol =>\n result.add(symbol),\n )\n Object.assign(newContext, getAllBindingTargetNames(target))\n if (letBindings) {\n letBindings.forEach((letBindingNode) => {\n const [letTarget, letValue] = letBindingNode[1]\n\n getUndefinedSymbols([letValue], contextStack.create(newContext), builtin, evaluateNode).forEach(symbol =>\n result.add(symbol),\n )\n Object.assign(newContext, getAllBindingTargetNames(letTarget))\n })\n }\n if (whenNode) {\n getUndefinedSymbols([whenNode], contextStack.create(newContext), builtin, evaluateNode).forEach(symbol =>\n result.add(symbol),\n )\n }\n if (whileNode) {\n getUndefinedSymbols([whileNode], contextStack.create(newContext), builtin, evaluateNode).forEach(symbol =>\n result.add(symbol),\n )\n }\n })\n getUndefinedSymbols([body], contextStack.create(newContext), builtin, evaluateNode).forEach(symbol =>\n result.add(symbol),\n )\n return result\n}\n\nconst forDocs: CustomDocs = {\n category: 'special-expression',\n customVariants: ['for (...binding) -> body'],\n details: [\n ['binding', 'loop-var in collection [...let-binding] [where whereExpr] [while whileExp]', 'A for loop binding'],\n ['loop-var', 'symbol', 'The name of the loop variable.'],\n ['collection', 'any', 'The collection to iterate over.'],\n ['let-binding', 'let binding', 'A let binding to create a local variable.'],\n ['whereExpr', 'expression', 'An expression that must evaluate to truthy for the loop body to be executed.'],\n ['whileExp', 'expression', 'An expression that must evaluate to truthy for the loop to continue.'],\n ['body', 'expressions', 'The expressions to evaluate for each iteration of the loop.'],\n ],\n returns: {\n type: 'any',\n array: true,\n },\n description: 'Iterates over `bindings`, evaluates `body` for each `binding` and returns an `array` of results.',\n examples: [\n `\nfor (i in [1, 2, 3]) -> i * 2\n `,\n `\nfor (\n i in range(10) let ii = i ^ 2 while ii < 40 when ii % 3 == 0,\n j in range(10) when j % 2 == 1\n) -> ii + j\n `,\n ],\n}\n\nexport const forSpecialExpression: BuiltinSpecialExpression<Any, ForNode> = {\n arity: toFixedArity(1),\n docs: forDocs,\n evaluate: (node, contextStack, helpers) => evaluateLoop(true, node, contextStack, helpers.evaluateNode),\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => analyze(node, contextStack, getUndefinedSymbols, builtin, evaluateNode),\n}\n\nconst doseqDocs: CustomDocs = {\n category: 'special-expression',\n customVariants: ['doseq (...binding) -> body'],\n details: [\n ['binding', 'loop-var in collection [...let-binding] [where whereExpr] [while whileExp]', 'A doseq loop binding'],\n ['loop-var', 'symbol', 'The name of the loop variable.'],\n ['collection', 'any', 'The collection to iterate over.'],\n ['let-binding', 'let binding', 'A let binding to create a local variable.'],\n ['whereExpr', 'expression', 'An expression that must evaluate to truthy for the loop body to be executed.'],\n ['whileExp', 'expression', 'An expression that must evaluate to truthy for the loop to continue.'],\n ['body', 'expressions', 'The expressions to evaluate for each iteration of the loop.'],\n ],\n returns: {\n type: 'null',\n },\n description: 'Iterates over `bindings`, evaluates `body` for each `binding` and returns `null`. This is useful for side effects.',\n examples: [\n `\ndoseq (i in [1, 2, 3]) -> write!(i * 2)\n `,\n ],\n}\n\nexport const doseqSpecialExpression: BuiltinSpecialExpression<null, DoSeqNode> = {\n arity: toFixedArity(1),\n docs: doseqDocs,\n evaluate: (node, contextStack, helpers) => {\n evaluateLoop(false, node, contextStack, helpers.evaluateNode)\n return null\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => analyze(node, contextStack, getUndefinedSymbols, builtin, evaluateNode),\n}\n","import type { Any } from '../../interface'\nimport type { Node, SpecialExpressionNode } from '../../parser/types'\nimport { asAny } from '../../typeGuards/lits'\nimport type { BuiltinSpecialExpression, FunctionDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type OrNode = SpecialExpressionNode<[typeof specialExpressionTypes['||'], Node[]]>\n\nconst docs: FunctionDocs = {\n category: 'special-expression',\n returns: {\n type: 'boolean',\n },\n args: {\n a: { type: 'any' },\n b: { type: 'any' },\n c: {\n type: 'any',\n rest: true,\n },\n },\n variants: [\n { argumentNames: ['a', 'b'] },\n { argumentNames: ['a', 'b', 'c'] },\n ],\n description: `\n Computes logical \\`or\\`. Evaluation of expressions evaluation starts from left.\n As soon as a \\`expression\\` evaluates to a truthy value, the result is returned.\n\n If all expressions evaluate to falsy values, the value of the last expression is returned.`,\n examples: [\n 'false || 1',\n '||(1, 1)',\n '||(3 > 2, \"string\")',\n '||(3 < 2, \"string\")',\n '||(false, false, false, true)',\n '||(1, 2, 3, 4)',\n ],\n}\n\nexport const orSpecialExpression: BuiltinSpecialExpression<Any, OrNode> = {\n arity: {},\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n let value: Any = false\n\n for (const param of node[1][1]) {\n value = evaluateNode(param, contextStack)\n if (value)\n break\n }\n\n return value\n },\n evaluateAsNormalExpression: (params, sourceCodeInfo) => {\n let value: Any = false\n for (const param of params) {\n value = asAny(param, sourceCodeInfo)\n if (value)\n break\n }\n return value\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => getUndefinedSymbols(node[1][1], contextStack, builtin, evaluateNode),\n}\n","import type { Any } from '../../interface'\nimport type { Node, SpecialExpressionNode } from '../../parser/types'\nimport { isUserDefinedSymbolNode } from '../../typeGuards/astNode'\nimport { asAny } from '../../typeGuards/lits'\nimport type { BuiltinSpecialExpression, FunctionDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type QqNode = SpecialExpressionNode<[typeof specialExpressionTypes['??'], Node[]]>\n\nconst docs: FunctionDocs = {\n category: 'special-expression',\n returns: {\n type: 'any',\n },\n args: {\n a: { type: 'any' },\n b: { type: 'any' },\n c: {\n type: 'any',\n rest: true,\n },\n },\n variants: [\n { argumentNames: ['a'] },\n { argumentNames: ['a', 'b'] },\n { argumentNames: ['a', 'b', 'c'] },\n ],\n description: `Nullish coalescing operator. Returns the first non-\\`null\\` value.\n\nEvaluation is short-circuited — as soon as a non-\\`null\\` value is found, the remaining expressions are not evaluated.\n\nIf all values are \\`null\\`, returns \\`null\\`.\n\nAlso works with undefined symbols — if a symbol is undefined, it is treated as \\`null\\`.`,\n examples: [\n '1 ?? 2',\n 'null ?? 2',\n '??(null)',\n '??(null, \"default\")',\n '??(1, \"default\")',\n 'false ?? \"default\"',\n '??(null, null, 3)',\n ],\n}\n\nexport const qqSpecialExpression: BuiltinSpecialExpression<Any, QqNode> = {\n arity: { min: 1 },\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n for (const param of node[1][1]) {\n if (isUserDefinedSymbolNode(param) && contextStack.lookUp(param) === null) {\n continue\n }\n const result = evaluateNode(param, contextStack)\n if (result !== null) {\n return result\n }\n }\n return null\n },\n\n evaluateAsNormalExpression: (params, sourceCodeInfo) => {\n for (const param of params) {\n const value = asAny(param, sourceCodeInfo)\n if (value !== null) {\n return value\n }\n }\n return null\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => getUndefinedSymbols(node[1][1], contextStack, builtin, evaluateNode),\n}\n","import { RecurSignal } from '../../errors'\nimport type { Node, SpecialExpressionNode } from '../../parser/types'\nimport type { BuiltinSpecialExpression, CustomDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type RecurNode = SpecialExpressionNode<[typeof specialExpressionTypes['recur'], Node[]]>\n\nconst docs: CustomDocs = {\n category: 'special-expression',\n customVariants: ['recur(...recur-args)'],\n description: 'Recursevly calls enclosing function or loop with its evaluated `recur-args`.',\n examples: [\n `\nlet foo = (n) -> do\n write!(n);\n if !(zero?(n)) then\n recur(n - 1)\n end\nend;\nfoo(3)`,\n `\n(n -> do\n write!(n);\n if !(zero?(n)) then\n recur(n - 1)\n end\nend)(3)`,\n `\nloop (n = 3) -> do\n write!(n);\n if !(zero?(n)) then\n recur(n - 1)\n end\nend`,\n ],\n}\n\nexport const recurSpecialExpression: BuiltinSpecialExpression<null, RecurNode> = {\n arity: {},\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n const params = node[1][1]\n const evaluatedParams = params.map(paramNode => evaluateNode(paramNode, contextStack))\n throw new RecurSignal(evaluatedParams)\n },\n evaluateAsNormalExpression: (params) => {\n throw new RecurSignal(params)\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) =>\n getUndefinedSymbols(node[1][1], contextStack, builtin, evaluateNode),\n}\n","import { UserDefinedError } from '../../errors'\nimport type { Node, SpecialExpressionNode } from '../../parser/types'\nimport { asString } from '../../typeGuards/string'\nimport { toFixedArity } from '../../utils/arity'\nimport type { BuiltinSpecialExpression, FunctionDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type ThrowNode = SpecialExpressionNode<[typeof specialExpressionTypes['throw'], Node]>\n\nconst docs: FunctionDocs = {\n category: 'special-expression',\n returns: {\n type: 'never',\n },\n args: {\n expr: {\n type: 'any',\n },\n },\n variants: [\n { argumentNames: ['expr'] },\n ],\n description: 'Throws `UserDefinedError` with message set to $expr evaluated. $expr must evaluate to a string.',\n examples: [\n 'try throw(\"You shall not pass!\") catch(error) \"Error: \" ++ error.message end',\n 'try throw(slice(\"You shall not pass!\", 0, 3)) catch(error) \"Error: \" ++ error.message end',\n ],\n}\n\nexport const throwSpecialExpression: BuiltinSpecialExpression<null, ThrowNode> = {\n arity: toFixedArity(1),\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n const message = asString(evaluateNode(node[1][1], contextStack), node[2], {\n nonEmpty: true,\n })\n throw new UserDefinedError(message, node[2])\n },\n evaluateAsNormalExpression: (params, sourceCodeInfo) => {\n const message = asString(params[0], sourceCodeInfo, {\n nonEmpty: true,\n })\n throw new UserDefinedError(message, undefined)\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => getUndefinedSymbols([node[1][1]], contextStack, builtin, evaluateNode),\n}\n","import type { Context } from '../../evaluator/interface'\nimport type { Any } from '../../interface'\nimport type { Node, SpecialExpressionNode, SymbolNode } from '../../parser/types'\nimport { joinSets } from '../../utils'\nimport type { BuiltinSpecialExpression, CustomDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type TryNode = SpecialExpressionNode<[typeof specialExpressionTypes['try'], Node, SymbolNode | undefined, Node]>\n\nconst docs: CustomDocs = {\n category: 'special-expression',\n customVariants: ['try { try-body } catch { catch-body }', 'try { try-body } catch(error) { catch-body }'],\n details: [\n ['try-body', 'expressions', 'The expressions to try.'],\n ['error', 'symbol', 'The error variable to bind.'],\n ['catch-body', 'expression', 'The expressions to evaluate if the try-body throws an error.'],\n ],\n description: 'Executes `try-body`. If that throws, the `catch-body` gets executed. See examples for details.',\n examples: [\n `\ntry\n 2 / 4\ncatch\n \"Oops!\"\nend`,\n `\ntry\n foo()\ncatch(error)\n \"Error: \" ++ error.message\nend`,\n `\ntry\n foo()\ncatch\n 42\nend`,\n ],\n}\n\nexport const trySpecialExpression: BuiltinSpecialExpression<Any, TryNode> = {\n arity: {},\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n const [, tryExpression, errorSymbol, catchExpression] = node[1]\n try {\n return evaluateNode(tryExpression, contextStack)\n }\n catch (error) {\n const newContext: Context = errorSymbol\n ? {\n [errorSymbol[1]]: { value: error as Any },\n }\n : {}\n return evaluateNode(catchExpression, contextStack.create(newContext))\n }\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => {\n const [, tryExpression, errorSymbol, catchExpression] = node[1]\n const tryResult = getUndefinedSymbols([tryExpression], contextStack, builtin, evaluateNode)\n const newContext: Context = errorSymbol\n ? {\n [errorSymbol[1]]: { value: true },\n }\n : {}\n const catchResult = getUndefinedSymbols([catchExpression], contextStack.create(newContext), builtin, evaluateNode)\n return joinSets(tryResult, catchResult)\n },\n}\n","import { LitsError } from '../../errors'\nimport type { Any, Arr } from '../../interface'\nimport type { Node, SpecialExpressionNode } from '../../parser/types'\nimport { isSpreadNode } from '../../typeGuards/astNode'\nimport { asAny } from '../../typeGuards/lits'\nimport type { BuiltinSpecialExpression, FunctionDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type ArrayNode = SpecialExpressionNode<[typeof specialExpressionTypes['array'], Node[]]>\n\nconst docs: FunctionDocs = {\n category: 'special-expression',\n returns: {\n type: 'any',\n array: true,\n },\n args: {\n values: {\n type: 'any',\n rest: true,\n },\n },\n variants: [\n { argumentNames: ['values'] },\n ],\n description: 'Makes new array from $values.',\n examples: [\n 'array(1, 2, 3)',\n 'array(array(null, false, true))',\n '[]',\n '[1, 2, 3]',\n '[1, 2, ...[3, 4, 5], 6]',\n '[[null, false, true]]',\n '[1, 2, 3][1]',\n ],\n hideOperatorForm: true,\n}\n\nexport const arraySpecialExpression: BuiltinSpecialExpression<Any, ArrayNode> = {\n arity: {},\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n const result: Arr = []\n\n for (const param of node[1][1]) {\n if (isSpreadNode(param)) {\n const spreadValue = evaluateNode(param[1], contextStack)\n if (!Array.isArray(spreadValue)) {\n throw new LitsError('Spread value is not an array', param[2])\n }\n result.push(...spreadValue)\n }\n else {\n result.push(evaluateNode(param, contextStack))\n }\n }\n\n return result\n },\n evaluateAsNormalExpression: (params, sourceCodeInfo) => {\n const result: Arr = []\n\n for (const param of params) {\n result.push(asAny(param, sourceCodeInfo))\n }\n\n return result\n },\n\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => getUndefinedSymbols(node[1][1], contextStack, builtin, evaluateNode),\n}\n","import { LitsError } from '../../errors'\nimport type { Any, Obj } from '../../interface'\nimport type { Node, SpecialExpressionNode } from '../../parser/types'\nimport { isUnknownRecord } from '../../typeGuards'\nimport { isSpreadNode } from '../../typeGuards/astNode'\nimport { assertString } from '../../typeGuards/string'\nimport type { BuiltinSpecialExpression, FunctionDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type ObjectNode = SpecialExpressionNode<[typeof specialExpressionTypes['object'], Node[]]>\n\nconst docs: FunctionDocs = {\n category: 'special-expression',\n returns: {\n type: 'object',\n },\n args: {\n kvps: {\n type: 'any',\n rest: true,\n description: 'key - value pairs, where key is a string',\n },\n },\n variants: [\n { argumentNames: ['kvps'] },\n ],\n description: 'Constructs a new object. Object members are created from the $kvps key-value pairs. Requires an even number of arguments.',\n examples: [\n 'object()',\n `\nlet default = {\n type: \"Person\",\n name: \"John Doe\",\n age: 42\n};\n\n{\n ...default,\n name: \"Lisa\"\n}`,\n 'object(\"x\", 10, \"y\", true, \"z\", \"A string\")',\n '{}',\n '{ a: 1, b: 2 }',\n ],\n hideOperatorForm: true,\n}\n\nexport const objectSpecialExpression: BuiltinSpecialExpression<Any, ObjectNode> = {\n arity: {},\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n const result: Obj = {}\n\n const params = node[1][1]\n for (let i = 0; i < params.length; i += 2) {\n const keyNode = params[i]!\n if (isSpreadNode(keyNode)) {\n const spreadObject = evaluateNode(keyNode[1], contextStack)\n if (!isUnknownRecord(spreadObject)) {\n throw new LitsError('Spread value is not an object', keyNode[2])\n }\n Object.assign(result, spreadObject)\n i -= 1\n }\n else {\n const key = evaluateNode(keyNode, contextStack)\n const valueNode = params[i + 1]\n if (valueNode === undefined) {\n throw new LitsError('Missing value for key', keyNode[2])\n }\n const value = evaluateNode(valueNode, contextStack)\n assertString(key, keyNode[2])\n result[key] = value\n }\n }\n return result\n },\n evaluateAsNormalExpression: (params, sourceCodeInfo) => {\n const result: Obj = {}\n\n for (let i = 0; i < params.length; i += 2) {\n const key = params[i]\n const value = params[i + 1]\n assertString(key, sourceCodeInfo)\n result[key] = value ?? null\n }\n\n return result\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => getUndefinedSymbols(node[1][1], contextStack, builtin, evaluateNode),\n}\n","export const specialExpressionTypes = {\n '??': 0,\n '&&': 1,\n '||': 2,\n 'array': 3,\n 'cond': 4,\n '0_def': 5,\n 'defined?': 6,\n // '0_defn': 7,\n 'block': 7,\n 'doseq': 8,\n '0_lambda': 9,\n 'for': 10,\n // 'function': 10,\n 'if': 11,\n 'let': 12,\n 'loop': 13,\n 'object': 14,\n 'recur': 15,\n 'switch': 16,\n 'throw': 17,\n 'try': 18,\n 'unless': 19,\n} as const\n\nexport type SpecialExpressionTypes = typeof specialExpressionTypes\n","import type { Builtin } from './interface'\nimport { allNormalExpressions, normalExpressions } from './normalExpressions'\nimport { andSpecialExpression } from './specialExpressions/and'\nimport { condSpecialExpression } from './specialExpressions/cond'\nimport { switchSpecialExpression } from './specialExpressions/switch'\nimport { definedSpecialExpression } from './specialExpressions/defined'\nimport { defSpecialExpression } from './specialExpressions/def'\nimport { doSpecialExpression } from './specialExpressions/block'\nimport { lambdaSpecialExpression } from './specialExpressions/functions'\nimport { ifSpecialExpression } from './specialExpressions/if'\nimport { unlessSpecialExpression } from './specialExpressions/unless'\nimport { letSpecialExpression } from './specialExpressions/let'\nimport { loopSpecialExpression } from './specialExpressions/loop'\nimport { doseqSpecialExpression, forSpecialExpression } from './specialExpressions/loops'\nimport { orSpecialExpression } from './specialExpressions/or'\nimport { qqSpecialExpression } from './specialExpressions/qq'\nimport { recurSpecialExpression } from './specialExpressions/recur'\nimport { throwSpecialExpression } from './specialExpressions/throw'\nimport { trySpecialExpression } from './specialExpressions/try'\nimport { arraySpecialExpression } from './specialExpressions/array'\nimport { objectSpecialExpression } from './specialExpressions/object'\nimport { specialExpressionTypes } from './specialExpressionTypes'\n\nexport const specialExpressions = [\n qqSpecialExpression,\n andSpecialExpression,\n orSpecialExpression,\n arraySpecialExpression,\n condSpecialExpression,\n defSpecialExpression,\n definedSpecialExpression,\n doSpecialExpression,\n doseqSpecialExpression,\n lambdaSpecialExpression,\n forSpecialExpression,\n ifSpecialExpression,\n letSpecialExpression,\n loopSpecialExpression,\n objectSpecialExpression,\n recurSpecialExpression,\n switchSpecialExpression,\n throwSpecialExpression,\n trySpecialExpression,\n unlessSpecialExpression,\n] as const\n\nexport type SpecialExpressions = typeof specialExpressions\nexport type SpecialExpression = SpecialExpressions[number]\nexport type SpecialExpressionName = keyof typeof specialExpressionTypes\nexport type CommonSpecialExpressionType = [\n | typeof specialExpressionTypes['??']\n | typeof specialExpressionTypes['&&']\n | typeof specialExpressionTypes['cond']\n | typeof specialExpressionTypes['switch']\n | typeof specialExpressionTypes['defined?']\n | typeof specialExpressionTypes['block']\n | typeof specialExpressionTypes['if']\n | typeof specialExpressionTypes['unless']\n | typeof specialExpressionTypes['||']\n | typeof specialExpressionTypes['throw']\n | typeof specialExpressionTypes['array']\n | typeof specialExpressionTypes['object'],\n]\n\nexport type SpecialExpressionType = typeof specialExpressionTypes[SpecialExpressionName]\n\nexport const builtin: Builtin = {\n normalExpressions,\n specialExpressions,\n allNormalExpressions,\n}\n\nexport const normalExpressionKeys = Object.keys(normalExpressions)\nexport const specialExpressionKeys = Object.keys(specialExpressionTypes)\nexport const specialExpressionNameSet = new Set(specialExpressionKeys)\n","import type { Builtin } from '../builtin/interface'\nimport type { DoNode } from '../builtin/specialExpressions/block'\nimport { specialExpressionTypes } from '../builtin/specialExpressionTypes'\nimport { NodeTypes } from '../constants/constants'\nimport { LitsError } from '../errors'\nimport type { ContextStack } from '../evaluator/ContextStack'\nimport type { EvaluateNode } from '../evaluator/interface'\nimport type { Ast, Node, NormalExpressionNode, SpecialExpressionNode, SpreadNode, UserDefinedSymbolNode } from '../parser/types'\nimport { isNormalExpressionNodeWithName, isUserDefinedSymbolNode } from '../typeGuards/astNode'\n\nexport type UndefinedSymbols = Set<string>\n\nexport const getUndefinedSymbols: GetUndefinedSymbols = (ast, contextStack, builtin, evaluateNode) => {\n const nodes: Node[] = Array.isArray(ast)\n ? ast\n : [[NodeTypes.SpecialExpression, [specialExpressionTypes.block, ast.body]] satisfies DoNode]\n\n const unresolvedSymbols = new Set<string>()\n\n for (const subNode of nodes) {\n findUnresolvedSymbolsInNode(subNode, contextStack, builtin, evaluateNode)\n ?.forEach(symbol => unresolvedSymbols.add(symbol))\n }\n return unresolvedSymbols\n}\n\nexport type GetUndefinedSymbols = (ast: Ast | Node[], contextStack: ContextStack, builtin: Builtin, evaluateNode: EvaluateNode) => UndefinedSymbols\n\nfunction findUnresolvedSymbolsInNode(node: Node, contextStack: ContextStack, builtin: Builtin, evaluateNode: EvaluateNode): UndefinedSymbols | null {\n const nodeType = node[0]\n switch (nodeType) {\n case NodeTypes.UserDefinedSymbol: {\n const symbolNode = node as UserDefinedSymbolNode\n const lookUpResult = contextStack.lookUp(symbolNode)\n if (lookUpResult === null)\n return new Set([symbolNode[1]])\n\n return null\n }\n case NodeTypes.NormalBuiltinSymbol:\n case NodeTypes.SpecialBuiltinSymbol:\n case NodeTypes.String:\n case NodeTypes.Number:\n case NodeTypes.ReservedSymbol:\n case NodeTypes.Binding:\n return null\n case NodeTypes.NormalExpression: {\n const normalExpressionNode = node as NormalExpressionNode\n const unresolvedSymbols = new Set<string>()\n if (isNormalExpressionNodeWithName(normalExpressionNode)) {\n const [, [symbolNode]] = normalExpressionNode\n if (isUserDefinedSymbolNode(symbolNode)) {\n const lookUpResult = contextStack.lookUp(symbolNode)\n if (lookUpResult === null)\n unresolvedSymbols.add(symbolNode[1])\n }\n }\n else {\n const [, [expressionNode]] = normalExpressionNode\n findUnresolvedSymbolsInNode(expressionNode, contextStack, builtin, evaluateNode)?.forEach(symbol => unresolvedSymbols.add(symbol))\n }\n for (const subNode of normalExpressionNode[1][1]) {\n findUnresolvedSymbolsInNode(subNode, contextStack, builtin, evaluateNode)?.forEach(symbol => unresolvedSymbols.add(symbol))\n }\n return unresolvedSymbols\n }\n case NodeTypes.SpecialExpression: {\n const specialExpressionNode = node as SpecialExpressionNode\n const specialExpressionType = specialExpressionNode[1][0]\n const specialExpression = builtin.specialExpressions[specialExpressionType]\n\n const castedGetUndefinedSymbols = specialExpression.getUndefinedSymbols as Function\n\n return castedGetUndefinedSymbols(specialExpressionNode, contextStack, {\n getUndefinedSymbols,\n builtin,\n evaluateNode,\n }) as UndefinedSymbols\n }\n case NodeTypes.Spread:\n return findUnresolvedSymbolsInNode((node as SpreadNode)[1], contextStack, builtin, evaluateNode)\n\n /* v8 ignore next 2 */\n default:\n throw new LitsError(`Unhandled node type: ${nodeType satisfies never}`, node[2])\n }\n}\n","import type { Any } from '../interface'\n\nconst nonNumberReservedSymbolRecord = {\n true: true,\n false: false,\n null: null,\n do: null,\n else: null,\n case: null,\n each: null,\n in: null,\n when: null,\n while: null,\n catch: null,\n function: null,\n export: null,\n as: null,\n then: null,\n end: null,\n _: null,\n} as const satisfies Record<string, Any>\n\nconst phi = (1 + Math.sqrt(5)) / 2\nexport const numberReservedSymbolRecord = {\n 'E': Math.E,\n '-E': -Math.E,\n 'ε': Math.E,\n '-ε': -Math.E,\n 'PI': Math.PI,\n '-PI': -Math.PI,\n 'π': Math.PI,\n '-π': -Math.PI,\n 'PHI': phi,\n '-PHI': -phi,\n 'φ': phi,\n '-φ': -phi,\n 'POSITIVE_INFINITY': Number.POSITIVE_INFINITY,\n '∞': Number.POSITIVE_INFINITY,\n 'NEGATIVE_INFINITY': Number.NEGATIVE_INFINITY,\n '-∞': Number.NEGATIVE_INFINITY,\n 'MAX_SAFE_INTEGER': Number.MAX_SAFE_INTEGER,\n 'MIN_SAFE_INTEGER': Number.MIN_SAFE_INTEGER,\n 'MAX_VALUE': Number.MAX_VALUE,\n 'MIN_VALUE': Number.MIN_VALUE,\n 'NaN': Number.NaN,\n} as const satisfies Record<string, number>\n\nexport const reservedSymbolRecord = {\n ...nonNumberReservedSymbolRecord,\n ...numberReservedSymbolRecord,\n} as const\n\nexport type ReservedSymbol = keyof typeof reservedSymbolRecord\n\nexport function isReservedSymbol(symbol: string): symbol is keyof typeof reservedSymbolRecord {\n return symbol in reservedSymbolRecord\n}\n\nexport function isNumberReservedSymbol(symbol: string): symbol is keyof typeof numberReservedSymbolRecord {\n return symbol in numberReservedSymbolRecord\n}\n","import { specialExpressions } from '../builtin'\nimport { evaluateBindingNodeValues } from '../builtin/bindingNode'\nimport { allNormalExpressions } from '../builtin/normalExpressions'\nimport { LitsError, RecurSignal } from '../errors'\nimport { arityAcceptsMin, assertNumberOfParams } from '../utils/arity'\nimport type { Any, Arr } from '../interface'\nimport type {\n CompFunction,\n ComplementFunction,\n ConstantlyFunction,\n EveryPredFunction,\n FNullFunction,\n JuxtFunction,\n LitsFunctionType,\n ModuleFunction,\n NativeJsFunction,\n NormalBuiltinFunction,\n PartialFunction,\n SomePredFunction,\n SpecialBuiltinFunction,\n UserDefinedFunction,\n} from '../parser/types'\nimport { bindingTargetTypes } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { asNonUndefined, isUnknownRecord } from '../typeGuards'\nimport { asAny, asFunctionLike } from '../typeGuards/lits'\nimport { toAny } from '../utils'\nimport { valueToString } from '../utils/debug/debugTools'\nimport type { ContextStack } from './ContextStack'\nimport type { Context, EvaluateNode, ExecuteFunction } from './interface'\n\ntype FunctionExecutors = Record<LitsFunctionType, (\n fn: any,\n params: Arr,\n sourceCodeInfo: SourceCodeInfo | undefined,\n contextStack: ContextStack,\n helpers: { evaluateNode: EvaluateNode, executeFunction: ExecuteFunction },\n) => Any>\n\nexport const functionExecutors: FunctionExecutors = {\n NativeJsFunction: (fn: NativeJsFunction, params, sourceCodeInfo) => {\n try {\n return toAny(fn.nativeFn.fn(...params))\n }\n catch (error) {\n const message\n = typeof error === 'string'\n ? error\n : isUnknownRecord(error) && typeof error.message === 'string'\n ? error.message\n : '<no message>'\n throw new LitsError(`Native function threw: \"${message}\"`, sourceCodeInfo)\n }\n },\n UserDefined: (fn: UserDefinedFunction, params, sourceCodeInfo, contextStack, { evaluateNode }) => {\n for (;;) {\n if (!arityAcceptsMin(fn.arity, params.length)) {\n throw new LitsError(`Expected ${fn.arity} arguments, got ${params.length}.`, sourceCodeInfo)\n }\n const evaluatedFunction = fn.evaluatedfunction\n const args = evaluatedFunction[0]\n const nbrOfNonRestArgs: number = args.filter(arg => arg[0] !== bindingTargetTypes.rest).length\n\n const newContextStack = contextStack.create(fn.evaluatedfunction[2])\n const newContext: Context = { self: { value: fn } }\n\n const rest: Arr = []\n for (let i = 0; i < params.length; i += 1) {\n if (i < nbrOfNonRestArgs) {\n const param = toAny(params[i])\n const valueRecord = evaluateBindingNodeValues(args[i]!, param, node =>\n evaluateNode(node, newContextStack.create(newContext)))\n Object.entries(valueRecord).forEach(([key, value]) => {\n newContext[key] = { value }\n })\n }\n else {\n rest.push(toAny(params[i]))\n }\n }\n\n for (let i = params.length; i < nbrOfNonRestArgs; i++) {\n const arg = args[i]!\n const defaultValue = evaluateNode(arg[1][1]!, contextStack.create(newContext))\n const valueRecord = evaluateBindingNodeValues(arg, defaultValue, node =>\n evaluateNode(node, contextStack.create(newContext)))\n Object.entries(valueRecord).forEach(([key, value]) => {\n newContext[key] = { value }\n })\n }\n\n const restArgument = args.find(arg => arg[0] === bindingTargetTypes.rest)\n if (restArgument !== undefined) {\n const valueRecord = evaluateBindingNodeValues(restArgument, rest, node => evaluateNode(node, contextStack.create(newContext)))\n Object.entries(valueRecord).forEach(([key, value]) => {\n newContext[key] = { value }\n })\n }\n\n try {\n let result: Any = null\n const newContextStack2 = newContextStack.create(newContext)\n for (const node of evaluatedFunction[1]) {\n result = evaluateNode(node, newContextStack2)\n }\n\n return result\n }\n catch (error) {\n if (error instanceof RecurSignal) {\n params = error.params\n continue\n }\n throw error\n }\n }\n },\n Partial: (fn: PartialFunction, params, sourceCodeInfo, contextStack, { executeFunction }) => {\n const actualParams = [...fn.params]\n if (params.length !== fn.placeholders.length) {\n throw new LitsError(`(partial) expects ${fn.placeholders.length} arguments, got ${params.length}.`, sourceCodeInfo)\n }\n const paramsCopy = [...params]\n for (const placeholderIndex of fn.placeholders) {\n actualParams.splice(placeholderIndex, 0, paramsCopy.shift())\n }\n return executeFunction(fn.function, actualParams, contextStack, sourceCodeInfo)\n },\n Comp: (fn: CompFunction, params, sourceCodeInfo, contextStack, { executeFunction }) => {\n const { params: f } = fn\n if (f.length === 0) {\n if (params.length !== 1)\n throw new LitsError(`(comp) expects one argument, got ${valueToString(params.length)}.`, sourceCodeInfo)\n\n return asAny(params[0], sourceCodeInfo)\n }\n return asAny(\n f.reduceRight((result: Arr, fun) => {\n return [executeFunction(asFunctionLike(fun, sourceCodeInfo), result, contextStack, sourceCodeInfo)]\n }, params)[0],\n sourceCodeInfo,\n )\n },\n Constantly: (fn: ConstantlyFunction) => {\n return fn.value\n },\n Juxt: (fn: JuxtFunction, params, sourceCodeInfo, contextStack, { executeFunction }) => {\n return fn.params.map(fun => executeFunction(asFunctionLike(fun, sourceCodeInfo), params, contextStack, sourceCodeInfo))\n },\n Complement: (fn: ComplementFunction, params, sourceCodeInfo, contextStack, { executeFunction }) => {\n return !executeFunction(fn.function, params, contextStack, sourceCodeInfo)\n },\n EveryPred: (fn: EveryPredFunction, params, sourceCodeInfo, contextStack, { executeFunction }) => {\n for (const f of fn.params) {\n for (const param of params) {\n const result = executeFunction(asFunctionLike(f, sourceCodeInfo), [param], contextStack, sourceCodeInfo)\n if (!result)\n return false\n }\n }\n return true\n },\n SomePred: (fn: SomePredFunction, params, sourceCodeInfo, contextStack, { executeFunction }) => {\n for (const f of fn.params) {\n for (const param of params) {\n const result = executeFunction(asFunctionLike(f, sourceCodeInfo), [param], contextStack, sourceCodeInfo)\n if (result)\n return true\n }\n }\n return false\n },\n Fnull: (fn: FNullFunction, params, sourceCodeInfo, contextStack, { executeFunction }) => {\n const fnulledParams = params.map((param, index) => (param === null ? toAny(fn.params[index]) : param))\n return executeFunction(asFunctionLike(fn.function, sourceCodeInfo), fnulledParams, contextStack, sourceCodeInfo)\n },\n Builtin: (fn: NormalBuiltinFunction, params, sourceCodeInfo, contextStack, { executeFunction }) => {\n const normalExpression = asNonUndefined(allNormalExpressions[fn.normalBuiltinSymbolType], sourceCodeInfo)\n return normalExpression.evaluate(params, sourceCodeInfo, contextStack, { executeFunction })\n },\n SpecialBuiltin: (fn: SpecialBuiltinFunction, params, sourceCodeInfo, contextStack, { executeFunction }) => {\n const specialExpression = asNonUndefined(specialExpressions[fn.specialBuiltinSymbolType], sourceCodeInfo)\n if (specialExpression.evaluateAsNormalExpression) {\n return specialExpression.evaluateAsNormalExpression(params, sourceCodeInfo, contextStack, { executeFunction })\n }\n else {\n throw new LitsError(`Special builtin function ${fn.specialBuiltinSymbolType} is not supported as normal expression.`, sourceCodeInfo)\n }\n },\n Module: (fn: ModuleFunction, params, sourceCodeInfo, contextStack, { executeFunction }) => {\n const module = contextStack.getModule(fn.moduleName)\n if (!module) {\n throw new LitsError(`Module '${fn.moduleName}' not found.`, sourceCodeInfo)\n }\n const expression = module.functions[fn.functionName]\n if (!expression) {\n throw new LitsError(`Function '${fn.functionName}' not found in module '${fn.moduleName}'.`, sourceCodeInfo)\n }\n assertNumberOfParams(expression.arity, params.length, sourceCodeInfo)\n return expression.evaluate(params, sourceCodeInfo, contextStack, { executeFunction })\n },\n}\n","import type { SpecialExpression } from '../builtin'\nimport { builtin } from '../builtin'\nimport { NodeTypes, getNodeTypeName } from '../constants/constants'\nimport { LitsError, UndefinedSymbolError } from '../errors'\nimport { getUndefinedSymbols } from '../getUndefinedSymbols'\nimport type { Any, Arr, Obj } from '../interface'\nimport type {\n Ast,\n FunctionLike,\n Node,\n NormalExpressionNode,\n NumberNode,\n PartialFunction,\n ReservedSymbolNode,\n SpecialExpressionNode,\n StringNode,\n SymbolNode,\n} from '../parser/types'\nimport { reservedSymbolRecord } from '../tokenizer/reservedNames'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { asNonUndefined } from '../typeGuards'\nimport { annotate } from '../typeGuards/annotatedArrays'\nimport { isNormalBuiltinSymbolNode, isNormalExpressionNodeWithName, isSpreadNode } from '../typeGuards/astNode'\nimport { asFunctionLike, assertSeq, isObj } from '../typeGuards/lits'\nimport { isLitsFunction } from '../typeGuards/litsFunction'\nimport { assertNumber, isNumber } from '../typeGuards/number'\nimport { assertString } from '../typeGuards/string'\nimport { toAny } from '../utils'\nimport { valueToString } from '../utils/debug/debugTools'\nimport { toFixedArity } from '../utils/arity'\nimport { FUNCTION_SYMBOL } from '../utils/symbols'\nimport type { ContextStack } from './ContextStack'\nimport { functionExecutors } from './functionExecutors'\n\nexport function evaluate(ast: Ast, contextStack: ContextStack): Any {\n let result: Any = null\n\n for (const node of ast.body) {\n result = evaluateNode(node, contextStack)\n }\n\n return result\n}\n\nexport function evaluateNode(node: Node, contextStack: ContextStack): Any {\n switch (node[0]) {\n case NodeTypes.Number:\n return evaluateNumber(node as NumberNode)\n case NodeTypes.String:\n return evaluateString(node as StringNode)\n case NodeTypes.NormalBuiltinSymbol:\n case NodeTypes.SpecialBuiltinSymbol:\n case NodeTypes.UserDefinedSymbol:\n return contextStack.evaluateSymbol(node as SymbolNode)\n case NodeTypes.ReservedSymbol:\n return evaluateReservedSymbol(node as ReservedSymbolNode)\n case NodeTypes.NormalExpression: {\n const result = evaluateNormalExpression(node as NormalExpressionNode, contextStack)\n if (typeof result === 'number' && Number.isNaN(result)) {\n throw new LitsError('Number is NaN', node[2])\n }\n return annotate(result)\n }\n case NodeTypes.SpecialExpression:\n return annotate(evaluateSpecialExpression(node as SpecialExpressionNode, contextStack))\n /* v8 ignore next 2 */\n default:\n throw new LitsError(`${getNodeTypeName(node[0])}-node cannot be evaluated`, node[2])\n }\n}\n\nfunction evaluateNumber(node: NumberNode): number {\n return node[1]\n}\n\nfunction evaluateString(node: StringNode): string {\n return node[1]\n}\n\nfunction evaluateReservedSymbol(node: ReservedSymbolNode): Any {\n const reservedName = node[1]\n if (!['true', 'false', 'null'].includes(reservedName)) {\n throw new LitsError(`Reserved symbol ${reservedName} cannot be evaluated`, node[2])\n }\n const value = reservedSymbolRecord[reservedName]\n return asNonUndefined(value, node[2])\n}\n\nfunction evaluateNormalExpression(node: NormalExpressionNode, contextStack: ContextStack): Any {\n const sourceCodeInfo = node[2]\n const paramNodes: Node[] = node[1][1]\n const params: Arr = []\n const placeholders: number[] = []\n paramNodes.forEach((paramNode, index) => {\n if (isSpreadNode(paramNode)) {\n const spreadValue = evaluateNode(paramNode[1], contextStack)\n if (Array.isArray(spreadValue)) {\n params.push(...spreadValue)\n }\n else {\n throw new LitsError(`Spread operator requires an array, got ${valueToString(paramNode)}`, paramNode[2])\n }\n }\n else if (paramNode[0] === NodeTypes.ReservedSymbol && paramNode[1] === '_') {\n placeholders.push(index)\n }\n else {\n params.push(evaluateNode(paramNode, contextStack))\n }\n })\n if (isNormalExpressionNodeWithName(node)) {\n const nameSymbol = node[1][0]\n if (placeholders.length > 0) {\n const fn = evaluateNode(nameSymbol, contextStack)\n const partialFunction: PartialFunction = {\n [FUNCTION_SYMBOL]: true,\n function: asFunctionLike(fn, sourceCodeInfo),\n functionType: 'Partial',\n params,\n placeholders,\n sourceCodeInfo,\n arity: toFixedArity(placeholders.length),\n }\n return partialFunction\n }\n\n if (isNormalBuiltinSymbolNode(nameSymbol)) {\n const type = nameSymbol[1]\n const normalExpression = builtin.allNormalExpressions[type]!\n return normalExpression.evaluate(params, node[2], contextStack, { executeFunction })\n }\n else {\n const fn = contextStack.getValue(nameSymbol[1])\n if (fn !== undefined) {\n return executeFunction(asFunctionLike(fn, sourceCodeInfo), params, contextStack, sourceCodeInfo)\n }\n throw new UndefinedSymbolError(nameSymbol[1], node[2])\n }\n }\n else {\n const fnNode: Node = node[1][0]\n const fn = asFunctionLike(evaluateNode(fnNode, contextStack), sourceCodeInfo)\n if (placeholders.length > 0) {\n const partialFunction: PartialFunction = {\n [FUNCTION_SYMBOL]: true,\n function: fn,\n functionType: 'Partial',\n params,\n placeholders,\n sourceCodeInfo,\n arity: toFixedArity(placeholders.length),\n }\n return partialFunction\n }\n return executeFunction(fn, params, contextStack, sourceCodeInfo)\n }\n}\n\nfunction executeFunction(fn: FunctionLike, params: Arr, contextStack: ContextStack, sourceCodeInfo?: SourceCodeInfo): Any {\n if (isLitsFunction(fn))\n return functionExecutors[fn.functionType](fn, params, sourceCodeInfo, contextStack, { evaluateNode, executeFunction })\n\n if (Array.isArray(fn))\n return evaluateArrayAsFunction(fn, params, sourceCodeInfo)\n\n if (isObj(fn))\n return evalueateObjectAsFunction(fn, params, sourceCodeInfo)\n\n if (typeof fn === 'string')\n return evaluateStringAsFunction(fn, params, sourceCodeInfo)\n\n if (isNumber(fn)) {\n return evaluateNumberAsFunction(fn, params, sourceCodeInfo)\n /* v8 ignore next 4 */\n }\n throw new LitsError('Unexpected function type', sourceCodeInfo)\n}\n\nfunction evaluateSpecialExpression(node: SpecialExpressionNode, contextStack: ContextStack): Any {\n const specialExpressionType = node[1][0]\n const specialExpression: SpecialExpression = asNonUndefined(builtin.specialExpressions[specialExpressionType], node[2])\n const castedEvaluate = specialExpression.evaluate as Function\n\n return castedEvaluate(node, contextStack, { evaluateNode, builtin, getUndefinedSymbols }) as Any\n}\n\nfunction evalueateObjectAsFunction(fn: Obj, params: Arr, sourceCodeInfo?: SourceCodeInfo): Any {\n if (params.length !== 1)\n throw new LitsError('Object as function requires one string parameter.', sourceCodeInfo)\n\n const key = params[0]\n assertString(key, sourceCodeInfo)\n return toAny(fn[key])\n}\n\nfunction evaluateArrayAsFunction(fn: Arr, params: Arr, sourceCodeInfo?: SourceCodeInfo): Any {\n if (params.length !== 1)\n throw new LitsError('Array as function requires one non negative integer parameter.', sourceCodeInfo)\n\n const index = params[0]\n assertNumber(index, sourceCodeInfo, { integer: true, nonNegative: true })\n return toAny(fn[index])\n}\n\nfunction evaluateStringAsFunction(fn: string, params: Arr, sourceCodeInfo?: SourceCodeInfo): Any {\n if (params.length !== 1)\n throw new LitsError('String as function requires one Obj parameter.', sourceCodeInfo)\n\n const param = toAny(params[0])\n if (isObj(param))\n return toAny((param)[fn])\n\n if (isNumber(param, { integer: true }))\n return toAny(fn[param])\n\n throw new LitsError(\n `string as function expects Obj or integer parameter, got ${valueToString(param)}`,\n sourceCodeInfo,\n )\n}\n\nfunction evaluateNumberAsFunction(fn: number, params: Arr, sourceCodeInfo?: SourceCodeInfo): Any {\n assertNumber(fn, sourceCodeInfo, { integer: true })\n if (params.length !== 1)\n throw new LitsError('Number as function requires one Arr parameter.', sourceCodeInfo)\n\n const param = params[0]\n assertSeq(param, sourceCodeInfo)\n return toAny(param[fn])\n}\n"],"names":["getCodeMarker","sourceCodeInfo","position","code","leftPadding","column","rightPadding","length","repeat","Math","max","RecurSignal","Error","params","constructor","super","Object","setPrototypeOf","this","prototype","name","LitsError","shortMessage","err","message","location","line","filePath","getLitsErrorMessage","UserDefinedError","userMessage","UndefinedSymbolError","symbol","symbolName","isLitsError","error","NodeTypes","Number","String","NormalExpression","SpecialExpression","UserDefinedSymbol","NormalBuiltinSymbol","SpecialBuiltinSymbol","ReservedSymbol","Binding","Spread","NodeTypesSet","Set","values","getNodeTypeName","type","keys","find","key","functionTypeSet","FUNCTION_SYMBOL","REGEXP_SYMBOL","isLitsFunction","func","has","isFunctionType","functionType","isNode","value","Array","isArray","isNodeType","valueToString","RegExp","toString","JSON","stringify","getSourceCodeInfo","anyValue","getAssertionError","typeName","asNonUndefined","assertNonUndefined","undefined","isNonUndefined","isUnknownRecord","asLitsFunction","assertLitsFunction","isUserDefinedFunction","asUserDefinedFunction","assertUserDefinedFunction","isNativeJsFunction","asNativeJsFunction","assertNativeJsFunction","isBuiltinFunction","isNumber","options","isNaN","integer","isInteger","finite","isFinite","zero","nonZero","positive","negative","nonPositive","nonNegative","gt","gte","lt","lte","assertNumber","sign","getSignString","numberType","range","getRangeString","filter","x","join","getNumberTypeName","isAny","asAny","assertAny","isSeq","assertSeq","isObj","isRegularExpression","assertObj","isColl","asColl","assertColl","regexp","assertStringOrRegularExpression","isStringOrRegularExpression","asFunctionLike","assertFunctionLike","isFunctionLike","arityAcceptsMin","arity","nbrOfParams","min","assertNumberOfParams","toFixedArity","bitwiseNormalExpression","evaluate","num","count","first","rest","reduce","result","xor","nonEmpty","char","isString","asString","assertString","isStringOrNumber","asStringOrNumber","assertStringOrNumber","collHasKey","coll","getOwnPropertyDescriptor","compare","a","b","deepEqual","epsilon","EPSILON","diff","abs","absA","absB","i","s","f","aKeys","bKeys","toAny","results","symbols","forEach","add","addToSet","target","source","smartTrim","str","minIndent","lines","split","match","shift","pop","indent","acc","lineIndent","Infinity","slice","trimEnd","assertArray","every","v","isStringArray","isCharArray","collectionNormalExpression","fn","contextStack","executeFunction","elem","entries","map","at","colls","obj","objKeys","includes","push","mapObjects","seqs","isStr","len","seq","paramArray","mapped","p","initial","get","defaultValue","copy","assoc","arr","concat","assign","arrayNormalExpression","second","third","from","step","to","flatten","depth","actualDepth","POSITIVE_INFINITY","asNumber","flat","mapcat","windowSize","subArr","sequenceNormalExpression","nth","array","last","index","indexOf","item","assertCharArray","substring","next","reverse","some","sort","comparer","compareValue","defaultComparer","annotatedArrays","vectors","WeakSet","notVectors","matrices","notMatrices","grids","notGrids","annotate","isVector","isMatrix","isGrid","vector","assertNonEmptyVector","assertVector","grid","row","nbrOfCols","matrix","getNumberVectorOrMatrixOperation","hasVector","hasMatrix","param","rows","cold","unaryMathOp","operation","operands","val","j","reduceMathOp","identity","m","mathNormalExpression","inc","firstVector","firstMatrix","binaryMathOp","trunc","floor","sqrt","cbrt","decimals","round","factor","ceil","isEqual","firstAny","miscNormalExpression","isIdentical","currentValue","ms","Date","toISOString","dateTime","valueOf","console","log","boolean","import","importPath","dotIndex","moduleName","module","getModule","expression","functions","functionName","objectNormalExpression","vals","dissoc","newObj","merge","entry","assertStringArray","predicatesNormalExpression","NEGATIVE_INFINITY","table","regexpNormalExpression","sourceArg","flagsArg","flags","e","text","assertRegularExpression","exec","matcher","replace","replaceAll","blankRegexp","stringNormalExpression","number","toLowerCase","toUpperCase","trim","stringList","delimiter","stringOrRegExpValue","limit","test","comp","generateDocString","reference","title","description","variants","args","returns","_isOperator","variant","argumentNames","argName","signature","arg","argStrings","examples","example","typeString","argType","prod","sorted","mid","calcMedian","expressions","normalExpressionReference","docString","getMetaNormalExpression","normalExpressionTypes","normalExpressions","allNormalExpressions","andSpecialExpression","node","evaluateNode","evaluateAsNormalExpression","getUndefinedSymbols","builtin","isSymbolNode","nodeType","asUserDefinedSymbolNode","isUserDefinedSymbolNode","assertUserDefinedSymbolNode","isNormalBuiltinSymbolNode","isSpecialBuiltinSymbolNode","isSpreadNode","definedSpecialExpression","symbolNode","assertSymbolNode","lookUp","bindingTargetTypes","bindingTarget","onDefault","element","walkDefaults","evaluateBindingNodeValues","record","createRecord","restElement","restValues","capturedKeys","restIndex","getAllBindingTargetNames","names","getNamesFromBindingTarget","defSpecialExpression","bindingNode","bindingValue","Node","exportValues","defaultNode","bindingResult","addValues","lambdaSpecialExpression","evaluatedFunction","functionContext","context","ctx","new","undefinedSymbols","evaluateFunction","self","newContext","newContextStack","create","overloadResult","getFunctionUnresolvedSymbols","letSpecialExpression","loopSpecialExpression","bindingNodes","valueRecord","bindingContext","body","bindings","evaluateLoop","returnResult","loopNode","loopBindings","bindingIndices","abort","bindingsLoop","bindingIndex","letBindings","whenNode","whileNode","targetNode","valueNode","skip","addToContext","loopBindingNode","letBindingNode","letTarget","letValue","forSpecialExpression","helpers","analyze","doseqSpecialExpression","orSpecialExpression","qqSpecialExpression","recurSpecialExpression","paramNode","evaluatedParams","throwSpecialExpression","tryExpression","errorSymbol","catchExpression","tryResult","arraySpecialExpression","spreadValue","objectSpecialExpression","keyNode","spreadObject","specialExpressionTypes","block","doseq","for","if","let","loop","object","recur","switch","specialExpressions","form","trueNode","falseNode","conditionNode","n","switchValueNode","cases","switchValue","specialExpressionKeys","ast","nodes","unresolvedSymbols","subNode","findUnresolvedSymbolsInNode","normalExpressionNode","isNormalExpressionNodeWithName","expressionNode","specialExpressionNode","specialExpressionType","castedGetUndefinedSymbols","phi","numberReservedSymbolRecord","E","PI","PHI","MAX_SAFE_INTEGER","MIN_SAFE_INTEGER","MAX_VALUE","MIN_VALUE","NaN","reservedSymbolRecord","true","false","each","in","when","while","catch","function","export","as","then","end","_","NativeJsFunction","nativeFn","UserDefined","evaluatedfunction","nbrOfNonRestArgs","restArgument","newContextStack2","Partial","actualParams","placeholders","placeholderIndex","splice","paramsCopy","Comp","reduceRight","fun","Constantly","Juxt","Complement","EveryPred","SomePred","Fnull","fnulledParams","Builtin","normalBuiltinSymbolType","SpecialBuiltin","specialExpression","specialBuiltinSymbolType","Module","evaluateSymbol","reservedName","evaluateReservedSymbol","paramNodes","nameSymbol","getValue","evaluateNormalExpression","castedEvaluate","evaluateSpecialExpression","functionExecutors","evaluateArrayAsFunction","evalueateObjectAsFunction","evaluateNumberAsFunction","globalContext","nativeJsFunctions","modules","contexts","hostValues","Map","ContextStackImpl","shadowedName","getShadowedBuiltinName","currentContext","contextEntry","hostValue","nativeJsFunction","throw","normalExpression","lookUpResult","normalExpressionKeys","createContextStack","jsFunctions","identifier","identifierParts","scope","part","isJsFunction","TypeError","assertJsFunction","assertNotShadowingBuiltin","globalModuleScope","binaryOperators","symbolicOperators","nonFunctionOperatorSet","operator","binaryOperatorSet","isBinaryOperator","symbolicOperatorSet","isSymbolicOperator","illegalSymbolCharacters","illegalFirstSymbolCharacters","tokenizeString","input","escaping","binaryNumberRegExp","postNumberRegExp","tokenizeSymbol","initialPosition","NO_MATCH","tokenizers","whitespaceRegExp","symbolMeta","startsWith","tokenizeToken","nextThreeChars","stringLength","token","baseChar","octalNumberRegExp","hexNumberRegExp","nextChar","plusPrefix","start","negate","hasExponent","decimalNumberRegExp","hasDecimalPoint","threeChars","twoChars","oneChar","lastLine","lineNbr","getSourceCodeLine","getCurrentToken","nbrOfCharacters","tokenizeShebang","tokenizer","asSymbolToken","isSymbolToken","throwUnexpectedToken","assertSymbolToken","isReservedSymbolToken","assertReservedSymbolToken","asReservedSymbolToken","isOperatorToken","operatorName","assertOperatorToken","isLParenToken","assertLParenToken","assertRParenToken","isLBracketToken","asLBracketToken","isRBracketToken","isLBraceToken","asLBraceToken","assertLBraceToken","isRBraceToken","expected","expectedValue","actual","actualOutput","minifyTokenStream","removeWhiteSpace","tokens","tokenStream","isSingleLineCommentToken","isMultiLineCommentToken","isShebangToken","isWhitespaceToken","normalExpressionNames","specialExpressionNames","getSymbolName","placeholderRegexp","withSourceCodeInfo","getPrecedence","operatorSign","createNamedNormalExpressionNode","left","right","fromBinaryOperatorToNode","Parser","parseState","peek","peekSourceCodeInfo","currentToken","peekAhead","advance","parse","isAtEnd","parseExpression","precedence","moduleScope","firstToken","parseLet","parseIfOrUnless","parseCond","parseSwitch","parseForOrDoseq","parseLoop","parseTry","parseBlock","parseExport","parseOperand","isAtExpressionEnd","isA_BinaryOperatorToken","newPrecedece","isFunctionOperator","operatorSymbol","parseSymbol","asToken","operand","symbolToken","createAccessorNode","parseFunctionCall","parseOperandPart","positionBefore","lamdaFunction","parseLambdaFunction","isRParenToken","parseShorthandLambdaFunction","parseObject","parseArray","tokenType","parseNumber","parseString","parseReservedSymbol","isStringToken","stringNode","stringFromQuotedSymbol","nextToken","assertRBracketToken","functionArguments","parsedBlock","defaults","parseBindingTarget","startPos","endPos","dollar1","pos","parseOptionalDefaulValue","requireDefaultValue","noRest","elements","keySymbol","keyName","allowDocString","isDocStringToken","parseDocString","assertImplicitBlockEnd","ends","isImplicitBlockEnd","parseImplicitBlock","try","isDoseq","existingBoundNames","forLoopBindings","flatMap","newBoundNames","loopBinding","parseForLoopBinding","parseBinding","assertInternalLoopBindingDelimiter","modifiers","letNode","isInternalLoopBindingDelimiter","symbolsString","isUnless","condition","thenExpression","elseExpression","unless","cond","valueExpression","caseExpression","exportToken","stringToSymbolNode","backslash","singleQuote","normalChar","isNumberReservedSymbol","numberString","stringToken","doubleQuote","newline","tab","carriageReturn","backspace","formFeed","parseRegexpShorthand","endStringPosition","lastIndexOf","regexpString","optionsString","optionsNode","litsCommands","AutoCompleter","originalProgram","prefixProgram","suffixProgram","searchString","suggestions","lits","originalPosition","partialProgram","lastToken","tokenize","generateSuggestions","getNextSuggestion","getAutoCompleteSuggestionResult","getNextSuggestionSymbol","getPreviousSuggestion","getPreviousSuggestionSymbol","suggestion","program","suggestionIndex","getSuggestions","getSearchString","generateWithPredicate","blacklist","startsWithCaseSensitive","startsWithCaseInsensitive","includesCaseSensitive","includesCaseInsensitive","shouldInclude","localeCompare","Cache","cache","firstEntry","lastEntry","_size","maxSize","getContent","size","clear","set","newEntry","nextEntry","dropFirstEntry","Lits","astCache","astCacheSize","debug","config","initialCache","cacheEntry","nsList","ns","getRuntimeInfo","run","generateAst","programOrAst","tokenizeParams","createSourceCodeInfo","tokenDescriptor","minify","hasDebugData","transformSymbols","transformer","tokenStram","transformSymbolTokens","untokenize","apply","fnParams","generateApplyFunctionCall","fnName","paramsString","cachedAst","getAutoCompleter"],"mappings":"AAEM,SAAUA,EAAcC,GAC5B,IAAKA,EAAeC,WAAaD,EAAeE,KAC9C,MAAO,GAET,MAAMC,EAAcH,EAAeC,SAASG,OAAS,EAC/CC,EAAeL,EAAeE,KAAKI,OAASH,EAAc,EAChE,MAAO,GAA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