@mojir/dvala 0.0.1 → 0.0.2
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/LICENSE +1 -1
- package/README.md +1613 -4
- package/dist/bundler.esm.js +2 -0
- package/dist/bundler.esm.js.map +1 -0
- package/dist/bundler.js +2 -0
- package/dist/bundler.js.map +1 -0
- package/dist/cli/cli/src/cli.d.ts +2 -0
- package/dist/cli/cli/src/cliDocumentation/formatCliDescription.d.ts +3 -0
- package/dist/cli/cli/src/cliDocumentation/getCliArgumentInfo.d.ts +3 -0
- package/dist/cli/cli/src/cliDocumentation/getCliDocumentation.d.ts +2 -0
- package/dist/cli/cli/src/cliDocumentation/getCliFunctionExamples.d.ts +3 -0
- package/dist/cli/cli/src/cliDocumentation/getCliFunctionSignature.d.ts +3 -0
- package/dist/cli/cli/src/cliDocumentation/getCliTitle.d.ts +3 -0
- package/dist/cli/cli/src/cliDocumentation/getCliType.d.ts +3 -0
- package/dist/cli/cli/src/cliFormatterRules.d.ts +13 -0
- package/dist/cli/cli/src/colorizer.d.ts +939 -0
- package/dist/cli/cli/src/createReadlineInterface.d.ts +5 -0
- package/dist/cli/cli/src/js-interop/Cli/Fs/index.d.ts +2 -0
- package/dist/cli/cli/src/js-interop/Cli/Proc/index.d.ts +3 -0
- package/dist/cli/cli/src/js-interop/Cli/index.d.ts +2 -0
- package/dist/cli/cli.js +38614 -0
- package/dist/cli/common/createFormatter.d.ts +6 -0
- package/dist/cli/common/utils.d.ts +2 -0
- package/dist/cli/reference/api.d.ts +75 -0
- package/dist/cli/reference/datatype.d.ts +3 -0
- package/dist/cli/reference/effect.d.ts +3 -0
- package/dist/cli/reference/examples.d.ts +11 -0
- package/dist/cli/reference/index.d.ts +191 -0
- package/dist/cli/reference/shorthand.d.ts +3 -0
- package/dist/cli/src/AutoCompleter/AutoCompleter.d.ts +25 -0
- package/dist/cli/src/Dvala/Cache.d.ts +16 -0
- package/dist/cli/src/Dvala/Dvala.d.ts +68 -0
- package/dist/cli/src/allModules.d.ts +2 -0
- package/dist/cli/src/builtin/bindingNode.d.ts +11 -0
- package/dist/cli/src/builtin/core/array.d.ts +2 -0
- package/dist/cli/src/builtin/core/assertion.d.ts +2 -0
- package/dist/cli/src/builtin/core/bitwise.d.ts +2 -0
- package/dist/cli/src/builtin/core/collection.d.ts +2 -0
- package/dist/cli/src/builtin/core/functional.d.ts +2 -0
- package/dist/cli/src/builtin/core/math.d.ts +2 -0
- package/dist/cli/src/builtin/core/meta.d.ts +3 -0
- package/dist/cli/src/builtin/core/misc.d.ts +2 -0
- package/dist/cli/src/builtin/core/object.d.ts +2 -0
- package/dist/cli/src/builtin/core/predicates.d.ts +2 -0
- package/dist/cli/src/builtin/core/regexp.d.ts +2 -0
- package/dist/cli/src/builtin/core/sequence.d.ts +2 -0
- package/dist/cli/src/builtin/core/string.d.ts +2 -0
- package/dist/cli/src/builtin/core/vector.d.ts +2 -0
- package/dist/cli/src/builtin/index.d.ts +13 -0
- package/dist/cli/src/builtin/interface.d.ts +113 -0
- package/dist/cli/src/builtin/modules/assertion/docs.d.ts +2 -0
- package/dist/cli/src/builtin/modules/assertion/index.d.ts +2 -0
- 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/convert/index.d.ts +2 -0
- package/dist/cli/src/builtin/modules/functional/index.d.ts +2 -0
- package/dist/cli/src/builtin/modules/grid/docs.d.ts +2 -0
- package/dist/cli/src/builtin/modules/grid/fromArray.d.ts +8 -0
- package/dist/cli/src/builtin/modules/grid/index.d.ts +2 -0
- package/dist/cli/src/builtin/modules/grid/transpose.d.ts +2 -0
- package/dist/cli/src/builtin/modules/interface.d.ts +11 -0
- package/dist/cli/src/builtin/modules/linear-algebra/docs.d.ts +2 -0
- package/dist/cli/src/builtin/modules/linear-algebra/helpers/calcFractionalRanks.d.ts +1 -0
- package/dist/cli/src/builtin/modules/linear-algebra/helpers/collinear.d.ts +2 -0
- package/dist/cli/src/builtin/modules/linear-algebra/helpers/corrleation.d.ts +8 -0
- package/dist/cli/src/builtin/modules/linear-algebra/helpers/covariance.d.ts +4 -0
- package/dist/cli/src/builtin/modules/linear-algebra/helpers/dot.d.ts +1 -0
- package/dist/cli/src/builtin/modules/linear-algebra/helpers/gaussJordanElimination.d.ts +7 -0
- package/dist/cli/src/builtin/modules/linear-algebra/helpers/getUnit.d.ts +2 -0
- package/dist/cli/src/builtin/modules/linear-algebra/helpers/isZeroVector.d.ts +1 -0
- package/dist/cli/src/builtin/modules/linear-algebra/helpers/kendallTau.d.ts +10 -0
- package/dist/cli/src/builtin/modules/linear-algebra/helpers/length.d.ts +1 -0
- package/dist/cli/src/builtin/modules/linear-algebra/helpers/pearsonCorr.d.ts +1 -0
- package/dist/cli/src/builtin/modules/linear-algebra/helpers/scale.d.ts +1 -0
- package/dist/cli/src/builtin/modules/linear-algebra/helpers/solve.d.ts +8 -0
- package/dist/cli/src/builtin/modules/linear-algebra/helpers/subtract.d.ts +1 -0
- package/dist/cli/src/builtin/modules/linear-algebra/index.d.ts +4 -0
- package/dist/cli/src/builtin/modules/math/index.d.ts +2 -0
- package/dist/cli/src/builtin/modules/matrix/docs.d.ts +2 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/adjugate.d.ts +1 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/band.d.ts +9 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/cofactor.d.ts +1 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/determinant.d.ts +6 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/inverse.d.ts +6 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/isBanded.d.ts +11 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/isDiagonal.d.ts +10 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/isIdentity.d.ts +1 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/isOrthogonal.d.ts +1 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/isSquare.d.ts +1 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/isSymetric.d.ts +8 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/isTriangular.d.ts +13 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/matrixMultiply.d.ts +7 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/minor.d.ts +1 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/norm1.d.ts +1 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/trace.d.ts +8 -0
- package/dist/cli/src/builtin/modules/matrix/index.d.ts +4 -0
- package/dist/cli/src/builtin/modules/number-theory/binomialCefficient.d.ts +1 -0
- package/dist/cli/src/builtin/modules/number-theory/combinations.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/derangements.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/divisors.d.ts +4 -0
- package/dist/cli/src/builtin/modules/number-theory/docs.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/factorial.d.ts +3 -0
- package/dist/cli/src/builtin/modules/number-theory/index.d.ts +4 -0
- package/dist/cli/src/builtin/modules/number-theory/partitions.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/permutations.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/powerSet.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/primeFactors.d.ts +11 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/abundant.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/arithmetic.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/bell.d.ts +1 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/bernoulli.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/catalan.d.ts +1 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/collatz.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/composite.d.ts +3 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/deficient.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/factorial.d.ts +1 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/fibonacci.d.ts +1 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/geometric.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/golomb.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/happy.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/index.d.ts +27 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/juggler.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/lookAndSay.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/lucas.d.ts +1 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/lucky.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/mersenne.d.ts +1 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/padovan.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/partition.d.ts +1 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/pell.d.ts +1 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/perfect.d.ts +1 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/perfectCube.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/perfectPower.d.ts +10 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/perfectSquare.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/poligonal.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/prime.d.ts +3 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/recaman.d.ts +9 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/sylvester.d.ts +1 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/thueMorse.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/tribonacci.d.ts +1 -0
- package/dist/cli/src/builtin/modules/random/docs.d.ts +2 -0
- package/dist/cli/src/builtin/modules/random/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/builtin/modules/vector/bincount.d.ts +9 -0
- package/dist/cli/src/builtin/modules/vector/calcMad.d.ts +1 -0
- package/dist/cli/src/builtin/modules/vector/calcMean.d.ts +1 -0
- package/dist/cli/src/builtin/modules/vector/calcMedad.d.ts +1 -0
- package/dist/cli/src/builtin/modules/vector/calcMedian.d.ts +1 -0
- package/dist/cli/src/builtin/modules/vector/calcStdDev.d.ts +2 -0
- package/dist/cli/src/builtin/modules/vector/calcVariance.d.ts +2 -0
- package/dist/cli/src/builtin/modules/vector/docs.d.ts +2 -0
- package/dist/cli/src/builtin/modules/vector/entropy.d.ts +8 -0
- package/dist/cli/src/builtin/modules/vector/histogram.d.ts +9 -0
- package/dist/cli/src/builtin/modules/vector/index.d.ts +2 -0
- package/dist/cli/src/builtin/modules/vector/mode.d.ts +6 -0
- package/dist/cli/src/builtin/modules/vector/outliers.d.ts +7 -0
- package/dist/cli/src/builtin/modules/vector/percentile.d.ts +7 -0
- package/dist/cli/src/builtin/modules/vector/quartiles.d.ts +1 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/entropy.d.ts +2 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/giniCoefficient.d.ts +2 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/index.d.ts +13 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/iqr.d.ts +2 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/kurtosis.d.ts +5 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/mad.d.ts +2 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/mean.d.ts +4 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/medad.d.ts +2 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/median.d.ts +2 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/prod.d.ts +2 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/rms.d.ts +2 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/skewness.d.ts +3 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/span.d.ts +2 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/standardDeviation.d.ts +3 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/sum.d.ts +2 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/variance.d.ts +3 -0
- package/dist/cli/src/builtin/normalExpressions/index.d.ts +8 -0
- package/dist/cli/src/builtin/specialExpressionTypes.d.ts +26 -0
- package/dist/cli/src/builtin/specialExpressions/and.d.ts +6 -0
- package/dist/cli/src/builtin/specialExpressions/array.d.ts +6 -0
- package/dist/cli/src/builtin/specialExpressions/block.d.ts +6 -0
- package/dist/cli/src/builtin/specialExpressions/cond.d.ts +6 -0
- package/dist/cli/src/builtin/specialExpressions/defined.d.ts +5 -0
- package/dist/cli/src/builtin/specialExpressions/effect.d.ts +5 -0
- package/dist/cli/src/builtin/specialExpressions/functions.d.ts +6 -0
- package/dist/cli/src/builtin/specialExpressions/if.d.ts +6 -0
- package/dist/cli/src/builtin/specialExpressions/import.d.ts +6 -0
- package/dist/cli/src/builtin/specialExpressions/let.d.ts +6 -0
- package/dist/cli/src/builtin/specialExpressions/loop.d.ts +6 -0
- package/dist/cli/src/builtin/specialExpressions/loops.d.ts +9 -0
- package/dist/cli/src/builtin/specialExpressions/match.d.ts +7 -0
- package/dist/cli/src/builtin/specialExpressions/object.d.ts +6 -0
- package/dist/cli/src/builtin/specialExpressions/or.d.ts +6 -0
- package/dist/cli/src/builtin/specialExpressions/parallel.d.ts +6 -0
- package/dist/cli/src/builtin/specialExpressions/perform.d.ts +6 -0
- package/dist/cli/src/builtin/specialExpressions/qq.d.ts +6 -0
- package/dist/cli/src/builtin/specialExpressions/race.d.ts +6 -0
- package/dist/cli/src/builtin/specialExpressions/recur.d.ts +5 -0
- package/dist/cli/src/builtin/specialExpressions/throw.d.ts +5 -0
- package/dist/cli/src/builtin/specialExpressions/try.d.ts +7 -0
- package/dist/cli/src/builtin/specialExpressions/unless.d.ts +6 -0
- package/dist/cli/src/builtin/utils.d.ts +6 -0
- package/dist/cli/src/bundler/index.d.ts +9 -0
- package/dist/cli/src/bundler/interface.d.ts +15 -0
- package/dist/cli/src/bundler.d.ts +3 -0
- package/dist/cli/src/cli.d.ts +2 -0
- package/dist/cli/src/cliDocumentation/formatCliDescription.d.ts +3 -0
- package/dist/cli/src/cliDocumentation/getCliArgumentInfo.d.ts +3 -0
- package/dist/cli/src/cliDocumentation/getCliDocumentation.d.ts +2 -0
- package/dist/cli/src/cliDocumentation/getCliFunctionExamples.d.ts +3 -0
- package/dist/cli/src/cliDocumentation/getCliFunctionSignature.d.ts +3 -0
- package/dist/cli/src/cliDocumentation/getCliTitle.d.ts +3 -0
- package/dist/cli/src/cliDocumentation/getCliType.d.ts +3 -0
- package/dist/cli/src/cliFormatterRules.d.ts +13 -0
- package/dist/cli/src/colorizer.d.ts +939 -0
- package/dist/cli/src/constants/constants.d.ts +19 -0
- package/dist/cli/src/createReadlineInterface.d.ts +5 -0
- package/dist/cli/src/effects.d.ts +106 -0
- package/dist/cli/src/errors.d.ts +24 -0
- package/dist/cli/src/evaluator/ContextStack.d.ts +65 -0
- package/dist/cli/src/evaluator/effectRef.d.ts +27 -0
- package/dist/cli/src/evaluator/effectTypes.d.ts +79 -0
- package/dist/cli/src/evaluator/frames.d.ts +525 -0
- package/dist/cli/src/evaluator/interface.d.ts +14 -0
- package/dist/cli/src/evaluator/serialization.d.ts +45 -0
- package/dist/cli/src/evaluator/standardEffects.d.ts +35 -0
- package/dist/cli/src/evaluator/step.d.ts +159 -0
- package/dist/cli/src/evaluator/suspension.d.ts +53 -0
- package/dist/cli/src/evaluator/trampoline.d.ts +119 -0
- package/dist/cli/src/getUndefinedSymbols/index.d.ts +7 -0
- package/dist/cli/src/index.d.ts +18 -0
- package/dist/cli/src/initReferenceData.d.ts +1 -0
- package/dist/cli/src/interface.d.ts +7 -0
- package/dist/cli/src/js-interop/Cli/Fs/index.d.ts +2 -0
- package/dist/cli/src/js-interop/Cli/Proc/index.d.ts +3 -0
- package/dist/cli/src/js-interop/Cli/index.d.ts +2 -0
- package/dist/cli/src/parser/ParserContext.d.ts +20 -0
- package/dist/cli/src/parser/getPrecedence.d.ts +3 -0
- package/dist/cli/src/parser/helpers.d.ts +19 -0
- package/dist/cli/src/parser/index.d.ts +5 -0
- package/dist/cli/src/parser/subParsers/parseArray.d.ts +3 -0
- package/dist/cli/src/parser/subParsers/parseBindingTarget.d.ts +8 -0
- package/dist/cli/src/parser/subParsers/parseCond.d.ts +4 -0
- package/dist/cli/src/parser/subParsers/parseDo.d.ts +3 -0
- package/dist/cli/src/parser/subParsers/parseExpression.d.ts +5 -0
- package/dist/cli/src/parser/subParsers/parseForOrDoseq.d.ts +4 -0
- package/dist/cli/src/parser/subParsers/parseFunction.d.ts +4 -0
- package/dist/cli/src/parser/subParsers/parseFunctionCall.d.ts +3 -0
- package/dist/cli/src/parser/subParsers/parseIfOrUnless.d.ts +5 -0
- package/dist/cli/src/parser/subParsers/parseImplicitBlock.d.ts +5 -0
- package/dist/cli/src/parser/subParsers/parseLet.d.ts +4 -0
- package/dist/cli/src/parser/subParsers/parseLoop.d.ts +4 -0
- package/dist/cli/src/parser/subParsers/parseMatch.d.ts +4 -0
- package/dist/cli/src/parser/subParsers/parseNumber.d.ts +3 -0
- package/dist/cli/src/parser/subParsers/parseObject.d.ts +3 -0
- package/dist/cli/src/parser/subParsers/parseOperand.d.ts +3 -0
- package/dist/cli/src/parser/subParsers/parseRegexpShorthand.d.ts +3 -0
- package/dist/cli/src/parser/subParsers/parseReservedSymbol.d.ts +3 -0
- package/dist/cli/src/parser/subParsers/parseString.d.ts +4 -0
- package/dist/cli/src/parser/subParsers/parseSymbol.d.ts +3 -0
- package/dist/cli/src/parser/subParsers/parseTry.d.ts +4 -0
- package/dist/cli/src/parser/types.d.ts +129 -0
- package/dist/cli/src/symbolPatterns.d.ts +2 -0
- package/dist/cli/src/testFramework/index.d.ts +15 -0
- package/dist/cli/src/tokenizer/minifyTokenStream.d.ts +4 -0
- package/dist/cli/src/tokenizer/operators.d.ts +12 -0
- package/dist/cli/src/tokenizer/reservedNames.d.ts +66 -0
- package/dist/cli/src/tokenizer/token.d.ts +84 -0
- package/dist/cli/src/tokenizer/tokenize.d.ts +8 -0
- package/dist/cli/src/tokenizer/tokenizers.d.ts +14 -0
- package/dist/cli/src/transformer/index.d.ts +2 -0
- package/dist/cli/src/typeGuards/annotatedArrays.d.ts +16 -0
- package/dist/cli/src/typeGuards/array.d.ts +9 -0
- package/dist/cli/src/typeGuards/astNode.d.ts +19 -0
- package/dist/cli/src/typeGuards/dvala.d.ts +26 -0
- package/dist/cli/src/typeGuards/dvalaFunction.d.ts +12 -0
- package/dist/cli/src/typeGuards/index.d.ts +7 -0
- package/dist/cli/src/typeGuards/number.d.ts +66 -0
- package/dist/cli/src/typeGuards/string.d.ts +15 -0
- package/dist/cli/src/untokenizer/index.d.ts +2 -0
- package/dist/cli/src/utils/arity.d.ts +10 -0
- package/dist/cli/src/utils/debug/debugTools.d.ts +1 -0
- package/dist/cli/src/utils/debug/getCodeMarker.d.ts +2 -0
- package/dist/cli/src/utils/debug/getSourceCodeInfo.d.ts +2 -0
- package/dist/cli/src/utils/docString/generateDocString.d.ts +2 -0
- package/dist/cli/src/utils/getAssertionError.d.ts +3 -0
- package/dist/cli/src/utils/index.d.ts +14 -0
- package/dist/cli/src/utils/maybePromise.d.ts +54 -0
- package/dist/cli/src/utils/symbols.d.ts +3 -0
- package/dist/common/createFormatter.d.ts +6 -0
- package/dist/common/utils.d.ts +2 -0
- package/dist/debug.esm.js +2 -0
- package/dist/debug.esm.js.map +1 -0
- package/dist/debug.js +2 -0
- package/dist/debug.js.map +1 -0
- package/dist/dvala.iife.js +2 -0
- package/dist/dvala.iife.js.map +1 -0
- package/dist/full.esm.js +2 -0
- package/dist/full.esm.js.map +1 -0
- package/dist/full.js +2 -0
- package/dist/full.js.map +1 -0
- package/dist/index.esm.js +2 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/modules/assertion.esm.js +2 -0
- package/dist/modules/assertion.esm.js.map +1 -0
- package/dist/modules/assertion.js +2 -0
- package/dist/modules/assertion.js.map +1 -0
- 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/cli/src/cli.d.ts +2 -0
- package/dist/modules/cli/src/cliDocumentation/formatCliDescription.d.ts +3 -0
- package/dist/modules/cli/src/cliDocumentation/getCliArgumentInfo.d.ts +3 -0
- package/dist/modules/cli/src/cliDocumentation/getCliDocumentation.d.ts +2 -0
- package/dist/modules/cli/src/cliDocumentation/getCliFunctionExamples.d.ts +3 -0
- package/dist/modules/cli/src/cliDocumentation/getCliFunctionSignature.d.ts +3 -0
- package/dist/modules/cli/src/cliDocumentation/getCliTitle.d.ts +3 -0
- package/dist/modules/cli/src/cliDocumentation/getCliType.d.ts +3 -0
- package/dist/modules/cli/src/cliFormatterRules.d.ts +13 -0
- package/dist/modules/cli/src/colorizer.d.ts +939 -0
- package/dist/modules/cli/src/createReadlineInterface.d.ts +5 -0
- package/dist/modules/cli/src/js-interop/Cli/Fs/index.d.ts +2 -0
- package/dist/modules/cli/src/js-interop/Cli/Proc/index.d.ts +3 -0
- package/dist/modules/cli/src/js-interop/Cli/index.d.ts +2 -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/common/createFormatter.d.ts +6 -0
- package/dist/modules/common/utils.d.ts +2 -0
- package/dist/modules/convert.esm.js +2 -0
- package/dist/modules/convert.esm.js.map +1 -0
- package/dist/modules/convert.js +2 -0
- package/dist/modules/convert.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 +2 -0
- package/dist/modules/grid.esm.js.map +1 -0
- package/dist/modules/grid.js +2 -0
- package/dist/modules/grid.js.map +1 -0
- 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 +2 -0
- package/dist/modules/matrix.esm.js.map +1 -0
- package/dist/modules/matrix.js +2 -0
- package/dist/modules/matrix.js.map +1 -0
- 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 +2 -0
- package/dist/modules/random.esm.js.map +1 -0
- package/dist/modules/random.js +2 -0
- package/dist/modules/random.js.map +1 -0
- package/dist/modules/reference/api.d.ts +75 -0
- package/dist/modules/reference/datatype.d.ts +3 -0
- package/dist/modules/reference/effect.d.ts +3 -0
- package/dist/modules/reference/index.d.ts +191 -0
- package/dist/modules/reference/shorthand.d.ts +3 -0
- 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/AutoCompleter/AutoCompleter.d.ts +25 -0
- package/dist/modules/src/Dvala/Cache.d.ts +16 -0
- package/dist/modules/src/Dvala/Dvala.d.ts +68 -0
- package/dist/modules/src/allModules.d.ts +2 -0
- package/dist/modules/src/builtin/bindingNode.d.ts +11 -0
- package/dist/modules/src/builtin/core/array.d.ts +2 -0
- package/dist/modules/src/builtin/core/assertion.d.ts +2 -0
- package/dist/modules/src/builtin/core/bitwise.d.ts +2 -0
- package/dist/modules/src/builtin/core/collection.d.ts +2 -0
- package/dist/modules/src/builtin/core/functional.d.ts +2 -0
- package/dist/modules/src/builtin/core/math.d.ts +2 -0
- package/dist/modules/src/builtin/core/meta.d.ts +3 -0
- package/dist/modules/src/builtin/core/misc.d.ts +2 -0
- package/dist/modules/src/builtin/core/object.d.ts +2 -0
- package/dist/modules/src/builtin/core/predicates.d.ts +2 -0
- package/dist/modules/src/builtin/core/regexp.d.ts +2 -0
- package/dist/modules/src/builtin/core/sequence.d.ts +2 -0
- package/dist/modules/src/builtin/core/string.d.ts +2 -0
- package/dist/modules/src/builtin/core/vector.d.ts +2 -0
- package/dist/modules/src/builtin/index.d.ts +13 -0
- package/dist/modules/src/builtin/interface.d.ts +113 -0
- package/dist/modules/src/builtin/modules/assertion/docs.d.ts +2 -0
- package/dist/modules/src/builtin/modules/assertion/index.d.ts +2 -0
- 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/convert/index.d.ts +2 -0
- package/dist/modules/src/builtin/modules/functional/index.d.ts +2 -0
- package/dist/modules/src/builtin/modules/grid/docs.d.ts +2 -0
- package/dist/modules/src/builtin/modules/grid/fromArray.d.ts +8 -0
- package/dist/modules/src/builtin/modules/grid/index.d.ts +2 -0
- package/dist/modules/src/builtin/modules/grid/transpose.d.ts +2 -0
- package/dist/modules/src/builtin/modules/interface.d.ts +11 -0
- package/dist/modules/src/builtin/modules/linear-algebra/docs.d.ts +2 -0
- package/dist/modules/src/builtin/modules/linear-algebra/helpers/calcFractionalRanks.d.ts +1 -0
- package/dist/modules/src/builtin/modules/linear-algebra/helpers/collinear.d.ts +2 -0
- package/dist/modules/src/builtin/modules/linear-algebra/helpers/corrleation.d.ts +8 -0
- package/dist/modules/src/builtin/modules/linear-algebra/helpers/covariance.d.ts +4 -0
- package/dist/modules/src/builtin/modules/linear-algebra/helpers/dot.d.ts +1 -0
- package/dist/modules/src/builtin/modules/linear-algebra/helpers/gaussJordanElimination.d.ts +7 -0
- package/dist/modules/src/builtin/modules/linear-algebra/helpers/getUnit.d.ts +2 -0
- package/dist/modules/src/builtin/modules/linear-algebra/helpers/isZeroVector.d.ts +1 -0
- package/dist/modules/src/builtin/modules/linear-algebra/helpers/kendallTau.d.ts +10 -0
- package/dist/modules/src/builtin/modules/linear-algebra/helpers/length.d.ts +1 -0
- package/dist/modules/src/builtin/modules/linear-algebra/helpers/pearsonCorr.d.ts +1 -0
- package/dist/modules/src/builtin/modules/linear-algebra/helpers/scale.d.ts +1 -0
- package/dist/modules/src/builtin/modules/linear-algebra/helpers/solve.d.ts +8 -0
- package/dist/modules/src/builtin/modules/linear-algebra/helpers/subtract.d.ts +1 -0
- package/dist/modules/src/builtin/modules/linear-algebra/index.d.ts +4 -0
- package/dist/modules/src/builtin/modules/math/index.d.ts +2 -0
- package/dist/modules/src/builtin/modules/matrix/docs.d.ts +2 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/adjugate.d.ts +1 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/band.d.ts +9 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/cofactor.d.ts +1 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/determinant.d.ts +6 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/diagonal.d.ts +1 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/inverse.d.ts +6 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/isBanded.d.ts +11 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/isDiagonal.d.ts +10 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/isIdentity.d.ts +1 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/isOrthogonal.d.ts +1 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/isSquare.d.ts +1 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/isSymetric.d.ts +8 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/isTriangular.d.ts +13 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/matrixMultiply.d.ts +7 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/minor.d.ts +1 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/norm1.d.ts +1 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/trace.d.ts +8 -0
- package/dist/modules/src/builtin/modules/matrix/index.d.ts +4 -0
- package/dist/modules/src/builtin/modules/number-theory/binomialCefficient.d.ts +1 -0
- package/dist/modules/src/builtin/modules/number-theory/combinations.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/derangements.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/divisors.d.ts +4 -0
- package/dist/modules/src/builtin/modules/number-theory/docs.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/factorial.d.ts +3 -0
- package/dist/modules/src/builtin/modules/number-theory/index.d.ts +4 -0
- package/dist/modules/src/builtin/modules/number-theory/partitions.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/permutations.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/powerSet.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/primeFactors.d.ts +11 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/abundant.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/arithmetic.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/bell.d.ts +1 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/bernoulli.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/catalan.d.ts +1 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/collatz.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/composite.d.ts +3 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/deficient.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/factorial.d.ts +1 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/fibonacci.d.ts +1 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/geometric.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/golomb.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/happy.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/index.d.ts +27 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/juggler.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/lookAndSay.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/lucas.d.ts +1 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/lucky.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/mersenne.d.ts +1 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/padovan.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/partition.d.ts +1 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/pell.d.ts +1 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/perfect.d.ts +1 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/perfectCube.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/perfectPower.d.ts +10 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/perfectSquare.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/poligonal.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/prime.d.ts +3 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/recaman.d.ts +9 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/sylvester.d.ts +1 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/thueMorse.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/tribonacci.d.ts +1 -0
- package/dist/modules/src/builtin/modules/random/docs.d.ts +2 -0
- package/dist/modules/src/builtin/modules/random/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/builtin/modules/vector/bincount.d.ts +9 -0
- package/dist/modules/src/builtin/modules/vector/calcMad.d.ts +1 -0
- package/dist/modules/src/builtin/modules/vector/calcMean.d.ts +1 -0
- package/dist/modules/src/builtin/modules/vector/calcMedad.d.ts +1 -0
- package/dist/modules/src/builtin/modules/vector/calcMedian.d.ts +1 -0
- package/dist/modules/src/builtin/modules/vector/calcStdDev.d.ts +2 -0
- package/dist/modules/src/builtin/modules/vector/calcVariance.d.ts +2 -0
- package/dist/modules/src/builtin/modules/vector/docs.d.ts +2 -0
- package/dist/modules/src/builtin/modules/vector/entropy.d.ts +8 -0
- package/dist/modules/src/builtin/modules/vector/histogram.d.ts +9 -0
- package/dist/modules/src/builtin/modules/vector/index.d.ts +2 -0
- package/dist/modules/src/builtin/modules/vector/mode.d.ts +6 -0
- package/dist/modules/src/builtin/modules/vector/outliers.d.ts +7 -0
- package/dist/modules/src/builtin/modules/vector/percentile.d.ts +7 -0
- package/dist/modules/src/builtin/modules/vector/quartiles.d.ts +1 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/entropy.d.ts +2 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/giniCoefficient.d.ts +2 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/index.d.ts +13 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/iqr.d.ts +2 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/kurtosis.d.ts +5 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/mad.d.ts +2 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/mean.d.ts +4 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/medad.d.ts +2 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/median.d.ts +2 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/prod.d.ts +2 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/rms.d.ts +2 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/skewness.d.ts +3 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/span.d.ts +2 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/standardDeviation.d.ts +3 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/sum.d.ts +2 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/variance.d.ts +3 -0
- package/dist/modules/src/builtin/normalExpressions/index.d.ts +8 -0
- package/dist/modules/src/builtin/specialExpressionTypes.d.ts +26 -0
- package/dist/modules/src/builtin/specialExpressions/and.d.ts +6 -0
- package/dist/modules/src/builtin/specialExpressions/array.d.ts +6 -0
- package/dist/modules/src/builtin/specialExpressions/block.d.ts +6 -0
- package/dist/modules/src/builtin/specialExpressions/cond.d.ts +6 -0
- package/dist/modules/src/builtin/specialExpressions/defined.d.ts +5 -0
- package/dist/modules/src/builtin/specialExpressions/effect.d.ts +5 -0
- package/dist/modules/src/builtin/specialExpressions/functions.d.ts +6 -0
- package/dist/modules/src/builtin/specialExpressions/if.d.ts +6 -0
- package/dist/modules/src/builtin/specialExpressions/import.d.ts +6 -0
- package/dist/modules/src/builtin/specialExpressions/let.d.ts +6 -0
- package/dist/modules/src/builtin/specialExpressions/loop.d.ts +6 -0
- package/dist/modules/src/builtin/specialExpressions/loops.d.ts +9 -0
- package/dist/modules/src/builtin/specialExpressions/match.d.ts +7 -0
- package/dist/modules/src/builtin/specialExpressions/object.d.ts +6 -0
- package/dist/modules/src/builtin/specialExpressions/or.d.ts +6 -0
- package/dist/modules/src/builtin/specialExpressions/parallel.d.ts +6 -0
- package/dist/modules/src/builtin/specialExpressions/perform.d.ts +6 -0
- package/dist/modules/src/builtin/specialExpressions/qq.d.ts +6 -0
- package/dist/modules/src/builtin/specialExpressions/race.d.ts +6 -0
- package/dist/modules/src/builtin/specialExpressions/recur.d.ts +5 -0
- package/dist/modules/src/builtin/specialExpressions/throw.d.ts +5 -0
- package/dist/modules/src/builtin/specialExpressions/try.d.ts +7 -0
- package/dist/modules/src/builtin/specialExpressions/unless.d.ts +6 -0
- package/dist/modules/src/builtin/utils.d.ts +6 -0
- package/dist/modules/src/bundler/index.d.ts +9 -0
- package/dist/modules/src/bundler/interface.d.ts +15 -0
- package/dist/modules/src/bundler.d.ts +3 -0
- package/dist/modules/src/constants/constants.d.ts +19 -0
- package/dist/modules/src/debug.d.ts +115 -0
- package/dist/modules/src/effects.d.ts +106 -0
- package/dist/modules/src/errors.d.ts +24 -0
- package/dist/modules/src/evaluator/ContextStack.d.ts +65 -0
- package/dist/modules/src/evaluator/effectRef.d.ts +27 -0
- package/dist/modules/src/evaluator/effectTypes.d.ts +79 -0
- package/dist/modules/src/evaluator/frames.d.ts +525 -0
- package/dist/modules/src/evaluator/interface.d.ts +14 -0
- package/dist/modules/src/evaluator/serialization.d.ts +45 -0
- package/dist/modules/src/evaluator/standardEffects.d.ts +35 -0
- package/dist/modules/src/evaluator/step.d.ts +159 -0
- package/dist/modules/src/evaluator/suspension.d.ts +53 -0
- package/dist/modules/src/evaluator/trampoline.d.ts +119 -0
- package/dist/modules/src/full.d.ts +17 -0
- package/dist/modules/src/getUndefinedSymbols/index.d.ts +7 -0
- package/dist/modules/src/index.d.ts +18 -0
- package/dist/modules/src/initReferenceData.d.ts +1 -0
- package/dist/modules/src/interface.d.ts +7 -0
- package/dist/modules/src/modules/assertion.d.ts +2 -0
- 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/convert.d.ts +2 -0
- package/dist/modules/src/modules/functional.d.ts +2 -0
- package/dist/modules/src/modules/grid.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/matrix.d.ts +2 -0
- package/dist/modules/src/modules/number-theory.d.ts +2 -0
- package/dist/modules/src/modules/random.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/modules/vector.d.ts +2 -0
- package/dist/modules/src/parser/ParserContext.d.ts +20 -0
- package/dist/modules/src/parser/getPrecedence.d.ts +3 -0
- package/dist/modules/src/parser/helpers.d.ts +19 -0
- package/dist/modules/src/parser/index.d.ts +5 -0
- package/dist/modules/src/parser/subParsers/parseArray.d.ts +3 -0
- package/dist/modules/src/parser/subParsers/parseBindingTarget.d.ts +8 -0
- package/dist/modules/src/parser/subParsers/parseCond.d.ts +4 -0
- package/dist/modules/src/parser/subParsers/parseDo.d.ts +3 -0
- package/dist/modules/src/parser/subParsers/parseExpression.d.ts +5 -0
- package/dist/modules/src/parser/subParsers/parseForOrDoseq.d.ts +4 -0
- package/dist/modules/src/parser/subParsers/parseFunction.d.ts +4 -0
- package/dist/modules/src/parser/subParsers/parseFunctionCall.d.ts +3 -0
- package/dist/modules/src/parser/subParsers/parseIfOrUnless.d.ts +5 -0
- package/dist/modules/src/parser/subParsers/parseImplicitBlock.d.ts +5 -0
- package/dist/modules/src/parser/subParsers/parseLet.d.ts +4 -0
- package/dist/modules/src/parser/subParsers/parseLoop.d.ts +4 -0
- package/dist/modules/src/parser/subParsers/parseMatch.d.ts +4 -0
- package/dist/modules/src/parser/subParsers/parseNumber.d.ts +3 -0
- package/dist/modules/src/parser/subParsers/parseObject.d.ts +3 -0
- package/dist/modules/src/parser/subParsers/parseOperand.d.ts +3 -0
- package/dist/modules/src/parser/subParsers/parseRegexpShorthand.d.ts +3 -0
- package/dist/modules/src/parser/subParsers/parseReservedSymbol.d.ts +3 -0
- package/dist/modules/src/parser/subParsers/parseString.d.ts +4 -0
- package/dist/modules/src/parser/subParsers/parseSymbol.d.ts +3 -0
- package/dist/modules/src/parser/subParsers/parseTry.d.ts +4 -0
- package/dist/modules/src/parser/types.d.ts +129 -0
- package/dist/modules/src/symbolPatterns.d.ts +2 -0
- package/dist/modules/src/testFramework/index.d.ts +15 -0
- package/dist/modules/src/tokenizer/minifyTokenStream.d.ts +4 -0
- package/dist/modules/src/tokenizer/operators.d.ts +12 -0
- package/dist/modules/src/tokenizer/reservedNames.d.ts +66 -0
- package/dist/modules/src/tokenizer/token.d.ts +84 -0
- package/dist/modules/src/tokenizer/tokenize.d.ts +8 -0
- package/dist/modules/src/tokenizer/tokenizers.d.ts +14 -0
- package/dist/modules/src/transformer/index.d.ts +2 -0
- package/dist/modules/src/typeGuards/annotatedArrays.d.ts +16 -0
- package/dist/modules/src/typeGuards/array.d.ts +9 -0
- package/dist/modules/src/typeGuards/astNode.d.ts +19 -0
- package/dist/modules/src/typeGuards/dvala.d.ts +26 -0
- package/dist/modules/src/typeGuards/dvalaFunction.d.ts +12 -0
- package/dist/modules/src/typeGuards/index.d.ts +7 -0
- package/dist/modules/src/typeGuards/number.d.ts +66 -0
- package/dist/modules/src/typeGuards/string.d.ts +15 -0
- package/dist/modules/src/untokenizer/index.d.ts +2 -0
- package/dist/modules/src/utils/arity.d.ts +10 -0
- package/dist/modules/src/utils/debug/debugTools.d.ts +1 -0
- package/dist/modules/src/utils/debug/getCodeMarker.d.ts +2 -0
- package/dist/modules/src/utils/debug/getSourceCodeInfo.d.ts +2 -0
- package/dist/modules/src/utils/docString/generateDocString.d.ts +2 -0
- package/dist/modules/src/utils/getAssertionError.d.ts +3 -0
- package/dist/modules/src/utils/index.d.ts +14 -0
- package/dist/modules/src/utils/maybePromise.d.ts +54 -0
- package/dist/modules/src/utils/symbols.d.ts +3 -0
- 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 +2 -0
- package/dist/modules/vector.esm.js.map +1 -0
- package/dist/modules/vector.js +2 -0
- package/dist/modules/vector.js.map +1 -0
- package/dist/reference/api.d.ts +75 -0
- package/dist/reference/datatype.d.ts +3 -0
- package/dist/reference/effect.d.ts +3 -0
- package/dist/reference/index.d.ts +191 -0
- package/dist/reference/shorthand.d.ts +3 -0
- package/dist/src/AutoCompleter/AutoCompleter.d.ts +25 -0
- package/dist/src/Dvala/Cache.d.ts +16 -0
- package/dist/src/Dvala/Dvala.d.ts +68 -0
- package/dist/src/allModules.d.ts +2 -0
- package/dist/src/builtin/bindingNode.d.ts +11 -0
- package/dist/src/builtin/core/array.d.ts +2 -0
- package/dist/src/builtin/core/assertion.d.ts +2 -0
- package/dist/src/builtin/core/bitwise.d.ts +2 -0
- package/dist/src/builtin/core/collection.d.ts +2 -0
- package/dist/src/builtin/core/functional.d.ts +2 -0
- package/dist/src/builtin/core/math.d.ts +2 -0
- package/dist/src/builtin/core/meta.d.ts +3 -0
- package/dist/src/builtin/core/misc.d.ts +2 -0
- package/dist/src/builtin/core/object.d.ts +2 -0
- package/dist/src/builtin/core/predicates.d.ts +2 -0
- package/dist/src/builtin/core/regexp.d.ts +2 -0
- package/dist/src/builtin/core/sequence.d.ts +2 -0
- package/dist/src/builtin/core/string.d.ts +2 -0
- package/dist/src/builtin/core/vector.d.ts +2 -0
- package/dist/src/builtin/index.d.ts +13 -0
- package/dist/src/builtin/interface.d.ts +113 -0
- package/dist/src/builtin/modules/assertion/docs.d.ts +2 -0
- package/dist/src/builtin/modules/assertion/index.d.ts +2 -0
- 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/convert/index.d.ts +2 -0
- package/dist/src/builtin/modules/functional/index.d.ts +2 -0
- package/dist/src/builtin/modules/grid/docs.d.ts +2 -0
- package/dist/src/builtin/modules/grid/fromArray.d.ts +8 -0
- package/dist/src/builtin/modules/grid/index.d.ts +2 -0
- package/dist/src/builtin/modules/grid/transpose.d.ts +2 -0
- package/dist/src/builtin/modules/interface.d.ts +11 -0
- package/dist/src/builtin/modules/linear-algebra/docs.d.ts +2 -0
- package/dist/src/builtin/modules/linear-algebra/helpers/calcFractionalRanks.d.ts +1 -0
- package/dist/src/builtin/modules/linear-algebra/helpers/collinear.d.ts +2 -0
- package/dist/src/builtin/modules/linear-algebra/helpers/corrleation.d.ts +8 -0
- package/dist/src/builtin/modules/linear-algebra/helpers/covariance.d.ts +4 -0
- package/dist/src/builtin/modules/linear-algebra/helpers/dot.d.ts +1 -0
- package/dist/src/builtin/modules/linear-algebra/helpers/gaussJordanElimination.d.ts +7 -0
- package/dist/src/builtin/modules/linear-algebra/helpers/getUnit.d.ts +2 -0
- package/dist/src/builtin/modules/linear-algebra/helpers/isZeroVector.d.ts +1 -0
- package/dist/src/builtin/modules/linear-algebra/helpers/kendallTau.d.ts +10 -0
- package/dist/src/builtin/modules/linear-algebra/helpers/length.d.ts +1 -0
- package/dist/src/builtin/modules/linear-algebra/helpers/pearsonCorr.d.ts +1 -0
- package/dist/src/builtin/modules/linear-algebra/helpers/scale.d.ts +1 -0
- package/dist/src/builtin/modules/linear-algebra/helpers/solve.d.ts +8 -0
- package/dist/src/builtin/modules/linear-algebra/helpers/subtract.d.ts +1 -0
- package/dist/src/builtin/modules/linear-algebra/index.d.ts +4 -0
- package/dist/src/builtin/modules/math/index.d.ts +2 -0
- package/dist/src/builtin/modules/matrix/docs.d.ts +2 -0
- package/dist/src/builtin/modules/matrix/helpers/adjugate.d.ts +1 -0
- package/dist/src/builtin/modules/matrix/helpers/band.d.ts +9 -0
- package/dist/src/builtin/modules/matrix/helpers/cofactor.d.ts +1 -0
- package/dist/src/builtin/modules/matrix/helpers/determinant.d.ts +6 -0
- package/dist/src/builtin/modules/matrix/helpers/diagonal.d.ts +1 -0
- package/dist/src/builtin/modules/matrix/helpers/inverse.d.ts +6 -0
- package/dist/src/builtin/modules/matrix/helpers/isBanded.d.ts +11 -0
- package/dist/src/builtin/modules/matrix/helpers/isDiagonal.d.ts +10 -0
- package/dist/src/builtin/modules/matrix/helpers/isIdentity.d.ts +1 -0
- package/dist/src/builtin/modules/matrix/helpers/isOrthogonal.d.ts +1 -0
- package/dist/src/builtin/modules/matrix/helpers/isSquare.d.ts +1 -0
- package/dist/src/builtin/modules/matrix/helpers/isSymetric.d.ts +8 -0
- package/dist/src/builtin/modules/matrix/helpers/isTriangular.d.ts +13 -0
- package/dist/src/builtin/modules/matrix/helpers/matrixMultiply.d.ts +7 -0
- package/dist/src/builtin/modules/matrix/helpers/minor.d.ts +1 -0
- package/dist/src/builtin/modules/matrix/helpers/norm1.d.ts +1 -0
- package/dist/src/builtin/modules/matrix/helpers/trace.d.ts +8 -0
- package/dist/src/builtin/modules/matrix/index.d.ts +4 -0
- package/dist/src/builtin/modules/number-theory/binomialCefficient.d.ts +1 -0
- package/dist/src/builtin/modules/number-theory/combinations.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/derangements.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/divisors.d.ts +4 -0
- package/dist/src/builtin/modules/number-theory/docs.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/factorial.d.ts +3 -0
- package/dist/src/builtin/modules/number-theory/index.d.ts +4 -0
- package/dist/src/builtin/modules/number-theory/partitions.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/permutations.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/powerSet.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/primeFactors.d.ts +11 -0
- package/dist/src/builtin/modules/number-theory/sequences/abundant.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/arithmetic.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/bell.d.ts +1 -0
- package/dist/src/builtin/modules/number-theory/sequences/bernoulli.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/catalan.d.ts +1 -0
- package/dist/src/builtin/modules/number-theory/sequences/collatz.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/composite.d.ts +3 -0
- package/dist/src/builtin/modules/number-theory/sequences/deficient.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/factorial.d.ts +1 -0
- package/dist/src/builtin/modules/number-theory/sequences/fibonacci.d.ts +1 -0
- package/dist/src/builtin/modules/number-theory/sequences/geometric.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/golomb.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/happy.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/index.d.ts +27 -0
- package/dist/src/builtin/modules/number-theory/sequences/juggler.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/lookAndSay.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/lucas.d.ts +1 -0
- package/dist/src/builtin/modules/number-theory/sequences/lucky.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/mersenne.d.ts +1 -0
- package/dist/src/builtin/modules/number-theory/sequences/padovan.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/partition.d.ts +1 -0
- package/dist/src/builtin/modules/number-theory/sequences/pell.d.ts +1 -0
- package/dist/src/builtin/modules/number-theory/sequences/perfect.d.ts +1 -0
- package/dist/src/builtin/modules/number-theory/sequences/perfectCube.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/perfectPower.d.ts +10 -0
- package/dist/src/builtin/modules/number-theory/sequences/perfectSquare.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/poligonal.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/prime.d.ts +3 -0
- package/dist/src/builtin/modules/number-theory/sequences/recaman.d.ts +9 -0
- package/dist/src/builtin/modules/number-theory/sequences/sylvester.d.ts +1 -0
- package/dist/src/builtin/modules/number-theory/sequences/thueMorse.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/tribonacci.d.ts +1 -0
- package/dist/src/builtin/modules/random/docs.d.ts +2 -0
- package/dist/src/builtin/modules/random/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/builtin/modules/vector/bincount.d.ts +9 -0
- package/dist/src/builtin/modules/vector/calcMad.d.ts +1 -0
- package/dist/src/builtin/modules/vector/calcMean.d.ts +1 -0
- package/dist/src/builtin/modules/vector/calcMedad.d.ts +1 -0
- package/dist/src/builtin/modules/vector/calcMedian.d.ts +1 -0
- package/dist/src/builtin/modules/vector/calcStdDev.d.ts +2 -0
- package/dist/src/builtin/modules/vector/calcVariance.d.ts +2 -0
- package/dist/src/builtin/modules/vector/docs.d.ts +2 -0
- package/dist/src/builtin/modules/vector/entropy.d.ts +8 -0
- package/dist/src/builtin/modules/vector/histogram.d.ts +9 -0
- package/dist/src/builtin/modules/vector/index.d.ts +2 -0
- package/dist/src/builtin/modules/vector/mode.d.ts +6 -0
- package/dist/src/builtin/modules/vector/outliers.d.ts +7 -0
- package/dist/src/builtin/modules/vector/percentile.d.ts +7 -0
- package/dist/src/builtin/modules/vector/quartiles.d.ts +1 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/entropy.d.ts +2 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/giniCoefficient.d.ts +2 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/index.d.ts +13 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/iqr.d.ts +2 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/kurtosis.d.ts +5 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/mad.d.ts +2 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/mean.d.ts +4 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/medad.d.ts +2 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/median.d.ts +2 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/prod.d.ts +2 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/rms.d.ts +2 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/skewness.d.ts +3 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/span.d.ts +2 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/standardDeviation.d.ts +3 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/sum.d.ts +2 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/variance.d.ts +3 -0
- package/dist/src/builtin/normalExpressions/index.d.ts +8 -0
- package/dist/src/builtin/specialExpressionTypes.d.ts +26 -0
- package/dist/src/builtin/specialExpressions/and.d.ts +6 -0
- package/dist/src/builtin/specialExpressions/array.d.ts +6 -0
- package/dist/src/builtin/specialExpressions/block.d.ts +6 -0
- package/dist/src/builtin/specialExpressions/cond.d.ts +6 -0
- package/dist/src/builtin/specialExpressions/defined.d.ts +5 -0
- package/dist/src/builtin/specialExpressions/effect.d.ts +5 -0
- package/dist/src/builtin/specialExpressions/functions.d.ts +6 -0
- package/dist/src/builtin/specialExpressions/if.d.ts +6 -0
- package/dist/src/builtin/specialExpressions/import.d.ts +6 -0
- package/dist/src/builtin/specialExpressions/let.d.ts +6 -0
- package/dist/src/builtin/specialExpressions/loop.d.ts +6 -0
- package/dist/src/builtin/specialExpressions/loops.d.ts +9 -0
- package/dist/src/builtin/specialExpressions/match.d.ts +7 -0
- package/dist/src/builtin/specialExpressions/object.d.ts +6 -0
- package/dist/src/builtin/specialExpressions/or.d.ts +6 -0
- package/dist/src/builtin/specialExpressions/parallel.d.ts +6 -0
- package/dist/src/builtin/specialExpressions/perform.d.ts +6 -0
- package/dist/src/builtin/specialExpressions/qq.d.ts +6 -0
- package/dist/src/builtin/specialExpressions/race.d.ts +6 -0
- package/dist/src/builtin/specialExpressions/recur.d.ts +5 -0
- package/dist/src/builtin/specialExpressions/throw.d.ts +5 -0
- package/dist/src/builtin/specialExpressions/try.d.ts +7 -0
- package/dist/src/builtin/specialExpressions/unless.d.ts +6 -0
- package/dist/src/builtin/utils.d.ts +6 -0
- package/dist/src/bundler/index.d.ts +9 -0
- package/dist/src/bundler/interface.d.ts +15 -0
- package/dist/src/bundler.d.ts +3 -0
- package/dist/src/constants/constants.d.ts +19 -0
- package/dist/src/debug.d.ts +115 -0
- package/dist/src/effects.d.ts +106 -0
- package/dist/src/errors.d.ts +24 -0
- package/dist/src/evaluator/ContextStack.d.ts +65 -0
- package/dist/src/evaluator/effectRef.d.ts +27 -0
- package/dist/src/evaluator/effectTypes.d.ts +79 -0
- package/dist/src/evaluator/frames.d.ts +525 -0
- package/dist/src/evaluator/interface.d.ts +14 -0
- package/dist/src/evaluator/serialization.d.ts +45 -0
- package/dist/src/evaluator/standardEffects.d.ts +35 -0
- package/dist/src/evaluator/step.d.ts +159 -0
- package/dist/src/evaluator/suspension.d.ts +53 -0
- package/dist/src/evaluator/trampoline.d.ts +119 -0
- package/dist/src/full.d.ts +17 -0
- package/dist/src/getUndefinedSymbols/index.d.ts +7 -0
- package/dist/src/index.d.ts +18 -0
- package/dist/src/initReferenceData.d.ts +1 -0
- package/dist/src/interface.d.ts +7 -0
- package/dist/src/modules/assertion.d.ts +2 -0
- package/dist/src/modules/bitwise.d.ts +2 -0
- package/dist/src/modules/collection.d.ts +2 -0
- package/dist/src/modules/convert.d.ts +2 -0
- package/dist/src/modules/functional.d.ts +2 -0
- package/dist/src/modules/grid.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/matrix.d.ts +2 -0
- package/dist/src/modules/number-theory.d.ts +2 -0
- package/dist/src/modules/random.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/modules/vector.d.ts +2 -0
- package/dist/src/parser/ParserContext.d.ts +20 -0
- package/dist/src/parser/getPrecedence.d.ts +3 -0
- package/dist/src/parser/helpers.d.ts +19 -0
- package/dist/src/parser/index.d.ts +5 -0
- package/dist/src/parser/subParsers/parseArray.d.ts +3 -0
- package/dist/src/parser/subParsers/parseBindingTarget.d.ts +8 -0
- package/dist/src/parser/subParsers/parseCond.d.ts +4 -0
- package/dist/src/parser/subParsers/parseDo.d.ts +3 -0
- package/dist/src/parser/subParsers/parseExpression.d.ts +5 -0
- package/dist/src/parser/subParsers/parseForOrDoseq.d.ts +4 -0
- package/dist/src/parser/subParsers/parseFunction.d.ts +4 -0
- package/dist/src/parser/subParsers/parseFunctionCall.d.ts +3 -0
- package/dist/src/parser/subParsers/parseIfOrUnless.d.ts +5 -0
- package/dist/src/parser/subParsers/parseImplicitBlock.d.ts +5 -0
- package/dist/src/parser/subParsers/parseLet.d.ts +4 -0
- package/dist/src/parser/subParsers/parseLoop.d.ts +4 -0
- package/dist/src/parser/subParsers/parseMatch.d.ts +4 -0
- package/dist/src/parser/subParsers/parseNumber.d.ts +3 -0
- package/dist/src/parser/subParsers/parseObject.d.ts +3 -0
- package/dist/src/parser/subParsers/parseOperand.d.ts +3 -0
- package/dist/src/parser/subParsers/parseRegexpShorthand.d.ts +3 -0
- package/dist/src/parser/subParsers/parseReservedSymbol.d.ts +3 -0
- package/dist/src/parser/subParsers/parseString.d.ts +4 -0
- package/dist/src/parser/subParsers/parseSymbol.d.ts +3 -0
- package/dist/src/parser/subParsers/parseTry.d.ts +4 -0
- package/dist/src/parser/types.d.ts +129 -0
- package/dist/src/symbolPatterns.d.ts +2 -0
- package/dist/src/testFramework/index.d.ts +15 -0
- package/dist/src/tokenizer/minifyTokenStream.d.ts +4 -0
- package/dist/src/tokenizer/operators.d.ts +12 -0
- package/dist/src/tokenizer/reservedNames.d.ts +66 -0
- package/dist/src/tokenizer/token.d.ts +84 -0
- package/dist/src/tokenizer/tokenize.d.ts +8 -0
- package/dist/src/tokenizer/tokenizers.d.ts +14 -0
- package/dist/src/transformer/index.d.ts +2 -0
- package/dist/src/typeGuards/annotatedArrays.d.ts +16 -0
- package/dist/src/typeGuards/array.d.ts +9 -0
- package/dist/src/typeGuards/astNode.d.ts +19 -0
- package/dist/src/typeGuards/dvala.d.ts +26 -0
- package/dist/src/typeGuards/dvalaFunction.d.ts +12 -0
- package/dist/src/typeGuards/index.d.ts +7 -0
- package/dist/src/typeGuards/number.d.ts +66 -0
- package/dist/src/typeGuards/string.d.ts +15 -0
- package/dist/src/untokenizer/index.d.ts +2 -0
- package/dist/src/utils/arity.d.ts +10 -0
- package/dist/src/utils/debug/debugTools.d.ts +1 -0
- package/dist/src/utils/debug/getCodeMarker.d.ts +2 -0
- package/dist/src/utils/debug/getSourceCodeInfo.d.ts +2 -0
- package/dist/src/utils/docString/generateDocString.d.ts +2 -0
- package/dist/src/utils/getAssertionError.d.ts +3 -0
- package/dist/src/utils/index.d.ts +14 -0
- package/dist/src/utils/maybePromise.d.ts +54 -0
- package/dist/src/utils/symbols.d.ts +3 -0
- package/dist/testFramework.esm.js +2 -0
- package/dist/testFramework.esm.js.map +1 -0
- package/dist/testFramework.js +2 -0
- package/dist/testFramework.js.map +1 -0
- package/package.json +144 -16
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functional.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/typeGuards/dvalaFunction.ts","../../src/typeGuards/dvala.ts","../../src/utils/getAssertionError.ts","../../src/utils/debug/getSourceCodeInfo.ts","../../src/utils/arity.ts","../../src/builtin/modules/functional/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 getDvalaErrorMessage(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 DvalaError 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(getDvalaErrorMessage(message, sourceCodeInfo))\n this.shortMessage = message\n this.sourceCodeInfo = sourceCodeInfo\n Object.setPrototypeOf(this, DvalaError.prototype)\n this.name = 'DvalaError'\n }\n\n public getCodeMarker(): string | undefined {\n return this.sourceCodeInfo && getCodeMarker(this.sourceCodeInfo)\n }\n}\n\nexport class UserDefinedError extends DvalaError {\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 DvalaError {\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 DvalaError {\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 isDvalaError(error: unknown): error is DvalaError {\n return error instanceof DvalaError\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^^'\nexport const EFFECT_SYMBOL = '^^ef^^'\n","import { getNodeTypeName, isFunctionType, isNodeType } from '../../constants/constants'\nimport type { AstNode, DvalaFunction } from '../../parser/types'\nimport { FUNCTION_SYMBOL } from '../symbols'\n\nfunction isDvalaFunction(func: unknown): func is DvalaFunction {\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 AstNode {\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 (isDvalaFunction(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 { DvalaFunction, 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 isDvalaFunction(value: unknown): value is DvalaFunction {\n if (value === null || typeof value !== 'object')\n return false\n\n return !!(value as DvalaFunction)[FUNCTION_SYMBOL]\n}\nexport function asDvalaFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): DvalaFunction {\n assertDvalaFunction(value, sourceCodeInfo)\n return value\n}\nexport function assertDvalaFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is DvalaFunction {\n if (!isDvalaFunction(value))\n throw getAssertionError('DvalaFunction', value, sourceCodeInfo)\n}\n\nexport function isUserDefinedFunction(value: unknown): value is UserDefinedFunction {\n return isDvalaFunction(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 isDvalaFunction(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 type { Any, Coll, Obj, Seq } from '../interface'\nimport type { EffectRef, FunctionLike, RegularExpression } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\nimport { EFFECT_SYMBOL, REGEXP_SYMBOL } from '../utils/symbols'\nimport { isDvalaFunction } from './dvalaFunction'\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 || isDvalaFunction(value)\n || isRegularExpression(value)\n || isEffectRef(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 isEffectRef(value: unknown): value is EffectRef {\n if (value === null || typeof value !== 'object')\n return false\n\n return !!(value as EffectRef)[EFFECT_SYMBOL]\n}\nexport function asEffectRef(value: unknown, sourceCodeInfo?: SourceCodeInfo): EffectRef {\n assertEffectRef(value, sourceCodeInfo)\n return value\n}\nexport function assertEffectRef(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is EffectRef {\n if (!isEffectRef(value))\n throw getAssertionError('EffectRef', value, sourceCodeInfo)\n}\n\nfunction isFunctionLike(value: unknown): value is FunctionLike {\n if (typeof value === 'number')\n return true\n if (isColl(value))\n return true\n if (isDvalaFunction(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 { DvalaError } 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): DvalaError {\n return new DvalaError(`Expected ${typeName}, got ${valueToString(value)}.`, getSourceCodeInfo(value, sourceCodeInfo))\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 type { Arity } from '../builtin/interface'\nimport { DvalaError } from '../errors'\nimport type { FunctionLike } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { isColl } from '../typeGuards/dvala'\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 DvalaError(\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 DvalaError(\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 type { Arr } from '../../../interface'\nimport type {\n ComplementFunction,\n EveryPredFunction,\n FNullFunction,\n FunctionLike,\n JuxtFunction,\n SomePredFunction,\n} from '../../../parser/types'\nimport { getArityFromFunction, getCommonArityFromFunctions, toFixedArity } from '../../../utils/arity'\nimport { FUNCTION_SYMBOL } from '../../../utils/symbols'\nimport type { BuiltinNormalExpressions } from '../../interface'\nimport { asFunctionLike, assertFunctionLike } from '../../../typeGuards/dvala'\nimport { DvalaError } from '../../../errors'\nimport type { DvalaModule } from '../interface'\n\nconst functionalUtilsNormalExpression: BuiltinNormalExpressions = {\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 DvalaError('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 `let { juxt } = import(functional);\njuxt(+, *, min, max)(\n 3,\n 4,\n 6,\n)`,\n `let { juxt } = import(functional);\njuxt(\"a\", \"b\")(\n {\n a: 1,\n b: 2,\n c: 3,\n d: 4\n }\n)`,\n `let { juxt } = import(functional);\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', 'functional.every-pred', 'functional.some-pred'],\n examples: [\n 'let { complement } = import(functional);\\ncomplement(>)(1, 3)',\n 'let { complement } = import(functional);\\ncomplement(<)(1, 3)',\n 'let { complement } = import(functional);\\ncomplement(+)(1, 3)',\n 'let { complement } = import(functional);\\ncomplement(+)(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: ['functional.some-pred', 'functional.complement', 'collection.every?'],\n examples: [\n `let { every-pred } = import(functional);\nevery-pred(string?, -> count($) > 3)(\n \"Albert\",\n \"Mojir\"\n)`,\n `let { every-pred } = import(functional);\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: ['functional.every-pred', 'functional.complement', 'collection.any?'],\n examples: [\n 'let { some-pred } = import(functional);\\nsome-pred(string?, -> count($) > 3)(\"Albert\", \"Mojir\")',\n 'let { some-pred } = import(functional);\\nsome-pred(string?, -> count($) > 3)(\"a\", \"M\")',\n 'let { some-pred } = import(functional);\\nsome-pred(string?, -> count($) > 3)(\"a\", [1, 2, 3])',\n 'let { some-pred } = import(functional);\\nsome-pred(string?, -> count($) > 3)([1, 2, 3], [2])',\n ],\n hideOperatorForm: true,\n },\n },\n\n 'fnull': {\n evaluate: ([fn, ...params]: Arr, 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 'let { fnull } = import(functional);\\nfnull(inc, 0)(1)',\n 'let { fnull } = import(functional);\\nfnull(inc, 0)(null)',\n 'let { fnull } = import(functional);\\n(inc fnull 0)(null)',\n 'let { fnull } = import(functional);\\nfnull(+, 1, 2)(null, 0)',\n 'let { fnull } = import(functional);\\nfnull(+, 1, 2)(0, null)',\n 'let { fnull } = import(functional);\\nfnull(+, 1, 2)(null, null)',\n 'let { fnull } = import(functional);\\nfnull(+, 1, 2)(null, null, 3, 4)',\n ],\n },\n },\n}\n\nexport const functionalUtilsModule: DvalaModule = {\n name: 'functional',\n functions: functionalUtilsNormalExpression,\n}\n"],"names":["getCodeMarker","sourceCodeInfo","position","code","leftPadding","column","rightPadding","length","repeat","Math","max","DvalaError","Error","shortMessage","constructor","err","message","super","location","line","filePath","getDvalaErrorMessage","this","Object","setPrototypeOf","prototype","name","NodeTypes","Number","String","NormalExpression","SpecialExpression","UserDefinedSymbol","NormalBuiltinSymbol","SpecialBuiltinSymbol","ReservedSymbol","Binding","Spread","NodeTypesSet","Set","values","functionTypeSet","FUNCTION_SYMBOL","REGEXP_SYMBOL","EFFECT_SYMBOL","isDvalaFunction","func","type","functionType","has","isNode","value","Array","isArray","valueToString","keys","find","key","RegExp","toString","JSON","stringify","isObj","regexp","isEffectRef","isColl","isSeq","asFunctionLike","assertFunctionLike","isFunctionLike","typeName","anyValue","getSourceCodeInfo","getAssertionError","getArityFromFunction","param","toFixedArity","arity","min","functionalUtilsModule","functions","juxt","evaluate","params","forEach","reduce","acc","aMin","aMax","bMin","bMax","undefined","getCommonArityFromFunctions","docs","category","returns","args","a","b","fun","fns","rest","variants","argumentNames","description","seeAlso","examples","complement","fn","function","hideOperatorForm","fnull","arg"],"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,GAAG,IAAII,OAAOC,KAAKC,IAAIN,EAAa,OAAO,IAAII,OAAOC,KAAKC,IAAIJ,EAAc,KACtF,CCkBM,MAAOK,UAAmBC,MACdX,eACAY,aAChB,WAAAC,CAAYC,EAAcd,GACxB,MAAMe,EAAUD,aAAeH,MAC3BG,EAAIC,QACJ,GAAGD,IAEPE,MA/BJ,SAA8BD,EAAiBf,GAC7C,IAAKA,EACH,OAAOe,EAET,MAAME,EAAW,GAAGjB,EAAeC,SAASiB,QAAQlB,EAAeC,SAASG,SAM5E,MAAO,GAAGW,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DC,SAAU,CACR,kGACA,yFACA,+FACA,gGAEFI,kBAAkB,IAItBC,MAAS,CACP7B,SAAU,EAAE0B,KAAOzB,GAAclF,KAC/B,MAAMkG,EAAMhC,EAAeyC,EAAI3G,GAC/B,MAAO,CACLyC,CAACA,IAAkB,EACnBzC,iBACA+C,aAAc,QACd6D,SAAUV,EACVhB,SACAN,MAAOH,EAAqByB,KAGhCtB,MAAO,CAAEC,IAAK,GACde,KAAM,CACJC,SAAU,aACVC,QAAS,CAAEhD,KAAM,YACjBiD,KAAM,CACJC,EAAG,CAAElD,KAAM,YACXmD,EAAG,CAAEnD,KAAM,OACXoD,IAAK,CAAEpD,KAAM,YACbiE,IAAK,CAAEjE,KAAM,OACbiD,KAAM,CAAEjD,KAAM,MAAOsD,MAAM,IAE7BC,SAAU,CACR,CAAEC,cAAe,CAAC,MAAO,QACzB,CAAEA,cAAe,CAAC,MAAO,MAAO,UAElCC,YAAa,0HACbC,QAAS,CAAC,WAAY,cACtBC,SAAU,CACR,wDACA,2DACA,2DACA,+DACA,+DACA,kEACA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";function n(n){if(!n.position||!n.code)return"";const t=n.position.column-1,e=n.code.length-t-1;return`${" ".repeat(Math.max(t,0))}^${" ".repeat(Math.max(e,0))}`}class t extends Error{sourceCodeInfo;shortMessage;constructor(e,r){const o=e instanceof Error?e.message:`${e}`;super(function(t,e){if(!e)return t;const r=`${e.position.line}:${e.position.column}`;return`${t}${e.filePath?`\n${e.filePath}:${r}`:`\nLocation ${r}`}\n${e.code}\n${n(e)}`}(o,r)),this.shortMessage=o,this.sourceCodeInfo=r,Object.setPrototypeOf(this,t.prototype),this.name="DvalaError"}getCodeMarker(){return this.sourceCodeInfo&&n(this.sourceCodeInfo)}}const e={Number:1,String:2,NormalExpression:3,SpecialExpression:4,UserDefinedSymbol:5,NormalBuiltinSymbol:6,SpecialBuiltinSymbol:7,ReservedSymbol:8,Binding:9,Spread:10},r=new Set(Object.values(e));const o=new Set(["UserDefined","Partial","Comp","Constantly","Juxt","Complement","EveryPred","SomePred","Fnull","Builtin","SpecialBuiltin","NativeJsFunction","Module"]);const u="^^fn^^",a="^^re^^",i="^^ef^^";function l(n){return null!==n&&"object"==typeof n&&(u in n&&"functionType"in n&&("string"==typeof(t=n.functionType)&&o.has(t)));var t}function s(n){return!(!Array.isArray(n)||n.length<2)&&("number"==typeof(t=n[0])&&r.has(t));var t}function c(n){return l(n)?`<function ${n.name||"λ"}>`:s(n)?`${t=n[0],Object.keys(e).find(n=>e[n]===t)}-node`:null===n?"null":"object"==typeof n&&n instanceof RegExp?`${n}`:"object"==typeof n&&n instanceof Error?n.toString():JSON.stringify(n);var t}function f(n){return null!==n&&"object"==typeof n&&!!n[u]}function m(n){return!(null===n||"object"!=typeof n||Array.isArray(n)||n instanceof RegExp||f(n)||(t=n,null!==t&&"object"==typeof t&&t[a])||function(n){return null!==n&&"object"==typeof n&&!!n[i]}(n));var t}function p(n){return function(n){return Array.isArray(n)||"string"==typeof n}(n)||m(n)}function y(n,t){return d(n,t),n}function d(n,e){if(!function(n){return"number"==typeof n||!!p(n)||!!f(n)}(n))throw function(n,e,r){return new t(`Expected ${n}, got ${c(e)}.`,function(n,t){return n?.sourceCodeInfo??t}(e,r))}("FunctionLike",n,e)}function g(n){return"number"==typeof n||p(n)?h(1):n.arity}function h(n){return{min:n,max:n}}const b={name:"functional",functions:{juxt:{evaluate:(n,e)=>{n.forEach(n=>d(n,e));const r=function(n){return n.reduce((n,t)=>{if(null===n)return null;const e="number"==typeof t||p(t)?h(1):t.arity,{min:r,max:o}=e,{min:u,max:a}=n,i="number"==typeof r&&"number"==typeof u?Math.max(r,u):"number"==typeof r?r:"number"==typeof u?u:void 0,l="number"==typeof o&&"number"==typeof a?Math.min(o,a):"number"==typeof o?o:"number"==typeof a?a:void 0;return"number"==typeof i&&"number"==typeof l&&i>l?null:{min:i,max:l}},{})}(n);if(null===r)throw new t("All functions must accept the same number of arguments",e);return{[u]:!0,sourceCodeInfo:e,functionType:"Juxt",params:n,arity:r}},arity:{min:1},docs:{category:"functional",returns:{type:"function"},args:{a:{type:"function"},b:{type:"function"},fun:{type:"function"},fns:{type:"function",rest:!0}},variants:[{argumentNames:["fun"]},{argumentNames:["fun","fns"]}],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).",seeAlso:["comp"],examples:["let { juxt } = import(functional);\njuxt(+, *, min, max)(\n 3,\n 4,\n 6,\n)",'let { juxt } = import(functional);\njuxt("a", "b")(\n {\n a: 1,\n b: 2,\n c: 3,\n d: 4\n }\n)',"let { juxt } = import(functional);\njuxt(+, *, min, max) apply range(1, 11)"]}},complement:{evaluate:([n],t)=>{const e=y(n,t);return{[u]:!0,sourceCodeInfo:t,functionType:"Complement",function:e,arity:g(e)}},arity:h(1),docs:{category:"functional",returns:{type:"function"},args:{fun:{type:"function"}},variants:[{argumentNames:["fun"]}],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.",seeAlso:["comp","functional.every-pred","functional.some-pred"],examples:["let { complement } = import(functional);\ncomplement(>)(1, 3)","let { complement } = import(functional);\ncomplement(<)(1, 3)","let { complement } = import(functional);\ncomplement(+)(1, 3)","let { complement } = import(functional);\ncomplement(+)(0, 0)"]}},"every-pred":{evaluate:(n,t)=>({[u]:!0,sourceCodeInfo:t,functionType:"EveryPred",params:n,arity:{min:1,max:1}}),arity:{min:1},docs:{category:"functional",returns:{type:"function"},args:{fun:{type:"function"},fns:{type:"function",rest:!0}},variants:[{argumentNames:["fun"]},{argumentNames:["fun","fns"]}],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`.",seeAlso:["functional.some-pred","functional.complement","collection.every?"],examples:['let { every-pred } = import(functional);\nevery-pred(string?, -> count($) > 3)(\n "Albert",\n "Mojir"\n)','let { every-pred } = import(functional);\n(string? every-pred -> count($) > 3)(\n "Albert",\n "M"\n)'],hideOperatorForm:!0}},"some-pred":{evaluate:(n,t)=>({[u]:!0,sourceCodeInfo:t,functionType:"SomePred",params:n,arity:{min:1,max:1}}),arity:{min:1},docs:{category:"functional",returns:{type:"function"},args:{fun:{type:"function"},fns:{type:"function",rest:!0}},variants:[{argumentNames:["fun"]},{argumentNames:["fun","fns"]}],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`.",seeAlso:["functional.every-pred","functional.complement","collection.any?"],examples:['let { some-pred } = import(functional);\nsome-pred(string?, -> count($) > 3)("Albert", "Mojir")','let { some-pred } = import(functional);\nsome-pred(string?, -> count($) > 3)("a", "M")','let { some-pred } = import(functional);\nsome-pred(string?, -> count($) > 3)("a", [1, 2, 3])',"let { some-pred } = import(functional);\nsome-pred(string?, -> count($) > 3)([1, 2, 3], [2])"],hideOperatorForm:!0}},fnull:{evaluate:([n,...t],e)=>{const r=y(n,e);return{[u]:!0,sourceCodeInfo:e,functionType:"Fnull",function:r,params:t,arity:g(r)}},arity:{min:2},docs:{category:"functional",returns:{type:"function"},args:{a:{type:"function"},b:{type:"any"},fun:{type:"function"},arg:{type:"any"},args:{type:"any",rest:!0}},variants:[{argumentNames:["fun","arg"]},{argumentNames:["fun","arg","args"]}],description:"Takes a function $fun, and returns a function that calls $fun, replacing a null argument to the corresponding argument.",seeAlso:["identity","constantly"],examples:["let { fnull } = import(functional);\nfnull(inc, 0)(1)","let { fnull } = import(functional);\nfnull(inc, 0)(null)","let { fnull } = import(functional);\n(inc fnull 0)(null)","let { fnull } = import(functional);\nfnull(+, 1, 2)(null, 0)","let { fnull } = import(functional);\nfnull(+, 1, 2)(0, null)","let { fnull } = import(functional);\nfnull(+, 1, 2)(null, null)","let { fnull } = import(functional);\nfnull(+, 1, 2)(null, null, 3, 4)"]}}}};exports.functionalUtilsModule=b;
|
|
2
|
+
//# sourceMappingURL=functional.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functional.js","sources":["../../src/utils/debug/getCodeMarker.ts","../../src/errors.ts","../../src/constants/constants.ts","../../src/utils/symbols.ts","../../src/utils/debug/debugTools.ts","../../src/typeGuards/dvalaFunction.ts","../../src/typeGuards/dvala.ts","../../src/utils/getAssertionError.ts","../../src/utils/debug/getSourceCodeInfo.ts","../../src/utils/arity.ts","../../src/builtin/modules/functional/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 getDvalaErrorMessage(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 DvalaError 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(getDvalaErrorMessage(message, sourceCodeInfo))\n this.shortMessage = message\n this.sourceCodeInfo = sourceCodeInfo\n Object.setPrototypeOf(this, DvalaError.prototype)\n this.name = 'DvalaError'\n }\n\n public getCodeMarker(): string | undefined {\n return this.sourceCodeInfo && getCodeMarker(this.sourceCodeInfo)\n }\n}\n\nexport class UserDefinedError extends DvalaError {\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 DvalaError {\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 DvalaError {\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 isDvalaError(error: unknown): error is DvalaError {\n return error instanceof DvalaError\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^^'\nexport const EFFECT_SYMBOL = '^^ef^^'\n","import { getNodeTypeName, isFunctionType, isNodeType } from '../../constants/constants'\nimport type { AstNode, DvalaFunction } from '../../parser/types'\nimport { FUNCTION_SYMBOL } from '../symbols'\n\nfunction isDvalaFunction(func: unknown): func is DvalaFunction {\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 AstNode {\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 (isDvalaFunction(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 { DvalaFunction, 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 isDvalaFunction(value: unknown): value is DvalaFunction {\n if (value === null || typeof value !== 'object')\n return false\n\n return !!(value as DvalaFunction)[FUNCTION_SYMBOL]\n}\nexport function asDvalaFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): DvalaFunction {\n assertDvalaFunction(value, sourceCodeInfo)\n return value\n}\nexport function assertDvalaFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is DvalaFunction {\n if (!isDvalaFunction(value))\n throw getAssertionError('DvalaFunction', value, sourceCodeInfo)\n}\n\nexport function isUserDefinedFunction(value: unknown): value is UserDefinedFunction {\n return isDvalaFunction(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 isDvalaFunction(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 type { Any, Coll, Obj, Seq } from '../interface'\nimport type { EffectRef, FunctionLike, RegularExpression } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\nimport { EFFECT_SYMBOL, REGEXP_SYMBOL } from '../utils/symbols'\nimport { isDvalaFunction } from './dvalaFunction'\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 || isDvalaFunction(value)\n || isRegularExpression(value)\n || isEffectRef(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 isEffectRef(value: unknown): value is EffectRef {\n if (value === null || typeof value !== 'object')\n return false\n\n return !!(value as EffectRef)[EFFECT_SYMBOL]\n}\nexport function asEffectRef(value: unknown, sourceCodeInfo?: SourceCodeInfo): EffectRef {\n assertEffectRef(value, sourceCodeInfo)\n return value\n}\nexport function assertEffectRef(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is EffectRef {\n if (!isEffectRef(value))\n throw getAssertionError('EffectRef', value, sourceCodeInfo)\n}\n\nfunction isFunctionLike(value: unknown): value is FunctionLike {\n if (typeof value === 'number')\n return true\n if (isColl(value))\n return true\n if (isDvalaFunction(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 { DvalaError } 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): DvalaError {\n return new DvalaError(`Expected ${typeName}, got ${valueToString(value)}.`, getSourceCodeInfo(value, sourceCodeInfo))\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 type { Arity } from '../builtin/interface'\nimport { DvalaError } from '../errors'\nimport type { FunctionLike } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { isColl } from '../typeGuards/dvala'\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 DvalaError(\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 DvalaError(\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 type { Arr } from '../../../interface'\nimport type {\n ComplementFunction,\n EveryPredFunction,\n FNullFunction,\n FunctionLike,\n JuxtFunction,\n SomePredFunction,\n} from '../../../parser/types'\nimport { getArityFromFunction, getCommonArityFromFunctions, toFixedArity } from '../../../utils/arity'\nimport { FUNCTION_SYMBOL } from '../../../utils/symbols'\nimport type { BuiltinNormalExpressions } from '../../interface'\nimport { asFunctionLike, assertFunctionLike } from '../../../typeGuards/dvala'\nimport { DvalaError } from '../../../errors'\nimport type { DvalaModule } from '../interface'\n\nconst functionalUtilsNormalExpression: BuiltinNormalExpressions = {\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 DvalaError('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 `let { juxt } = import(functional);\njuxt(+, *, min, max)(\n 3,\n 4,\n 6,\n)`,\n `let { juxt } = import(functional);\njuxt(\"a\", \"b\")(\n {\n a: 1,\n b: 2,\n c: 3,\n d: 4\n }\n)`,\n `let { juxt } = import(functional);\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', 'functional.every-pred', 'functional.some-pred'],\n examples: [\n 'let { complement } = import(functional);\\ncomplement(>)(1, 3)',\n 'let { complement } = import(functional);\\ncomplement(<)(1, 3)',\n 'let { complement } = import(functional);\\ncomplement(+)(1, 3)',\n 'let { complement } = import(functional);\\ncomplement(+)(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: ['functional.some-pred', 'functional.complement', 'collection.every?'],\n examples: [\n `let { every-pred } = import(functional);\nevery-pred(string?, -> count($) > 3)(\n \"Albert\",\n \"Mojir\"\n)`,\n `let { every-pred } = import(functional);\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: ['functional.every-pred', 'functional.complement', 'collection.any?'],\n examples: [\n 'let { some-pred } = import(functional);\\nsome-pred(string?, -> count($) > 3)(\"Albert\", \"Mojir\")',\n 'let { some-pred } = import(functional);\\nsome-pred(string?, -> count($) > 3)(\"a\", \"M\")',\n 'let { some-pred } = import(functional);\\nsome-pred(string?, -> count($) > 3)(\"a\", [1, 2, 3])',\n 'let { some-pred } = import(functional);\\nsome-pred(string?, -> count($) > 3)([1, 2, 3], [2])',\n ],\n hideOperatorForm: true,\n },\n },\n\n 'fnull': {\n evaluate: ([fn, ...params]: Arr, 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 'let { fnull } = import(functional);\\nfnull(inc, 0)(1)',\n 'let { fnull } = import(functional);\\nfnull(inc, 0)(null)',\n 'let { fnull } = import(functional);\\n(inc fnull 0)(null)',\n 'let { fnull } = import(functional);\\nfnull(+, 1, 2)(null, 0)',\n 'let { fnull } = import(functional);\\nfnull(+, 1, 2)(0, null)',\n 'let { fnull } = import(functional);\\nfnull(+, 1, 2)(null, null)',\n 'let { fnull } = import(functional);\\nfnull(+, 1, 2)(null, null, 3, 4)',\n ],\n },\n },\n}\n\nexport const functionalUtilsModule: DvalaModule = {\n name: 'functional',\n functions: functionalUtilsNormalExpression,\n}\n"],"names":["getCodeMarker","sourceCodeInfo","position","code","leftPadding","column","rightPadding","length","repeat","Math","max","DvalaError","Error","shortMessage","constructor","err","message","super","location","line","filePath","getDvalaErrorMessage","this","Object","setPrototypeOf","prototype","name","NodeTypes","Number","String","NormalExpression","SpecialExpression","UserDefinedSymbol","NormalBuiltinSymbol","SpecialBuiltinSymbol","ReservedSymbol","Binding","Spread","NodeTypesSet","Set","values","functionTypeSet","FUNCTION_SYMBOL","REGEXP_SYMBOL","EFFECT_SYMBOL","isDvalaFunction","func","type","functionType","has","isNode","value","Array","isArray","valueToString","keys","find","key","RegExp","toString","JSON","stringify","isObj","regexp","isEffectRef","isColl","isSeq","asFunctionLike","assertFunctionLike","isFunctionLike","typeName","anyValue","getSourceCodeInfo","getAssertionError","getArityFromFunction","param","toFixedArity","arity","min","functionalUtilsModule","functions","juxt","evaluate","params","forEach","reduce","acc","aMin","aMax","bMin","bMax","undefined","getCommonArityFromFunctions","docs","category","returns","args","a","b","fun","fns","rest","variants","argumentNames","description","seeAlso","examples","complement","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|
1
|
+
function e(e){if(!e.position||!e.code)return"";const t=e.position.column-1,r=e.code.length-t-1;return`${" ".repeat(Math.max(t,0))}^${" ".repeat(Math.max(r,0))}`}class t extends Error{sourceCodeInfo;shortMessage;constructor(r,n){const i=r instanceof Error?r.message:`${r}`;super(function(t,r){if(!r)return t;const n=`${r.position.line}:${r.position.column}`;return`${t}${r.filePath?`\n${r.filePath}:${n}`:`\nLocation ${n}`}\n${r.code}\n${e(r)}`}(i,n)),this.shortMessage=i,this.sourceCodeInfo=n,Object.setPrototypeOf(this,t.prototype),this.name="DvalaError"}getCodeMarker(){return this.sourceCodeInfo&&e(this.sourceCodeInfo)}}const r={Number:1,String:2,NormalExpression:3,SpecialExpression:4,UserDefinedSymbol:5,NormalBuiltinSymbol:6,SpecialBuiltinSymbol:7,ReservedSymbol:8,Binding:9,Spread:10},n=new Set(Object.values(r));const i=new Set(["UserDefined","Partial","Comp","Constantly","Juxt","Complement","EveryPred","SomePred","Fnull","Builtin","SpecialBuiltin","NativeJsFunction","Module"]);const o="^^fn^^",s="^^re^^",a="^^ef^^";function l(e){return null!==e&&"object"==typeof e&&(o in e&&"functionType"in e&&("string"==typeof(t=e.functionType)&&i.has(t)));var t}function g(e){return!(!Array.isArray(e)||e.length<2)&&("number"==typeof(t=e[0])&&n.has(t));var t}function c(e){return l(e)?`<function ${e.name||"λ"}>`:g(e)?`${t=e[0],Object.keys(r).find(e=>r[e]===t)}-node`:null===e?"null":"object"==typeof e&&e instanceof RegExp?`${e}`:"object"==typeof e&&e instanceof Error?e.toString():JSON.stringify(e);var t}function d(e,t){return e?.sourceCodeInfo??t}function u(e,t={}){return"number"==typeof e&&(!Number.isNaN(e)&&(!(t.integer&&!Number.isInteger(e))&&(!(t.finite&&!Number.isFinite(e))&&((!t.zero||0===e)&&((!t.nonZero||0!==e)&&(!(t.positive&&e<=0)&&(!(t.negative&&e>=0)&&(!(t.nonPositive&&e>0)&&(!(t.nonNegative&&e<0)&&(!("number"==typeof t.gt&&e<=t.gt)&&(!("number"==typeof t.gte&&e<t.gte)&&(!("number"==typeof t.lt&&e>=t.lt)&&!("number"==typeof t.lte&&e>t.lte)))))))))))))}function h(e,r,n={}){if(!u(e,n))throw new t(`Expected ${function(e){if(e.zero)return"zero";const t=function(e){return e.positive?"positive":e.negative?"negative":e.nonNegative?"non negative":e.nonPositive?"non positive":e.nonZero?"non zero":""}(e),r=e.integer?"integer":"number",n=e.finite?"finite":"",i=function(e){return"number"!=typeof e.gt&&"number"!=typeof e.gte||"number"!=typeof e.lt&&"number"!=typeof e.lte?"number"==typeof e.gt||"number"==typeof e.gte?"number"==typeof e.gt?`n > ${e.gt}`:`n >= ${e.gte}`:"number"==typeof e.lt||"number"==typeof e.lte?"number"==typeof e.lt?`n < ${e.lt}`:`n <= ${e.lte}`:"":`${"number"==typeof e.gt?`${e.gt} < n `:`${e.gte} <= n `}${"number"==typeof e.lt?`< ${e.lt}`:`<= ${e.lte}`}`}(e);return[t,n,r,i].filter(e=>!!e).join(" ")}(n)}, got ${c(e)}.`,d(e,r))}const p=new WeakSet,m=new WeakSet,f=new WeakSet,y=new WeakSet,b=new WeakSet;function w(e,r){if(!function(e){return!(!Array.isArray(e)||!m.has(e)&&(f.has(e)||(e.every(e=>u(e))?(p.add(e),m.add(e),0):(f.add(e),1))))}(e))throw new t(`Expected a vector, but got ${e}`,r)}function v(e,r){if(!function(e){if(!Array.isArray(e))return!1;if(y.has(e))return!0;if(b.has(e))return!1;if(0===e.length)return b.add(e),!1;if(!Array.isArray(e[0]))return b.add(e),!1;const t=e[0].length;for(const r of e.slice(1)){if(!Array.isArray(r))return b.add(e),!1;if(r.length!==t)return b.add(e),!1}return p.add(e),y.add(e),!0}(e))throw new t(`Expected a grid, but got ${e}`,r)}function A(e,r,n){return new t(`Expected ${e}, got ${c(r)}.`,d(r,n))}function N(e,t){if(!Array.isArray(e))throw A("array",e,t)}function x(e){return null!==e&&"object"==typeof e&&!!e[o]}function $(e,t){return T(e,t),e}function T(e,t){if(!function(e){return void 0!==e}(e))throw A("not undefined",e,t)}function K(e){return!(null===e||"object"!=typeof e||Array.isArray(e)||e instanceof RegExp||x(e)||(t=e,null!==t&&"object"==typeof t&&t[s])||function(e){return null!==e&&"object"==typeof e&&!!e[a]}(e));var t}function C(e){return function(e){return Array.isArray(e)||"string"==typeof e}(e)||K(e)}function F(e,t){if(!function(e){return"number"==typeof e||!!C(e)||!!x(e)}(e))throw A("FunctionLike",e,t)}function S(e){return{min:e,max:e}}function k(e,t){return e instanceof Promise?e.then(t):t(e)}function E(e,t){const r=[];for(let n=0;n<e.length;n++){const i=t(e[n],n);if(i instanceof Promise)return O(i,r,e,t,n);r.push(i)}return r}async function O(e,t,r,n,i){t.push(await e);for(let e=i+1;e<r.length;e++)t.push(await n(r[e],e));return t}function P(e,t,r){let n=r;for(let r=0;r<e.length;r++){const i=t(n,e[r],r);if(i instanceof Promise)return j(i,e,t,r);n=i}return n}async function j(e,t,r,n){let i=await e;for(let e=n+1;e<t.length;e++)i=await r(i,t[e],e);return i}function R(e,t){for(let r=0;r<e.length;r++){const n=t(e[r],r);if(n instanceof Promise)return z(n,e,t,r);if(n)return!0}return!1}async function z(e,t,r,n){if(await e)return!0;for(let e=n+1;e<t.length;e++)if(await r(t[e],e))return!0;return!1}function I(e,t){for(let r=0;r<e.length;r++){const n=t(e[r],r);if(n instanceof Promise)return M(n,e,t,r);if(!n)return!1}return!0}async function M(e,t,r,n){if(!await e)return!1;for(let e=n+1;e<t.length;e++)if(!await r(t[e],e))return!1;return!0}const U={"cell-every?":{category:"grid",description:"Checks if all elements in a grid satisfy a predicate. Returns true only if the predicate returns true for every element in the grid.",returns:{type:"boolean"},args:{a:{type:"grid"},b:{type:"function"}},variants:[{argumentNames:["a","b"]}],examples:['let { cell-every? } = import(grid);\ncell-every?([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], string?)','let { cell-every? } = import(grid);\ncell-every?([\n ["Albert", "father"],\n ["Nina", "mother"],\n ["Kian", "son"],\n], string?)',"let { cell-every? } = import(grid);\ncell-every?([\n [1, 2],\n [3, 4],\n], string?)"],seeAlso:["collection.every?","grid.some?","grid.every-row?","grid.every-col?"]},"some?":{category:"grid",description:"Checks if any element in a grid satisfies a predicate. Returns true if the predicate returns true for at least one element in the grid.",returns:{type:"boolean"},args:{a:{type:"grid"},b:{type:"function"}},variants:[{argumentNames:["a","b"]}],examples:['let { some? } = import(grid);\nsome?([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], string?)','let { some? } = import(grid);\nsome?([\n ["Albert", "father"],\n ["Nina", "mother"],\n ["Kian", "son"],\n], string?)',"let { some? } = import(grid);\nsome?([\n [1, 2],\n [3, 4],\n], string?)"],seeAlso:["collection.any?","grid.cell-every?","grid.some-row?","grid.some-col?"]},"every-row?":{category:"grid",description:"Checks if all rows in a grid satisfy a predicate. Returns true only if the predicate returns true for every row in the grid.",returns:{type:"boolean"},args:{a:{type:"grid"},b:{type:"function"}},variants:[{argumentNames:["a","b"]}],examples:['let { every-row? } = import(grid);\nevery-row?([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], -> string?($[0]))','let { every-row? } = import(grid);\nevery-row?([\n ["Albert", "father"],\n ["Nina", "mother"],\n ["Kian", "son"],\n], -> string?($[0]))',"let { every-row? } = import(grid);\nevery-row?([\n [1, 2],\n [3, 4],\n], -> string?($[0]))"],seeAlso:["grid.some-row?","grid.every-col?","grid.cell-every?"]},"some-row?":{category:"grid",description:"Checks if any row in a grid satisfies a predicate. Returns true if the predicate returns true for at least one row in the grid.",returns:{type:"boolean"},args:{a:{type:"grid"},b:{type:"function"}},variants:[{argumentNames:["a","b"]}],examples:['let { some-row? } = import(grid);\nsome-row?([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], -> $ contains? "Albert")','let { some-row? } = import(grid);\nsome-row?([\n ["Albert", "father"],\n ["Nina", "mother"],\n ["Kian", "son"],\n], -> $ contains? "Albert")','let { some-row? } = import(grid);\nsome-row?([\n [1, 2],\n [3, 4],\n], -> $ contains? "Albert")'],seeAlso:["grid.every-row?","grid.some-col?","grid.some?"]},"every-col?":{category:"grid",description:"Checks if all columns in a grid satisfy a predicate. Returns true only if the predicate returns true for every column in the grid.",returns:{type:"boolean"},args:{a:{type:"grid"},b:{type:"function"}},variants:[{argumentNames:["a","b"]}],examples:['let { every-col? } = import(grid);\nevery-col?([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], -> string?($[0]))','let { every-col? } = import(grid);\nevery-col?([\n ["Albert", "father"],\n ["Nina", "mother"],\n ["Kian", "son"],\n], -> string?($[0]))',"let { every-col? } = import(grid);\nevery-col?([\n [1, 2],\n [3, 4],\n], -> string?($[0]))"],seeAlso:["grid.some-col?","grid.every-row?","grid.cell-every?"]},"some-col?":{category:"grid",description:"Checks if any column in a grid satisfies a predicate. Returns true if the predicate returns true for at least one column in the grid.",returns:{type:"boolean"},args:{a:{type:"grid"},b:{type:"function"}},variants:[{argumentNames:["a","b"]}],examples:['let { some-col? } = import(grid);\nsome-col?([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], -> $ contains? "Albert")','let { some-col? } = import(grid);\nsome-col?([\n ["Albert", "father"],\n ["Nina", "mother"],\n ["Kian", "son"],\n], -> $ contains? "Albert")','let { some-col? } = import(grid);\nsome-col?([\n [1, 2],\n [3, 4],\n], -> $ contains? "Albert")'],seeAlso:["grid.every-col?","grid.some-row?","grid.some?"]},row:{category:"grid",description:"Returns the row at index $a in the grid $b.",returns:{type:"any"},args:{a:{type:"grid"},b:{type:"number"}},variants:[{argumentNames:["a","b"]}],examples:['let { row } = import(grid);\nrow([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], 0)','let { row } = import(grid);\nrow([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], 1)','let { row } = import(grid);\nrow([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], 2)'],seeAlso:["grid.col","grid.shape"]},col:{category:"grid",description:"Returns the column at index $a in the grid $b.",returns:{type:"any"},args:{a:{type:"grid"},b:{type:"number"}},variants:[{argumentNames:["a","b"]}],examples:['let { col } = import(grid);\ncol([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], 0)','let { col } = import(grid);\ncol([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], 1)','let { col } = import(grid);\ncol([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], 2)'],seeAlso:["grid.row","grid.shape"]},shape:{category:"grid",description:"Returns the shape of the grid `g` as a `vector` of two numbers, where the first number is the number of rows and the second number is the number of columns.",returns:{type:"vector"},args:{g:{type:"grid",description:"The grid to get the shape of."}},variants:[{argumentNames:["g"]}],examples:['let { shape } = import(grid);\nshape([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n])','let { shape } = import(grid);\nshape([\n ["Albert", "father"],\n ["Nina", "mother"],\n ["Kian", "son"],\n])',"let { shape } = import(grid);\nshape([\n [1, 2],\n [3, 4],\n])"],seeAlso:["grid.row","grid.col","grid.reshape"]},fill:{category:"grid",description:"Creates a grid of the specified size, filled with the specified value.",returns:{type:"grid"},args:{rows:{type:"integer",description:"The number of rows in the grid."},cols:{type:"integer",description:"The number of columns in the grid."},value:{type:"any",description:"The value to fill the grid with."}},variants:[{argumentNames:["rows","cols","value"]}],examples:["let { fill } = import(grid);\nfill(2, 3, 0)",'let { fill } = import(grid);\nfill(2, 3, "x")'],seeAlso:["grid.generate","grid.from-array"]},generate:{category:"grid",description:"Generates a grid of the specified size, where each element is generated by the provided function.",returns:{type:"grid"},args:{rows:{type:"number",description:"The number of rows in the grid."},cols:{type:"number",description:"The number of columns in the grid."},fn:{type:"function",description:"The function to generate the grid. It takes two arguments: the row index and the column index."}},variants:[{argumentNames:["rows","cols","fn"]}],examples:["let { generate } = import(grid);\ngenerate(3, 3, (i, j) -> i + j)"],seeAlso:["grid.fill","grid.from-array"]},reshape:{category:"grid",description:"Reshapes the grid `a` into a new grid with the specified number of rows `b`. The number of columns is automatically calculated based on the total number of elements in the grid.",returns:{type:"grid"},args:{a:{type:"grid"},b:{type:"number"}},variants:[{argumentNames:["a","b"]}],examples:['let { reshape } = import(grid);\nreshape([\n ["Albert", "father"],\n ["Nina", "mother"],\n ["Kian", "son"],\n], 2)'],seeAlso:["grid.shape","grid.from-array"]},transpose:{category:"grid",description:"Transposes the grid `g`, swapping its rows and columns.",returns:{type:"grid"},args:{g:{type:"grid",description:"The grid to transpose."}},variants:[{argumentNames:["g"]}],examples:['let { transpose } = import(grid);\ntranspose([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n])','let { transpose } = import(grid);\ntranspose([\n ["Albert", "father"],\n ["Nina", "mother"],\n ["Kian", "son"],\n])',"let { transpose } = import(grid);\ntranspose([\n [1, 2],\n [3, 4],\n])"],seeAlso:["grid.flip-h","grid.flip-v","grid.rotate"]},"flip-h":{category:"grid",description:"Flips the grid `g` horizontally.",returns:{type:"grid"},args:{g:{type:"grid",description:"The grid to flip horizontally."}},variants:[{argumentNames:["g"]}],examples:['let { flip-h } = import(grid);\nflip-h([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n])','let { flip-h } = import(grid);\nflip-h([\n ["Albert", "father"],\n ["Nina", "mother"],\n ["Kian", "son"],\n])',"let { flip-h } = import(grid);\nflip-h([\n [1, 2],\n [3, 4],\n])"],seeAlso:["grid.flip-v","grid.transpose","grid.rotate"]},"flip-v":{category:"grid",description:"Flips the grid `g` vertically.",returns:{type:"grid"},args:{g:{type:"grid",description:"The grid to flip vertically."}},variants:[{argumentNames:["g"]}],examples:['let { flip-v } = import(grid);\nflip-v([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n])','let { flip-v } = import(grid);\nflip-v([\n ["Albert", "father"],\n ["Nina", "mother"],\n ["Kian", "son"],\n])',"let { flip-v } = import(grid);\nflip-v([\n [1, 2],\n [3, 4],\n])"],seeAlso:["grid.flip-h","grid.transpose","grid.rotate"]},rotate:{category:"grid",description:"Rotates the grid `g` by the specified angle. The angle is given in terms of 90-degree rotations. Positive values rotate the grid clockwise, while negative values rotate it counterclockwise.",returns:{type:"grid"},args:{a:{type:"grid"},b:{type:"integer"}},variants:[{argumentNames:["a","b"]}],examples:["let { rotate } = import(grid);\nrotate([\n [1, 2],\n [3, 4],\n], 1)","let { rotate } = import(grid);\nrotate([\n [1, 2],\n [3, 4],\n], 2)","let { rotate } = import(grid);\nrotate([\n [1, 2],\n [3, 4],\n], 3)","let { rotate } = import(grid);\nrotate([\n [1, 2],\n [3, 4],\n], 4)","let { rotate } = import(grid);\nrotate([\n [1, 2],\n [3, 4],\n], -1)","let { rotate } = import(grid);\nrotate([\n [1, 2],\n [3, 4],\n], -2)","let { rotate } = import(grid);\nrotate([\n [1, 2],\n [3, 4],\n], -3)"],seeAlso:["grid.transpose","grid.flip-h","grid.flip-v"]},crop:{category:"grid",description:"Crops the grid `g` from the starting index `begin` to the optional ending index `stop`. The crop is inclusive of the starting index and exclusive of the ending index.",returns:{type:"grid"},args:{g:{type:"grid",description:"The grid to slice."},begin:{type:"vector",description:"The starting index of the slice as a vector of two numbers: `[row, col]`."},stop:{type:"vector",description:"Optional ending index of the slice as a vector of two numbers: `[row, col]`."}},variants:[{argumentNames:["g","begin"]},{argumentNames:["g","begin","stop"]}],examples:['let { crop } = import(grid);\ncrop([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], [1, 1], [2, 2])','let { crop } = import(grid);\ncrop([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], [1, 1])'],hideOperatorForm:!0,seeAlso:["grid.slice-rows","grid.slice-cols"]},"slice-rows":{category:"grid",description:"Slices rows of the grid `g` from the starting index `begin` to the optional ending index `stop`. The slice is inclusive of the starting index and exclusive of the ending index.",returns:{type:"grid"},args:{g:{type:"grid",description:"The grid to slice."},begin:{type:"number",description:"The starting index of the slice."},stop:{type:"number",description:"Optional ending index of the slice."}},variants:[{argumentNames:["g","begin"]},{argumentNames:["g","begin","stop"]}],examples:['let { slice-rows } = import(grid);\nslice-rows([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], 1, 2)','let { slice-rows } = import(grid);\nslice-rows([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], 1)'],hideOperatorForm:!0,seeAlso:["grid.crop","grid.slice-cols","grid.splice-rows"]},"slice-cols":{category:"grid",description:"Slices columns of the grid `g` from the starting index `begin` to the optional ending index `stop`. The slice is inclusive of the starting index and exclusive of the ending index.",returns:{type:"grid"},args:{g:{type:"grid",description:"The grid to slice."},begin:{type:"number",description:"The starting index of the slice."},stop:{type:"number",description:"Optional ending index of the slice."}},variants:[{argumentNames:["g","begin"]},{argumentNames:["g","begin","stop"]}],examples:['let { slice-cols } = import(grid);\nslice-cols([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], 1, 2)','let { slice-cols } = import(grid);\nslice-cols([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], 1)'],hideOperatorForm:!0,seeAlso:["grid.crop","grid.slice-rows","grid.splice-cols"]},"splice-rows":{category:"grid",description:"Splices rows of the grid `g` starting from the index `begin`. Deletes `deleteCount` rows and inserts the specified `items` at that position.",returns:{type:"grid"},args:{g:{type:"grid",description:"The grid to splice."},begin:{type:"number",description:"The starting index of the splice."},deleteCount:{type:"number",description:"The number of rows to delete."},items:{type:"array",rest:!0,description:"The rows to insert."}},variants:[{argumentNames:["g","begin","deleteCount"]},{argumentNames:["g","begin","deleteCount","items"]}],examples:['let { splice-rows } = import(grid);\nsplice-rows([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], 1, 2)','let { splice-rows } = import(grid);\nsplice-rows([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], 1, 1, ["Nazanin", "mother", 40])'],hideOperatorForm:!0,seeAlso:["grid.splice-cols","grid.slice-rows"]},"splice-cols":{category:"grid",description:"Splices columns of the grid `g` starting from the index `begin`. Deletes `deleteCount` columns and inserts the specified `items` at that position.",returns:{type:"grid"},args:{g:{type:"grid",description:"The grid to splice."},begin:{type:"number",description:"The starting index of the splice."},deleteCount:{type:"number",description:"The number of columns to delete."},items:{type:"array",rest:!0,description:"The columns to insert."}},variants:[{argumentNames:["g","begin","deleteCount"]},{argumentNames:["g","begin","deleteCount","items"]}],examples:['let { splice-cols } = import(grid);\nsplice-cols([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], 1, 2)','let { splice-cols } = import(grid);\nsplice-cols([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], 1, 1, ["f", "m", "s"])'],hideOperatorForm:!0,seeAlso:["grid.splice-rows","grid.slice-cols"]},"concat-rows":{category:"grid",description:"Concatenates two grids `a` and `b` by rows. The number of columns in both grids must be the same.",returns:{type:"grid"},args:{a:{type:"grid"},b:{type:"grid"}},variants:[{argumentNames:["a","b"]}],examples:['let { concat-rows } = import(grid);\nconcat-rows([\n ["Albert", "father"],\n ["Nina", "mother"],\n ["Kian", "son"],\n], [\n [1, 2],\n [3, 4],\n])'],seeAlso:["grid.concat-cols","grid.push-rows"]},"concat-cols":{category:"grid",description:"Concatenates two grids `a` and `b` by columns. The number of rows in both grids must be the same.",returns:{type:"grid"},args:{a:{type:"grid"},b:{type:"grid"}},variants:[{argumentNames:["a","b"]}],examples:['let { concat-cols } = import(grid);\nconcat-cols([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], [\n ["Albert", "father"],\n ["Nina", "mother"],\n ["Kian", "son"],\n])'],seeAlso:["grid.concat-rows","grid.push-cols"]},"cell-map":{category:"grid",description:"Maps a function `a` over each element of the grid `b`, returning a new grid with the results.",returns:{type:"grid"},args:{a:{type:"grid"},b:{type:"function"}},variants:[{argumentNames:["a","b"]}],examples:['let { cell-map } = import(grid);\ncell-map([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], str)'],seeAlso:["map","grid.cell-mapi","grid.cell-reduce"]},"cell-mapi":{category:"grid",description:"Maps a function `a` over each element of the grid `b`, passing the row and column index as additional arguments to the function.",returns:{type:"grid"},args:{a:{type:"grid"},b:{type:"function"}},variants:[{argumentNames:["a","b"]}],examples:['let { cell-mapi } = import(grid);\ncell-mapi([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], -> $1 ++ "(" ++ $2 ++ ", " ++ $3 ++ ")")'],seeAlso:["grid.cell-map","grid.cell-reducei","map"]},"cell-reduce":{category:"grid",description:"Reduces the grid `a` using the function `b`, returning a single value.",returns:{type:"any"},args:{g:{type:"grid",description:"The grid to reduce."},fn:{type:"function",description:"The function to reduce the grid. It takes two arguments: the accumulator and the current element."},"initial-value":{type:"any",description:"The initial value for the accumulator."}},variants:[{argumentNames:["g","fn","initial-value"]}],examples:['// Using "as" alias because "reduce" shadows a builtin function\nlet { cell-reduce } = import(grid);\ncell-reduce([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], ++, "")'],seeAlso:["reduce","grid.cell-reducei","grid.cell-map"]},"cell-reducei":{category:"grid",description:"Reduces the grid `a` using the function `b`, passing the row and column indices as additional arguments to the function.",returns:{type:"any"},args:{g:{type:"grid",description:"The grid to reduce."},fn:{type:"function",description:"The function to reduce the grid. It takes four arguments: the accumulator, the current element, the row index, and the column index."},"initial-value":{type:"any",description:"The initial value for the accumulator."}},variants:[{argumentNames:["g","fn","initial-value"]}],examples:['// Using "as" alias because "reducei" shadows a builtin function\nlet { cell-reducei } = import(grid);\ncell-reducei([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], ++, "")'],seeAlso:["grid.cell-reduce","grid.cell-mapi","reduce"]},"push-rows":{category:"grid",description:"Pushes the specified rows into the grid `g` and returns the new grid.",returns:{type:"grid"},args:{g:{type:"grid",description:"The grid to push rows into."},rows:{type:"array",rest:!0,description:"The rows to push into the grid."}},variants:[{argumentNames:["g","rows"]}],examples:['let { push-rows } = import(grid);\npush-rows([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], ["Nazanin", "mother", 40])'],hideOperatorForm:!0,seeAlso:["grid.unshift-rows","grid.pop-row","grid.shift-row","grid.concat-rows"]},"unshift-rows":{category:"grid",description:"Unshifts the specified rows into the grid `g` and returns the new grid.",returns:{type:"grid"},args:{g:{type:"grid",description:"The grid to unshift rows into."},rows:{type:"array",rest:!0,description:"The rows to unshift into the grid."}},variants:[{argumentNames:["g","rows"]}],examples:['let { unshift-rows } = import(grid);\nunshift-rows([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], ["Nazanin", "mother", 40])'],hideOperatorForm:!0,seeAlso:["grid.push-rows","grid.shift-row","grid.pop-row"]},"pop-row":{category:"grid",description:"Pops the last row from the grid `g` and returns the new grid.",returns:{type:"grid"},args:{g:{type:"grid",description:"The grid to pop a row from."}},variants:[{argumentNames:["g"]}],examples:['let { pop-row } = import(grid);\npop-row([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n])'],seeAlso:["grid.shift-row","grid.push-rows","grid.unshift-rows"]},"shift-row":{category:"grid",description:"Shifts the first row from the grid `g` and returns the new grid.",returns:{type:"grid"},args:{g:{type:"grid",description:"The grid to shift a row from."}},variants:[{argumentNames:["g"]}],examples:['let { shift-row } = import(grid);\nshift-row([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n])'],seeAlso:["grid.pop-row","grid.push-rows","grid.unshift-rows"]},"push-cols":{category:"grid",description:"Pushes the specified columns into the grid `g` and returns the new grid.",returns:{type:"grid"},args:{g:{type:"grid",description:"The grid to push columns into."},cols:{type:"array",rest:!0,description:"The columns to push into the grid."}},variants:[{argumentNames:["g","cols"]}],examples:['let { push-cols } = import(grid);\npush-cols([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], ["f", "m", "s"])'],hideOperatorForm:!0,seeAlso:["grid.unshift-cols","grid.pop-col","grid.shift-col","grid.concat-cols"]},"unshift-cols":{category:"grid",description:"Unshifts the specified columns into the grid `g` and returns the new grid.",returns:{type:"grid"},args:{g:{type:"grid",description:"The grid to unshift columns into."},cols:{type:"array",rest:!0,description:"The columns to unshift into the grid."}},variants:[{argumentNames:["g","cols"]}],examples:['let { unshift-cols } = import(grid);\nunshift-cols([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n], ["f", "m", "s"])'],hideOperatorForm:!0,seeAlso:["grid.push-cols","grid.shift-col","grid.pop-col"]},"pop-col":{category:"grid",description:"Pops the last column from the grid `g` and returns the new grid.",returns:{type:"grid"},args:{g:{type:"grid",description:"The grid to pop a column from."}},variants:[{argumentNames:["g"]}],examples:['let { pop-col } = import(grid);\npop-col([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n])'],seeAlso:["grid.shift-col","grid.push-cols","grid.unshift-cols"]},"shift-col":{category:"grid",description:"Shifts the first column from the grid `g` and returns the new grid.",returns:{type:"grid"},args:{g:{type:"grid",description:"The grid to shift a column from."}},variants:[{argumentNames:["g"]}],examples:['let { shift-col } = import(grid);\nshift-col([\n ["Albert", "father", 10],\n ["Nina", "mother", 20],\n ["Kian", "son", 30],\n])'],seeAlso:["grid.pop-col","grid.push-cols","grid.unshift-cols"]},"from-array":{category:"grid",description:"Creates a grid from a flat array with specified dimensions. The array is reshaped into the specified number of rows, and the number of columns is automatically calculated based on the total number of elements in the array.",returns:{type:"grid"},args:{a:{type:"array"},b:{type:"number"}},variants:[{argumentNames:["a","b"]}],examples:["let { from-array } = import(grid);\nfrom-array([1, 2, 3, 4], 2)","let { from-array } = import(grid);\nfrom-array([1, 2, 3, 4], 4)"],seeAlso:["grid.fill","grid.generate","grid.reshape"]}};function B(e){const t=[];for(let r=0;r<e[0].length;r+=1){const n=[];for(let t=0;t<e.length;t+=1)n.push(e[t][r]);t.push(n)}return t}const D={"cell-every?":{evaluate:([e,t],r,n,{executeFunction:i})=>{v(e,r),F(t,r);const o=[];for(const t of e)for(const e of t)o.push(e);return I(o,e=>i(t,[e],n,r))},arity:S(2)},"some?":{evaluate:([e,t],r,n,{executeFunction:i})=>{v(e,r),F(t,r);const o=[];for(const t of e)for(const e of t)o.push(e);return R(o,e=>i(t,[e],n,r))},arity:S(2)},"every-row?":{evaluate:([e,t],r,n,{executeFunction:i})=>(v(e,r),F(t,r),I(Array.from(e),e=>i(t,[e],n,r))),arity:S(2)},"some-row?":{evaluate:([e,t],r,n,{executeFunction:i})=>(v(e,r),F(t,r),R(Array.from(e),e=>i(t,[e],n,r))),arity:S(2)},"every-col?":{evaluate:([e,t],r,n,{executeFunction:i})=>{v(e,r),F(t,r);const o=B(e);return I(Array.from(o),e=>i(t,[e],n,r))},arity:S(2)},"some-col?":{evaluate:([e,t],r,n,{executeFunction:i})=>{v(e,r),F(t,r);const o=B(e);return R(Array.from(o),e=>i(t,[e],n,r))},arity:S(2)},row:{evaluate:([e,t],r)=>(v(e,r),h(t,r,{integer:!0,nonNegative:!0,lt:e.length}),e[t]),arity:S(2)},col:{evaluate:([e,t],r)=>(v(e,r),h(t,r,{integer:!0,nonNegative:!0,lt:e[0].length}),e.map(e=>e[t])),arity:S(2)},shape:{evaluate:([e],t)=>(v(e,t),[e.length,e[0].length]),arity:S(1)},fill:{evaluate:([e,t,r],n)=>{h(e,n,{integer:!0,positive:!0}),h(t,n,{integer:!0,positive:!0}),T(r,n);const i=[];for(let n=0;n<e;n+=1){const e=[];for(let n=0;n<t;n+=1)e.push(r);i.push(e)}return i},arity:S(3)},generate:{evaluate:([e,t,r],n,i,{executeFunction:o})=>(h(e,n,{integer:!0,positive:!0}),h(t,n,{integer:!0,positive:!0}),F(r,n),E(Array.from({length:e}),(e,s)=>E(Array.from({length:t}),(e,t)=>k(o(r,[s,t],i,n),e=>(T(e,n),e))))),arity:S(3)},reshape:{evaluate:([e,r],n)=>{v(e,n),h(r,n,{integer:!0,positive:!0});const i=e.flat();if(i.length%r!==0)throw new t(`The number of elements in the grid must be divisible by rows, but got ${i.length} and ${r}`,n);const o=i.length/r,s=[];for(let e=0;e<r;e+=1){const t=[];for(let r=0;r<o;r+=1)t.push(i[e*o+r]);s.push(t)}return s},arity:S(2)},transpose:{evaluate:([e],t)=>(v(e,t),B(e)),arity:S(1)},"flip-h":{evaluate:([e],t)=>(v(e,t),e.map(e=>e.reverse())),arity:S(1)},"flip-v":{evaluate:([e],t)=>(v(e,t),e.reverse()),arity:S(1)},rotate:{evaluate:([e,t],r)=>{if(v(e,r),h(t,r,{integer:!0}),0===(t=(t%4+4)%4)||0===e.length)return e.map(e=>[...e]);const n=e.length,i=e[0].length;let o;switch(t){case 1:o=Array(i).fill(null).map(()=>Array(n).fill(null));for(let t=0;t<n;t++)for(let r=0;r<i;r++)o[r][n-1-t]=e[t][r];break;case 2:o=Array(n).fill(null).map(()=>Array(i).fill(null));for(let t=0;t<n;t++)for(let r=0;r<i;r++)o[n-1-t][i-1-r]=e[t][r];break;case 3:o=Array(i).fill(null).map(()=>Array(n).fill(null));for(let t=0;t<n;t++)for(let r=0;r<i;r++)o[i-1-r][t]=e[t][r]}return o},arity:S(2)},crop:{evaluate:([e,r,n],i)=>{if(v(e,i),w(r,i),2!==r.length)throw new t(`The start vector must have 2 elements, but got ${r.length}`,i);const[o,s]=r;if(h(o,i,{integer:!0,nonNegative:!0,lt:e.length}),h(s,i,{integer:!0,nonNegative:!0,lt:e[0].length}),n??=[e.length,e[0].length],w(n,i),2!==n.length)throw new t(`The end vector must have 2 elements, but got ${n.length}`,i);const[a,l]=n;h(a,i,{gt:o,lte:e.length}),h(l,i,{gt:s,lte:e[0].length});const g=[];for(let t=o;t<a;t+=1){const r=[];for(let n=s;n<l;n+=1)r.push(e[t][n]);g.push(r)}return g},arity:{min:2,max:3}},"slice-rows":{evaluate:([e,t,r],n)=>(v(e,n),void 0===r?(h(t,n,{integer:!0,lte:e.length,gte:-e.length}),t<0?e.slice(e.length+t):e.slice(t)):(h(t,n,{integer:!0,nonNegative:!0,lte:e.length}),h(r,n,{integer:!0}),h(r=r<0?e.length+r:r,n,{gt:t,lte:e.length}),e.slice(t,r))),arity:{min:2,max:3}},"slice-cols":{evaluate:([e,t,r],n)=>{v(e,n);const i=B(e);return void 0===r?(h(t,n,{integer:!0,lte:i.length,gte:-i.length}),B(t<0?i.slice(i.length+t):i.slice(t))):(h(t,n,{integer:!0,nonNegative:!0,lte:i.length}),h(r,n,{integer:!0}),h(r=r<0?i.length+r:r,n,{gt:t,lte:i.length}),B(i.slice(t,r)))},arity:{min:2,max:3}},"splice-rows":{evaluate:([e,r,n,...i],o)=>{v(e,o),h(r,o,{integer:!0,nonNegative:!0,lte:e.length}),h(n,o,{integer:!0,nonNegative:!0}),0!==i.length&&(v(i,o),i.every(r=>{if(N(r,o),e[0].length!==r.length)throw new t(`All rows must have the same length as the number of columns in grid, but got ${r.length}`,o);return!0}));const s=[];for(let t=0;t<r;t+=1)s.push(e[t]);i.length>0&&s.push(...i);for(let t=r+n;t<e.length;t+=1)s.push(e[t]);return s},arity:{min:3}},"splice-cols":{evaluate:([e,r,n,...i],o)=>{v(e,o);const s=B(e);h(r,o,{integer:!0,nonNegative:!0,lte:s.length}),h(n,o,{integer:!0,nonNegative:!0}),0!==i.length&&(v(i,o),i.every(e=>{if(N(e,o),s[0].length!==e.length)throw new t(`All rows must have the same length as the number of rows in grid, but got ${e.length}`,o);return!0}));const a=[];for(let e=0;e<r;e+=1)a.push(s[e]);a.push(...i);for(let e=r+n;e<s.length;e+=1)a.push(s[e]);return B(a)},arity:{min:3}},"concat-rows":{evaluate:(e,r)=>{N(e,r),e.every(e=>v(e,r));const n=e[0][0].length;e.slice(1).every(e=>{if(e[0].length!==n)throw new t(`All grids must have the same number of columns, but got ${n} and ${e[0].length}`,r);return!0});const i=[];return e.forEach(e=>{e.forEach(e=>{i.push(e)})}),i},arity:{min:1}},"concat-cols":{evaluate:(e,r)=>{N(e,r),e.every(e=>v(e,r));const n=e[0].length;e.slice(1).every(e=>{if(e.length!==n)throw new t(`All grids must have the same number of rows, but got ${n} and ${e.length}`,r);return!0});const i=[];for(let t=0;t<n;t+=1){const r=[];e.forEach(e=>{r.push(...e[t])}),i.push(r)}return i},arity:{min:1}},"cell-map":{evaluate:(e,r,n,{executeFunction:i})=>{const o=function(e,t){return F(e,t),e}(e.at(-1),r),s=e.slice(0,-1);v(s[0],r);const a=s[0].length,l=s[0][0].length;return s.slice(1).forEach(e=>{if(v(e,r),e.length!==a)throw new t(`All grids must have the same number of rows, but got ${a} and ${e.length}`,r);if(e[0].length!==l)throw new t(`All grids must have the same number of columns, but got ${l} and ${e[0].length}`,r)}),E(Array.from({length:a}),(e,t)=>E(Array.from({length:l}),(e,a)=>{const l=s.map(e=>e[t][a]);return k(i(o,l,n,r),e=>$(e))}))},arity:{min:2}},"cell-mapi":{evaluate:([e,t],r,n,{executeFunction:i})=>{v(e,r),F(t,r);const o=e.length,s=e[0].length;return E(Array.from({length:o}),(o,a)=>E(Array.from({length:s}),(o,s)=>k(i(t,[e[a][s],a,s],n,r),e=>$(e))))},arity:S(2)},"cell-reduce":{evaluate:([e,t,r],n,i,{executeFunction:o})=>{v(e,n),F(t,n);const s=[];for(const t of e)for(const e of t)s.push(e);return P(s,(e,r)=>o(t,[e,r],i,n),$(r))},arity:S(3)},"cell-reducei":{evaluate:([e,t,r],n,i,{executeFunction:o})=>{v(e,n),F(t,n);const s=[];for(let t=0;t<e.length;t+=1)for(let r=0;r<e[t].length;r+=1)s.push({cell:e[t][r],i:t,j:r});return P(s,(e,{cell:r,i:s,j:a})=>o(t,[e,r,s,a],i,n),$(r))},arity:S(3)},"push-rows":{evaluate:([e,...r],n)=>{if(v(e,n),v(r,n),e[0].length!==r[0].length)throw new t(`All rows must have the same length as the number of columns in grid, but got ${e[0].length} and ${r[0].length}`,n);return[...e,...r]},arity:{min:2}},"unshift-rows":{evaluate:([e,...r],n)=>{if(v(e,n),v(r,n),e[0].length!==r[0].length)throw new t(`All rows must have the same length as the number of columns in grid, but got ${e[0].length} and ${r[0].length}`,n);return[...r,...e]},arity:{min:2}},"pop-row":{evaluate:([e],t)=>(v(e,t),1===e.length?null:e.slice(0,-1)),arity:S(1)},"shift-row":{evaluate:([e],t)=>(v(e,t),1===e.length?null:e.slice(1)),arity:S(1)},"push-cols":{evaluate:([e,...r],n)=>{if(v(e,n),v(r,n),e.length!==r[0].length)throw new t(`All columns must have the same length as the number of rows in grid, but got ${r.length}`,n);const i=[];for(let t=0;t<e.length;t+=1){const n=[];n.push(...e[t]),r.forEach(e=>{n.push(e[t])}),i.push(n)}return i},arity:{min:2}},"unshift-cols":{evaluate:([e,...r],n)=>{if(v(e,n),v(r,n),e.length!==r[0].length)throw new t(`All columns must have the same length as the number of rows in grid, but got ${r.length}`,n);const i=[];for(let t=0;t<e.length;t+=1){const n=[];r.forEach(e=>{n.push(e[t])}),n.push(...e[t]),i.push(n)}return i},arity:{min:2}},"pop-col":{evaluate:([e],t)=>(v(e,t),1===e[0].length?null:e.map(e=>e.slice(0,-1))),arity:S(1)},"shift-col":{evaluate:([e],t)=>(v(e,t),1===e[0].length?null:e.map(e=>e.slice(1))),arity:S(1)},"from-array":{evaluate:([e,r],n)=>{if(N(e,n),h(r,n,{integer:!0,positive:!0}),e.length%r!==0)throw new t(`The number of elements in the array must be divisible by rows, but got ${e.length} and ${r}`,n);return function(e,t){const r=[],n=e.length/t;for(let i=0;i<t;i++){const t=i*n,o=t+n;r.push(e.slice(t,o))}return r}(e,r)},arity:S(2)}};for(const[e,t]of Object.entries(U))D[e]&&(D[e].docs=t);const W={name:"grid",functions:D};export{W as gridModule};
|
|
2
|
+
//# sourceMappingURL=grid.esm.js.map
|