@mojir/lits 2.2.2-alpha.6 → 2.2.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.
Files changed (908) hide show
  1. package/README.md +1556 -107
  2. package/dist/cli/cli/src/cli.d.ts +1 -1
  3. package/dist/cli/cli/src/cliDocumentation/getCliType.d.ts +1 -1
  4. package/dist/cli/cli/src/colorizer.d.ts +36 -36
  5. package/dist/cli/cli/src/js-interop/Cli/Fs/index.d.ts +2 -0
  6. package/dist/cli/cli/src/js-interop/Cli/Proc/index.d.ts +3 -0
  7. package/dist/cli/cli/src/js-interop/Cli/index.d.ts +3 -0
  8. package/dist/cli/cli/src/js-interop/utils.d.ts +2 -0
  9. package/dist/cli/cli.js +30531 -12755
  10. package/dist/cli/reference/api.d.ts +53 -41
  11. package/dist/cli/reference/index.d.ts +150 -23
  12. package/dist/cli/src/AutoCompleter/AutoCompleter.d.ts +24 -0
  13. package/dist/cli/src/Lits/Cache.d.ts +1 -1
  14. package/dist/cli/src/Lits/Lits.d.ts +26 -22
  15. package/dist/cli/src/allModules.d.ts +2 -0
  16. package/dist/cli/src/builtin/bindingNode.d.ts +5 -0
  17. package/dist/cli/src/builtin/{normalExpressions/categories → core}/array.d.ts +1 -1
  18. package/dist/cli/src/builtin/{normalExpressions/categories → core}/bitwise.d.ts +1 -1
  19. package/dist/{src/builtin/normalExpressions/categories → cli/src/builtin/core}/collection.d.ts +1 -1
  20. package/dist/{src/builtin/normalExpressions/categories → cli/src/builtin/core}/functional.d.ts +1 -1
  21. package/dist/{src/builtin/normalExpressions/categories → cli/src/builtin/core}/math.d.ts +1 -1
  22. package/dist/cli/src/builtin/core/meta.d.ts +3 -0
  23. package/dist/cli/src/builtin/{normalExpressions/categories → core}/misc.d.ts +1 -1
  24. package/dist/{src/builtin/normalExpressions/categories → cli/src/builtin/core}/object.d.ts +1 -1
  25. package/dist/{src/builtin/normalExpressions/categories → cli/src/builtin/core}/predicates.d.ts +1 -1
  26. package/dist/{src/builtin/normalExpressions/categories → cli/src/builtin/core}/regexp.d.ts +1 -1
  27. package/dist/cli/src/builtin/core/sequence.d.ts +2 -0
  28. package/dist/cli/src/builtin/{normalExpressions/categories → core}/string.d.ts +1 -1
  29. package/dist/cli/src/builtin/core/vector.d.ts +2 -0
  30. package/dist/cli/src/builtin/index.d.ts +10 -34
  31. package/dist/cli/src/builtin/interface.d.ts +92 -24
  32. package/dist/cli/src/builtin/modules/assert/docs.d.ts +2 -0
  33. package/dist/cli/src/builtin/modules/assert/index.d.ts +2 -0
  34. package/dist/cli/src/builtin/modules/bitwise/index.d.ts +2 -0
  35. package/dist/cli/src/builtin/modules/collection/index.d.ts +2 -0
  36. package/dist/cli/src/builtin/modules/functional/index.d.ts +2 -0
  37. package/dist/cli/src/builtin/modules/grid/docs.d.ts +2 -0
  38. package/dist/cli/src/builtin/modules/grid/fromArray.d.ts +8 -0
  39. package/dist/cli/src/builtin/modules/grid/index.d.ts +2 -0
  40. package/dist/cli/src/builtin/modules/grid/transpose.d.ts +2 -0
  41. package/dist/cli/src/builtin/modules/interface.d.ts +11 -0
  42. package/dist/cli/src/builtin/modules/linear-algebra/docs.d.ts +2 -0
  43. package/dist/cli/src/builtin/modules/linear-algebra/helpers/calcFractionalRanks.d.ts +1 -0
  44. package/dist/cli/src/builtin/modules/linear-algebra/helpers/collinear.d.ts +2 -0
  45. package/dist/cli/src/builtin/modules/linear-algebra/helpers/corrleation.d.ts +8 -0
  46. package/dist/cli/src/builtin/modules/linear-algebra/helpers/covariance.d.ts +4 -0
  47. package/dist/cli/src/builtin/modules/linear-algebra/helpers/dot.d.ts +1 -0
  48. package/dist/cli/src/builtin/modules/linear-algebra/helpers/gaussJordanElimination.d.ts +7 -0
  49. package/dist/cli/src/builtin/modules/linear-algebra/helpers/getUnit.d.ts +2 -0
  50. package/dist/cli/src/builtin/modules/linear-algebra/helpers/isZeroVector.d.ts +1 -0
  51. package/dist/cli/src/builtin/modules/linear-algebra/helpers/kendallTau.d.ts +10 -0
  52. package/dist/cli/src/builtin/modules/linear-algebra/helpers/length.d.ts +1 -0
  53. package/dist/cli/src/builtin/modules/linear-algebra/helpers/pearsonCorr.d.ts +1 -0
  54. package/dist/cli/src/builtin/modules/linear-algebra/helpers/scale.d.ts +1 -0
  55. package/dist/cli/src/builtin/modules/linear-algebra/helpers/solve.d.ts +8 -0
  56. package/dist/cli/src/builtin/modules/linear-algebra/helpers/subtract.d.ts +1 -0
  57. package/dist/cli/src/builtin/modules/linear-algebra/index.d.ts +4 -0
  58. package/dist/cli/src/builtin/modules/math/index.d.ts +2 -0
  59. package/dist/cli/src/builtin/modules/matrix/docs.d.ts +2 -0
  60. package/dist/cli/src/builtin/modules/matrix/helpers/adjugate.d.ts +1 -0
  61. package/dist/cli/src/builtin/modules/matrix/helpers/band.d.ts +9 -0
  62. package/dist/cli/src/builtin/modules/matrix/helpers/cofactor.d.ts +1 -0
  63. package/dist/cli/src/builtin/modules/matrix/helpers/determinant.d.ts +6 -0
  64. package/dist/cli/src/builtin/modules/matrix/helpers/inverse.d.ts +6 -0
  65. package/dist/cli/src/builtin/modules/matrix/helpers/isBanded.d.ts +11 -0
  66. package/dist/cli/src/builtin/modules/matrix/helpers/isDiagonal.d.ts +10 -0
  67. package/dist/cli/src/builtin/modules/matrix/helpers/isIdentity.d.ts +1 -0
  68. package/dist/cli/src/builtin/modules/matrix/helpers/isOrthogonal.d.ts +1 -0
  69. package/dist/cli/src/builtin/modules/matrix/helpers/isSquare.d.ts +1 -0
  70. package/dist/cli/src/builtin/modules/matrix/helpers/isSymetric.d.ts +8 -0
  71. package/dist/cli/src/builtin/modules/matrix/helpers/isTriangular.d.ts +13 -0
  72. package/dist/cli/src/builtin/modules/matrix/helpers/matrixMultiply.d.ts +7 -0
  73. package/dist/cli/src/builtin/modules/matrix/helpers/minor.d.ts +1 -0
  74. package/dist/cli/src/builtin/modules/matrix/helpers/norm1.d.ts +1 -0
  75. package/dist/cli/src/builtin/modules/matrix/helpers/trace.d.ts +8 -0
  76. package/dist/cli/src/builtin/modules/matrix/index.d.ts +4 -0
  77. package/dist/cli/src/builtin/modules/number-theory/binomialCefficient.d.ts +1 -0
  78. package/dist/cli/src/builtin/modules/number-theory/combinations.d.ts +2 -0
  79. package/dist/cli/src/builtin/modules/number-theory/derangements.d.ts +2 -0
  80. package/dist/cli/src/builtin/modules/number-theory/divisors.d.ts +4 -0
  81. package/dist/cli/src/builtin/modules/number-theory/docs.d.ts +2 -0
  82. package/dist/cli/src/builtin/modules/number-theory/factorial.d.ts +3 -0
  83. package/dist/cli/src/builtin/modules/number-theory/index.d.ts +4 -0
  84. package/dist/cli/src/builtin/modules/number-theory/partitions.d.ts +2 -0
  85. package/dist/cli/src/builtin/modules/number-theory/permutations.d.ts +2 -0
  86. package/dist/cli/src/builtin/modules/number-theory/powerSet.d.ts +2 -0
  87. package/dist/cli/src/builtin/modules/number-theory/primeFactors.d.ts +11 -0
  88. package/dist/cli/src/builtin/modules/number-theory/sequences/abundant.d.ts +2 -0
  89. package/dist/cli/src/builtin/modules/number-theory/sequences/arithmetic.d.ts +2 -0
  90. package/dist/cli/src/builtin/modules/number-theory/sequences/bell.d.ts +1 -0
  91. package/dist/cli/src/builtin/modules/number-theory/sequences/bernoulli.d.ts +2 -0
  92. package/dist/cli/src/builtin/modules/number-theory/sequences/catalan.d.ts +1 -0
  93. package/dist/cli/src/builtin/modules/number-theory/sequences/collatz.d.ts +2 -0
  94. package/dist/cli/src/builtin/modules/number-theory/sequences/composite.d.ts +3 -0
  95. package/dist/cli/src/builtin/modules/number-theory/sequences/deficient.d.ts +2 -0
  96. package/dist/cli/src/builtin/modules/number-theory/sequences/factorial.d.ts +1 -0
  97. package/dist/cli/src/builtin/modules/number-theory/sequences/fibonacci.d.ts +1 -0
  98. package/dist/cli/src/builtin/modules/number-theory/sequences/geometric.d.ts +2 -0
  99. package/dist/cli/src/builtin/modules/number-theory/sequences/golomb.d.ts +2 -0
  100. package/dist/cli/src/builtin/modules/number-theory/sequences/happy.d.ts +2 -0
  101. package/dist/cli/src/builtin/modules/number-theory/sequences/index.d.ts +26 -0
  102. package/dist/cli/src/builtin/modules/number-theory/sequences/juggler.d.ts +2 -0
  103. package/dist/cli/src/builtin/modules/number-theory/sequences/lookAndSay.d.ts +2 -0
  104. package/dist/cli/src/builtin/modules/number-theory/sequences/lucas.d.ts +1 -0
  105. package/dist/cli/src/builtin/modules/number-theory/sequences/lucky.d.ts +2 -0
  106. package/dist/cli/src/builtin/modules/number-theory/sequences/mersenne.d.ts +1 -0
  107. package/dist/cli/src/builtin/modules/number-theory/sequences/padovan.d.ts +2 -0
  108. package/dist/cli/src/builtin/modules/number-theory/sequences/partition.d.ts +1 -0
  109. package/dist/cli/src/builtin/modules/number-theory/sequences/pell.d.ts +1 -0
  110. package/dist/cli/src/builtin/modules/number-theory/sequences/perfect.d.ts +1 -0
  111. package/dist/cli/src/builtin/modules/number-theory/sequences/perfectCube.d.ts +2 -0
  112. package/dist/cli/src/builtin/modules/number-theory/sequences/perfectPower.d.ts +10 -0
  113. package/dist/cli/src/builtin/modules/number-theory/sequences/perfectSquare.d.ts +2 -0
  114. package/dist/cli/src/builtin/modules/number-theory/sequences/poligonal.d.ts +2 -0
  115. package/dist/cli/src/builtin/modules/number-theory/sequences/prime.d.ts +3 -0
  116. package/dist/cli/src/builtin/modules/number-theory/sequences/recaman.d.ts +9 -0
  117. package/dist/cli/src/builtin/modules/number-theory/sequences/sylvester.d.ts +1 -0
  118. package/dist/cli/src/builtin/modules/number-theory/sequences/thueMorse.d.ts +2 -0
  119. package/dist/cli/src/builtin/modules/number-theory/sequences/tribonacci.d.ts +1 -0
  120. package/dist/cli/src/builtin/modules/random/docs.d.ts +2 -0
  121. package/dist/cli/src/builtin/modules/random/index.d.ts +2 -0
  122. package/dist/cli/src/builtin/modules/sequence/index.d.ts +2 -0
  123. package/dist/cli/src/builtin/modules/string/index.d.ts +2 -0
  124. package/dist/cli/src/builtin/modules/vector/bincount.d.ts +9 -0
  125. package/dist/cli/src/builtin/modules/vector/calcMad.d.ts +1 -0
  126. package/dist/cli/src/builtin/modules/vector/calcMean.d.ts +1 -0
  127. package/dist/cli/src/builtin/modules/vector/calcMedad.d.ts +1 -0
  128. package/dist/cli/src/builtin/modules/vector/calcMedian.d.ts +1 -0
  129. package/dist/cli/src/builtin/modules/vector/calcStdDev.d.ts +2 -0
  130. package/dist/cli/src/builtin/modules/vector/calcVariance.d.ts +2 -0
  131. package/dist/cli/src/builtin/modules/vector/docs.d.ts +2 -0
  132. package/dist/cli/src/builtin/modules/vector/entropy.d.ts +8 -0
  133. package/dist/cli/src/builtin/modules/vector/histogram.d.ts +9 -0
  134. package/dist/cli/src/builtin/modules/vector/index.d.ts +2 -0
  135. package/dist/cli/src/builtin/modules/vector/mode.d.ts +6 -0
  136. package/dist/cli/src/builtin/modules/vector/outliers.d.ts +7 -0
  137. package/dist/cli/src/builtin/modules/vector/percentile.d.ts +7 -0
  138. package/dist/cli/src/builtin/modules/vector/quartiles.d.ts +1 -0
  139. package/dist/cli/src/builtin/modules/vector/reductionFunctions/entropy.d.ts +2 -0
  140. package/dist/cli/src/builtin/modules/vector/reductionFunctions/giniCoefficient.d.ts +2 -0
  141. package/dist/cli/src/builtin/modules/vector/reductionFunctions/index.d.ts +13 -0
  142. package/dist/cli/src/builtin/modules/vector/reductionFunctions/iqr.d.ts +2 -0
  143. package/dist/cli/src/builtin/modules/vector/reductionFunctions/kurtosis.d.ts +5 -0
  144. package/dist/cli/src/builtin/modules/vector/reductionFunctions/mad.d.ts +2 -0
  145. package/dist/cli/src/builtin/modules/vector/reductionFunctions/mean.d.ts +4 -0
  146. package/dist/cli/src/builtin/modules/vector/reductionFunctions/medad.d.ts +2 -0
  147. package/dist/cli/src/builtin/modules/vector/reductionFunctions/median.d.ts +2 -0
  148. package/dist/cli/src/builtin/modules/vector/reductionFunctions/prod.d.ts +2 -0
  149. package/dist/cli/src/builtin/modules/vector/reductionFunctions/rms.d.ts +2 -0
  150. package/dist/cli/src/builtin/modules/vector/reductionFunctions/skewness.d.ts +3 -0
  151. package/dist/cli/src/builtin/modules/vector/reductionFunctions/span.d.ts +2 -0
  152. package/dist/cli/src/builtin/modules/vector/reductionFunctions/standardDeviation.d.ts +3 -0
  153. package/dist/cli/src/builtin/modules/vector/reductionFunctions/sum.d.ts +2 -0
  154. package/dist/cli/src/builtin/modules/vector/reductionFunctions/variance.d.ts +3 -0
  155. package/dist/cli/src/builtin/normalExpressions/index.d.ts +7 -1
  156. package/dist/cli/src/builtin/specialExpressionTypes.d.ts +23 -0
  157. package/dist/cli/src/builtin/specialExpressions/and.d.ts +3 -3
  158. package/dist/cli/src/builtin/specialExpressions/array.d.ts +6 -0
  159. package/dist/cli/src/builtin/specialExpressions/block.d.ts +6 -0
  160. package/dist/cli/src/builtin/specialExpressions/cond.d.ts +3 -3
  161. package/dist/cli/src/builtin/specialExpressions/def.d.ts +5 -4
  162. package/dist/cli/src/builtin/specialExpressions/defined.d.ts +5 -0
  163. package/dist/cli/src/builtin/specialExpressions/functions.d.ts +5 -17
  164. package/dist/cli/src/builtin/specialExpressions/if.d.ts +3 -3
  165. package/dist/cli/src/builtin/specialExpressions/let.d.ts +3 -7
  166. package/dist/cli/src/builtin/specialExpressions/loop.d.ts +3 -4
  167. package/dist/cli/src/builtin/specialExpressions/loops.d.ts +5 -14
  168. package/dist/cli/src/builtin/specialExpressions/object.d.ts +6 -0
  169. package/dist/cli/src/builtin/specialExpressions/or.d.ts +3 -3
  170. package/dist/cli/src/builtin/specialExpressions/qq.d.ts +3 -3
  171. package/dist/cli/src/builtin/specialExpressions/recur.d.ts +3 -3
  172. package/dist/cli/src/builtin/specialExpressions/switch.d.ts +6 -0
  173. package/dist/cli/src/builtin/specialExpressions/throw.d.ts +3 -3
  174. package/dist/cli/src/builtin/specialExpressions/try.d.ts +3 -5
  175. package/dist/cli/src/builtin/specialExpressions/unless.d.ts +6 -0
  176. package/dist/cli/src/builtin/utils.d.ts +3 -15
  177. package/dist/cli/src/cli.d.ts +1 -1
  178. package/dist/cli/src/cliDocumentation/getCliType.d.ts +1 -1
  179. package/dist/cli/src/colorizer.d.ts +36 -36
  180. package/dist/cli/src/constants/constants.d.ts +18 -44
  181. package/dist/cli/src/errors.d.ts +2 -5
  182. package/dist/cli/src/evaluator/ContextStack.d.ts +16 -11
  183. package/dist/cli/src/evaluator/functionExecutors.d.ts +4 -4
  184. package/dist/cli/src/evaluator/index.d.ts +2 -2
  185. package/dist/cli/src/evaluator/interface.d.ts +5 -5
  186. package/dist/cli/src/getUndefinedSymbols/index.d.ts +7 -0
  187. package/dist/cli/src/index.d.ts +9 -12
  188. package/dist/cli/src/initReferenceData.d.ts +1 -0
  189. package/dist/cli/src/interface.d.ts +1 -2
  190. package/dist/cli/src/js-interop/Cli/Fs/index.d.ts +2 -0
  191. package/dist/cli/src/js-interop/Cli/Proc/index.d.ts +3 -0
  192. package/dist/cli/src/js-interop/Cli/index.d.ts +3 -0
  193. package/dist/cli/src/js-interop/utils.d.ts +2 -0
  194. package/dist/cli/src/parser/Parser.d.ts +58 -0
  195. package/dist/cli/src/parser/types.d.ts +133 -0
  196. package/dist/cli/src/symbolPatterns.d.ts +2 -0
  197. package/dist/cli/src/tokenizer/minifyTokenStream.d.ts +4 -0
  198. package/dist/cli/src/tokenizer/operators.d.ts +12 -0
  199. package/dist/cli/src/tokenizer/reservedNames.d.ts +66 -0
  200. package/dist/cli/src/tokenizer/token.d.ts +86 -0
  201. package/dist/cli/src/tokenizer/tokenize.d.ts +8 -0
  202. package/dist/cli/src/tokenizer/tokenizers.d.ts +14 -19
  203. package/dist/cli/src/transformer/index.d.ts +2 -2
  204. package/dist/cli/src/typeGuards/annotatedArrays.d.ts +16 -0
  205. package/dist/cli/src/typeGuards/array.d.ts +1 -1
  206. package/dist/cli/src/typeGuards/astNode.d.ts +20 -17
  207. package/dist/cli/src/typeGuards/index.d.ts +1 -10
  208. package/dist/cli/src/typeGuards/lits.d.ts +5 -2
  209. package/dist/cli/src/typeGuards/litsFunction.d.ts +3 -3
  210. package/dist/cli/src/typeGuards/number.d.ts +1 -1
  211. package/dist/cli/src/typeGuards/string.d.ts +1 -1
  212. package/dist/cli/src/untokenizer/index.d.ts +1 -1
  213. package/dist/cli/src/utils/arity.d.ts +10 -0
  214. package/dist/cli/src/utils/debug/debugTools.d.ts +0 -2
  215. package/dist/cli/src/utils/debug/getCodeMarker.d.ts +2 -0
  216. package/dist/cli/src/utils/debug/getSourceCodeInfo.d.ts +2 -2
  217. package/dist/cli/src/utils/docString/generateDocString.d.ts +2 -0
  218. package/dist/cli/src/utils/getAssertionError.d.ts +1 -1
  219. package/dist/cli/src/utils/index.d.ts +9 -6
  220. package/dist/full.esm.js +2 -0
  221. package/dist/full.esm.js.map +1 -0
  222. package/dist/full.js +2 -0
  223. package/dist/full.js.map +1 -0
  224. package/dist/index.esm.js +1 -15635
  225. package/dist/index.esm.js.map +1 -1
  226. package/dist/index.js +1 -15663
  227. package/dist/index.js.map +1 -1
  228. package/dist/lits.iife.js +1 -15668
  229. package/dist/lits.iife.js.map +1 -1
  230. package/dist/modules/assert.esm.js +2 -0
  231. package/dist/modules/assert.esm.js.map +1 -0
  232. package/dist/modules/assert.js +2 -0
  233. package/dist/modules/assert.js.map +1 -0
  234. package/dist/modules/bitwise.esm.js +2 -0
  235. package/dist/modules/bitwise.esm.js.map +1 -0
  236. package/dist/modules/bitwise.js +2 -0
  237. package/dist/modules/bitwise.js.map +1 -0
  238. package/dist/modules/cli/src/cli.d.ts +2 -0
  239. package/dist/modules/cli/src/cliDocumentation/formatCliDescription.d.ts +3 -0
  240. package/dist/modules/cli/src/cliDocumentation/getCliArgumentInfo.d.ts +3 -0
  241. package/dist/modules/cli/src/cliDocumentation/getCliDocumentation.d.ts +2 -0
  242. package/dist/modules/cli/src/cliDocumentation/getCliFunctionExamples.d.ts +3 -0
  243. package/dist/modules/cli/src/cliDocumentation/getCliFunctionSignature.d.ts +3 -0
  244. package/dist/modules/cli/src/cliDocumentation/getCliTitle.d.ts +3 -0
  245. package/dist/modules/cli/src/cliDocumentation/getCliType.d.ts +3 -0
  246. package/dist/modules/cli/src/cliFormatterRules.d.ts +13 -0
  247. package/dist/modules/cli/src/colorizer.d.ts +939 -0
  248. package/dist/modules/cli/src/createReadlineInterface.d.ts +5 -0
  249. package/dist/modules/cli/src/js-interop/Cli/Fs/index.d.ts +2 -0
  250. package/dist/modules/cli/src/js-interop/Cli/Proc/index.d.ts +3 -0
  251. package/dist/modules/cli/src/js-interop/Cli/index.d.ts +3 -0
  252. package/dist/modules/cli/src/js-interop/utils.d.ts +2 -0
  253. package/dist/modules/collection.esm.js +2 -0
  254. package/dist/modules/collection.esm.js.map +1 -0
  255. package/dist/modules/collection.js +2 -0
  256. package/dist/modules/collection.js.map +1 -0
  257. package/dist/modules/common/createFormatter.d.ts +6 -0
  258. package/dist/modules/common/utils.d.ts +2 -0
  259. package/dist/modules/functional.esm.js +2 -0
  260. package/dist/modules/functional.esm.js.map +1 -0
  261. package/dist/modules/functional.js +2 -0
  262. package/dist/modules/functional.js.map +1 -0
  263. package/dist/modules/grid.esm.js +2 -0
  264. package/dist/modules/grid.esm.js.map +1 -0
  265. package/dist/modules/grid.js +2 -0
  266. package/dist/modules/grid.js.map +1 -0
  267. package/dist/modules/linear-algebra.esm.js +2 -0
  268. package/dist/modules/linear-algebra.esm.js.map +1 -0
  269. package/dist/modules/linear-algebra.js +2 -0
  270. package/dist/modules/linear-algebra.js.map +1 -0
  271. package/dist/modules/math.esm.js +2 -0
  272. package/dist/modules/math.esm.js.map +1 -0
  273. package/dist/modules/math.js +2 -0
  274. package/dist/modules/math.js.map +1 -0
  275. package/dist/modules/matrix.esm.js +2 -0
  276. package/dist/modules/matrix.esm.js.map +1 -0
  277. package/dist/modules/matrix.js +2 -0
  278. package/dist/modules/matrix.js.map +1 -0
  279. package/dist/modules/number-theory.esm.js +2 -0
  280. package/dist/modules/number-theory.esm.js.map +1 -0
  281. package/dist/modules/number-theory.js +2 -0
  282. package/dist/modules/number-theory.js.map +1 -0
  283. package/dist/modules/random.esm.js +2 -0
  284. package/dist/modules/random.esm.js.map +1 -0
  285. package/dist/modules/random.js +2 -0
  286. package/dist/modules/random.js.map +1 -0
  287. package/dist/modules/reference/api.d.ts +71 -0
  288. package/dist/modules/reference/datatype.d.ts +3 -0
  289. package/dist/modules/reference/index.d.ts +178 -0
  290. package/dist/modules/reference/shorthand.d.ts +3 -0
  291. package/dist/modules/sequence.esm.js +2 -0
  292. package/dist/modules/sequence.esm.js.map +1 -0
  293. package/dist/modules/sequence.js +2 -0
  294. package/dist/modules/sequence.js.map +1 -0
  295. package/dist/modules/src/AutoCompleter/AutoCompleter.d.ts +24 -0
  296. package/dist/modules/src/Lits/Cache.d.ts +16 -0
  297. package/dist/modules/src/Lits/Lits.d.ts +58 -0
  298. package/dist/modules/src/allModules.d.ts +2 -0
  299. package/dist/modules/src/builtin/bindingNode.d.ts +5 -0
  300. package/dist/{src/builtin/normalExpressions/categories → modules/src/builtin/core}/array.d.ts +1 -1
  301. package/dist/{src/builtin/normalExpressions/categories → modules/src/builtin/core}/bitwise.d.ts +1 -1
  302. package/dist/{cli/src/builtin/normalExpressions/categories → modules/src/builtin/core}/collection.d.ts +1 -1
  303. package/dist/{cli/src/builtin/normalExpressions/categories → modules/src/builtin/core}/functional.d.ts +1 -1
  304. package/dist/{cli/src/builtin/normalExpressions/categories → modules/src/builtin/core}/math.d.ts +1 -1
  305. package/dist/modules/src/builtin/core/meta.d.ts +3 -0
  306. package/dist/{src/builtin/normalExpressions/categories → modules/src/builtin/core}/misc.d.ts +1 -1
  307. package/dist/{cli/src/builtin/normalExpressions/categories → modules/src/builtin/core}/object.d.ts +1 -1
  308. package/dist/{cli/src/builtin/normalExpressions/categories → modules/src/builtin/core}/predicates.d.ts +1 -1
  309. package/dist/{cli/src/builtin/normalExpressions/categories → modules/src/builtin/core}/regexp.d.ts +1 -1
  310. package/dist/modules/src/builtin/core/sequence.d.ts +2 -0
  311. package/dist/{src/builtin/normalExpressions/categories → modules/src/builtin/core}/string.d.ts +1 -1
  312. package/dist/modules/src/builtin/core/vector.d.ts +2 -0
  313. package/dist/modules/src/builtin/index.d.ts +14 -0
  314. package/dist/modules/src/builtin/interface.d.ts +110 -0
  315. package/dist/modules/src/builtin/modules/assert/docs.d.ts +2 -0
  316. package/dist/modules/src/builtin/modules/assert/index.d.ts +2 -0
  317. package/dist/modules/src/builtin/modules/bitwise/index.d.ts +2 -0
  318. package/dist/modules/src/builtin/modules/collection/index.d.ts +2 -0
  319. package/dist/modules/src/builtin/modules/functional/index.d.ts +2 -0
  320. package/dist/modules/src/builtin/modules/grid/docs.d.ts +2 -0
  321. package/dist/modules/src/builtin/modules/grid/fromArray.d.ts +8 -0
  322. package/dist/modules/src/builtin/modules/grid/index.d.ts +2 -0
  323. package/dist/modules/src/builtin/modules/grid/transpose.d.ts +2 -0
  324. package/dist/modules/src/builtin/modules/interface.d.ts +11 -0
  325. package/dist/modules/src/builtin/modules/linear-algebra/docs.d.ts +2 -0
  326. package/dist/modules/src/builtin/modules/linear-algebra/helpers/calcFractionalRanks.d.ts +1 -0
  327. package/dist/modules/src/builtin/modules/linear-algebra/helpers/collinear.d.ts +2 -0
  328. package/dist/modules/src/builtin/modules/linear-algebra/helpers/corrleation.d.ts +8 -0
  329. package/dist/modules/src/builtin/modules/linear-algebra/helpers/covariance.d.ts +4 -0
  330. package/dist/modules/src/builtin/modules/linear-algebra/helpers/dot.d.ts +1 -0
  331. package/dist/modules/src/builtin/modules/linear-algebra/helpers/gaussJordanElimination.d.ts +7 -0
  332. package/dist/modules/src/builtin/modules/linear-algebra/helpers/getUnit.d.ts +2 -0
  333. package/dist/modules/src/builtin/modules/linear-algebra/helpers/isZeroVector.d.ts +1 -0
  334. package/dist/modules/src/builtin/modules/linear-algebra/helpers/kendallTau.d.ts +10 -0
  335. package/dist/modules/src/builtin/modules/linear-algebra/helpers/length.d.ts +1 -0
  336. package/dist/modules/src/builtin/modules/linear-algebra/helpers/pearsonCorr.d.ts +1 -0
  337. package/dist/modules/src/builtin/modules/linear-algebra/helpers/scale.d.ts +1 -0
  338. package/dist/modules/src/builtin/modules/linear-algebra/helpers/solve.d.ts +8 -0
  339. package/dist/modules/src/builtin/modules/linear-algebra/helpers/subtract.d.ts +1 -0
  340. package/dist/modules/src/builtin/modules/linear-algebra/index.d.ts +4 -0
  341. package/dist/modules/src/builtin/modules/math/index.d.ts +2 -0
  342. package/dist/modules/src/builtin/modules/matrix/docs.d.ts +2 -0
  343. package/dist/modules/src/builtin/modules/matrix/helpers/adjugate.d.ts +1 -0
  344. package/dist/modules/src/builtin/modules/matrix/helpers/band.d.ts +9 -0
  345. package/dist/modules/src/builtin/modules/matrix/helpers/cofactor.d.ts +1 -0
  346. package/dist/modules/src/builtin/modules/matrix/helpers/determinant.d.ts +6 -0
  347. package/dist/modules/src/builtin/modules/matrix/helpers/diagonal.d.ts +1 -0
  348. package/dist/modules/src/builtin/modules/matrix/helpers/inverse.d.ts +6 -0
  349. package/dist/modules/src/builtin/modules/matrix/helpers/isBanded.d.ts +11 -0
  350. package/dist/modules/src/builtin/modules/matrix/helpers/isDiagonal.d.ts +10 -0
  351. package/dist/modules/src/builtin/modules/matrix/helpers/isIdentity.d.ts +1 -0
  352. package/dist/modules/src/builtin/modules/matrix/helpers/isOrthogonal.d.ts +1 -0
  353. package/dist/modules/src/builtin/modules/matrix/helpers/isSquare.d.ts +1 -0
  354. package/dist/modules/src/builtin/modules/matrix/helpers/isSymetric.d.ts +8 -0
  355. package/dist/modules/src/builtin/modules/matrix/helpers/isTriangular.d.ts +13 -0
  356. package/dist/modules/src/builtin/modules/matrix/helpers/matrixMultiply.d.ts +7 -0
  357. package/dist/modules/src/builtin/modules/matrix/helpers/minor.d.ts +1 -0
  358. package/dist/modules/src/builtin/modules/matrix/helpers/norm1.d.ts +1 -0
  359. package/dist/modules/src/builtin/modules/matrix/helpers/trace.d.ts +8 -0
  360. package/dist/modules/src/builtin/modules/matrix/index.d.ts +4 -0
  361. package/dist/modules/src/builtin/modules/number-theory/binomialCefficient.d.ts +1 -0
  362. package/dist/modules/src/builtin/modules/number-theory/combinations.d.ts +2 -0
  363. package/dist/modules/src/builtin/modules/number-theory/derangements.d.ts +2 -0
  364. package/dist/modules/src/builtin/modules/number-theory/divisors.d.ts +4 -0
  365. package/dist/modules/src/builtin/modules/number-theory/docs.d.ts +2 -0
  366. package/dist/modules/src/builtin/modules/number-theory/factorial.d.ts +3 -0
  367. package/dist/modules/src/builtin/modules/number-theory/index.d.ts +4 -0
  368. package/dist/modules/src/builtin/modules/number-theory/partitions.d.ts +2 -0
  369. package/dist/modules/src/builtin/modules/number-theory/permutations.d.ts +2 -0
  370. package/dist/modules/src/builtin/modules/number-theory/powerSet.d.ts +2 -0
  371. package/dist/modules/src/builtin/modules/number-theory/primeFactors.d.ts +11 -0
  372. package/dist/modules/src/builtin/modules/number-theory/sequences/abundant.d.ts +2 -0
  373. package/dist/modules/src/builtin/modules/number-theory/sequences/arithmetic.d.ts +2 -0
  374. package/dist/modules/src/builtin/modules/number-theory/sequences/bell.d.ts +1 -0
  375. package/dist/modules/src/builtin/modules/number-theory/sequences/bernoulli.d.ts +2 -0
  376. package/dist/modules/src/builtin/modules/number-theory/sequences/catalan.d.ts +1 -0
  377. package/dist/modules/src/builtin/modules/number-theory/sequences/collatz.d.ts +2 -0
  378. package/dist/modules/src/builtin/modules/number-theory/sequences/composite.d.ts +3 -0
  379. package/dist/modules/src/builtin/modules/number-theory/sequences/deficient.d.ts +2 -0
  380. package/dist/modules/src/builtin/modules/number-theory/sequences/factorial.d.ts +1 -0
  381. package/dist/modules/src/builtin/modules/number-theory/sequences/fibonacci.d.ts +1 -0
  382. package/dist/modules/src/builtin/modules/number-theory/sequences/geometric.d.ts +2 -0
  383. package/dist/modules/src/builtin/modules/number-theory/sequences/golomb.d.ts +2 -0
  384. package/dist/modules/src/builtin/modules/number-theory/sequences/happy.d.ts +2 -0
  385. package/dist/modules/src/builtin/modules/number-theory/sequences/index.d.ts +26 -0
  386. package/dist/modules/src/builtin/modules/number-theory/sequences/juggler.d.ts +2 -0
  387. package/dist/modules/src/builtin/modules/number-theory/sequences/lookAndSay.d.ts +2 -0
  388. package/dist/modules/src/builtin/modules/number-theory/sequences/lucas.d.ts +1 -0
  389. package/dist/modules/src/builtin/modules/number-theory/sequences/lucky.d.ts +2 -0
  390. package/dist/modules/src/builtin/modules/number-theory/sequences/mersenne.d.ts +1 -0
  391. package/dist/modules/src/builtin/modules/number-theory/sequences/padovan.d.ts +2 -0
  392. package/dist/modules/src/builtin/modules/number-theory/sequences/partition.d.ts +1 -0
  393. package/dist/modules/src/builtin/modules/number-theory/sequences/pell.d.ts +1 -0
  394. package/dist/modules/src/builtin/modules/number-theory/sequences/perfect.d.ts +1 -0
  395. package/dist/modules/src/builtin/modules/number-theory/sequences/perfectCube.d.ts +2 -0
  396. package/dist/modules/src/builtin/modules/number-theory/sequences/perfectPower.d.ts +10 -0
  397. package/dist/modules/src/builtin/modules/number-theory/sequences/perfectSquare.d.ts +2 -0
  398. package/dist/modules/src/builtin/modules/number-theory/sequences/poligonal.d.ts +2 -0
  399. package/dist/modules/src/builtin/modules/number-theory/sequences/prime.d.ts +3 -0
  400. package/dist/modules/src/builtin/modules/number-theory/sequences/recaman.d.ts +9 -0
  401. package/dist/modules/src/builtin/modules/number-theory/sequences/sylvester.d.ts +1 -0
  402. package/dist/modules/src/builtin/modules/number-theory/sequences/thueMorse.d.ts +2 -0
  403. package/dist/modules/src/builtin/modules/number-theory/sequences/tribonacci.d.ts +1 -0
  404. package/dist/modules/src/builtin/modules/random/docs.d.ts +2 -0
  405. package/dist/modules/src/builtin/modules/random/index.d.ts +2 -0
  406. package/dist/modules/src/builtin/modules/sequence/index.d.ts +2 -0
  407. package/dist/modules/src/builtin/modules/string/index.d.ts +2 -0
  408. package/dist/modules/src/builtin/modules/vector/bincount.d.ts +9 -0
  409. package/dist/modules/src/builtin/modules/vector/calcMad.d.ts +1 -0
  410. package/dist/modules/src/builtin/modules/vector/calcMean.d.ts +1 -0
  411. package/dist/modules/src/builtin/modules/vector/calcMedad.d.ts +1 -0
  412. package/dist/modules/src/builtin/modules/vector/calcMedian.d.ts +1 -0
  413. package/dist/modules/src/builtin/modules/vector/calcStdDev.d.ts +2 -0
  414. package/dist/modules/src/builtin/modules/vector/calcVariance.d.ts +2 -0
  415. package/dist/modules/src/builtin/modules/vector/docs.d.ts +2 -0
  416. package/dist/modules/src/builtin/modules/vector/entropy.d.ts +8 -0
  417. package/dist/modules/src/builtin/modules/vector/histogram.d.ts +9 -0
  418. package/dist/modules/src/builtin/modules/vector/index.d.ts +2 -0
  419. package/dist/modules/src/builtin/modules/vector/mode.d.ts +6 -0
  420. package/dist/modules/src/builtin/modules/vector/outliers.d.ts +7 -0
  421. package/dist/modules/src/builtin/modules/vector/percentile.d.ts +7 -0
  422. package/dist/modules/src/builtin/modules/vector/quartiles.d.ts +1 -0
  423. package/dist/modules/src/builtin/modules/vector/reductionFunctions/entropy.d.ts +2 -0
  424. package/dist/modules/src/builtin/modules/vector/reductionFunctions/giniCoefficient.d.ts +2 -0
  425. package/dist/modules/src/builtin/modules/vector/reductionFunctions/index.d.ts +13 -0
  426. package/dist/modules/src/builtin/modules/vector/reductionFunctions/iqr.d.ts +2 -0
  427. package/dist/modules/src/builtin/modules/vector/reductionFunctions/kurtosis.d.ts +5 -0
  428. package/dist/modules/src/builtin/modules/vector/reductionFunctions/mad.d.ts +2 -0
  429. package/dist/modules/src/builtin/modules/vector/reductionFunctions/mean.d.ts +4 -0
  430. package/dist/modules/src/builtin/modules/vector/reductionFunctions/medad.d.ts +2 -0
  431. package/dist/modules/src/builtin/modules/vector/reductionFunctions/median.d.ts +2 -0
  432. package/dist/modules/src/builtin/modules/vector/reductionFunctions/prod.d.ts +2 -0
  433. package/dist/modules/src/builtin/modules/vector/reductionFunctions/rms.d.ts +2 -0
  434. package/dist/modules/src/builtin/modules/vector/reductionFunctions/skewness.d.ts +3 -0
  435. package/dist/modules/src/builtin/modules/vector/reductionFunctions/span.d.ts +2 -0
  436. package/dist/modules/src/builtin/modules/vector/reductionFunctions/standardDeviation.d.ts +3 -0
  437. package/dist/modules/src/builtin/modules/vector/reductionFunctions/sum.d.ts +2 -0
  438. package/dist/modules/src/builtin/modules/vector/reductionFunctions/variance.d.ts +3 -0
  439. package/dist/modules/src/builtin/normalExpressions/index.d.ts +8 -0
  440. package/dist/modules/src/builtin/specialExpressionTypes.d.ts +23 -0
  441. package/dist/modules/src/builtin/specialExpressions/and.d.ts +6 -0
  442. package/dist/modules/src/builtin/specialExpressions/array.d.ts +6 -0
  443. package/dist/modules/src/builtin/specialExpressions/block.d.ts +6 -0
  444. package/dist/modules/src/builtin/specialExpressions/cond.d.ts +6 -0
  445. package/dist/modules/src/builtin/specialExpressions/def.d.ts +6 -0
  446. package/dist/modules/src/builtin/specialExpressions/defined.d.ts +5 -0
  447. package/dist/modules/src/builtin/specialExpressions/functions.d.ts +6 -0
  448. package/dist/modules/src/builtin/specialExpressions/if.d.ts +6 -0
  449. package/dist/modules/src/builtin/specialExpressions/let.d.ts +6 -0
  450. package/dist/modules/src/builtin/specialExpressions/loop.d.ts +6 -0
  451. package/dist/modules/src/builtin/specialExpressions/loops.d.ts +9 -0
  452. package/dist/modules/src/builtin/specialExpressions/object.d.ts +6 -0
  453. package/dist/modules/src/builtin/specialExpressions/or.d.ts +6 -0
  454. package/dist/modules/src/builtin/specialExpressions/qq.d.ts +6 -0
  455. package/dist/modules/src/builtin/specialExpressions/recur.d.ts +5 -0
  456. package/dist/modules/src/builtin/specialExpressions/switch.d.ts +6 -0
  457. package/dist/modules/src/builtin/specialExpressions/throw.d.ts +5 -0
  458. package/dist/modules/src/builtin/specialExpressions/try.d.ts +6 -0
  459. package/dist/modules/src/builtin/specialExpressions/unless.d.ts +6 -0
  460. package/dist/modules/src/builtin/utils.d.ts +6 -0
  461. package/dist/modules/src/constants/constants.d.ts +19 -0
  462. package/dist/modules/src/errors.d.ts +24 -0
  463. package/dist/modules/src/evaluator/ContextStack.d.ts +29 -0
  464. package/dist/modules/src/evaluator/functionExecutors.d.ts +11 -0
  465. package/dist/modules/src/evaluator/index.d.ts +5 -0
  466. package/dist/modules/src/evaluator/interface.d.ts +12 -0
  467. package/dist/modules/src/full.d.ts +17 -0
  468. package/dist/modules/src/getUndefinedSymbols/index.d.ts +7 -0
  469. package/dist/modules/src/index.d.ts +14 -0
  470. package/dist/modules/src/initReferenceData.d.ts +1 -0
  471. package/dist/modules/src/interface.d.ts +7 -0
  472. package/dist/modules/src/modules/assert.d.ts +2 -0
  473. package/dist/modules/src/modules/bitwise.d.ts +2 -0
  474. package/dist/modules/src/modules/collection.d.ts +2 -0
  475. package/dist/modules/src/modules/functional.d.ts +2 -0
  476. package/dist/modules/src/modules/grid.d.ts +2 -0
  477. package/dist/modules/src/modules/linear-algebra.d.ts +2 -0
  478. package/dist/modules/src/modules/math.d.ts +2 -0
  479. package/dist/modules/src/modules/matrix.d.ts +2 -0
  480. package/dist/modules/src/modules/number-theory.d.ts +2 -0
  481. package/dist/modules/src/modules/random.d.ts +2 -0
  482. package/dist/modules/src/modules/sequence.d.ts +2 -0
  483. package/dist/modules/src/modules/string.d.ts +2 -0
  484. package/dist/modules/src/modules/vector.d.ts +2 -0
  485. package/dist/modules/src/parser/Parser.d.ts +58 -0
  486. package/dist/modules/src/parser/types.d.ts +133 -0
  487. package/dist/modules/src/symbolPatterns.d.ts +2 -0
  488. package/dist/modules/src/testFramework/index.d.ts +14 -0
  489. package/dist/modules/src/tokenizer/minifyTokenStream.d.ts +4 -0
  490. package/dist/modules/src/tokenizer/operators.d.ts +12 -0
  491. package/dist/modules/src/tokenizer/reservedNames.d.ts +66 -0
  492. package/dist/modules/src/tokenizer/token.d.ts +86 -0
  493. package/dist/modules/src/tokenizer/tokenize.d.ts +8 -0
  494. package/dist/modules/src/tokenizer/tokenizers.d.ts +14 -0
  495. package/dist/modules/src/transformer/index.d.ts +2 -0
  496. package/dist/modules/src/typeGuards/annotatedArrays.d.ts +16 -0
  497. package/dist/modules/src/typeGuards/array.d.ts +9 -0
  498. package/dist/modules/src/typeGuards/astNode.d.ts +20 -0
  499. package/dist/modules/src/typeGuards/index.d.ts +8 -0
  500. package/dist/modules/src/typeGuards/lits.d.ts +24 -0
  501. package/dist/modules/src/typeGuards/litsFunction.d.ts +12 -0
  502. package/dist/modules/src/typeGuards/number.d.ts +66 -0
  503. package/dist/modules/src/typeGuards/string.d.ts +15 -0
  504. package/dist/modules/src/untokenizer/index.d.ts +2 -0
  505. package/dist/modules/src/utils/arity.d.ts +10 -0
  506. package/dist/modules/src/utils/debug/debugTools.d.ts +1 -0
  507. package/dist/modules/src/utils/debug/getCodeMarker.d.ts +2 -0
  508. package/dist/modules/src/utils/debug/getSourceCodeInfo.d.ts +2 -0
  509. package/dist/modules/src/utils/docString/generateDocString.d.ts +2 -0
  510. package/dist/modules/src/utils/getAssertionError.d.ts +3 -0
  511. package/dist/modules/src/utils/index.d.ts +14 -0
  512. package/dist/modules/src/utils/symbols.d.ts +2 -0
  513. package/dist/modules/string.esm.js +2 -0
  514. package/dist/modules/string.esm.js.map +1 -0
  515. package/dist/modules/string.js +2 -0
  516. package/dist/modules/string.js.map +1 -0
  517. package/dist/modules/vector.esm.js +2 -0
  518. package/dist/modules/vector.esm.js.map +1 -0
  519. package/dist/modules/vector.js +2 -0
  520. package/dist/modules/vector.js.map +1 -0
  521. package/dist/reference/api.d.ts +53 -41
  522. package/dist/reference/index.d.ts +150 -23
  523. package/dist/src/AutoCompleter/AutoCompleter.d.ts +24 -0
  524. package/dist/src/Lits/Cache.d.ts +1 -1
  525. package/dist/src/Lits/Lits.d.ts +26 -22
  526. package/dist/src/allModules.d.ts +2 -0
  527. package/dist/src/builtin/bindingNode.d.ts +5 -0
  528. package/dist/src/builtin/core/array.d.ts +2 -0
  529. package/dist/src/builtin/core/bitwise.d.ts +2 -0
  530. package/dist/src/builtin/core/collection.d.ts +2 -0
  531. package/dist/src/builtin/core/functional.d.ts +2 -0
  532. package/dist/src/builtin/core/math.d.ts +2 -0
  533. package/dist/src/builtin/core/meta.d.ts +3 -0
  534. package/dist/src/builtin/core/misc.d.ts +2 -0
  535. package/dist/src/builtin/core/object.d.ts +2 -0
  536. package/dist/src/builtin/core/predicates.d.ts +2 -0
  537. package/dist/src/builtin/core/regexp.d.ts +2 -0
  538. package/dist/src/builtin/core/sequence.d.ts +2 -0
  539. package/dist/src/builtin/core/string.d.ts +2 -0
  540. package/dist/src/builtin/core/vector.d.ts +2 -0
  541. package/dist/src/builtin/index.d.ts +10 -34
  542. package/dist/src/builtin/interface.d.ts +92 -24
  543. package/dist/src/builtin/modules/assert/docs.d.ts +2 -0
  544. package/dist/src/builtin/modules/assert/index.d.ts +2 -0
  545. package/dist/src/builtin/modules/bitwise/index.d.ts +2 -0
  546. package/dist/src/builtin/modules/collection/index.d.ts +2 -0
  547. package/dist/src/builtin/modules/functional/index.d.ts +2 -0
  548. package/dist/src/builtin/modules/grid/docs.d.ts +2 -0
  549. package/dist/src/builtin/modules/grid/fromArray.d.ts +8 -0
  550. package/dist/src/builtin/modules/grid/index.d.ts +2 -0
  551. package/dist/src/builtin/modules/grid/transpose.d.ts +2 -0
  552. package/dist/src/builtin/modules/interface.d.ts +11 -0
  553. package/dist/src/builtin/modules/linear-algebra/docs.d.ts +2 -0
  554. package/dist/src/builtin/modules/linear-algebra/helpers/calcFractionalRanks.d.ts +1 -0
  555. package/dist/src/builtin/modules/linear-algebra/helpers/collinear.d.ts +2 -0
  556. package/dist/src/builtin/modules/linear-algebra/helpers/corrleation.d.ts +8 -0
  557. package/dist/src/builtin/modules/linear-algebra/helpers/covariance.d.ts +4 -0
  558. package/dist/src/builtin/modules/linear-algebra/helpers/dot.d.ts +1 -0
  559. package/dist/src/builtin/modules/linear-algebra/helpers/gaussJordanElimination.d.ts +7 -0
  560. package/dist/src/builtin/modules/linear-algebra/helpers/getUnit.d.ts +2 -0
  561. package/dist/src/builtin/modules/linear-algebra/helpers/isZeroVector.d.ts +1 -0
  562. package/dist/src/builtin/modules/linear-algebra/helpers/kendallTau.d.ts +10 -0
  563. package/dist/src/builtin/modules/linear-algebra/helpers/length.d.ts +1 -0
  564. package/dist/src/builtin/modules/linear-algebra/helpers/pearsonCorr.d.ts +1 -0
  565. package/dist/src/builtin/modules/linear-algebra/helpers/scale.d.ts +1 -0
  566. package/dist/src/builtin/modules/linear-algebra/helpers/solve.d.ts +8 -0
  567. package/dist/src/builtin/modules/linear-algebra/helpers/subtract.d.ts +1 -0
  568. package/dist/src/builtin/modules/linear-algebra/index.d.ts +4 -0
  569. package/dist/src/builtin/modules/math/index.d.ts +2 -0
  570. package/dist/src/builtin/modules/matrix/docs.d.ts +2 -0
  571. package/dist/src/builtin/modules/matrix/helpers/adjugate.d.ts +1 -0
  572. package/dist/src/builtin/modules/matrix/helpers/band.d.ts +9 -0
  573. package/dist/src/builtin/modules/matrix/helpers/cofactor.d.ts +1 -0
  574. package/dist/src/builtin/modules/matrix/helpers/determinant.d.ts +6 -0
  575. package/dist/src/builtin/modules/matrix/helpers/diagonal.d.ts +1 -0
  576. package/dist/src/builtin/modules/matrix/helpers/inverse.d.ts +6 -0
  577. package/dist/src/builtin/modules/matrix/helpers/isBanded.d.ts +11 -0
  578. package/dist/src/builtin/modules/matrix/helpers/isDiagonal.d.ts +10 -0
  579. package/dist/src/builtin/modules/matrix/helpers/isIdentity.d.ts +1 -0
  580. package/dist/src/builtin/modules/matrix/helpers/isOrthogonal.d.ts +1 -0
  581. package/dist/src/builtin/modules/matrix/helpers/isSquare.d.ts +1 -0
  582. package/dist/src/builtin/modules/matrix/helpers/isSymetric.d.ts +8 -0
  583. package/dist/src/builtin/modules/matrix/helpers/isTriangular.d.ts +13 -0
  584. package/dist/src/builtin/modules/matrix/helpers/matrixMultiply.d.ts +7 -0
  585. package/dist/src/builtin/modules/matrix/helpers/minor.d.ts +1 -0
  586. package/dist/src/builtin/modules/matrix/helpers/norm1.d.ts +1 -0
  587. package/dist/src/builtin/modules/matrix/helpers/trace.d.ts +8 -0
  588. package/dist/src/builtin/modules/matrix/index.d.ts +4 -0
  589. package/dist/src/builtin/modules/number-theory/binomialCefficient.d.ts +1 -0
  590. package/dist/src/builtin/modules/number-theory/combinations.d.ts +2 -0
  591. package/dist/src/builtin/modules/number-theory/derangements.d.ts +2 -0
  592. package/dist/src/builtin/modules/number-theory/divisors.d.ts +4 -0
  593. package/dist/src/builtin/modules/number-theory/docs.d.ts +2 -0
  594. package/dist/src/builtin/modules/number-theory/factorial.d.ts +3 -0
  595. package/dist/src/builtin/modules/number-theory/index.d.ts +4 -0
  596. package/dist/src/builtin/modules/number-theory/partitions.d.ts +2 -0
  597. package/dist/src/builtin/modules/number-theory/permutations.d.ts +2 -0
  598. package/dist/src/builtin/modules/number-theory/powerSet.d.ts +2 -0
  599. package/dist/src/builtin/modules/number-theory/primeFactors.d.ts +11 -0
  600. package/dist/src/builtin/modules/number-theory/sequences/abundant.d.ts +2 -0
  601. package/dist/src/builtin/modules/number-theory/sequences/arithmetic.d.ts +2 -0
  602. package/dist/src/builtin/modules/number-theory/sequences/bell.d.ts +1 -0
  603. package/dist/src/builtin/modules/number-theory/sequences/bernoulli.d.ts +2 -0
  604. package/dist/src/builtin/modules/number-theory/sequences/catalan.d.ts +1 -0
  605. package/dist/src/builtin/modules/number-theory/sequences/collatz.d.ts +2 -0
  606. package/dist/src/builtin/modules/number-theory/sequences/composite.d.ts +3 -0
  607. package/dist/src/builtin/modules/number-theory/sequences/deficient.d.ts +2 -0
  608. package/dist/src/builtin/modules/number-theory/sequences/factorial.d.ts +1 -0
  609. package/dist/src/builtin/modules/number-theory/sequences/fibonacci.d.ts +1 -0
  610. package/dist/src/builtin/modules/number-theory/sequences/geometric.d.ts +2 -0
  611. package/dist/src/builtin/modules/number-theory/sequences/golomb.d.ts +2 -0
  612. package/dist/src/builtin/modules/number-theory/sequences/happy.d.ts +2 -0
  613. package/dist/src/builtin/modules/number-theory/sequences/index.d.ts +26 -0
  614. package/dist/src/builtin/modules/number-theory/sequences/juggler.d.ts +2 -0
  615. package/dist/src/builtin/modules/number-theory/sequences/lookAndSay.d.ts +2 -0
  616. package/dist/src/builtin/modules/number-theory/sequences/lucas.d.ts +1 -0
  617. package/dist/src/builtin/modules/number-theory/sequences/lucky.d.ts +2 -0
  618. package/dist/src/builtin/modules/number-theory/sequences/mersenne.d.ts +1 -0
  619. package/dist/src/builtin/modules/number-theory/sequences/padovan.d.ts +2 -0
  620. package/dist/src/builtin/modules/number-theory/sequences/partition.d.ts +1 -0
  621. package/dist/src/builtin/modules/number-theory/sequences/pell.d.ts +1 -0
  622. package/dist/src/builtin/modules/number-theory/sequences/perfect.d.ts +1 -0
  623. package/dist/src/builtin/modules/number-theory/sequences/perfectCube.d.ts +2 -0
  624. package/dist/src/builtin/modules/number-theory/sequences/perfectPower.d.ts +10 -0
  625. package/dist/src/builtin/modules/number-theory/sequences/perfectSquare.d.ts +2 -0
  626. package/dist/src/builtin/modules/number-theory/sequences/poligonal.d.ts +2 -0
  627. package/dist/src/builtin/modules/number-theory/sequences/prime.d.ts +3 -0
  628. package/dist/src/builtin/modules/number-theory/sequences/recaman.d.ts +9 -0
  629. package/dist/src/builtin/modules/number-theory/sequences/sylvester.d.ts +1 -0
  630. package/dist/src/builtin/modules/number-theory/sequences/thueMorse.d.ts +2 -0
  631. package/dist/src/builtin/modules/number-theory/sequences/tribonacci.d.ts +1 -0
  632. package/dist/src/builtin/modules/random/docs.d.ts +2 -0
  633. package/dist/src/builtin/modules/random/index.d.ts +2 -0
  634. package/dist/src/builtin/modules/sequence/index.d.ts +2 -0
  635. package/dist/src/builtin/modules/string/index.d.ts +2 -0
  636. package/dist/src/builtin/modules/vector/bincount.d.ts +9 -0
  637. package/dist/src/builtin/modules/vector/calcMad.d.ts +1 -0
  638. package/dist/src/builtin/modules/vector/calcMean.d.ts +1 -0
  639. package/dist/src/builtin/modules/vector/calcMedad.d.ts +1 -0
  640. package/dist/src/builtin/modules/vector/calcMedian.d.ts +1 -0
  641. package/dist/src/builtin/modules/vector/calcStdDev.d.ts +2 -0
  642. package/dist/src/builtin/modules/vector/calcVariance.d.ts +2 -0
  643. package/dist/src/builtin/modules/vector/docs.d.ts +2 -0
  644. package/dist/src/builtin/modules/vector/entropy.d.ts +8 -0
  645. package/dist/src/builtin/modules/vector/histogram.d.ts +9 -0
  646. package/dist/src/builtin/modules/vector/index.d.ts +2 -0
  647. package/dist/src/builtin/modules/vector/mode.d.ts +6 -0
  648. package/dist/src/builtin/modules/vector/outliers.d.ts +7 -0
  649. package/dist/src/builtin/modules/vector/percentile.d.ts +7 -0
  650. package/dist/src/builtin/modules/vector/quartiles.d.ts +1 -0
  651. package/dist/src/builtin/modules/vector/reductionFunctions/entropy.d.ts +2 -0
  652. package/dist/src/builtin/modules/vector/reductionFunctions/giniCoefficient.d.ts +2 -0
  653. package/dist/src/builtin/modules/vector/reductionFunctions/index.d.ts +13 -0
  654. package/dist/src/builtin/modules/vector/reductionFunctions/iqr.d.ts +2 -0
  655. package/dist/src/builtin/modules/vector/reductionFunctions/kurtosis.d.ts +5 -0
  656. package/dist/src/builtin/modules/vector/reductionFunctions/mad.d.ts +2 -0
  657. package/dist/src/builtin/modules/vector/reductionFunctions/mean.d.ts +4 -0
  658. package/dist/src/builtin/modules/vector/reductionFunctions/medad.d.ts +2 -0
  659. package/dist/src/builtin/modules/vector/reductionFunctions/median.d.ts +2 -0
  660. package/dist/src/builtin/modules/vector/reductionFunctions/prod.d.ts +2 -0
  661. package/dist/src/builtin/modules/vector/reductionFunctions/rms.d.ts +2 -0
  662. package/dist/src/builtin/modules/vector/reductionFunctions/skewness.d.ts +3 -0
  663. package/dist/src/builtin/modules/vector/reductionFunctions/span.d.ts +2 -0
  664. package/dist/src/builtin/modules/vector/reductionFunctions/standardDeviation.d.ts +3 -0
  665. package/dist/src/builtin/modules/vector/reductionFunctions/sum.d.ts +2 -0
  666. package/dist/src/builtin/modules/vector/reductionFunctions/variance.d.ts +3 -0
  667. package/dist/src/builtin/normalExpressions/index.d.ts +7 -1
  668. package/dist/src/builtin/specialExpressionTypes.d.ts +23 -0
  669. package/dist/src/builtin/specialExpressions/and.d.ts +3 -3
  670. package/dist/src/builtin/specialExpressions/array.d.ts +6 -0
  671. package/dist/src/builtin/specialExpressions/block.d.ts +6 -0
  672. package/dist/src/builtin/specialExpressions/cond.d.ts +3 -3
  673. package/dist/src/builtin/specialExpressions/def.d.ts +5 -4
  674. package/dist/src/builtin/specialExpressions/defined.d.ts +5 -0
  675. package/dist/src/builtin/specialExpressions/functions.d.ts +5 -17
  676. package/dist/src/builtin/specialExpressions/if.d.ts +3 -3
  677. package/dist/src/builtin/specialExpressions/let.d.ts +3 -7
  678. package/dist/src/builtin/specialExpressions/loop.d.ts +3 -4
  679. package/dist/src/builtin/specialExpressions/loops.d.ts +5 -14
  680. package/dist/src/builtin/specialExpressions/object.d.ts +6 -0
  681. package/dist/src/builtin/specialExpressions/or.d.ts +3 -3
  682. package/dist/src/builtin/specialExpressions/qq.d.ts +3 -3
  683. package/dist/src/builtin/specialExpressions/recur.d.ts +3 -3
  684. package/dist/src/builtin/specialExpressions/switch.d.ts +6 -0
  685. package/dist/src/builtin/specialExpressions/throw.d.ts +3 -3
  686. package/dist/src/builtin/specialExpressions/try.d.ts +3 -5
  687. package/dist/src/builtin/specialExpressions/unless.d.ts +6 -0
  688. package/dist/src/builtin/utils.d.ts +3 -15
  689. package/dist/src/constants/constants.d.ts +18 -44
  690. package/dist/src/errors.d.ts +2 -5
  691. package/dist/src/evaluator/ContextStack.d.ts +16 -11
  692. package/dist/src/evaluator/functionExecutors.d.ts +4 -4
  693. package/dist/src/evaluator/index.d.ts +2 -2
  694. package/dist/src/evaluator/interface.d.ts +5 -5
  695. package/dist/src/full.d.ts +17 -0
  696. package/dist/src/getUndefinedSymbols/index.d.ts +7 -0
  697. package/dist/src/index.d.ts +9 -12
  698. package/dist/src/initReferenceData.d.ts +1 -0
  699. package/dist/src/interface.d.ts +1 -2
  700. package/dist/src/modules/assert.d.ts +2 -0
  701. package/dist/src/modules/bitwise.d.ts +2 -0
  702. package/dist/src/modules/collection.d.ts +2 -0
  703. package/dist/src/modules/functional.d.ts +2 -0
  704. package/dist/src/modules/grid.d.ts +2 -0
  705. package/dist/src/modules/linear-algebra.d.ts +2 -0
  706. package/dist/src/modules/math.d.ts +2 -0
  707. package/dist/src/modules/matrix.d.ts +2 -0
  708. package/dist/src/modules/number-theory.d.ts +2 -0
  709. package/dist/src/modules/random.d.ts +2 -0
  710. package/dist/src/modules/sequence.d.ts +2 -0
  711. package/dist/src/modules/string.d.ts +2 -0
  712. package/dist/src/modules/vector.d.ts +2 -0
  713. package/dist/src/parser/Parser.d.ts +58 -0
  714. package/dist/src/parser/types.d.ts +133 -0
  715. package/dist/src/symbolPatterns.d.ts +2 -0
  716. package/dist/src/tokenizer/minifyTokenStream.d.ts +4 -0
  717. package/dist/src/tokenizer/operators.d.ts +12 -0
  718. package/dist/src/tokenizer/reservedNames.d.ts +66 -0
  719. package/dist/src/tokenizer/token.d.ts +86 -0
  720. package/dist/src/tokenizer/tokenize.d.ts +8 -0
  721. package/dist/src/tokenizer/tokenizers.d.ts +14 -19
  722. package/dist/src/transformer/index.d.ts +2 -2
  723. package/dist/src/typeGuards/annotatedArrays.d.ts +16 -0
  724. package/dist/src/typeGuards/array.d.ts +1 -1
  725. package/dist/src/typeGuards/astNode.d.ts +20 -17
  726. package/dist/src/typeGuards/index.d.ts +1 -10
  727. package/dist/src/typeGuards/lits.d.ts +5 -2
  728. package/dist/src/typeGuards/litsFunction.d.ts +3 -3
  729. package/dist/src/typeGuards/number.d.ts +1 -1
  730. package/dist/src/typeGuards/string.d.ts +1 -1
  731. package/dist/src/untokenizer/index.d.ts +1 -1
  732. package/dist/src/utils/arity.d.ts +10 -0
  733. package/dist/src/utils/debug/debugTools.d.ts +0 -2
  734. package/dist/src/utils/debug/getCodeMarker.d.ts +2 -0
  735. package/dist/src/utils/debug/getSourceCodeInfo.d.ts +2 -2
  736. package/dist/src/utils/docString/generateDocString.d.ts +2 -0
  737. package/dist/src/utils/getAssertionError.d.ts +1 -1
  738. package/dist/src/utils/index.d.ts +9 -6
  739. package/dist/testFramework.esm.js +1 -8913
  740. package/dist/testFramework.esm.js.map +1 -1
  741. package/dist/testFramework.js +1 -8916
  742. package/dist/testFramework.js.map +1 -1
  743. package/package.json +88 -8
  744. package/dist/cli/common/clojureDocs.d.ts +0 -1
  745. package/dist/cli/reference/categories/array.d.ts +0 -3
  746. package/dist/cli/reference/categories/assert.d.ts +0 -3
  747. package/dist/cli/reference/categories/bitwise.d.ts +0 -3
  748. package/dist/cli/reference/categories/collection.d.ts +0 -3
  749. package/dist/cli/reference/categories/functional.d.ts +0 -3
  750. package/dist/cli/reference/categories/math.d.ts +0 -3
  751. package/dist/cli/reference/categories/misc.d.ts +0 -3
  752. package/dist/cli/reference/categories/object.d.ts +0 -3
  753. package/dist/cli/reference/categories/predicate.d.ts +0 -3
  754. package/dist/cli/reference/categories/regularExpression.d.ts +0 -3
  755. package/dist/cli/reference/categories/sequence.d.ts +0 -3
  756. package/dist/cli/reference/categories/specialExpressions.d.ts +0 -3
  757. package/dist/cli/reference/categories/string.d.ts +0 -3
  758. package/dist/cli/src/analyze/calculateOutcomes/calculateAndOutcomes.d.ts +0 -3
  759. package/dist/cli/src/analyze/calculateOutcomes/calculateCommentOutcomes.d.ts +0 -3
  760. package/dist/cli/src/analyze/calculateOutcomes/calculateCondOutcomes.d.ts +0 -3
  761. package/dist/cli/src/analyze/calculateOutcomes/calculateDeclaredOutcomes.d.ts +0 -3
  762. package/dist/cli/src/analyze/calculateOutcomes/calculateDefOutcomes.d.ts +0 -3
  763. package/dist/cli/src/analyze/calculateOutcomes/calculateDefsOutcomes.d.ts +0 -3
  764. package/dist/cli/src/analyze/calculateOutcomes/calculateDoOutcomes.d.ts +0 -3
  765. package/dist/cli/src/analyze/calculateOutcomes/calculateFunctionOutcomes.d.ts +0 -5
  766. package/dist/cli/src/analyze/calculateOutcomes/calculateIfLetOutcomes.d.ts +0 -3
  767. package/dist/cli/src/analyze/calculateOutcomes/calculateIfNotOutcomes.d.ts +0 -3
  768. package/dist/cli/src/analyze/calculateOutcomes/calculateIfOutcomes.d.ts +0 -3
  769. package/dist/cli/src/analyze/calculateOutcomes/calculateLetOutcomes.d.ts +0 -3
  770. package/dist/cli/src/analyze/calculateOutcomes/calculateLoopOutcomes.d.ts +0 -3
  771. package/dist/cli/src/analyze/calculateOutcomes/calculateLoopsOutcomes.d.ts +0 -4
  772. package/dist/cli/src/analyze/calculateOutcomes/calculateOrOutcomes.d.ts +0 -3
  773. package/dist/cli/src/analyze/calculateOutcomes/calculateQqOutcomes.d.ts +0 -3
  774. package/dist/cli/src/analyze/calculateOutcomes/calculateRecurOutcomes.d.ts +0 -3
  775. package/dist/cli/src/analyze/calculateOutcomes/calculateThrowOutcomes.d.ts +0 -3
  776. package/dist/cli/src/analyze/calculateOutcomes/calculateTimeOutcomes.d.ts +0 -3
  777. package/dist/cli/src/analyze/calculateOutcomes/calculateTryOutcomes.d.ts +0 -3
  778. package/dist/cli/src/analyze/calculateOutcomes/calculateWhenFirstOutcomes.d.ts +0 -3
  779. package/dist/cli/src/analyze/calculateOutcomes/calculateWhenLetOutcomes.d.ts +0 -3
  780. package/dist/cli/src/analyze/calculateOutcomes/calculateWhenNotOutcomes.d.ts +0 -3
  781. package/dist/cli/src/analyze/calculateOutcomes/calculateWhenOutcomes.d.ts +0 -3
  782. package/dist/cli/src/analyze/calculateOutcomes/index.d.ts +0 -18
  783. package/dist/cli/src/analyze/calculateOutcomes/specialExpressionCalculators.d.ts +0 -55
  784. package/dist/cli/src/analyze/findUnresolvedIdentifiers.d.ts +0 -2
  785. package/dist/cli/src/analyze/index.d.ts +0 -17
  786. package/dist/cli/src/analyze/utils.d.ts +0 -4
  787. package/dist/cli/src/builtin/normalExpressions/categories/assert.d.ts +0 -2
  788. package/dist/cli/src/builtin/normalExpressions/categories/sequence.d.ts +0 -4
  789. package/dist/cli/src/builtin/specialExpressions/comment.d.ts +0 -5
  790. package/dist/cli/src/builtin/specialExpressions/declared.d.ts +0 -5
  791. package/dist/cli/src/builtin/specialExpressions/defs.d.ts +0 -5
  792. package/dist/cli/src/builtin/specialExpressions/do.d.ts +0 -6
  793. package/dist/cli/src/builtin/specialExpressions/if-let.d.ts +0 -10
  794. package/dist/cli/src/builtin/specialExpressions/if-not.d.ts +0 -6
  795. package/dist/cli/src/builtin/specialExpressions/time.d.ts +0 -6
  796. package/dist/cli/src/builtin/specialExpressions/when-first.d.ts +0 -7
  797. package/dist/cli/src/builtin/specialExpressions/when-let.d.ts +0 -7
  798. package/dist/cli/src/builtin/specialExpressions/when-not.d.ts +0 -6
  799. package/dist/cli/src/builtin/specialExpressions/when.d.ts +0 -6
  800. package/dist/cli/src/identifier.d.ts +0 -8
  801. package/dist/cli/src/parser/index.d.ts +0 -3
  802. package/dist/cli/src/parser/interface.d.ts +0 -155
  803. package/dist/cli/src/parser/parsers.d.ts +0 -4
  804. package/dist/cli/src/removeCommentNodes/index.d.ts +0 -11
  805. package/dist/cli/src/removeCommentNodes/removeCommentNodesFromSpecialExpression.d.ts +0 -3
  806. package/dist/cli/src/reservedNames.d.ts +0 -7
  807. package/dist/cli/src/tokenizer/index.d.ts +0 -9
  808. package/dist/cli/src/tokenizer/interface.d.ts +0 -35
  809. package/dist/cli/src/tokenizer/sugar/applyCollectionAccessor.d.ts +0 -2
  810. package/dist/cli/src/tokenizer/sugar/index.d.ts +0 -3
  811. package/dist/cli/src/typeGuards/token.d.ts +0 -13
  812. package/dist/cli/src/unparser/UnparseOptions.d.ts +0 -15
  813. package/dist/cli/src/unparser/unparse.d.ts +0 -5
  814. package/dist/cli/src/unparser/unparseArrayLiteral.d.ts +0 -3
  815. package/dist/cli/src/unparser/unparseBindings.d.ts +0 -3
  816. package/dist/cli/src/unparser/unparseNormalExpression.d.ts +0 -3
  817. package/dist/cli/src/unparser/unparseObjectLiteral.d.ts +0 -3
  818. package/dist/cli/src/unparser/unparseParams.d.ts +0 -17
  819. package/dist/cli/src/unparser/unparseSpecialExpression/index.d.ts +0 -3
  820. package/dist/cli/src/unparser/unparseSpecialExpression/unparseCond.d.ts +0 -3
  821. package/dist/cli/src/unparser/unparseSpecialExpression/unparseDo.d.ts +0 -3
  822. package/dist/cli/src/unparser/unparseSpecialExpression/unparseIfLet.d.ts +0 -3
  823. package/dist/cli/src/unparser/unparseSpecialExpression/unparseIfOrWhenLike.d.ts +0 -6
  824. package/dist/cli/src/unparser/unparseSpecialExpression/unparseLet.d.ts +0 -3
  825. package/dist/cli/src/unparser/utils.d.ts +0 -5
  826. package/dist/common/clojureDocs.d.ts +0 -1
  827. package/dist/reference/categories/array.d.ts +0 -3
  828. package/dist/reference/categories/assert.d.ts +0 -3
  829. package/dist/reference/categories/bitwise.d.ts +0 -3
  830. package/dist/reference/categories/collection.d.ts +0 -3
  831. package/dist/reference/categories/functional.d.ts +0 -3
  832. package/dist/reference/categories/math.d.ts +0 -3
  833. package/dist/reference/categories/misc.d.ts +0 -3
  834. package/dist/reference/categories/object.d.ts +0 -3
  835. package/dist/reference/categories/predicate.d.ts +0 -3
  836. package/dist/reference/categories/regularExpression.d.ts +0 -3
  837. package/dist/reference/categories/sequence.d.ts +0 -3
  838. package/dist/reference/categories/specialExpressions.d.ts +0 -3
  839. package/dist/reference/categories/string.d.ts +0 -3
  840. package/dist/src/analyze/calculateOutcomes/calculateAndOutcomes.d.ts +0 -3
  841. package/dist/src/analyze/calculateOutcomes/calculateCommentOutcomes.d.ts +0 -3
  842. package/dist/src/analyze/calculateOutcomes/calculateCondOutcomes.d.ts +0 -3
  843. package/dist/src/analyze/calculateOutcomes/calculateDeclaredOutcomes.d.ts +0 -3
  844. package/dist/src/analyze/calculateOutcomes/calculateDefOutcomes.d.ts +0 -3
  845. package/dist/src/analyze/calculateOutcomes/calculateDefsOutcomes.d.ts +0 -3
  846. package/dist/src/analyze/calculateOutcomes/calculateDoOutcomes.d.ts +0 -3
  847. package/dist/src/analyze/calculateOutcomes/calculateFunctionOutcomes.d.ts +0 -5
  848. package/dist/src/analyze/calculateOutcomes/calculateIfLetOutcomes.d.ts +0 -3
  849. package/dist/src/analyze/calculateOutcomes/calculateIfNotOutcomes.d.ts +0 -3
  850. package/dist/src/analyze/calculateOutcomes/calculateIfOutcomes.d.ts +0 -3
  851. package/dist/src/analyze/calculateOutcomes/calculateLetOutcomes.d.ts +0 -3
  852. package/dist/src/analyze/calculateOutcomes/calculateLoopOutcomes.d.ts +0 -3
  853. package/dist/src/analyze/calculateOutcomes/calculateLoopsOutcomes.d.ts +0 -4
  854. package/dist/src/analyze/calculateOutcomes/calculateOrOutcomes.d.ts +0 -3
  855. package/dist/src/analyze/calculateOutcomes/calculateQqOutcomes.d.ts +0 -3
  856. package/dist/src/analyze/calculateOutcomes/calculateRecurOutcomes.d.ts +0 -3
  857. package/dist/src/analyze/calculateOutcomes/calculateThrowOutcomes.d.ts +0 -3
  858. package/dist/src/analyze/calculateOutcomes/calculateTimeOutcomes.d.ts +0 -3
  859. package/dist/src/analyze/calculateOutcomes/calculateTryOutcomes.d.ts +0 -3
  860. package/dist/src/analyze/calculateOutcomes/calculateWhenFirstOutcomes.d.ts +0 -3
  861. package/dist/src/analyze/calculateOutcomes/calculateWhenLetOutcomes.d.ts +0 -3
  862. package/dist/src/analyze/calculateOutcomes/calculateWhenNotOutcomes.d.ts +0 -3
  863. package/dist/src/analyze/calculateOutcomes/calculateWhenOutcomes.d.ts +0 -3
  864. package/dist/src/analyze/calculateOutcomes/index.d.ts +0 -18
  865. package/dist/src/analyze/calculateOutcomes/specialExpressionCalculators.d.ts +0 -55
  866. package/dist/src/analyze/findUnresolvedIdentifiers.d.ts +0 -2
  867. package/dist/src/analyze/index.d.ts +0 -17
  868. package/dist/src/analyze/utils.d.ts +0 -4
  869. package/dist/src/builtin/normalExpressions/categories/assert.d.ts +0 -2
  870. package/dist/src/builtin/normalExpressions/categories/sequence.d.ts +0 -4
  871. package/dist/src/builtin/specialExpressions/comment.d.ts +0 -5
  872. package/dist/src/builtin/specialExpressions/declared.d.ts +0 -5
  873. package/dist/src/builtin/specialExpressions/defs.d.ts +0 -5
  874. package/dist/src/builtin/specialExpressions/do.d.ts +0 -6
  875. package/dist/src/builtin/specialExpressions/if-let.d.ts +0 -10
  876. package/dist/src/builtin/specialExpressions/if-not.d.ts +0 -6
  877. package/dist/src/builtin/specialExpressions/time.d.ts +0 -6
  878. package/dist/src/builtin/specialExpressions/when-first.d.ts +0 -7
  879. package/dist/src/builtin/specialExpressions/when-let.d.ts +0 -7
  880. package/dist/src/builtin/specialExpressions/when-not.d.ts +0 -6
  881. package/dist/src/builtin/specialExpressions/when.d.ts +0 -6
  882. package/dist/src/identifier.d.ts +0 -8
  883. package/dist/src/parser/index.d.ts +0 -3
  884. package/dist/src/parser/interface.d.ts +0 -155
  885. package/dist/src/parser/parsers.d.ts +0 -4
  886. package/dist/src/removeCommentNodes/index.d.ts +0 -11
  887. package/dist/src/removeCommentNodes/removeCommentNodesFromSpecialExpression.d.ts +0 -3
  888. package/dist/src/reservedNames.d.ts +0 -7
  889. package/dist/src/tokenizer/index.d.ts +0 -9
  890. package/dist/src/tokenizer/interface.d.ts +0 -35
  891. package/dist/src/tokenizer/sugar/applyCollectionAccessor.d.ts +0 -2
  892. package/dist/src/tokenizer/sugar/index.d.ts +0 -3
  893. package/dist/src/typeGuards/token.d.ts +0 -13
  894. package/dist/src/unparser/UnparseOptions.d.ts +0 -15
  895. package/dist/src/unparser/__tests__/testFormatter.d.ts +0 -1
  896. package/dist/src/unparser/unparse.d.ts +0 -5
  897. package/dist/src/unparser/unparseArrayLiteral.d.ts +0 -3
  898. package/dist/src/unparser/unparseBindings.d.ts +0 -3
  899. package/dist/src/unparser/unparseNormalExpression.d.ts +0 -3
  900. package/dist/src/unparser/unparseObjectLiteral.d.ts +0 -3
  901. package/dist/src/unparser/unparseParams.d.ts +0 -17
  902. package/dist/src/unparser/unparseSpecialExpression/index.d.ts +0 -3
  903. package/dist/src/unparser/unparseSpecialExpression/unparseCond.d.ts +0 -3
  904. package/dist/src/unparser/unparseSpecialExpression/unparseDo.d.ts +0 -3
  905. package/dist/src/unparser/unparseSpecialExpression/unparseIfLet.d.ts +0 -3
  906. package/dist/src/unparser/unparseSpecialExpression/unparseIfOrWhenLike.d.ts +0 -6
  907. package/dist/src/unparser/unparseSpecialExpression/unparseLet.d.ts +0 -3
  908. package/dist/src/unparser/utils.d.ts +0 -5
@@ -0,0 +1 @@
1
+ {"version":3,"file":"full.js","sources":["../src/utils/debug/getCodeMarker.ts","../src/errors.ts","../src/constants/constants.ts","../src/utils/symbols.ts","../src/utils/debug/debugTools.ts","../src/utils/debug/getSourceCodeInfo.ts","../src/typeGuards/number.ts","../src/utils/getAssertionError.ts","../src/typeGuards/index.ts","../src/typeGuards/litsFunction.ts","../src/typeGuards/lits.ts","../src/utils/arity.ts","../src/builtin/core/bitwise.ts","../src/typeGuards/string.ts","../src/utils/index.ts","../src/typeGuards/array.ts","../src/builtin/core/collection.ts","../src/builtin/core/array.ts","../src/builtin/core/sequence.ts","../src/typeGuards/annotatedArrays.ts","../src/builtin/core/math.ts","../src/builtin/core/misc.ts","../src/builtin/core/object.ts","../src/builtin/core/predicates.ts","../src/builtin/core/regexp.ts","../src/builtin/core/string.ts","../src/builtin/core/functional.ts","../src/utils/docString/generateDocString.ts","../src/builtin/core/meta.ts","../src/builtin/core/vector.ts","../src/builtin/normalExpressions/index.ts","../src/builtin/specialExpressions/and.ts","../src/builtin/specialExpressions/cond.ts","../src/builtin/specialExpressions/switch.ts","../src/typeGuards/astNode.ts","../src/builtin/specialExpressions/defined.ts","../src/parser/types.ts","../src/builtin/bindingNode.ts","../src/builtin/specialExpressions/def.ts","../src/builtin/specialExpressions/block.ts","../src/builtin/specialExpressions/functions.ts","../src/builtin/specialExpressions/if.ts","../src/builtin/specialExpressions/unless.ts","../src/builtin/specialExpressions/let.ts","../src/builtin/specialExpressions/loop.ts","../src/builtin/specialExpressions/loops.ts","../src/builtin/specialExpressions/or.ts","../src/builtin/specialExpressions/qq.ts","../src/builtin/specialExpressions/recur.ts","../src/builtin/specialExpressions/throw.ts","../src/builtin/specialExpressions/try.ts","../src/builtin/specialExpressions/array.ts","../src/builtin/specialExpressions/object.ts","../src/builtin/specialExpressionTypes.ts","../src/builtin/index.ts","../src/tokenizer/operators.ts","../src/builtin/interface.ts","../src/builtin/modules/assert/docs.ts","../src/builtin/modules/assert/index.ts","../src/builtin/modules/grid/docs.ts","../src/builtin/modules/grid/transpose.ts","../src/builtin/modules/grid/index.ts","../src/builtin/modules/grid/fromArray.ts","../src/builtin/modules/random/docs.ts","../src/builtin/modules/random/index.ts","../src/builtin/modules/vector/docs.ts","../src/builtin/modules/vector/outliers.ts","../src/builtin/modules/vector/percentile.ts","../src/builtin/modules/vector/quartiles.ts","../src/builtin/modules/vector/calcMean.ts","../src/builtin/modules/vector/reductionFunctions/mean.ts","../src/builtin/modules/vector/calcMedian.ts","../src/builtin/modules/vector/reductionFunctions/median.ts","../src/builtin/modules/vector/calcVariance.ts","../src/builtin/modules/vector/reductionFunctions/variance.ts","../src/builtin/modules/vector/calcStdDev.ts","../src/builtin/modules/vector/reductionFunctions/standardDeviation.ts","../src/builtin/modules/vector/reductionFunctions/iqr.ts","../src/builtin/modules/vector/reductionFunctions/span.ts","../src/builtin/modules/vector/reductionFunctions/skewness.ts","../src/builtin/modules/vector/reductionFunctions/kurtosis.ts","../src/builtin/modules/vector/reductionFunctions/rms.ts","../src/builtin/modules/vector/reductionFunctions/mad.ts","../src/builtin/modules/vector/calcMad.ts","../src/builtin/modules/vector/calcMedad.ts","../src/builtin/modules/vector/reductionFunctions/medad.ts","../src/builtin/modules/vector/reductionFunctions/giniCoefficient.ts","../src/builtin/modules/vector/reductionFunctions/entropy.ts","../src/builtin/modules/vector/entropy.ts","../src/builtin/modules/vector/reductionFunctions/index.ts","../src/builtin/modules/vector/reductionFunctions/sum.ts","../src/builtin/modules/vector/reductionFunctions/prod.ts","../src/builtin/modules/vector/index.ts","../src/builtin/modules/vector/mode.ts","../src/builtin/modules/vector/histogram.ts","../src/builtin/modules/vector/bincount.ts","../src/builtin/modules/linear-algebra/docs.ts","../src/builtin/modules/linear-algebra/helpers/gaussJordanElimination.ts","../src/builtin/modules/linear-algebra/helpers/collinear.ts","../src/builtin/modules/linear-algebra/helpers/isZeroVector.ts","../src/builtin/modules/linear-algebra/helpers/pearsonCorr.ts","../src/builtin/modules/linear-algebra/helpers/calcFractionalRanks.ts","../src/builtin/modules/linear-algebra/helpers/covariance.ts","../src/builtin/modules/linear-algebra/helpers/getUnit.ts","../src/builtin/modules/linear-algebra/helpers/dot.ts","../src/builtin/modules/linear-algebra/helpers/subtract.ts","../src/builtin/modules/linear-algebra/helpers/scale.ts","../src/builtin/modules/linear-algebra/index.ts","../src/builtin/modules/linear-algebra/helpers/length.ts","../src/builtin/modules/linear-algebra/helpers/kendallTau.ts","../src/builtin/modules/linear-algebra/helpers/corrleation.ts","../src/builtin/modules/linear-algebra/helpers/solve.ts","../src/builtin/modules/matrix/docs.ts","../src/builtin/modules/matrix/helpers/determinant.ts","../src/builtin/modules/matrix/helpers/minor.ts","../src/builtin/modules/matrix/helpers/adjugate.ts","../src/builtin/modules/matrix/helpers/isSquare.ts","../src/builtin/modules/matrix/helpers/isIdentity.ts","../src/builtin/modules/matrix/helpers/matrixMultiply.ts","../src/builtin/modules/matrix/index.ts","../src/builtin/modules/matrix/helpers/inverse.ts","../src/builtin/modules/matrix/helpers/cofactor.ts","../src/builtin/modules/matrix/helpers/trace.ts","../src/builtin/modules/matrix/helpers/isSymetric.ts","../src/builtin/modules/matrix/helpers/isTriangular.ts","../src/builtin/modules/matrix/helpers/isDiagonal.ts","../src/builtin/modules/matrix/helpers/isOrthogonal.ts","../src/builtin/modules/matrix/helpers/band.ts","../src/builtin/modules/matrix/helpers/isBanded.ts","../src/builtin/modules/matrix/helpers/norm1.ts","../src/builtin/modules/number-theory/docs.ts","../src/builtin/modules/number-theory/binomialCefficient.ts","../src/builtin/modules/number-theory/combinations.ts","../src/builtin/modules/number-theory/derangements.ts","../src/builtin/modules/number-theory/divisors.ts","../src/builtin/modules/number-theory/sequences/factorial.ts","../src/builtin/modules/number-theory/factorial.ts","../src/builtin/modules/number-theory/sequences/partition.ts","../src/builtin/modules/number-theory/partitions.ts","../src/builtin/modules/number-theory/permutations.ts","../src/builtin/modules/number-theory/powerSet.ts","../src/builtin/modules/number-theory/primeFactors.ts","../src/builtin/modules/number-theory/sequences/abundant.ts","../src/builtin/modules/number-theory/sequences/arithmetic.ts","../src/builtin/modules/number-theory/sequences/bernoulli.ts","../src/builtin/modules/number-theory/sequences/prime.ts","../src/builtin/modules/number-theory/sequences/composite.ts","../src/builtin/modules/number-theory/sequences/deficient.ts","../src/builtin/modules/number-theory/sequences/geometric.ts","../src/builtin/modules/number-theory/sequences/golomb.ts","../src/builtin/modules/number-theory/sequences/happy.ts","../src/builtin/modules/number-theory/sequences/juggler.ts","../src/builtin/modules/number-theory/sequences/lookAndSay.ts","../src/builtin/modules/number-theory/sequences/lucky.ts","../src/builtin/modules/number-theory/sequences/padovan.ts","../src/builtin/modules/number-theory/sequences/perfectCube.ts","../src/builtin/modules/number-theory/sequences/perfectPower.ts","../src/builtin/modules/number-theory/sequences/perfectSquare.ts","../src/builtin/modules/number-theory/sequences/poligonal.ts","../src/builtin/modules/number-theory/sequences/recaman.ts","../src/builtin/modules/number-theory/sequences/thueMorse.ts","../src/builtin/modules/number-theory/sequences/tribonacci.ts","../src/builtin/modules/number-theory/sequences/index.ts","../src/builtin/modules/number-theory/index.ts","../src/builtin/modules/number-theory/sequences/collatz.ts","../src/builtin/modules/number-theory/sequences/catalan.ts","../src/builtin/modules/number-theory/sequences/fibonacci.ts","../src/builtin/modules/number-theory/sequences/lucas.ts","../src/builtin/modules/number-theory/sequences/mersenne.ts","../src/builtin/modules/number-theory/sequences/pell.ts","../src/builtin/modules/number-theory/sequences/perfect.ts","../src/builtin/modules/number-theory/sequences/sylvester.ts","../src/builtin/modules/number-theory/sequences/bell.ts","../src/builtin/modules/string/index.ts","../src/builtin/modules/collection/index.ts","../src/builtin/modules/sequence/index.ts","../src/builtin/modules/math/index.ts","../src/builtin/modules/functional/index.ts","../src/builtin/modules/bitwise/index.ts","../reference/datatype.ts","../reference/shorthand.ts","../reference/index.ts","../src/initReferenceData.ts","../src/getUndefinedSymbols/index.ts","../src/tokenizer/reservedNames.ts","../src/evaluator/functionExecutors.ts","../src/evaluator/index.ts","../src/evaluator/ContextStack.ts","../src/evaluator/interface.ts","../src/tokenizer/tokenizers.ts","../src/tokenizer/tokenize.ts","../src/tokenizer/token.ts","../src/tokenizer/minifyTokenStream.ts","../src/parser/Parser.ts","../src/AutoCompleter/AutoCompleter.ts","../src/Lits/Cache.ts","../src/allModules.ts","../reference/api.ts","../src/Lits/Lits.ts","../src/transformer/index.ts","../src/untokenizer/index.ts"],"sourcesContent":["import type { SourceCodeInfo } from '../../tokenizer/token'\n\nexport function getCodeMarker(sourceCodeInfo: SourceCodeInfo): string {\n if (!sourceCodeInfo.position || !sourceCodeInfo.code)\n return ''\n\n const leftPadding = sourceCodeInfo.position.column - 1\n const rightPadding = sourceCodeInfo.code.length - leftPadding - 1\n return `${' '.repeat(Math.max(leftPadding, 0))}^${' '.repeat(Math.max(rightPadding, 0))}`\n}\n","import { getCodeMarker } from '../src/utils/debug/getCodeMarker'\nimport type { Arr } from './interface'\nimport type { SourceCodeInfo } from './tokenizer/token'\n\nfunction getLitsErrorMessage(message: string, sourceCodeInfo?: SourceCodeInfo) {\n if (!sourceCodeInfo) {\n return message\n }\n const location = `${sourceCodeInfo.position.line}:${sourceCodeInfo.position.column}`\n const filePathLine = sourceCodeInfo.filePath\n ? `\\n${sourceCodeInfo.filePath}:${location}`\n : `\\nLocation ${location}`\n const codeLine = `\\n${sourceCodeInfo.code}`\n const codeMarker = `\\n${getCodeMarker(sourceCodeInfo)}`\n return `${message}${filePathLine}${codeLine}${codeMarker}`\n}\n\nexport class RecurSignal extends Error {\n public params: Arr\n constructor(params: Arr) {\n super(`recur, params: ${params}`)\n Object.setPrototypeOf(this, RecurSignal.prototype)\n this.name = 'RecurSignal'\n this.params = params\n }\n}\n\nexport class LitsError extends Error {\n public readonly sourceCodeInfo?: SourceCodeInfo\n public readonly shortMessage: string\n constructor(err: unknown, sourceCodeInfo: SourceCodeInfo | undefined) {\n const message = err instanceof Error\n ? err.message\n : `${err}`\n\n super(getLitsErrorMessage(message, sourceCodeInfo))\n this.shortMessage = message\n this.sourceCodeInfo = sourceCodeInfo\n Object.setPrototypeOf(this, LitsError.prototype)\n this.name = 'LitsError'\n }\n\n public getCodeMarker(): string | undefined {\n return this.sourceCodeInfo && getCodeMarker(this.sourceCodeInfo)\n }\n}\n\nexport class UserDefinedError extends LitsError {\n public userMessage: string\n constructor(message: string, sourceCodeInfo?: SourceCodeInfo) {\n super(message, sourceCodeInfo)\n this.userMessage = message\n Object.setPrototypeOf(this, UserDefinedError.prototype)\n this.name = 'UserDefinedError'\n }\n}\n\nexport class AssertionError extends LitsError {\n constructor(message: string | Error, sourceCodeInfo?: SourceCodeInfo) {\n super(message, sourceCodeInfo)\n Object.setPrototypeOf(this, AssertionError.prototype)\n this.name = 'AssertionError'\n }\n}\n\nexport class UndefinedSymbolError extends LitsError {\n public symbol: string\n constructor(symbolName: string, sourceCodeInfo?: SourceCodeInfo) {\n const message = `Undefined symbol '${symbolName}'.`\n super(message, sourceCodeInfo)\n this.symbol = symbolName\n Object.setPrototypeOf(this, UndefinedSymbolError.prototype)\n this.name = 'UndefinedSymbolError'\n }\n}\n\nexport function isLitsError(error: unknown): error is LitsError {\n return error instanceof LitsError\n}\n","export const NodeTypes = {\n Number: 1,\n String: 2,\n NormalExpression: 3,\n SpecialExpression: 4,\n UserDefinedSymbol: 5,\n NormalBuiltinSymbol: 6,\n SpecialBuiltinSymbol: 7,\n ReservedSymbol: 8,\n Binding: 9,\n Spread: 10,\n} as const\n\nconst NodeTypesSet = new Set(Object.values(NodeTypes))\n\nexport type NodeType = typeof NodeTypes[keyof typeof NodeTypes]\n\nexport function getNodeTypeName(type: NodeType): keyof typeof NodeTypes {\n return Object.keys(NodeTypes).find(key => NodeTypes[key as keyof typeof NodeTypes] === type) as keyof typeof NodeTypes\n}\n\n// TODO, is this needed?\nexport function isNodeType(type: unknown): type is NodeType {\n return typeof type === 'number' && NodeTypesSet.has(type as NodeType)\n}\n\nconst functionTypes = [\n 'UserDefined',\n 'Partial',\n 'Comp',\n 'Constantly',\n 'Juxt',\n 'Complement',\n 'EveryPred',\n 'SomePred',\n 'Fnull',\n 'Builtin',\n 'SpecialBuiltin',\n 'NativeJsFunction',\n 'Module',\n] as const\n\nconst functionTypeSet = new Set(functionTypes)\n\nexport type FunctionType = typeof functionTypes[number]\n\nexport function isFunctionType(type: unknown): type is FunctionType {\n return typeof type === 'string' && functionTypeSet.has(type as FunctionType)\n}\n","export const FUNCTION_SYMBOL = '^^fn^^'\nexport const REGEXP_SYMBOL = '^^re^^'\n","import { getNodeTypeName, isFunctionType, isNodeType } from '../../constants/constants'\nimport type { LitsFunction, Node } from '../../parser/types'\nimport { FUNCTION_SYMBOL } from '../symbols'\n\nfunction isLitsFunction(func: unknown): func is LitsFunction {\n if (func === null || typeof func !== 'object')\n return false\n\n return FUNCTION_SYMBOL in func && 'functionType' in func && isFunctionType(func.functionType)\n}\n\nfunction isNode(value: unknown): value is Node {\n if (!Array.isArray(value) || value.length < 2)\n return false\n return isNodeType(value[0])\n}\n\nexport function valueToString(value: unknown): string {\n if (isLitsFunction(value))\n // eslint-disable-next-line ts/no-unsafe-member-access\n return `<function ${(value as any).name || '\\u03BB'}>`\n\n if (isNode(value))\n return `${getNodeTypeName(value[0])}-node`\n\n if (value === null)\n return 'null'\n\n if (typeof value === 'object' && value instanceof RegExp)\n return `${value}`\n\n if (typeof value === 'object' && value instanceof Error)\n return value.toString()\n\n return JSON.stringify(value)\n}\n","import type { SourceCodeInfo } from '../../tokenizer/token'\n\nexport function getSourceCodeInfo(anyValue: any, sourceCodeInfo: SourceCodeInfo | undefined): SourceCodeInfo | undefined {\n // eslint-disable-next-line ts/no-unsafe-return, ts/no-unsafe-member-access\n return anyValue?.sourceCodeInfo ?? sourceCodeInfo\n}\n","import { LitsError } from '../errors'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { valueToString } from '../utils/debug/debugTools'\nimport { getSourceCodeInfo } from '../utils/debug/getSourceCodeInfo'\n\ntype SignOptions =\n | {\n positive?: true\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: true\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: true\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: true\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: true\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: true\n }\n\ntype GtOptions =\n | {\n gt?: number\n gte?: never\n }\n | {\n gt?: never\n gte?: number\n }\n\ntype LtOptions =\n | {\n lt?: number\n lte?: never\n }\n | {\n lt?: never\n lte?: number\n }\n\ntype NumberOptions = {\n integer?: true\n finite?: true\n} & SignOptions &\nGtOptions &\nLtOptions\n\nfunction getRangeString(options: NumberOptions): string {\n const hasUpperAndLowerBound\n = (typeof options.gt === 'number' || typeof options.gte === 'number')\n && (typeof options.lt === 'number' || typeof options.lte === 'number')\n if (hasUpperAndLowerBound) {\n return `${typeof options.gt === 'number' ? `${options.gt} < n ` : `${options.gte} <= n `}${\n typeof options.lt === 'number' ? `< ${options.lt}` : `<= ${options.lte}`\n }`\n }\n else if (typeof options.gt === 'number' || typeof options.gte === 'number') {\n return `${typeof options.gt === 'number' ? `n > ${options.gt}` : `n >= ${options.gte}`}`\n }\n else if (typeof options.lt === 'number' || typeof options.lte === 'number') {\n return `${typeof options.lt === 'number' ? `n < ${options.lt}` : `n <= ${options.lte}`}`\n }\n else { return '' }\n}\n\nfunction getSignString(options: NumberOptions): string {\n return options.positive\n ? 'positive'\n : options.negative\n ? 'negative'\n : options.nonNegative\n ? 'non negative'\n : options.nonPositive\n ? 'non positive'\n : options.nonZero\n ? 'non zero'\n : ''\n}\n\nfunction getNumberTypeName(options: NumberOptions): string {\n if (options.zero)\n return 'zero'\n\n const sign = getSignString(options)\n const numberType = options.integer ? 'integer' : 'number'\n const finite = options.finite ? 'finite' : ''\n const range = getRangeString(options)\n\n return [sign, finite, numberType, range].filter(x => !!x).join(' ')\n}\n\nexport function isNumber(value: unknown, options: NumberOptions = {}): value is number {\n if (typeof value !== 'number')\n return false\n\n if (Number.isNaN(value))\n return false\n\n if (options.integer && !Number.isInteger(value))\n return false\n\n if (options.finite && !Number.isFinite(value))\n return false\n\n if (options.zero && value !== 0)\n return false\n\n if (options.nonZero && value === 0)\n return false\n\n if (options.positive && value <= 0)\n return false\n\n if (options.negative && value >= 0)\n return false\n\n if (options.nonPositive && value > 0)\n return false\n\n if (options.nonNegative && value < 0)\n return false\n\n if (typeof options.gt === 'number' && value <= options.gt)\n return false\n\n if (typeof options.gte === 'number' && value < options.gte)\n return false\n\n if (typeof options.lt === 'number' && value >= options.lt)\n return false\n\n if (typeof options.lte === 'number' && value > options.lte)\n return false\n\n return true\n}\n\nexport function assertNumber(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n options: NumberOptions = {},\n): asserts value is number {\n if (!isNumber(value, options)) {\n throw new LitsError(\n `Expected ${getNumberTypeName(options)}, got ${valueToString(value)}.`,\n getSourceCodeInfo(value, sourceCodeInfo),\n )\n }\n}\n\nexport function asNumber(\n value: unknown,\n sourceCodeInfo: SourceCodeInfo | undefined,\n options: NumberOptions = {},\n): number {\n assertNumber(value, sourceCodeInfo, options)\n return value\n}\n","import { LitsError } from '../errors'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { valueToString } from './debug/debugTools'\nimport { getSourceCodeInfo } from './debug/getSourceCodeInfo'\n\nexport function getAssertionError(typeName: string, value: unknown, sourceCodeInfo?: SourceCodeInfo): LitsError {\n return new LitsError(`Expected ${typeName}, got ${valueToString(value)}.`, getSourceCodeInfo(value, sourceCodeInfo))\n}\n","import { LitsError } from '../errors'\nimport type { UnknownRecord } from '../interface'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { valueToString } from '../utils/debug/debugTools'\nimport { getSourceCodeInfo } from '../utils/debug/getSourceCodeInfo'\n\nexport function isNonUndefined<T>(value: T | undefined): value is T {\n return value !== undefined\n}\n\nexport function asNonUndefined<T>(value: T | undefined, sourceCodeInfo?: SourceCodeInfo): T {\n assertNonUndefined(value, sourceCodeInfo)\n return value\n}\n\nexport function assertNonUndefined<T>(value: T | undefined, sourceCodeInfo?: SourceCodeInfo): asserts value is T {\n if (!isNonUndefined(value))\n throw new LitsError('Unexpected undefined', getSourceCodeInfo(value, sourceCodeInfo))\n}\n\nexport function isUnknownRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === 'object' && !Array.isArray(value)\n}\n\nexport function assertUnknownRecord(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is UnknownRecord {\n if (!isUnknownRecord(value)) {\n throw new LitsError(\n `Expected ${'UnknownRecord'}, got ${valueToString(value)}.`,\n getSourceCodeInfo(value, sourceCodeInfo),\n )\n }\n}\n\nexport function asUnknownRecord(value: unknown, sourceCodeInfo?: SourceCodeInfo): UnknownRecord {\n assertUnknownRecord(value, sourceCodeInfo)\n return value\n}\n","import type { LitsFunction, NativeJsFunction, NormalBuiltinFunction, UserDefinedFunction } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\nimport { FUNCTION_SYMBOL } from '../utils/symbols'\nimport { isUnknownRecord } from '.'\n\nexport function isLitsFunction(value: unknown): value is LitsFunction {\n if (value === null || typeof value !== 'object')\n return false\n\n return !!(value as LitsFunction)[FUNCTION_SYMBOL]\n}\nexport function asLitsFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): LitsFunction {\n assertLitsFunction(value, sourceCodeInfo)\n return value\n}\nexport function assertLitsFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is LitsFunction {\n if (!isLitsFunction(value))\n throw getAssertionError('LitsFunction', value, sourceCodeInfo)\n}\n\nexport function isUserDefinedFunction(value: unknown): value is UserDefinedFunction {\n return isLitsFunction(value) && value.functionType === 'UserDefined'\n}\nexport function asUserDefinedFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): UserDefinedFunction {\n assertUserDefinedFunction(value, sourceCodeInfo)\n return value\n}\nexport function assertUserDefinedFunction(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is UserDefinedFunction {\n if (!isUserDefinedFunction(value))\n throw getAssertionError('NativeJsFunction', value, sourceCodeInfo)\n}\n\nexport function isNativeJsFunction(value: unknown): value is NativeJsFunction {\n return isLitsFunction(value) && value.functionType === 'NativeJsFunction'\n}\nexport function asNativeJsFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): NativeJsFunction {\n assertNativeJsFunction(value, sourceCodeInfo)\n return value\n}\nexport function assertNativeJsFunction(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is NativeJsFunction {\n if (!isNativeJsFunction(value))\n throw getAssertionError('NativeJsFunction', value, sourceCodeInfo)\n}\n\nexport function isBuiltinFunction(value: unknown): value is NormalBuiltinFunction {\n return isUnknownRecord(value) && value.functionType === 'Builtin'\n}\n","import type { Any, Coll, Obj, Seq } from '../interface'\nimport type { FunctionLike, RegularExpression } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\nimport { REGEXP_SYMBOL } from '../utils/symbols'\nimport { isLitsFunction } from './litsFunction'\n\nexport function isAny(value: unknown): value is Any {\n // TODO weak test\n return value !== undefined\n}\nexport function asAny(value: unknown, sourceCodeInfo?: SourceCodeInfo): Any {\n assertAny(value, sourceCodeInfo)\n return value\n}\nexport function assertAny(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Any {\n if (!isAny(value))\n throw getAssertionError('not undefined', value, sourceCodeInfo)\n}\n\nexport function isSeq(value: unknown): value is Seq {\n return Array.isArray(value) || typeof value === 'string'\n}\nexport function asSeq(value: unknown, sourceCodeInfo?: SourceCodeInfo): Seq {\n assertSeq(value, sourceCodeInfo)\n return value\n}\nexport function assertSeq(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Seq {\n if (!isSeq(value))\n throw getAssertionError('string or array', value, sourceCodeInfo)\n}\n\nexport function isObj(value: unknown): value is Obj {\n return !(\n value === null\n || typeof value !== 'object'\n || Array.isArray(value)\n || value instanceof RegExp\n || isLitsFunction(value)\n || isRegularExpression(value)\n )\n}\nexport function asObj(value: unknown, sourceCodeInfo?: SourceCodeInfo): Obj {\n assertObj(value, sourceCodeInfo)\n return value\n}\nexport function assertObj(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Obj {\n if (!isObj(value))\n throw getAssertionError('object', value, sourceCodeInfo)\n}\n\nexport function isColl(value: unknown): value is Coll {\n return isSeq(value) || isObj(value)\n}\nexport function asColl(value: unknown, sourceCodeInfo?: SourceCodeInfo): Coll {\n assertColl(value, sourceCodeInfo)\n return value\n}\nexport function assertColl(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Coll {\n if (!isColl(value))\n throw getAssertionError('string, array or object', value, sourceCodeInfo)\n}\n\nexport function isRegularExpression(regexp: unknown): regexp is RegularExpression {\n if (regexp === null || typeof regexp !== 'object')\n return false\n\n return !!(regexp as RegularExpression)[REGEXP_SYMBOL]\n}\nexport function asRegularExpression(value: unknown, sourceCodeInfo?: SourceCodeInfo): RegularExpression {\n assertRegularExpression(value, sourceCodeInfo)\n return value\n}\nexport function assertRegularExpression(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is RegularExpression {\n if (!isRegularExpression(value))\n throw getAssertionError('RegularExpression', value, sourceCodeInfo)\n}\n\nexport function isStringOrRegularExpression(value: unknown): value is string | RegularExpression {\n return isRegularExpression(value) || typeof value === 'string'\n}\nexport function asStringOrRegularExpression(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): string | RegularExpression {\n assertStringOrRegularExpression(value, sourceCodeInfo)\n return value\n}\nexport function assertStringOrRegularExpression(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is string | RegularExpression {\n if (!isStringOrRegularExpression(value))\n throw getAssertionError('string or RegularExpression', value, sourceCodeInfo)\n}\n\nexport function isFunctionLike(value: unknown): value is FunctionLike {\n if (typeof value === 'number')\n return true\n if (isColl(value))\n return true\n if (isLitsFunction(value))\n return true\n\n return false\n}\nexport function asFunctionLike(value: unknown, sourceCodeInfo?: SourceCodeInfo): FunctionLike {\n assertFunctionLike(value, sourceCodeInfo)\n return value\n}\nexport function assertFunctionLike(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is FunctionLike {\n if (!isFunctionLike(value))\n throw getAssertionError('FunctionLike', value, sourceCodeInfo)\n}\n","import type { Arity } from '../builtin/interface'\nimport { LitsError } from '../errors'\nimport type { FunctionLike } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { isColl } from '../typeGuards/lits'\nimport { valueToString } from './debug/debugTools'\n\nexport function arityAccepts(arity: Arity, nbrOfParams: number): boolean {\n const { min, max } = arity\n if (typeof min === 'number' && nbrOfParams < min) {\n return false\n }\n if (typeof max === 'number' && nbrOfParams > max) {\n return false\n }\n return true\n}\n\nexport function arityAcceptsMin(arity: Arity, nbrOfParams: number): boolean {\n const { min } = arity\n if (typeof min === 'number' && nbrOfParams < min) {\n return false\n }\n return true\n}\n\nexport function getCommonArityFromFunctions(params: FunctionLike[]): Arity | null {\n return params.reduce((acc: Arity | null, param): Arity | null => {\n if (acc === null) {\n return null\n }\n const arity: Arity = (typeof param === 'number' || isColl(param)) ? toFixedArity(1) : param.arity\n const { min: aMin, max: aMax } = arity\n const { min: bMin, max: bMax } = acc\n const min = typeof aMin === 'number' && typeof bMin === 'number'\n ? Math.max(aMin, bMin)\n : typeof aMin === 'number' ? aMin : typeof bMin === 'number' ? bMin : undefined\n const max = typeof aMax === 'number' && typeof bMax === 'number'\n ? Math.min(aMax, bMax)\n : typeof aMax === 'number' ? aMax : typeof bMax === 'number' ? bMax : undefined\n\n if (typeof min === 'number' && typeof max === 'number' && min > max) {\n return null\n }\n\n return { min, max }\n }, {})\n}\n\nexport function getArityFromFunction(param: FunctionLike): Arity {\n return (typeof param === 'number' || isColl(param)) ? toFixedArity(1) : param.arity\n}\n\nexport function assertNumberOfParams(arity: Arity, length: number, sourceCodeInfo: SourceCodeInfo | undefined): void {\n const { min, max } = arity\n if (typeof min === 'number' && length < min) {\n throw new LitsError(\n `Wrong number of arguments, expected at least ${min}, got ${valueToString(length)}.`,\n sourceCodeInfo,\n )\n }\n\n if (typeof max === 'number' && length > max) {\n throw new LitsError(\n `Wrong number of arguments, expected at most ${max}, got ${valueToString(length)}.`,\n sourceCodeInfo,\n )\n }\n}\n\nexport function canBeOperator(count: Arity): boolean {\n if (typeof count.max === 'number' && count.max < 2) {\n return false\n }\n\n if (typeof count.min === 'number' && count.min > 2) {\n return false\n }\n\n return true\n}\n\nexport function toFixedArity(arity: number): Arity {\n return { min: arity, max: arity }\n}\n","import { assertNumber } from '../../typeGuards/number'\nimport { toFixedArity } from '../../utils/arity'\nimport type { Argument, BuiltinNormalExpressions } from '../interface'\n\nfunction getOperatorArgs(a: 'integer', b: 'integer'): Record<string, Argument> {\n return { a: { type: a }, b: { type: b } }\n}\n\nexport const bitwiseNormalExpression: BuiltinNormalExpressions = {\n '<<': {\n evaluate: ([num, count], sourceCodeInfo): number => {\n assertNumber(num, sourceCodeInfo, { integer: true })\n assertNumber(count, sourceCodeInfo, { integer: true, nonNegative: true })\n\n return num << count\n },\n arity: toFixedArity(2),\n docs: {\n category: 'bitwise',\n returns: { type: 'integer' },\n args: { ...getOperatorArgs('integer', 'integer') },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Shifts $a arithmetically left by $b bit positions.',\n seeAlso: ['>>', '>>>'],\n examples: [\n '1 << 10',\n '<<(1, 10)',\n '<<(-4, 2)',\n ],\n },\n },\n '>>': {\n evaluate: ([num, count], sourceCodeInfo): number => {\n assertNumber(num, sourceCodeInfo, { integer: true })\n assertNumber(count, sourceCodeInfo, { integer: true, nonNegative: true })\n\n return num >> count\n },\n arity: toFixedArity(2),\n docs: {\n category: 'bitwise',\n returns: { type: 'integer' },\n args: { ...getOperatorArgs('integer', 'integer') },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Shifts $a arithmetically right by $b bit positions.',\n seeAlso: ['<<', '>>>'],\n examples: [\n '2048 >> 10',\n '>>(2048, 10)',\n '>>>(-16, 2)',\n '>>(4, 10)',\n ],\n },\n },\n '>>>': {\n evaluate: ([num, count], sourceCodeInfo): number => {\n assertNumber(num, sourceCodeInfo, { integer: true })\n assertNumber(count, sourceCodeInfo, { integer: true, nonNegative: true })\n\n return num >>> count\n },\n arity: toFixedArity(2),\n docs: {\n category: 'bitwise',\n returns: { type: 'integer' },\n args: { ...getOperatorArgs('integer', 'integer') },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Shifts $a arithmetically right by $b bit positions without sign extension.',\n seeAlso: ['<<', '>>'],\n examples: [\n '-16 >>> 2',\n '>>>(2048, 10)',\n '>>>(-16, 2)',\n '>>>(4, 10)',\n '>>>(-1, 10)',\n ],\n },\n },\n '&': {\n evaluate: ([first, ...rest], sourceCodeInfo): number => {\n assertNumber(first, sourceCodeInfo, { integer: true })\n\n return rest.reduce((result: number, value) => {\n assertNumber(value, sourceCodeInfo, { integer: true })\n return result & value\n }, first)\n },\n arity: { min: 2 },\n docs: {\n category: 'bitwise',\n returns: { type: 'integer' },\n args: {\n ...getOperatorArgs('integer', 'integer'),\n c: { type: 'integer', rest: true },\n },\n variants: [\n { argumentNames: ['a', 'b'] },\n { argumentNames: ['a', 'b', 'c'] },\n ],\n description: 'Returns bitwise `and` of all arguments.',\n seeAlso: ['|', 'xor', 'bitwise.bit-not', 'bitwise.bit-and-not'],\n examples: [\n '0b0011 & 0b0110',\n '&(0b0011, 0b0110)',\n '&(0b0011, 0b0110, 0b1001)',\n ],\n },\n },\n '|': {\n evaluate: ([first, ...rest], sourceCodeInfo): number => {\n assertNumber(first, sourceCodeInfo, { integer: true })\n\n return rest.reduce((result: number, value) => {\n assertNumber(value, sourceCodeInfo, { integer: true })\n return result | value\n }, first)\n },\n arity: { min: 2 },\n docs: {\n category: 'bitwise',\n returns: { type: 'integer' },\n args: {\n ...getOperatorArgs('integer', 'integer'),\n c: { type: 'integer', rest: true },\n },\n variants: [\n { argumentNames: ['a', 'b'] },\n { argumentNames: ['a', 'b', 'c'] },\n ],\n description: 'Returns bitwise `or` of all arguments.',\n seeAlso: ['&', 'xor', 'bitwise.bit-not', 'bitwise.bit-and-not'],\n examples: [\n '0b0011 | 0b0110',\n '|(0b0011, 0b0110)',\n '|(0b1000, 0b0100, 0b0010)',\n ],\n },\n },\n 'xor': {\n evaluate: ([first, ...rest], sourceCodeInfo): number => {\n assertNumber(first, sourceCodeInfo, { integer: true })\n\n return rest.reduce((result: number, value) => {\n assertNumber(value, sourceCodeInfo, { integer: true })\n return result ^ value\n }, first)\n },\n arity: { min: 2 },\n docs: {\n category: 'bitwise',\n returns: { type: 'integer' },\n args: {\n ...getOperatorArgs('integer', 'integer'),\n c: { type: 'integer', rest: true },\n },\n variants: [\n { argumentNames: ['a', 'b'] },\n { argumentNames: ['a', 'b', 'c'] },\n ],\n description: 'Returns bitwise `xor` of all arguments.',\n seeAlso: ['&', '|', 'bitwise.bit-not', 'bitwise.bit-and-not'],\n examples: [\n '0b0011 xor 0b0110',\n 'xor(0b0011, 0b0110)',\n 'xor(0b11110000, 0b00111100, 0b10101010)',\n ],\n },\n },\n}\n","import type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\n\ntype StringAssertionOptions =\n | {\n nonEmpty?: true\n char?: never\n }\n | {\n nonEmpty?: never\n char?: true\n }\n\nexport function isString(value: unknown, options: StringAssertionOptions = {}): value is string {\n if (typeof value !== 'string')\n return false\n\n if (options.nonEmpty && value.length === 0)\n return false\n\n if (options.char && value.length !== 1)\n return false\n\n return true\n}\n\nexport function assertString(\n value: unknown,\n sourceCodeInfo: SourceCodeInfo | undefined,\n options: StringAssertionOptions = {},\n): asserts value is string {\n if (!isString(value, options)) {\n throw getAssertionError(\n `${options.nonEmpty ? 'non empty string' : options.char ? 'character' : 'string'}`,\n value,\n sourceCodeInfo,\n )\n }\n}\n\nexport function asString(\n value: unknown,\n sourceCodeInfo: SourceCodeInfo | undefined,\n options: StringAssertionOptions = {},\n): string {\n assertString(value, sourceCodeInfo, options)\n return value\n}\n\nexport function isStringOrNumber(value: unknown): value is string | number {\n return typeof value === 'string' || typeof value === 'number'\n}\nexport function asStringOrNumber(value: unknown, sourceCodeInfo?: SourceCodeInfo): string | number {\n assertStringOrNumber(value, sourceCodeInfo)\n return value\n}\nexport function assertStringOrNumber(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is string | number {\n if (!isStringOrNumber(value))\n throw getAssertionError('string or number', value, sourceCodeInfo)\n}\n","import type { Any, Coll, Obj } from '../interface'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { asAny, isColl, isObj, isRegularExpression } from '../typeGuards/lits'\nimport { isNumber } from '../typeGuards/number'\nimport { asString, assertStringOrNumber } from '../typeGuards/string'\nimport { isUnknownRecord } from '../typeGuards'\nimport { LitsError } from '../errors'\n\nexport function collHasKey(coll: unknown, key: string | number): boolean {\n if (!isColl(coll))\n return false\n\n if (typeof coll === 'string' || Array.isArray(coll)) {\n if (!isNumber(key, { integer: true }))\n return false\n\n return key >= 0 && key < coll.length\n }\n return !!Object.getOwnPropertyDescriptor(coll, key)\n}\n\nexport function compare<T extends string | number>(a: T, b: T, sourceCodeInfo: SourceCodeInfo | undefined): number {\n assertStringOrNumber(a, sourceCodeInfo)\n assertStringOrNumber(b, sourceCodeInfo)\n\n if (typeof a === 'string' && typeof b === 'string') {\n return a < b ? -1 : a > b ? 1 : 0\n }\n if (typeof a === 'number' && typeof b === 'number') {\n return Math.sign((a) - (b))\n }\n throw new LitsError(`Cannot compare values of different types: ${typeof a} and ${typeof b}`, sourceCodeInfo)\n}\n\nexport function deepEqual(a: unknown, b: unknown, sourceCodeInfo?: SourceCodeInfo): boolean {\n if (a === b)\n return true\n\n if (typeof a === 'number' && typeof b === 'number')\n return approxEqual(a, b)\n\n if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length)\n return false\n\n for (let i = 0; i < a.length; i += 1) {\n if (!deepEqual(asAny(a[i], sourceCodeInfo), asAny(b[i], sourceCodeInfo), sourceCodeInfo))\n return false\n }\n return true\n }\n if (isRegularExpression(a) && isRegularExpression(b))\n return a.s === b.s && a.f === b.f\n\n if (isUnknownRecord(a) && isUnknownRecord(b)) {\n const aKeys = Object.keys(a)\n const bKeys = Object.keys(b)\n if (aKeys.length !== bKeys.length)\n return false\n\n for (let i = 0; i < aKeys.length; i += 1) {\n const key = asString(aKeys[i], sourceCodeInfo)\n if (!deepEqual(a[key], b[key], sourceCodeInfo))\n return false\n }\n return true\n }\n return false\n}\n\nexport function toNonNegativeInteger(num: number): number {\n return Math.max(0, Math.ceil(num))\n}\n\nexport function toAny(value: unknown): Any {\n return (value ?? null) as Any\n}\n\nfunction clone<T>(value: T): T {\n if (isObj(value)) {\n return Object.entries(value).reduce((result: Obj, entry) => {\n const [key, val] = entry\n result[key] = clone(val)\n return result\n }, {}) as T\n }\n if (Array.isArray(value))\n // eslint-disable-next-line ts/no-unsafe-return\n return value.map(item => clone(item)) as unknown as T\n\n return value\n}\n\nexport function cloneColl<T extends Coll>(value: T): T {\n return clone(value)\n}\n\nexport function joinSets<T>(...results: Set<T>[]): Set<T> {\n const result = new Set<T>()\n for (const symbols of results)\n symbols.forEach(symbol => result.add(symbol))\n\n return result\n}\n\nexport function addToSet<T>(target: Set<T>, source: Set<T>): void {\n source.forEach(symbol => target.add(symbol))\n}\n\nexport const EPSILON = 1e-10\n\nexport function approxEqual(a: number, b: number, epsilon: number = EPSILON): boolean {\n if (a === b) {\n return true\n }\n\n const diff = Math.abs(a - b)\n\n if (a === 0 || b === 0 || diff < epsilon) {\n // Use absolute error for values near zero\n return diff < epsilon\n }\n const absA = Math.abs(a)\n const absB = Math.abs(b)\n\n // Use relative error for larger values\n return diff / (absA + absB) < epsilon\n}\n\nexport function approxZero(value: number): boolean {\n return Math.abs(value) < EPSILON\n}\n\nexport function smartTrim(str: string, minIndent = 0): string {\n const lines = str.split('\\n')\n while (lines[0]?.match(/^\\s*$/)) {\n lines.shift() // Remove leading empty lines\n }\n while (lines[lines.length - 1]?.match(/^\\s*$/)) {\n lines.pop() // Remove trailing empty lines\n }\n const indent = lines.reduce((acc, line) => {\n if (line.match(/^\\s*$/))\n return acc // Skip empty lines\n const lineIndent = line.match(/^\\s*/)![0].length\n return Math.min(acc, lineIndent)\n }, Infinity)\n return lines.map(line => ' '.repeat(minIndent) + line.slice(indent)).join('\\n').trimEnd()\n}\n","import type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\n\n// isArray not needed, use Array.isArary\nexport function asArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): unknown[] {\n assertArray(value, sourceCodeInfo)\n return value\n}\nexport function assertArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is unknown[] {\n if (!Array.isArray(value))\n throw getAssertionError('array', value, sourceCodeInfo)\n}\n\nexport function isStringArray(value: unknown): value is string[] {\n return Array.isArray(value) && value.every(v => typeof v === 'string')\n}\nexport function asStringArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): string[] {\n assertStringArray(value, sourceCodeInfo)\n return value\n}\nexport function assertStringArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is string[] {\n if (!isStringArray(value))\n throw getAssertionError('array of strings', value, sourceCodeInfo)\n}\n\nexport function isCharArray(value: unknown): value is string[] {\n return Array.isArray(value) && value.every(v => typeof v === 'string' && v.length === 1)\n}\nexport function asCharArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): string[] {\n assertCharArray(value, sourceCodeInfo)\n return value\n}\nexport function assertCharArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is string[] {\n if (!isCharArray(value))\n throw getAssertionError('array of strings', value, sourceCodeInfo)\n}\n","import type { ContextStack } from '../../evaluator/ContextStack'\nimport type { ExecuteFunction } from '../../evaluator/interface'\nimport type { Any, Arr, Coll, Obj, Seq } from '../../interface'\nimport type { SourceCodeInfo } from '../../tokenizer/token'\nimport { collHasKey, deepEqual, toAny } from '../../utils'\nimport { asAny, asFunctionLike, assertAny, assertColl, assertFunctionLike, assertObj, assertSeq, isObj, isSeq } from '../../typeGuards/lits'\nimport type { BuiltinNormalExpressions } from '../interface'\nimport { assertArray } from '../../typeGuards/array'\nimport { assertNumber, isNumber } from '../../typeGuards/number'\nimport { assertString, assertStringOrNumber, isString, isStringOrNumber } from '../../typeGuards/string'\nimport type { FunctionLike } from '../../parser/types'\nimport { LitsError } from '../../errors'\nimport { toFixedArity } from '../../utils/arity'\n\nfunction mapObjects({\n colls,\n contextStack,\n executeFunction,\n fn,\n sourceCodeInfo,\n}: {\n colls: unknown[]\n fn: FunctionLike\n sourceCodeInfo: SourceCodeInfo | undefined\n contextStack: ContextStack\n executeFunction: ExecuteFunction\n}): Obj {\n assertObj(colls[0], sourceCodeInfo)\n const keys = Object.keys(colls[0])\n const params: Record<string, unknown[]> = {}\n colls.forEach((obj) => {\n assertObj(obj, sourceCodeInfo)\n const objKeys = Object.keys(obj)\n if (objKeys.length !== keys.length) {\n throw new LitsError(`All objects must have the same keys. Expected: ${keys.join(', ')}. Found: ${objKeys.join(', ')}`, sourceCodeInfo)\n }\n if (!objKeys.every(key => keys.includes(key))) {\n throw new LitsError(`All objects must have the same keys. Expected: ${keys.join(', ')}. Found: ${objKeys.join(', ')}`, sourceCodeInfo)\n }\n Object.entries(obj).forEach(([key, value]) => {\n if (!params[key])\n params[key] = []\n params[key].push(value)\n })\n })\n\n return keys.reduce((result: Obj, key) => {\n result[key] = executeFunction(fn, params[key]!, contextStack, sourceCodeInfo)\n return result\n }, {})\n}\n\nfunction get(coll: Coll, key: string | number): Any | undefined {\n if (isObj(coll)) {\n if (typeof key === 'string' && collHasKey(coll, key))\n return toAny(coll[key])\n }\n else {\n if (isNumber(key, { nonNegative: true, integer: true }) && key >= 0 && key < coll.length)\n return toAny(coll[key])\n }\n return undefined\n}\n\nfunction assoc(coll: Coll, key: string | number, value: Any, sourceCodeInfo?: SourceCodeInfo) {\n assertColl(coll, sourceCodeInfo)\n assertStringOrNumber(key, sourceCodeInfo)\n if (Array.isArray(coll) || typeof coll === 'string') {\n assertNumber(key, sourceCodeInfo, { integer: true })\n assertNumber(key, sourceCodeInfo, { gte: 0 })\n assertNumber(key, sourceCodeInfo, { lte: coll.length })\n if (typeof coll === 'string') {\n assertString(value, sourceCodeInfo, { char: true })\n return `${coll.slice(0, key)}${value}${coll.slice(key + 1)}`\n }\n const copy = [...coll]\n copy[key] = value\n return copy\n }\n assertString(key, sourceCodeInfo)\n const copy = { ...coll }\n copy[key] = value\n return copy\n}\n\nexport const collectionNormalExpression: BuiltinNormalExpressions = {\n 'filter': {\n evaluate: ([coll, fn]: Arr, sourceCodeInfo, contextStack, { executeFunction }): Coll => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n if (Array.isArray(coll)) {\n const result = coll.filter(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n return result\n }\n if (isString(coll)) {\n return coll\n .split('')\n .filter(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n .join('')\n }\n return Object.entries(coll)\n .filter(([, value]) => executeFunction(fn, [value], contextStack, sourceCodeInfo))\n .reduce((result: Obj, [key, value]) => {\n result[key] = value\n return result\n }, {})\n },\n arity: toFixedArity(2),\n docs: {\n category: 'collection',\n returns: { type: 'collection' },\n args: {\n a: { type: 'collection' },\n b: { type: 'function' },\n coll: { type: 'collection' },\n fun: { type: 'function' },\n },\n variants: [{ argumentNames: ['coll', 'fun'] }],\n description: 'Creates a new collection with all elements that pass the test implemented by $fun.',\n seeAlso: ['collection.filteri', 'map', 'sequence.remove'],\n examples: [\n `\nfilter(\n [\"Albert\", \"Mojir\", 160, [1, 2]],\n string?\n)`,\n `\nfilter(\n [5, 10, 15, 20],\n -> $ > 10\n)`,\n `\nfilter(\n { a: 1, b: 2 },\n odd?\n)`,\n ],\n },\n },\n 'map': {\n evaluate: (params, sourceCodeInfo, contextStack, { executeFunction }) => {\n const fn = asFunctionLike(params.at(-1), sourceCodeInfo)\n\n if (isObj(params[0])) {\n return mapObjects({\n colls: params.slice(0, -1),\n fn,\n sourceCodeInfo,\n contextStack,\n executeFunction,\n })\n }\n\n const seqs = params.slice(0, -1) as Seq[]\n assertSeq(seqs[0], sourceCodeInfo)\n\n const isStr = typeof seqs[0] === 'string'\n let len = seqs[0].length\n seqs.slice(1).forEach((seq) => {\n if (isStr) {\n assertString(seq, sourceCodeInfo)\n }\n else {\n assertArray(seq, sourceCodeInfo)\n }\n len = Math.min(len, seq.length)\n })\n\n const paramArray: unknown[][] = []\n for (let i = 0; i < len; i++) {\n paramArray.push(seqs.map(seq => seq[i]))\n }\n\n const mapped = paramArray.map(p => executeFunction(fn, p, contextStack, sourceCodeInfo))\n\n if (!isStr) {\n return mapped\n }\n mapped.forEach(char => assertString(char, sourceCodeInfo))\n return mapped.join('')\n },\n arity: { min: 2 },\n docs: {\n category: 'collection',\n returns: { type: 'collection' },\n args: {\n a: { type: 'collection' },\n b: { type: 'function' },\n colls: { type: 'collection', rest: true, description: 'At least one.' },\n fun: { type: 'function' },\n },\n variants: [{ argumentNames: ['colls', 'fun'] }],\n description: 'Creates a new collection populated with the results of calling $fun on every element in $colls.',\n seeAlso: ['collection.mapi', 'filter', 'reduce', 'mapcat', 'grid.map', 'grid.mapi'],\n examples: [\n '[1, 2, 3] map -',\n '[1, 2, 3] map -> -($)',\n 'map([\"Albert\", \"Mojir\", 42], str)',\n 'map([1, 2, 3], inc)',\n 'map([1, 2, 3], [1, 10, 100], *)',\n 'map({ a: 1, b: 2 }, inc)',\n 'map({ a: 1, b: 2 }, { a: 10, b: 20 }, +)',\n ],\n },\n },\n 'reduce': {\n evaluate: ([coll, fn, initial], sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n assertAny(initial, sourceCodeInfo)\n\n if (typeof coll === 'string') {\n assertString(initial, sourceCodeInfo)\n if (coll.length === 0)\n return initial\n\n return coll.split('').reduce((result: Any, elem) => {\n return executeFunction(fn, [result, elem], contextStack, sourceCodeInfo)\n }, initial)\n }\n else if (Array.isArray(coll)) {\n if (coll.length === 0)\n return initial\n\n return coll.reduce((result: Any, elem) => {\n return executeFunction(fn, [result, elem], contextStack, sourceCodeInfo)\n }, initial)\n }\n else {\n if (Object.keys(coll).length === 0)\n return initial\n\n return Object.entries(coll).reduce((result: Any, [, elem]) => {\n return executeFunction(fn, [result, elem], contextStack, sourceCodeInfo)\n }, initial)\n }\n },\n arity: toFixedArity(3),\n docs: {\n category: 'collection',\n returns: { type: 'any' },\n args: {\n fun: { type: 'function' },\n coll: { type: 'collection' },\n initial: { type: 'any' },\n },\n variants: [{ argumentNames: ['coll', 'fun', 'initial'] }],\n description: 'Runs $fun function on each element of the $coll, passing in the return value from the calculation on the preceding element. The final result of running the reducer across all elements of the $coll is a single value.',\n seeAlso: ['collection.reduce-right', 'collection.reducei', 'collection.reductions', 'map', 'grid.reduce', 'grid.reducei'],\n examples: [\n 'reduce([1, 2, 3], +, 0)',\n 'reduce([], +, 0)',\n 'reduce({ a: 1, b: 2 }, +, 0)',\n `\nreduce(\n [1, 2, 3, 4, 5, 6, 7, 8, 9],\n (result, value) -> result + (even?(value) ? value : 0),\n 0)`,\n ],\n },\n },\n 'get': {\n evaluate: (params, sourceCodeInfo) => {\n const [coll, key] = params\n const defaultValue = toAny(params[2])\n assertStringOrNumber(key, sourceCodeInfo)\n if (coll === null)\n return defaultValue\n\n assertColl(coll, sourceCodeInfo)\n const result = get(coll, key)\n return result === undefined ? defaultValue : result\n },\n arity: { min: 2, max: 3 },\n docs: {\n category: 'collection',\n returns: { type: 'any' },\n args: {\n 'a': { type: 'collection' },\n 'b': { type: ['string', 'integer'] },\n 'not-found': { type: 'any', description: 'Default value to return if $b is not found.' },\n },\n variants: [\n { argumentNames: ['a', 'b'] },\n { argumentNames: ['a', 'b', 'not-found'] },\n ],\n description: 'Returns value in $a mapped at $b.',\n seeAlso: ['collection.get-in', 'contains?', 'find', 'nth'],\n examples: [\n '[1, 2, 3] get 1',\n '{ a: 1 } get \"a\"',\n '\"Albert\" get \"3\"',\n `\nget(\n [1, 2, 3],\n 1, // Optional comma after last argument\n)`,\n `\nget(\n [],\n 1\n)`,\n `\nget(\n [],\n 1,\n \"default\"\n)`,\n `\nget(\n { a: 1 },\n \"a\"\n)`,\n `\nget(\n { a: 1 },\n \"b\"\n)`,\n `\nget(\n { a: 1 },\n \"b\",\n \"default\"\n)`,\n `\nget(\n null,\n \"a\"\n)`,\n `\nget(\n null,\n \"b\",\n \"default\"\n)`,\n ],\n },\n },\n 'count': {\n evaluate: ([coll], sourceCodeInfo): number => {\n if (coll === null)\n return 0\n\n if (typeof coll === 'string')\n return coll.length\n\n assertColl(coll, sourceCodeInfo)\n if (Array.isArray(coll))\n return coll.length\n\n return Object.keys(coll).length\n },\n arity: toFixedArity(1),\n docs: {\n category: 'collection',\n returns: { type: 'number' },\n args: {\n coll: { type: ['collection', 'null'] },\n },\n variants: [{ argumentNames: ['coll'] }],\n description: 'Returns number of elements in $coll.',\n seeAlso: ['empty?'],\n examples: [\n 'count([1, 2, 3])',\n 'count([])',\n 'count({ a: 1 })',\n 'count(\"\")',\n 'count(\"Albert\")',\n 'count(null)',\n ],\n },\n },\n 'contains?': {\n evaluate: ([coll, key], sourceCodeInfo): boolean => {\n if (coll === null)\n return false\n\n assertColl(coll, sourceCodeInfo)\n if (isString(coll)) {\n assertString(key, sourceCodeInfo)\n return coll.includes(key)\n }\n if (isSeq(coll)) {\n assertAny(key, sourceCodeInfo)\n return !!coll.find(elem => deepEqual(asAny(elem), key, sourceCodeInfo))\n }\n assertString(key, sourceCodeInfo)\n return key in coll\n },\n arity: toFixedArity(2),\n docs: {\n category: 'collection',\n returns: { type: 'boolean' },\n args: {\n a: { type: ['collection', 'null'] },\n b: { type: ['string', 'integer'] },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns `true` if $a contains $b, otherwise returns `false`. For strings, it checks if substring is included.',\n seeAlso: ['get', 'find', 'index-of'],\n examples: [\n '[1, 2, 3] contains? 1',\n 'null contains? 1',\n '{ a: 1, b: 2 } contains? \"a\"',\n `\ncontains?(\n [],\n 1\n)`,\n `\ncontains?(\n [1],\n 1\n)`,\n `\ncontains?(\n [1, 2, 3],\n 1\n)`,\n `\ncontains?(\n {},\n \"a\"\n)`,\n `\ncontains?(\n { a: 1, b: 2 },\n \"a\"\n)`,\n ],\n },\n },\n 'assoc': {\n evaluate: ([coll, key, value], sourceCodeInfo): Coll => {\n assertColl(coll, sourceCodeInfo)\n assertStringOrNumber(key, sourceCodeInfo)\n assertAny(value, sourceCodeInfo)\n return assoc(coll, key, value, sourceCodeInfo)\n },\n arity: toFixedArity(3),\n docs: {\n category: 'collection',\n returns: { type: 'collection' },\n args: {\n coll: { type: 'collection' },\n key: { type: ['string', 'number'] },\n value: { type: 'any' },\n kvs: { type: 'any', description: 'Key-value pairs to associate.', rest: true },\n },\n variants: [\n { argumentNames: ['coll', 'key', 'value'] },\n { argumentNames: ['coll', 'key', 'value', 'kvs'] },\n ],\n description: `\nAdd or replace the value of element $key to $value in $coll. Repeated for all key-value pairs in $kvs.\nIf $coll is an 'array', $key must be \\`number\\` satisfying \\`0 <=\\` $key \\`<= length\\`.`,\n seeAlso: ['collection.assoc-in', 'dissoc', 'merge', 'collection.update'],\n examples: [\n `\nassoc(\n [1, 2, 3],\n 1,\n \"Two\"\n)`,\n `\nassoc(\n [1, 2, 3],\n 3,\n \"Four\"\n)`,\n `\nassoc(\n { a: 1, b: 2 },\n \"a\",\n \"One\")`,\n `\nassoc(\n { a: 1, b: 2 },\n \"c\",\n \"Three\")`,\n `\nassoc(\n \"Albert\",\n 6,\n \"a\")`,\n ],\n },\n },\n '++': {\n evaluate: (params, sourceCodeInfo): Any => {\n if (!isNumber(params[0])) {\n assertColl(params[0], sourceCodeInfo)\n }\n if (Array.isArray(params[0])) {\n return params.reduce((result: Arr, arr) => {\n assertArray(arr, sourceCodeInfo)\n return result.concat(arr)\n }, [])\n }\n else if (isStringOrNumber(params[0])) {\n return params.reduce((result: string, s) => {\n assertStringOrNumber(s, sourceCodeInfo)\n return `${result}${s}`\n }, '')\n }\n else {\n return params.reduce((result: Obj, obj) => {\n assertObj(obj, sourceCodeInfo)\n return Object.assign(result, obj)\n }, {})\n }\n },\n arity: { min: 1 },\n docs: {\n category: 'collection',\n returns: { type: 'collection' },\n args: {\n a: { type: 'collection' },\n b: { type: 'collection' },\n colls: { type: 'collection', rest: true },\n },\n variants: [\n { argumentNames: ['a'] },\n { argumentNames: ['a', 'colls'] },\n ],\n description: 'Concatenates collections into one collection.',\n seeAlso: ['mapcat', 'str', 'join', 'push', 'sequence.unshift'],\n examples: [\n '\"Albert\" ++ \" \" ++ \"Mojir\"',\n '\"Albert\" ++ \"Mojir\"',\n\n '++(\"Albert\", \"-\", \"Mojir\")',\n '++(\"Albert\")',\n\n '++(\"A\", \"l\", \"b\", \"e\", \"r\", \"t\")',\n '++([1, 2], [3, 4])',\n '++([], [3, 4])',\n '++([1, 2], [])',\n '++([1, 2], [3, 4], [5, 6])',\n '++([])',\n '++({ a: 1, b: 2 }, { b: 1, c: 2 })',\n '++({}, { a: 1 })',\n ],\n },\n },\n}\n","import type { Arr } from '../../interface'\nimport { assertArray } from '../../typeGuards/array'\nimport { asNumber, assertNumber } from '../../typeGuards/number'\nimport type { BuiltinNormalExpressions } from '../interface'\nimport { assertFunctionLike } from '../../typeGuards/lits'\nimport { toFixedArity } from '../../utils/arity'\n\nexport const arrayNormalExpression: BuiltinNormalExpressions = {\n 'range': {\n evaluate: (params, sourceCodeInfo): Arr => {\n const [first, second, third] = params\n let from: number\n let to: number\n let step: number\n assertNumber(first, sourceCodeInfo, { finite: true })\n\n if (params.length === 1) {\n from = 0\n to = first\n step = to >= 0 ? 1 : -1\n }\n else if (params.length === 2) {\n assertNumber(second, sourceCodeInfo, { finite: true })\n from = first\n to = second\n step = to >= from ? 1 : -1\n }\n else {\n assertNumber(second, sourceCodeInfo, { finite: true })\n assertNumber(third, sourceCodeInfo, { finite: true })\n from = first\n to = second\n step = third\n if (to > from)\n assertNumber(step, sourceCodeInfo, { positive: true })\n else if (to < from)\n assertNumber(step, sourceCodeInfo, { negative: true })\n else\n assertNumber(step, sourceCodeInfo, { nonZero: true })\n }\n\n const result: number[] = []\n\n for (let i = from; step < 0 ? i > to : i < to; i += step)\n result.push(i)\n\n return result\n },\n arity: { min: 1, max: 3 },\n docs: {\n category: 'array',\n returns: { type: 'number', array: true },\n args: {\n a: { type: 'number' },\n b: { type: 'number' },\n step: { type: 'number' },\n },\n variants: [\n { argumentNames: ['b'] },\n { argumentNames: ['a', 'b'] },\n { argumentNames: ['a', 'b', 'step'] },\n ],\n description: `$range creates an array with a range of numbers from $a to $b (exclusive), by $step.\n\n$a defaults to 0.\n$step defaults to 1.`,\n seeAlso: ['repeat', 'vector.linspace'],\n examples: [\n 'range(4)',\n 'range(1, 4)',\n '1 range 10',\n 'range(0.4, 4.9)',\n `\nrange(\n 0.25, // start value\n 1, // end value (exclusive)\n 0.25, // step value\n)`,\n ],\n },\n },\n\n 'repeat': {\n evaluate: ([value, count], sourceCodeInfo): Arr => {\n assertNumber(count, sourceCodeInfo, { integer: true, nonNegative: true })\n const result: Arr = []\n for (let i = 0; i < count; i += 1)\n result.push(value)\n\n return result\n },\n arity: toFixedArity(2),\n docs: {\n category: 'array',\n returns: { type: 'any', array: true },\n args: {\n a: { type: 'any' },\n b: { type: 'integer' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns an array with $a repeated $b times.',\n seeAlso: ['range', 'vector.ones', 'vector.zeros', 'vector.fill', 'vector.generate', 'string.string-repeat'],\n examples: [\n 'repeat(10, 3)',\n 'repeat(10, 0)',\n '\"Albert\" repeat 5',\n ],\n },\n },\n\n 'flatten': {\n evaluate: ([seq, depth], sourceCodeInfo): Arr => {\n assertArray(seq, sourceCodeInfo)\n\n const actualDepth = depth === undefined || depth === Number.POSITIVE_INFINITY\n ? Number.POSITIVE_INFINITY\n : asNumber(depth, sourceCodeInfo, { integer: true, nonNegative: true })\n\n return seq.flat(actualDepth)\n },\n arity: { min: 1, max: 2 },\n docs: {\n category: 'array',\n returns: { type: 'any', array: true },\n args: {\n x: { type: ['array', 'any'], description: 'If $x is not an array, `[ ]` is returned.' },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'Takes a nested array $x and flattens it.',\n seeAlso: ['mapcat'],\n examples: [\n 'flatten([1, 2, [3, 4], 5])',\n `\nlet foo = \"bar\";\nflatten([\n 1,\n \" 2 A \",\n [foo, [4, [\"ABC\"]]],\n 6,\n])`,\n ],\n hideOperatorForm: true,\n },\n },\n 'mapcat': {\n evaluate: ([arr, fn], sourceCodeInfo, contextStack, { executeFunction }): Arr | string => {\n assertArray(arr, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n return arr.map(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo)).flat(1)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'array',\n returns: { type: 'collection' },\n args: {\n a: { type: 'collection' },\n b: { type: 'function' },\n colls: { type: 'collection', array: true },\n fun: { type: 'function' },\n },\n variants: [{ argumentNames: ['colls', 'fun'] }],\n description: 'Returns the result of applying concat to the result of applying map to $fun and $colls.',\n seeAlso: ['flatten', 'map', '++'],\n examples: [\n '[[3, 2, 1, 0], [6, 5, 4], [9, 8, 7]] mapcat reverse',\n 'mapcat([[3, 2, 1, 0], [6, 5, 4], [9, 8, 7]], reverse)',\n '[[3, 2, 1, 0,], [6, 5, 4,], [9, 8, 7]] mapcat reverse',\n `\nlet foo = (n) -> do\n [n - 1, n, n + 1]\nend;\n[1, 2, 3] mapcat foo`,\n `\nmapcat(\n [[1, 2], [2, 2], [2, 3]],\n -> $ filter odd?\n)`,\n ],\n },\n },\n 'moving-fn': {\n evaluate: ([arr, windowSize, fn], sourceCodeInfo, contextStack, { executeFunction }): Arr => {\n assertArray(arr, sourceCodeInfo)\n assertNumber(windowSize, sourceCodeInfo, { integer: true, lte: arr.length })\n assertFunctionLike(fn, sourceCodeInfo)\n\n const result = []\n for (let i = 0; i <= arr.length - windowSize; i++) {\n const window = arr.slice(i, i + windowSize)\n const value = executeFunction(fn, [window], contextStack, sourceCodeInfo)\n result.push(value)\n }\n return result\n },\n arity: toFixedArity(3),\n docs: {\n category: 'array',\n returns: { type: 'array' },\n args: {\n arr: { type: 'array' },\n windowSize: { type: 'number', description: 'The size of the moving window.' },\n fn: { type: 'function' },\n },\n variants: [{ argumentNames: ['arr', 'windowSize', 'fn'] }],\n description: 'Returns the result of applying $fn to each moving window of size $windowSize in $arr.',\n seeAlso: ['running-fn', 'vector.moving-mean'],\n examples: [\n 'moving-fn([1, 2, 3], 2, sum)',\n 'moving-fn([1, 2, 3], 1, sum)',\n 'moving-fn([1, 2, 3], 3, sum)',\n ],\n },\n },\n 'running-fn': {\n evaluate: ([arr, fn], sourceCodeInfo, contextStack, { executeFunction }): Arr => {\n assertArray(arr, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n\n const result = []\n for (let i = 0; i < arr.length; i += 1) {\n const subArr = arr.slice(0, i + 1)\n result.push(executeFunction(fn, [subArr], contextStack, sourceCodeInfo))\n }\n return result\n },\n arity: toFixedArity(2),\n docs: {\n category: 'array',\n returns: { type: 'array' },\n args: {\n a: { type: 'array' },\n b: { type: 'function' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns the result of applying $b to each element of $a.',\n seeAlso: ['moving-fn', 'vector.running-mean'],\n examples: [\n 'running-fn([1, 2, 3], sum)',\n 'running-fn([1, 2, 3], max)',\n 'running-fn([1, 2, 3], min)',\n ],\n },\n },\n}\n","import type { Any, Arr, Seq } from '../../interface'\nimport { assertCharArray } from '../../typeGuards/array'\nimport { asAny, assertAny, assertFunctionLike, assertSeq } from '../../typeGuards/lits'\nimport { assertNumber } from '../../typeGuards/number'\nimport { assertString, assertStringOrNumber } from '../../typeGuards/string'\nimport { compare, deepEqual, toAny } from '../../utils'\nimport { toFixedArity } from '../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../interface'\n\nexport const sequenceNormalExpression: BuiltinNormalExpressions = {\n 'nth': {\n evaluate: (params, sourceCodeInfo): Any => {\n const [seq, i] = params\n const defaultValue = toAny(params[2])\n\n assertNumber(i, sourceCodeInfo, { integer: true })\n\n if (seq === null)\n return defaultValue\n\n assertSeq(seq, sourceCodeInfo)\n if (i >= 0 && i < seq.length) {\n const result = toAny(seq[i])\n return result\n }\n else {\n return defaultValue\n }\n },\n arity: { min: 2, max: 3 },\n docs: {\n category: 'sequence',\n returns: { type: 'any' },\n args: {\n 'a': { type: 'sequence' },\n 'b': { type: 'integer' },\n 'seq': { type: ['sequence', 'null'] },\n 'n': { type: 'integer' },\n 'not-found': { type: 'any' },\n },\n variants: [\n { argumentNames: ['seq', 'n'] },\n { argumentNames: ['seq', 'n', 'not-found'] },\n ],\n description: 'Accesses element $n of $seq. Accessing out-of-bounds indices returns $not-found, if present, else `null`.',\n seeAlso: ['first', 'second', 'last', 'get', 'slice'],\n examples: [\n '[1, 2, 3] nth 1',\n '\"A string\" nth 3',\n 'nth([1, 2, 3], 1)',\n 'nth([1, 2, 3], 3)',\n 'nth([1, 2, 3], -1)',\n 'nth([1, 2, 3], 3, 99)',\n 'nth(\"A string\", 1)',\n 'nth(\"A string\", 3)',\n 'nth(\"A string\", -3)',\n 'nth(\"A string\", 30, \"X\")',\n 'nth(null, 1)',\n 'nth(null, 1, \"Default value\")',\n ],\n },\n },\n 'first': {\n evaluate: ([array], sourceCodeInfo): Any => {\n if (array === null)\n return null\n\n assertSeq(array, sourceCodeInfo)\n const result = toAny(array[0])\n\n return result\n },\n arity: toFixedArity(1),\n docs: {\n category: 'sequence',\n returns: { type: 'any' },\n args: { seq: { type: ['sequence', 'null'] } },\n variants: [{ argumentNames: ['seq'] }],\n description: 'Returns the first element of $seq. If $seq is empty or `null`, `null` is returned.',\n seeAlso: ['second', 'last', 'nth', 'rest', 'next'],\n examples: [\n 'first([\"Albert\", \"Mojir\", 160, [1, 2]])',\n 'first([])',\n 'first(null)',\n ],\n },\n },\n 'last': {\n evaluate: ([array], sourceCodeInfo): Any => {\n if (array === null)\n return null\n\n assertSeq(array, sourceCodeInfo)\n const result = toAny(array.at(-1))\n\n return result\n },\n arity: toFixedArity(1),\n docs: {\n category: 'sequence',\n returns: { type: 'any' },\n args: { seq: { type: ['sequence', 'null'] } },\n variants: [{ argumentNames: ['seq'] }],\n description: 'Returns the last element of $seq. If $seq is empty, `null` is returned.',\n seeAlso: ['first', 'second', 'nth', 'pop'],\n examples: [\n 'last([\"Albert\", \"Mojir\", 160, [1, 2]])',\n 'last([1, 2])',\n 'last([1])',\n 'last([])',\n 'last(null)',\n ],\n },\n },\n 'pop': {\n evaluate: ([seq], sourceCodeInfo): Seq => {\n assertSeq(seq, sourceCodeInfo)\n if (typeof seq === 'string') {\n return seq.substring(0, seq.length - 1)\n }\n\n return seq.slice(0, seq.length - 1)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'sequence',\n returns: { type: ['sequence', 'null'], rest: true },\n args: { seq: { type: 'sequence' } },\n variants: [{ argumentNames: ['seq'] }],\n description: 'Returns a copy of $seq with last element removed. If $seq is empty `null` is returned.',\n seeAlso: ['push', 'sequence.shift', 'last'],\n examples: [\n 'pop([1, 2, 3])',\n 'pop([])',\n ],\n },\n },\n 'index-of': {\n evaluate: ([seq, value], sourceCodeInfo): number | null => {\n assertAny(value, sourceCodeInfo)\n if (seq === null)\n return null\n\n assertSeq(seq, sourceCodeInfo)\n if (typeof seq === 'string') {\n assertString(value, sourceCodeInfo)\n const index = seq.indexOf(value)\n return index !== -1 ? index : null\n }\n else {\n const index = seq.findIndex(item => deepEqual(asAny(item, sourceCodeInfo), value), sourceCodeInfo)\n return index !== -1 ? index : null\n }\n },\n arity: toFixedArity(2),\n docs: {\n category: 'sequence',\n returns: { type: ['number', 'null'] },\n args: {\n a: { type: 'sequence' },\n b: { type: 'any' },\n seq: { type: ['sequence', 'null'] },\n x: { type: 'any' },\n },\n variants: [{ argumentNames: ['seq', 'x'] }],\n description: 'Returns the index of $x in $seq. If element is not present in $seq `null` is returned.',\n seeAlso: ['sequence.last-index-of', 'sequence.position', 'contains?'],\n examples: [\n '[[1], [2], [1], [2]] index-of [1]',\n 'index-of([\"Albert\", \"Mojir\", 160, [1, 2]], \"Mojir\")',\n 'index-of([5, 10, 15, 20], 15)',\n 'index-of([5, 10, 15, 20], 1)',\n 'index-of(null, 1)',\n ],\n },\n },\n 'push': {\n evaluate: ([seq, ...values], sourceCodeInfo): Seq => {\n assertSeq(seq, sourceCodeInfo)\n if (typeof seq === 'string') {\n assertCharArray(values, sourceCodeInfo)\n return [seq, ...values].join('')\n }\n else {\n return [...seq, ...values]\n }\n },\n arity: { min: 2 },\n docs: {\n category: 'sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'any' },\n seq: { type: 'sequence' },\n values: { type: 'any', rest: true, description: 'At least one.' },\n },\n variants: [{ argumentNames: ['seq', 'values'] }],\n description: 'Returns copy of $seq with $values added to the end of it.',\n seeAlso: ['sequence.unshift', 'pop', '++'],\n examples: [\n '[1, 2, 3] push 4',\n '\"Albert\" push \"!\"',\n 'push([1, 2, 3], 4)',\n 'push([1, 2, 3], 4, 5, 6)',\n `\nlet l = [1, 2, 3];\npush(l, 4);\nl`,\n ],\n },\n },\n 'rest': {\n evaluate: ([seq], sourceCodeInfo): Arr | string => {\n assertSeq(seq, sourceCodeInfo)\n if (Array.isArray(seq)) {\n if (seq.length <= 1)\n return []\n\n return seq.slice(1)\n }\n return seq.substring(1)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'sequence',\n returns: { type: ['sequence', 'null'] },\n args: { seq: { type: 'sequence' } },\n variants: [{ argumentNames: ['seq'] }],\n description: `If $seq is an array, returns a new array with all but the first element from $seq.\nIf $seq has less than two elements, an empty array is returned.\nFor string $seq returns all but the first characters in $seq.`,\n seeAlso: ['next', 'first', 'sequence.shift'],\n examples: [\n 'rest([\"Albert\", \"Mojir\", 160, [1, 2]])',\n 'rest([\"Albert\"])',\n 'rest([])',\n 'rest(\"Albert\")',\n 'rest(\"A\",)',\n 'rest(\"\")',\n ],\n },\n },\n 'next': {\n evaluate: ([seq], sourceCodeInfo): Arr | string | null => {\n assertSeq(seq, sourceCodeInfo)\n if (Array.isArray(seq)) {\n if (seq.length <= 1)\n return null\n\n return seq.slice(1)\n }\n if (seq.length <= 1)\n return null\n\n return seq.substring(1)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'sequence',\n returns: { type: ['sequence', 'null'] },\n args: { seq: { type: 'sequence' } },\n variants: [{ argumentNames: ['seq'] }],\n description: 'If $seq is an array, returns a new array with all but the first element from $seq. If $seq has less than two elements, `null` is returned. For string $seq returns all but the first characters in $seq. If length of string $seq is less than two, `null` is returned.',\n seeAlso: ['rest', 'first'],\n examples: [\n 'next([\"Albert\", \"Mojir\", 160, [1, 2]])',\n 'next([\"Albert\"])',\n 'next([])',\n 'next(\"Albert\")',\n 'next(\"A\",)',\n 'next(\"\")',\n ],\n },\n },\n 'reverse': {\n evaluate: ([seq], sourceCodeInfo): Any => {\n if (seq === null)\n return null\n\n assertSeq(seq, sourceCodeInfo)\n if (Array.isArray(seq)) {\n return [...seq].reverse()\n }\n\n return seq.split('').reverse().join('')\n },\n arity: toFixedArity(1),\n docs: {\n category: 'sequence',\n returns: { type: ['sequence', 'null'] },\n args: { seq: { type: ['sequence', 'null'] } },\n variants: [{ argumentNames: ['seq'] }],\n description: 'If $seq is an array, creates a new array with the elements from $seq in reversed order. If $seq is a string, returns new reversed string.',\n seeAlso: ['sort'],\n examples: [\n 'reverse([\"Albert\", \"Mojir\", 160, [1, 2]])',\n 'reverse([])',\n 'reverse(\"Albert\")',\n 'reverse(null)',\n ],\n },\n },\n 'second': {\n evaluate: ([seq], sourceCodeInfo): Any => {\n if (seq === null)\n return null\n\n assertSeq(seq, sourceCodeInfo)\n return toAny(seq[1])\n },\n arity: toFixedArity(1),\n docs: {\n category: 'sequence',\n returns: { type: 'any' },\n args: { seq: { type: ['sequence', 'null'] } },\n variants: [{ argumentNames: ['seq'] }],\n description: 'Returns the second element of $seq. If $seq has less than two elements or is `null`, `null` is returned.',\n seeAlso: ['first', 'last', 'nth'],\n examples: [\n 'second([\"Albert\", \"Mojir\", 160, [1, 2]])',\n 'second([1])',\n 'second([])',\n 'second(null)',\n ],\n },\n },\n 'slice': {\n evaluate: (params, sourceCodeInfo): Any => {\n const [seq, from, to] = params\n assertSeq(seq, sourceCodeInfo)\n assertNumber(from, sourceCodeInfo, { integer: true })\n\n if (params.length === 2) {\n if (Array.isArray(seq)) {\n return seq.slice(from)\n }\n return seq.slice(from)\n }\n\n assertNumber(to, sourceCodeInfo, { integer: true })\n if (Array.isArray(seq)) {\n return seq.slice(from, to)\n }\n return seq.slice(from, to)\n },\n arity: { min: 2, max: 3 },\n docs: {\n category: 'sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'integer' },\n seq: { type: 'sequence', rest: true },\n start: { type: 'integer', description: 'Defaults to `0`.' },\n stop: { type: 'integer', description: 'Defaults lenght of sequence + 1.' },\n },\n variants: [\n { argumentNames: ['seq'] },\n { argumentNames: ['seq', 'start'] },\n { argumentNames: ['seq', 'start', 'stop'] },\n ],\n description: 'Returns a copy of a portion of $seq from index $start (inclusive) to $stop (exclusive).',\n seeAlso: ['sequence.take', 'sequence.drop', 'sequence.splice', 'nth'],\n examples: [\n '[1, 2, 3, 4, 5] slice 2',\n 'slice([1, 2, 3, 4, 5], 2, 4)',\n 'slice([1, 2, 3, 4, 5], 2)',\n ],\n },\n },\n 'some': {\n evaluate: ([seq, fn]: Arr, sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertFunctionLike(fn, sourceCodeInfo)\n if (seq === null)\n return null\n\n assertSeq(seq, sourceCodeInfo)\n\n if (seq.length === 0)\n return null\n\n if (typeof seq === 'string')\n return seq.split('').find(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo)) ?? null\n\n return toAny(seq.find(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo)))\n },\n arity: toFixedArity(2),\n docs: {\n category: 'sequence',\n returns: { type: 'any' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'function' },\n seq: { type: ['sequence', 'null'] },\n fun: { type: 'function' },\n },\n variants: [{ argumentNames: ['seq', 'fun'] }],\n description: 'Returns the first element that passes the test implemented by $fun. I no element was found, `null` is returned.',\n seeAlso: ['sequence.position', 'collection.any?', 'find'],\n examples: [\n `\nsome(\n [\"Albert\", \"Mojir\", 160, [1, 2]],\n string?\n)`,\n `\nsome(\n [5, 10, 15, 20],\n -> $ > 10\n)`,\n `\nsome(\n [1, 2, 3, 4],\n -> $ > 10\n)`,\n `\nsome(\n [],\n -> $ > 10\n)`,\n `\nsome(\n null,\n -> $ > 10\n)`,\n ],\n },\n },\n 'sort': {\n evaluate: (params: Arr, sourceCodeInfo, contextStack, { executeFunction }): Seq => {\n const [seq] = params\n const defaultComparer = params.length === 1\n const comparer = defaultComparer ? null : params[1]\n assertSeq(seq, sourceCodeInfo)\n\n if (typeof seq === 'string') {\n const result = seq.split('')\n if (defaultComparer) {\n result.sort((a, b) => compare(a, b, sourceCodeInfo))\n }\n else {\n assertFunctionLike(comparer, sourceCodeInfo)\n result.sort((a, b) => {\n const compareValue = executeFunction(comparer, [a, b], contextStack, sourceCodeInfo)\n assertNumber(compareValue, sourceCodeInfo, { finite: true })\n return compareValue\n })\n }\n return result.join('')\n }\n\n const result = [...seq]\n if (defaultComparer) {\n result.sort((a, b) => {\n assertStringOrNumber(a, sourceCodeInfo)\n assertStringOrNumber(b, sourceCodeInfo)\n return compare(a, b, sourceCodeInfo)\n })\n }\n else {\n result.sort((a, b) => {\n assertFunctionLike(comparer, sourceCodeInfo)\n const compareValue = executeFunction(comparer, [a, b], contextStack, sourceCodeInfo)\n assertNumber(compareValue, sourceCodeInfo, { finite: true })\n return compareValue\n })\n }\n return result\n },\n arity: { min: 1, max: 2 },\n docs: {\n category: 'sequence',\n returns: { type: 'any', rest: true },\n args: {\n a: { type: 'sequence' },\n b: { type: 'function' },\n seq: { type: 'sequence' },\n fun: { type: 'function' },\n },\n variants: [\n { argumentNames: ['seq'] },\n { argumentNames: ['seq', 'fun'] },\n ],\n description: 'Returns a new sequence with the elements from $seq sorted according to $fun. If no $fun is supplied, builtin `compare` will be used.',\n seeAlso: ['sequence.sort-by', 'compare', 'reverse', 'vector.sort-indices'],\n examples: [\n '[3, 1, 2] sort (a, b) -> b - a',\n 'sort([3, 1, 2])',\n `\nsort(\n [3, 1, 2],\n (a, b) -> cond case a < b then -1 case a > b then 1 case true then -1 end\n)`,\n `\nsort(\n [3, 1, 2],\n (a, b) -> cond case a > b then -1 case a < b then 1 case true then -1 end\n)`,\n ],\n },\n },\n}\n","import { LitsError } from '../errors'\nimport type { Any } from '../interface'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { isNumber } from './number'\n\nconst annotatedArrays = new WeakSet<unknown[]>()\nconst vectors = new WeakSet<unknown[]>()\nconst notVectors = new WeakSet<unknown[]>()\nconst matrices = new WeakSet<unknown[]>()\nconst notMatrices = new WeakSet<unknown[]>()\nconst grids = new WeakSet<unknown[]>()\nconst notGrids = new WeakSet<unknown[]>()\n\nexport function annotate<T>(value: T): T {\n if (!Array.isArray(value)) {\n return value\n }\n if (annotatedArrays.has(value)) {\n return value\n }\n isVector(value)\n if (!isMatrix(value)) {\n isGrid(value)\n }\n\n return value\n}\nexport function isVector(vector: unknown): vector is number[] {\n if (!Array.isArray(vector)) {\n return false\n }\n\n if (vectors.has(vector)) {\n return true\n }\n if (notVectors.has(vector)) {\n return false\n }\n\n if (vector.every(elem => isNumber(elem))) {\n annotatedArrays.add(vector)\n vectors.add(vector)\n return true\n }\n notVectors.add(vector)\n return false\n}\n\nexport function assertVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is number[] {\n if (!isVector(vector)) {\n throw new LitsError(`Expected a vector, but got ${vector}`, sourceCodeInfo)\n }\n}\n\nexport function is2dVector(vector: unknown): vector is [number, number] {\n if (!isVector(vector)) {\n return false\n }\n return vector.length === 2\n}\nexport function assert2dVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is [number, number] {\n if (!is2dVector(vector)) {\n throw new LitsError(`Expected a 2d vector, but got ${vector}`, sourceCodeInfo)\n }\n}\n\nexport function is3dVector(vector: unknown): vector is [number, number, number] {\n if (!isVector(vector)) {\n return false\n }\n return vector.length === 3\n}\nexport function assert3dVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is [number, number, number] {\n if (!is3dVector(vector)) {\n throw new LitsError(`Expected a 3d vector, but got ${vector}`, sourceCodeInfo)\n }\n}\n\nexport function assertNonEmptyVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is number[] {\n assertVector(vector, sourceCodeInfo)\n if (vector.length === 0) {\n throw new LitsError(`Expected a non empty vector, but got ${vector}`, sourceCodeInfo)\n }\n}\n\nexport function isGrid(grid: unknown): grid is unknown[][] {\n if (!Array.isArray(grid)) {\n return false\n }\n if (grids.has(grid)) {\n return true\n }\n if (notGrids.has(grid)) {\n return false\n }\n if (grid.length === 0) {\n notGrids.add(grid)\n return false\n }\n if (!Array.isArray(grid[0])) {\n notGrids.add(grid)\n return false\n }\n const nbrOfCols = grid[0].length\n for (const row of grid.slice(1)) {\n if (!Array.isArray(row)) {\n notGrids.add(grid)\n return false\n }\n if (row.length !== nbrOfCols) {\n notGrids.add(grid)\n return false\n }\n }\n annotatedArrays.add(grid)\n grids.add(grid)\n return true\n}\n\nexport function assertGrid(grid: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts grid is Any[][] {\n if (!isGrid(grid)) {\n throw new LitsError(`Expected a grid, but got ${grid}`, sourceCodeInfo)\n }\n}\n\nexport function isMatrix(matrix: unknown): matrix is number[][] {\n if (!Array.isArray(matrix)) {\n return false\n }\n if (matrices.has(matrix)) {\n return true\n }\n if (notMatrices.has(matrix)) {\n return false\n }\n if (matrix.length === 0) {\n notMatrices.add(matrix)\n return false\n }\n if (!Array.isArray(matrix[0]) || matrix[0].length === 0) {\n notMatrices.add(matrix)\n return false\n }\n const nbrOfCols = matrix[0].length\n for (const row of matrix) {\n if (!Array.isArray(row) || row.length !== nbrOfCols || row.some(cell => !isNumber(cell))) {\n notMatrices.add(matrix)\n return false\n }\n }\n annotatedArrays.add(matrix)\n grids.add(matrix)\n matrices.add(matrix)\n return true\n}\n\nexport function assertMatrix(matrix: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts matrix is number[][] {\n if (!isMatrix(matrix)) {\n throw new LitsError(`Expected a matrix, but got ${matrix}`, sourceCodeInfo)\n }\n}\n\nexport function assertSquareMatrix(matrix: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts matrix is number[][] {\n if (!isMatrix(matrix)) {\n throw new LitsError(`Expected a matrix, but got ${matrix}`, sourceCodeInfo)\n }\n if (matrix.length !== matrix[0]!.length) {\n throw new LitsError(`Expected square matrix, but got ${matrix.length} and ${matrix[0]!.length}`, sourceCodeInfo)\n }\n}\n\nexport function isSquareMatrix(matrix: unknown): matrix is number[][] {\n if (!isMatrix(matrix)) {\n return false\n }\n if (matrix.length !== matrix[0]!.length) {\n return false\n }\n return true\n}\n","import { LitsError } from '../../errors'\nimport type { SourceCodeInfo } from '../../tokenizer/token'\nimport { assertNonEmptyVector, isMatrix, isVector } from '../../typeGuards/annotatedArrays'\nimport { assertNumber, isNumber } from '../../typeGuards/number'\nimport { toFixedArity } from '../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../interface'\n\ntype NumberVectorOrMatrix = number | number[] | number[][]\n\nfunction getNumberVectorOrMatrixOperation(\n params: unknown[],\n sourceCodeInfo: SourceCodeInfo | undefined,\n):\n | ['number', number[]]\n | ['vector', number[][]]\n | ['matrix', number[][][]] {\n let hasVector: boolean = false\n let hasMatrix: boolean = false\n for (const param of params) {\n if (isVector(param)) {\n hasVector = true\n }\n else if (isMatrix(param)) {\n hasMatrix = true\n }\n else if (!isNumber(param)) {\n throw new LitsError(`Invalid parameter type: ${typeof param}`, sourceCodeInfo)\n }\n }\n if (hasMatrix) {\n if (hasVector) {\n throw new LitsError('Cannot mix vector and matrix types', sourceCodeInfo)\n }\n let rows: number | null = null\n let cold: number | null = null\n for (const param of params) {\n if (isMatrix(param)) {\n if (rows === null) {\n rows = param.length\n cold = param[0]!.length\n }\n else {\n if (param.length !== rows || param[0]!.length !== cold) {\n throw new LitsError('Matrix dimensions do not match', sourceCodeInfo)\n }\n }\n }\n }\n const matrices = params.map((param) => {\n if (isMatrix(param)) {\n return param\n }\n return Array.from({ length: rows as number }, () => Array.from({ length: cold as number }, () => param as number))\n })\n return ['matrix', matrices]\n }\n if (hasVector) {\n let length: number | null = null\n for (const param of params) {\n if (isVector(param)) {\n if (length === null) {\n length = param.length\n }\n else {\n if (param.length !== length) {\n throw new LitsError('Vector lengths do not match', sourceCodeInfo)\n }\n }\n }\n }\n const vectors = params.map((param) => {\n if (isVector(param)) {\n return param\n }\n return Array.from({ length: length as number }, () => param as number)\n })\n\n return ['vector', vectors]\n }\n return ['number', params as number[]]\n}\n\nfunction unaryMathOp(\n fn: (val: number) => number,\n): (params: unknown[], sourceCodeInfo: SourceCodeInfo | undefined) => NumberVectorOrMatrix {\n return (params, sourceCodeInfo) => {\n const [operation, operands] = getNumberVectorOrMatrixOperation(params, sourceCodeInfo)\n if (operation === 'number') {\n return fn(operands[0]!)\n }\n else if (operation === 'vector') {\n return operands[0]!.map(val => fn(val))\n }\n else {\n return operands[0]!.map(row => row.map(val => fn(val)))\n }\n }\n}\n\nfunction binaryMathOp(\n fn: (a: number, b: number) => number,\n): (params: unknown[], sourceCodeInfo: SourceCodeInfo | undefined) => NumberVectorOrMatrix {\n return (params, sourceCodeInfo) => {\n const [operation, operands] = getNumberVectorOrMatrixOperation(params, sourceCodeInfo)\n if (operation === 'number') {\n return fn(operands[0]!, operands[1]!)\n }\n else if (operation === 'vector') {\n return operands[0]!.map((val, i) => fn(val, operands[1]![i]!))\n }\n else {\n return operands[0]!.map((row, i) => row.map((val, j) => fn(val, operands[1]![i]![j]!)))\n }\n }\n}\n\nfunction reduceMathOp(\n identity: number,\n fn: (a: number, b: number) => number,\n): (params: unknown[], sourceCodeInfo: SourceCodeInfo | undefined) => NumberVectorOrMatrix {\n return (params, sourceCodeInfo) => {\n if (params.length === 0)\n return identity\n const [operation, operands] = getNumberVectorOrMatrixOperation(params, sourceCodeInfo)\n if (operation === 'number') {\n return operands.reduce((a, b) => fn(a, b), identity)\n }\n else if (operation === 'vector') {\n const [first, ...rest] = operands\n return rest.reduce((acc, v) => acc.map((val, i) => fn(val, v[i]!)), first!)\n }\n else {\n const [first, ...rest] = operands\n return rest.reduce((acc, m) => acc.map((row, i) => row.map((val, j) => fn(val, m[i]![j]!))), first!)\n }\n }\n}\n\nexport const mathNormalExpression: BuiltinNormalExpressions = {\n 'inc': {\n evaluate: unaryMathOp(val => val + 1),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: 'number' },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `inc` function increments its argument by 1, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it increases each element by 1 while preserving the original structure.',\n seeAlso: ['dec', '+'],\n examples: [\n 'inc(0)',\n 'inc(1)',\n 'inc(100.1)',\n 'inc([1, 2, 3])',\n 'inc([[1, 2], [3, 4]])',\n ],\n },\n },\n 'dec': {\n evaluate: unaryMathOp(val => val - 1),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `dec` function decrements its argument by 1, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it decreases each element by 1 while preserving the original structure.',\n seeAlso: ['inc', '-'],\n examples: [\n 'dec(0)',\n 'dec(1)',\n 'dec(100.1)',\n 'dec([1, 2, 3])',\n 'dec([[1, 2], [3, 4]])',\n ],\n },\n },\n '+': {\n evaluate: reduceMathOp(0, (a, b) => a + b),\n arity: {},\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n a: { type: ['number', 'vector', 'matrix'] },\n b: { type: ['number', 'vector', 'matrix'] },\n xs: { type: ['number', 'vector', 'matrix'], rest: true },\n },\n variants: [{ argumentNames: ['xs'] }],\n description: 'The `+` function performs addition of numbers and element-wise addition of `vectors` and `matrices` of compatible dimensions, returning the same type as its inputs. When used with mixed types, it adds the scalar to each element of the collection.',\n seeAlso: ['-', '*', '/', 'inc'],\n examples: [\n '1 + 2',\n '1 + 20 + 30',\n '+(1, 2, 3, 4)',\n '+()',\n '+(1)',\n '[1, 2, 3] + 2',\n '[1, 2, 3] + [4, 5, 6]',\n '[[1, 2, 3], [4, 5, 6]] + [[7, 8, 9], [10, 11, 12]]',\n '[[1, 2, 3], [4, 5, 6]] + 2',\n ],\n },\n },\n '*': {\n evaluate: reduceMathOp(1, (a, b) => a * b),\n arity: {},\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n a: { type: ['number', 'vector', 'matrix'] },\n b: { type: ['number', 'vector', 'matrix'] },\n xs: { type: ['number', 'vector', 'matrix'], rest: true },\n },\n variants: [{ argumentNames: ['xs'] }],\n description: 'The `*` function performs multiplication of `numbers` and element-wise multiplication of `vectors` and `matrices` of compatible dimensions, returning the same type as its inputs. When used with mixed types, it multiplies each element of the collection by the scalar.',\n seeAlso: ['/', '+', '-', '^'],\n examples: [\n '6 * 7',\n '-1 * 4',\n '*(4, 7)',\n '*(1, 2, 3, 4, 5)',\n '*()',\n '*(8)',\n '[1, 2, 3] * 2',\n '[1, 2, 3] * [4, 5, 6]',\n '[[1, 2, 3], [4, 5, 6]] * [[7, 8, 9], [10, 11, 12]]',\n '[[1, 2, 3], [4, 5, 6]] * 2',\n ],\n },\n },\n '/': {\n evaluate: (params, sourceCodeInfo): NumberVectorOrMatrix => {\n if (params.length === 0) {\n return 1\n }\n\n const [operation, operands] = getNumberVectorOrMatrixOperation(params, sourceCodeInfo)\n\n if (operation === 'number') {\n const [first, ...rest] = operands\n if (rest.length === 0) {\n return 1 / first!\n }\n return rest.reduce((result, param) => {\n return result / param\n }, first!)\n }\n else if (operation === 'vector') {\n const firstVector = operands[0]!\n const restVectors = operands.slice(1)\n return restVectors.reduce((acc, vector) => acc.map((val, i) => val / vector[i]!), firstVector)\n }\n else {\n const firstMatrix = operands[0]!\n const restMatrices = operands.slice(1)\n return restMatrices.reduce((acc, matrix) => acc.map((row, i) => row.map((val, j) => val / matrix[i]![j]!)), firstMatrix)\n }\n },\n arity: {},\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n a: { type: ['number', 'vector', 'matrix'] },\n b: { type: ['number', 'vector', 'matrix'] },\n xs: { type: ['number', 'vector', 'matrix'], rest: true },\n },\n variants: [{ argumentNames: ['xs'] }],\n description: 'The `/` function performs division of `numbers` and element-wise division of `vectors` and `matrices` of compatible dimensions, returning the same type as its inputs. When used with mixed types, it divides each element of the collection by the scalar.',\n seeAlso: ['*', '+', '-', 'quot', 'mod', '%'],\n examples: [\n '12 / 100',\n '-1 / 4',\n '/(7, 4)',\n '/(1, 2, 4, 8)',\n '/()',\n '/(8)',\n '[1, 2, 3] / 2',\n '[1, 2, 3] / [4, 5, 6]',\n '[[1, 2, 3], [4, 5, 6]] / [[7, 8, 9], [10, 11, 12]]',\n '[[1, 2, 3], [4, 5, 6]] / 2',\n ],\n },\n },\n '-': {\n evaluate: (params, sourceCodeInfo): NumberVectorOrMatrix => {\n if (params.length === 0) {\n return 0\n }\n\n const [operation, operands] = getNumberVectorOrMatrixOperation(params, sourceCodeInfo)\n\n if (operation === 'number') {\n const [first, ...rest] = operands\n if (rest.length === 0)\n return -first!\n\n return rest.reduce((result, param) => {\n return result - param\n }, first!)\n }\n else if (operation === 'vector') {\n const firstVector = operands[0]!\n const restVectors = operands.slice(1)\n return restVectors.reduce((acc, vector) => acc.map((val, i) => val - vector[i]!), firstVector)\n }\n else {\n const firstMatrix = operands[0]!\n const restMatrices = operands.slice(1)\n return restMatrices.reduce((acc, matrix) => acc.map((row, i) => row.map((val, j) => val - matrix[i]![j]!)), firstMatrix)\n }\n },\n arity: {},\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n a: { type: ['number', 'vector', 'matrix'] },\n b: { type: ['number', 'vector', 'matrix'] },\n xs: { type: ['number', 'vector', 'matrix'], rest: true },\n },\n variants: [{ argumentNames: ['xs'] }],\n description: 'Computes difference between first value and sum of the rest. When called with only one argument, it does negation.',\n seeAlso: ['+', '*', '/', 'dec', 'abs'],\n examples: [\n '50 - 8',\n '1 - 1 - 1',\n '-()',\n '-(4, 2)',\n '-(4, 3, 2, 1,)',\n '[1, 2, 3] - 2',\n '[1, 2, 3] - [4, 5, 6]',\n '[[1, 2, 3], [4, 5, 6]] - [[7, 8, 9], [10, 11, 12]]',\n '[[1, 2, 3], [4, 5, 6]] - 2',\n ],\n },\n },\n 'quot': {\n evaluate: binaryMathOp((a, b) => Math.trunc(a / b)),\n arity: toFixedArity(2),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n a: { type: ['number', 'vector', 'matrix'] },\n b: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'The `quot` function performs integer division truncated toward zero, working on `numbers` and element-wise on `vectors` and `matrices` of compatible dimensions. When used with mixed types, it applies integer division between each element of the collection and the scalar.',\n seeAlso: ['mod', '%', '/', 'trunc'],\n examples: [\n 'quot(5, 3)',\n 'quot(5.2, 3.1)',\n 'quot(-5, 3)',\n '5 quot -3',\n '-5 quot -3',\n 'quot(5, 0)',\n 'quot(0, 5)',\n '[1, 2, 3] quot 2',\n '2 quot [1, 2, 3]',\n 'quot([1, 2, 3], [4, 5, 6])',\n '[[1, 2, 3], [4, 5, 6]] quot [[7, 8, 9], [10, 11, 12]]',\n 'quot([[1, 2, 3], [4, 5, 6]], 2)',\n '[[1, 2, 3], [4, 5, 6]] quot [[7, 8, 9], [10, 11, 12]]',\n ],\n },\n },\n 'mod': {\n evaluate: binaryMathOp((a, b) => a - b * Math.floor(a / b)),\n arity: toFixedArity(2),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n a: { type: ['number', 'vector', 'matrix'] },\n b: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'The `mod` function computes the modulo of division with the same sign as the divisor, working on `numbers` and element-wise on `vectors` and `matrices` of compatible dimensions. When used with mixed types, it applies the modulo operation between each element of the collection and the scalar.',\n seeAlso: ['%', 'quot', '/'],\n examples: [\n 'mod(5, 3)',\n 'mod(5.2, 3.1)',\n 'mod(-5, 3)',\n '5 mod -3',\n '-5 mod -3',\n '[1, 2, 3] mod 2',\n '2 mod [1, 2, 3]',\n 'mod([1, 2, 3], [4, 5, 6])',\n '[[1, 2, 3], [4, 5, 6]] mod [[7, 8, 9], [10, 11, 12]]',\n 'mod([[1, 2, 3], [4, 5, 6]], 2)',\n ],\n },\n },\n '%': {\n evaluate: binaryMathOp((a, b) => a % b),\n arity: toFixedArity(2),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n a: { type: ['number', 'vector', 'matrix'] },\n b: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'The `%` function computes the remainder of division with the same sign as the dividend, working on `numbers` and element-wise on `vectors` and `matrices` of compatible dimensions. When used with mixed types, it applies the remainder operation between each element of the collection and the scalar.',\n seeAlso: ['mod', 'quot', '/'],\n examples: [\n '5 % 3',\n '5.2 % 3.1',\n '-5 % 3',\n '%(5, -3)',\n '%(-5, -3)',\n '[1, 2, 3] % 2',\n '2 % [1, 2, 3]',\n '%([1, 2, 3], [4, 5, 6])',\n '[[1, 2, 3], [4, 5, 6]] % [[7, 8, 9], [10, 11, 12]]',\n '%([[1, 2, 3], [4, 5, 6]], 2)',\n ],\n },\n },\n 'sqrt': {\n evaluate: unaryMathOp(val => Math.sqrt(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `sqrt` function calculates the square root of `numbers` and computes element-wise square roots of `vectors` and `matrices`. When applied to collections, it returns the square root of each element while preserving the original structure.',\n seeAlso: ['cbrt', '^'],\n examples: [\n 'sqrt(0)',\n 'sqrt(9)',\n 'sqrt(2)',\n 'sqrt(0)',\n 'sqrt(9)',\n 'sqrt(2)',\n 'sqrt([1, 4, 9])',\n 'sqrt([[1, 4], [9, 16]])',\n ],\n },\n },\n 'cbrt': {\n evaluate: unaryMathOp(val => Math.cbrt(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `cbrt` function calculates the cube root of `numbers` and computes element-wise cube roots of `vectors` and `matrices`. When applied to collections, it returns the cube root of each element while preserving the original structure.',\n seeAlso: ['sqrt', '^'],\n examples: [\n 'cbrt(0)',\n 'cbrt(27)',\n 'cbrt(2)',\n 'cbrt(1)',\n 'cbrt(0)',\n 'cbrt(27)',\n 'cbrt(2)',\n 'cbrt(1)',\n 'cbrt([1, 8, 27])',\n 'cbrt([[1, 8], [27, 64]])',\n ],\n },\n },\n '^': {\n evaluate: binaryMathOp((a, b) => a ** b),\n arity: toFixedArity(2),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n a: { type: ['number', 'vector', 'matrix'] },\n b: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'The ^ function computes exponentiation, raising the first argument to the power of the second, working on `numbers` and element-wise on `vectors` and `matrices` of compatible dimensions. When used with mixed types, it applies the power operation between each element of the collection and the scalar.',\n seeAlso: ['sqrt', 'cbrt', '*', 'math.ln'],\n examples: [\n '2 ^ 3',\n '2 ^ 0',\n '2 ^ -3',\n '^(-2, 3)',\n '^(-2, -3)',\n '[1, 2, 3] ^ 2',\n '2 ^ [1, 2, 3]',\n '^([1, 2, 3], [4, 5, 6])',\n '[[1, 2, 3], [4, 5, 6]] ^ [[7, 8, 9], [10, 11, 12]]',\n '^([[1, 2, 3], [4, 5, 6]], 2)',\n ],\n },\n },\n 'round': {\n evaluate: ([value, decimals], sourceCodeInfo): NumberVectorOrMatrix => {\n const [operation, operands] = getNumberVectorOrMatrixOperation([value], sourceCodeInfo)\n if (operation === 'number') {\n if (decimals === undefined || decimals === 0) {\n return Math.round(operands[0]!)\n }\n else {\n assertNumber(decimals, sourceCodeInfo, { integer: true, positive: true })\n const factor = 10 ** decimals\n return Math.round(operands[0]! * factor) / factor\n }\n }\n else if (operation === 'vector') {\n const vector = operands[0]!\n if (decimals === undefined || decimals === 0) {\n return vector.map(val => Math.round(val))\n }\n else {\n assertNumber(decimals, sourceCodeInfo, { integer: true, positive: true })\n const factor = 10 ** decimals\n return vector.map(val => Math.round(val * factor) / factor)\n }\n }\n else {\n const matrix = operands[0]!\n if (decimals === undefined || decimals === 0) {\n return matrix.map(row => row.map(val => Math.round(val)))\n }\n else {\n assertNumber(decimals, sourceCodeInfo, { integer: true, positive: true })\n const factor = 10 ** decimals\n return matrix.map(row => row.map(val => Math.round(val * factor) / factor))\n }\n }\n },\n arity: { min: 1, max: 2 },\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n a: { type: ['number', 'vector', 'matrix'] },\n b: { type: 'integer' },\n },\n variants: [\n { argumentNames: ['a'] },\n { argumentNames: ['a', 'b'] },\n ],\n description: 'The `round` function rounds a `number` to the nearest `integer` or to a specified number of `decimal` places, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it rounds each element while preserving the original structure.',\n seeAlso: ['floor', 'ceil', 'trunc'],\n examples: [\n 'round(2)',\n 'round(2.49)',\n 'round(2.5)',\n 'round(-2.49)',\n 'round(-2.5)',\n 'round(-2.501)',\n 'round(1.23456789, 4)',\n '1.123456789 round 2',\n 'round([1.23456789, 2.3456789], 1)',\n '[1.23456789, 2.3456789] round 4',\n '[[1.23456789, 2.3456789], [3.456789, 4.56789]] round 4',\n 'round([[1.23456789, 2.3456789], [3.456789, 4.56789]], 2)',\n ],\n },\n },\n 'trunc': {\n evaluate: unaryMathOp(val => Math.trunc(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['integer', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `trunc` function truncates `numbers` toward zero (removing decimal portions without rounding), working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it truncates each element while preserving the original structure.',\n seeAlso: ['round', 'floor', 'ceil', 'quot'],\n examples: [\n 'trunc(2)',\n 'trunc(2.49)',\n 'trunc(2.5)',\n 'trunc(-2.49)',\n 'trunc(-2.5)',\n 'trunc(-2.501)',\n 'trunc([1.23456789, 2.3456789])',\n 'trunc([[1.23456789, 2.3456789], [3.456789, 4.56789]])',\n ],\n },\n },\n 'floor': {\n evaluate: unaryMathOp(val => Math.floor(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['integer', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `floor` function returns the largest `integer` less than or equal to a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the floor of each element while preserving the original structure.',\n seeAlso: ['ceil', 'round', 'trunc'],\n examples: [\n 'floor(2)',\n 'floor(2.49)',\n 'floor(2.5)',\n 'floor(-2.49)',\n 'floor(-2.5)',\n 'floor(-2.501)',\n 'floor([1.23456789, 2.3456789])',\n 'floor([[1.23456789, 2.3456789], [3.456789, 4.56789]])',\n ],\n },\n },\n 'ceil': {\n evaluate: unaryMathOp(val => Math.ceil(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['integer', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `ceil` function returns the smallest `integer` greater than or equal to a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the ceiling of each element while preserving the original structure.',\n seeAlso: ['floor', 'round', 'trunc'],\n examples: [\n 'ceil(2)',\n 'ceil(2.49)',\n 'ceil(2.5)',\n 'ceil(-2.49)',\n 'ceil(-2.5)',\n 'ceil(-2.501)',\n 'ceil([1.23456789, 2.3456789])',\n 'ceil([[1.23456789, 2.3456789], [3.456789, 4.56789]])',\n ],\n },\n },\n 'min': {\n evaluate: (params, sourceCodeInfo): number => {\n if (params.length === 1 && isVector(params[0])) {\n const vector = params[0]\n assertNonEmptyVector(vector, sourceCodeInfo)\n return vector.reduce((m, val) => Math.min(m, val), Infinity)\n }\n const [first, ...rest] = params\n assertNumber(first, sourceCodeInfo)\n return rest.reduce((m: number, value) => {\n assertNumber(value, sourceCodeInfo)\n return Math.min(m, value)\n }, first)\n },\n arity: { min: 1 },\n docs: {\n category: 'math',\n returns: { type: 'number' },\n args: {\n a: { type: 'number' },\n b: { type: 'number' },\n xs: { type: 'number', rest: true },\n vector: { type: 'vector' },\n },\n variants: [\n { argumentNames: ['xs'] },\n { argumentNames: ['vector'] },\n ],\n description: 'Returns the smallest value. Accepts either multiple numbers or a single vector of numbers.',\n seeAlso: ['max', 'vector.span', 'vector.min-index'],\n examples: [\n '2 min 3',\n 'min(2, 0, 1)',\n 'min(2, -1, 1)',\n 'min([2, 0, -1])',\n '12 min 14',\n ],\n },\n },\n 'max': {\n evaluate: (params, sourceCodeInfo): number => {\n if (params.length === 1 && isVector(params[0])) {\n const vector = params[0]\n assertNonEmptyVector(vector, sourceCodeInfo)\n return vector.reduce((m, val) => Math.max(m, val), -Infinity)\n }\n const [first, ...rest] = params\n assertNumber(first, sourceCodeInfo)\n return rest.reduce((m: number, value) => {\n assertNumber(value, sourceCodeInfo)\n return Math.max(m, value)\n }, first)\n },\n arity: { min: 1 },\n docs: {\n category: 'math',\n returns: { type: 'number' },\n args: {\n a: { type: 'number' },\n b: { type: 'number' },\n xs: { type: 'number', rest: true },\n vector: { type: 'vector' },\n },\n variants: [\n { argumentNames: ['xs'] },\n { argumentNames: ['vector'] },\n ],\n description: 'Returns the largest value. Accepts either multiple numbers or a single vector of numbers.',\n seeAlso: ['min', 'vector.span', 'vector.max-index'],\n examples: [\n '2 max 3',\n 'max(2, 0, 1)',\n 'max(2, -1, 1)',\n 'max([2, 0, -1])',\n '4 max 2',\n ],\n },\n },\n 'abs': {\n evaluate: unaryMathOp(val => Math.abs(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The abs function returns the absolute value (magnitude) of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the absolute value of each element while preserving the original structure.',\n seeAlso: ['sign', '-'],\n examples: [\n 'abs(-2.3)',\n 'abs(0)',\n 'abs(2.5)',\n 'abs([1, -2, 3])',\n 'abs([[1, -2], [3, -4]])',\n ],\n },\n },\n 'sign': {\n evaluate: unaryMathOp(val => Math.sign(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `sign` function returns the `sign` of a `number` (-1 for negative, 0 for zero, 1 for positive), working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the sign of each element while preserving the original structure.',\n seeAlso: ['abs'],\n examples: [\n 'sign(-2.3)',\n 'sign(-0)',\n 'sign(0)',\n 'sign(12312)',\n 'sign([1, -2, 3])',\n 'sign([[1, -2], [3, -4]])',\n ],\n },\n },\n}\n","import { LitsError } from '../../errors'\nimport type { Any } from '../../interface'\nimport type { ModuleFunction } from '../../parser/types'\nimport type { SourceCodeInfo } from '../../tokenizer/token'\nimport { asAny, assertAny } from '../../typeGuards/lits'\nimport { assertNumber } from '../../typeGuards/number'\nimport { asStringOrNumber, assertString, assertStringOrNumber } from '../../typeGuards/string'\nimport { compare, deepEqual } from '../../utils'\nimport { toFixedArity } from '../../utils/arity'\nimport { FUNCTION_SYMBOL } from '../../utils/symbols'\nimport type { BuiltinNormalExpressions } from '../interface'\n\nfunction isEqual([first, ...rest]: unknown[], sourceCodeInfo: SourceCodeInfo | undefined) {\n const firstAny = asAny(first, sourceCodeInfo)\n for (const param of rest) {\n if (!deepEqual(firstAny, asAny(param, sourceCodeInfo), sourceCodeInfo))\n return false\n }\n return true\n}\n\nfunction isIdentical([first, ...rest]: unknown[]) {\n for (const param of rest) {\n if (param !== first)\n return false\n }\n return true\n}\n\nexport const miscNormalExpression: BuiltinNormalExpressions = {\n '==': {\n evaluate: (params, sourceCodeInfo): boolean => {\n return isEqual(params, sourceCodeInfo)\n },\n arity: { min: 1 },\n docs: {\n category: 'misc',\n returns: { type: 'boolean' },\n args: {\n a: { type: 'any' },\n b: { type: 'any' },\n x: { type: 'any' },\n ys: { type: 'any', rest: true },\n },\n variants: [\n { argumentNames: ['x'] },\n { argumentNames: ['x', 'ys'] },\n ],\n description: 'Returns `true` if all `values` are structaul equal to each other, otherwise result is `false`.',\n seeAlso: ['≠', 'identical?'],\n examples: [\n '1 == 1',\n '[1, 2] == [1, 2]',\n `\n{\n a: 1,\n b: 2,\n} == {\n b: 2,\n a: 1,\n}`,\n '==(1, 1)',\n '==(1.01, 1)',\n '==(\"1\", 1)',\n '==(\"2\", \"2\", \"2\", \"2\")',\n '==(2, 2, 1, 2)',\n '==([1, 2], [1, 2])',\n '==({ a: 1, b: 2 }, { b: 2, a: 1 })',\n ],\n },\n },\n '≠': {\n evaluate: (params, sourceCodeInfo): boolean => {\n return !isEqual(params, sourceCodeInfo)\n },\n arity: { min: 1 },\n docs: {\n category: 'misc',\n returns: { type: 'boolean' },\n args: {\n a: { type: 'any' },\n b: { type: 'any' },\n x: { type: 'any' },\n ys: { type: 'any', rest: true },\n },\n variants: [\n { argumentNames: ['x'] },\n { argumentNames: ['x', 'ys'] },\n ],\n description: 'Returns `true` if all `values` are not equal to each other, otherwise result is `false`. `(≠ a b c)` is same as `(! (== a b c))`.',\n seeAlso: ['==', 'identical?'],\n examples: [\n '1 ≠ 2',\n '3 ≠ 3',\n '≠(3)',\n '≠(3, 3, 2)',\n '≠(\"3\", \"2\", \"1\", \"0\",)',\n '≠(0, -0)',\n ],\n },\n },\n 'identical?': {\n evaluate: (params): boolean => {\n return isIdentical(params)\n },\n arity: { min: 1 },\n docs: {\n category: 'misc',\n returns: { type: 'boolean' },\n args: {\n a: { type: 'any' },\n b: { type: 'any' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns true if $a and $b are referential equal.',\n seeAlso: ['==', '≠'],\n examples: [\n 'identical?({ a: 10, b: 20 }, { b: 20, a: 10 })',\n 'identical?([1, true, null], [1, true, null])',\n 'identical?(0.3, 0.1 + 0.2)',\n ],\n },\n },\n '>': {\n evaluate: ([first, ...rest], sourceCodeInfo): boolean => {\n let currentValue = asStringOrNumber(first)\n for (const param of rest) {\n if (compare(currentValue, asStringOrNumber(param), sourceCodeInfo) <= 0)\n return false\n\n currentValue = asStringOrNumber(param)\n }\n return true\n },\n arity: { min: 1 },\n docs: {\n category: 'misc',\n returns: { type: 'boolean' },\n args: {\n a: { type: ['number', 'string'] },\n b: { type: ['number', 'string'] },\n x: { type: ['number', 'string'] },\n ys: { type: ['number', 'string'], rest: true },\n },\n variants: [\n { argumentNames: ['x'] },\n { argumentNames: ['x', 'ys'] },\n ],\n description: 'Returns `true` if $x and $ys are in decreasing order, `false` otherwise.',\n seeAlso: ['<', '>=', '<=', 'compare'],\n examples: [\n '>(1, 0)',\n '>(1.01, 1)',\n '>(1, 1)',\n '>(4, 3, 2, 1)',\n '>(3, 2, 2, 1)',\n ],\n },\n },\n\n '<': {\n evaluate: ([first, ...rest], sourceCodeInfo): boolean => {\n let currentValue = asStringOrNumber(first)\n for (const param of rest) {\n if (compare(currentValue, asStringOrNumber(param), sourceCodeInfo) >= 0)\n return false\n\n currentValue = asStringOrNumber(param)\n }\n return true\n },\n arity: { min: 1 },\n docs: {\n category: 'misc',\n returns: { type: 'boolean' },\n args: {\n a: { type: ['number', 'string'] },\n b: { type: ['number', 'string'] },\n x: { type: ['number', 'string'] },\n ys: { type: ['number', 'string'], rest: true },\n },\n variants: [\n { argumentNames: ['x'] },\n { argumentNames: ['x', 'ys'] },\n ],\n description: 'Returns `true` if $x and $ys are in increasing order, `false` otherwise.',\n seeAlso: ['>', '>=', '<=', 'compare'],\n examples: [\n '<(0, 1)',\n '<(1, 1.01)',\n '<(1, 1)',\n '<(1, 2, 2, 3)',\n '<(\"a\", \"b\")',\n ],\n },\n },\n '>=': {\n evaluate: ([first, ...rest], sourceCodeInfo): boolean => {\n let currentValue = asStringOrNumber(first)\n for (const param of rest) {\n if (compare(currentValue, asStringOrNumber(param), sourceCodeInfo) < 0)\n return false\n\n currentValue = asStringOrNumber(param)\n }\n return true\n },\n arity: { min: 1 },\n docs: {\n category: 'misc',\n returns: { type: 'boolean' },\n args: {\n a: { type: ['number', 'string'] },\n b: { type: ['number', 'string'] },\n x: { type: ['number', 'string'] },\n ys: { type: ['number', 'string'], rest: true },\n },\n variants: [\n { argumentNames: ['x'] },\n { argumentNames: ['x', 'ys'] },\n ],\n description: 'Returns `true` if $x and $ys are in non increasing order, `false` otherwise.',\n seeAlso: ['>', '<', '<=', 'compare'],\n examples: [\n '1 >= 1',\n '0 >= 1',\n '>=(1, 0)',\n '>=(1.01, 1)',\n '>=(1, 1)',\n '>=(4, 3, 2, 1)',\n '>=(3, 2, 2, 1)',\n ],\n },\n },\n '<=': {\n evaluate: ([first, ...rest], sourceCodeInfo): boolean => {\n let currentValue = asStringOrNumber(first)\n for (const param of rest) {\n if (compare(currentValue, asStringOrNumber(param), sourceCodeInfo) > 0)\n return false\n\n currentValue = asStringOrNumber(param)\n }\n return true\n },\n arity: { min: 1 },\n docs: {\n category: 'misc',\n returns: { type: 'boolean' },\n args: {\n a: { type: ['number', 'string'] },\n b: { type: ['number', 'string'] },\n x: { type: ['number', 'string'] },\n ys: { type: ['number', 'string'], rest: true },\n },\n variants: [\n { argumentNames: ['x'] },\n { argumentNames: ['x', 'ys'] },\n ],\n description: 'Returns `true` if $x and $ys are in non decreasing order, `false` otherwise.',\n seeAlso: ['>', '<', '>=', 'compare'],\n examples: [\n '1 <= 1',\n '<=(0, 1)',\n '<=(1, 1.01)',\n '<=(1, 1)',\n '<=(1, 2, 3, 4)',\n '<=(1, 2, 2, 3)',\n ],\n },\n },\n '!': {\n evaluate: ([first]): boolean => !first,\n arity: toFixedArity(1),\n docs: {\n category: 'misc',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Computes logical negation. Note that any other $x than `false`, `0`, `null` and `\\'\\'` is truthy.',\n seeAlso: ['boolean'],\n examples: [\n '!(3)',\n '!(true)',\n '!(\"A string\")',\n '!(0)',\n '!(false)',\n '!(null)',\n '!(\"\")',\n ],\n },\n },\n 'epoch->iso-date': {\n evaluate: ([ms], sourceCodeInfo): string => {\n assertNumber(ms, sourceCodeInfo)\n return new Date(ms).toISOString()\n },\n arity: toFixedArity(1),\n docs: {\n category: 'misc',\n returns: { type: 'string' },\n args: { ms: { type: 'number' } },\n variants: [{ argumentNames: ['ms'] }],\n description: 'Returns IOS date time string from `ms` (milliseconds elapsed since the UNIX epoch).',\n seeAlso: ['iso-date->epoch'],\n examples: [\n 'epoch->iso-date(1649756230899)',\n 'epoch->iso-date(0)',\n ],\n },\n },\n 'iso-date->epoch': {\n evaluate: ([dateTime], sourceCodeInfo): number => {\n assertString(dateTime, sourceCodeInfo)\n const ms = new Date(dateTime).valueOf()\n assertNumber(ms, sourceCodeInfo, { finite: true })\n return ms\n },\n arity: toFixedArity(1),\n docs: {\n category: 'misc',\n returns: { type: 'number' },\n args: { iso: { type: 'string' } },\n variants: [{ argumentNames: ['iso'] }],\n description: 'Returns milliseconds elapsed since the UNIX epoch to `iso`.',\n seeAlso: ['epoch->iso-date'],\n examples: [\n 'iso-date->epoch(\"2022-04-12T09:37:10.899Z\")',\n 'iso-date->epoch(\"1980-01-01\")',\n ],\n },\n },\n 'write!': {\n evaluate: (params, sourceCodeInfo): Any => {\n // eslint-disable-next-line no-console\n console.log(...params)\n\n if (params.length > 0)\n return asAny(params[params.length - 1], sourceCodeInfo)\n\n return null\n },\n arity: {},\n docs: {\n category: 'misc',\n returns: { type: 'any' },\n args: { values: { type: 'any', rest: true } },\n variants: [{ argumentNames: ['values'] }],\n description: 'It logs the $values and then returns the last argument. If called with no arguments `null` is returned.',\n examples: [\n 'write!(\"A string\")',\n 'write!(100, \"items\")',\n 'write!(object(\"a\", 10))',\n 'write!([\"a\", \"b\", \"c\"])',\n 'write!(#\"^start\")',\n 'write!(null, true, false)',\n ],\n hideOperatorForm: true,\n },\n },\n 'boolean': {\n evaluate: ([value]): boolean => {\n return !!value\n },\n arity: toFixedArity(1),\n docs: {\n category: 'misc',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Coerces $x to boolean.',\n seeAlso: ['!', 'boolean?', 'true?', 'false?'],\n examples: [\n 'boolean(0)',\n 'boolean(1)',\n 'boolean(null)',\n 'boolean(\"Albert\")',\n ],\n },\n },\n 'compare': {\n evaluate: ([a, b], sourceCodeInfo): number => {\n assertStringOrNumber(a, sourceCodeInfo)\n assertStringOrNumber(b, sourceCodeInfo)\n return compare(a, b, sourceCodeInfo)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'misc',\n returns: { type: 'number' },\n args: {\n a: { type: ['number', 'string'] },\n b: { type: ['number', 'string'] },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Compares two values. Returns `-1` if $a < $b, `1` if $a > $b and `0` if $a and $b have the same sort order.',\n seeAlso: ['<', '>', '<=', '>=', 'sort', 'sequence.sort-by'],\n examples: [\n 'compare(0, 1)',\n 'compare(0, 0)',\n 'compare(1, 0)',\n 'compare(\"Albert\", \"Mojir\")',\n ],\n },\n },\n 'json-parse': {\n evaluate: ([first], sourceCodeInfo): Any => {\n assertString(first, sourceCodeInfo)\n // eslint-disable-next-line ts/no-unsafe-return\n return JSON.parse(first)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'misc',\n returns: { type: 'any' },\n args: { x: { type: 'string' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `JSON.parse(`$x`)`.',\n seeAlso: ['json-stringify'],\n examples: [\n 'json-parse(\"[1, 2, 3]\")',\n ],\n },\n },\n 'json-stringify': {\n evaluate: ([first, second], sourceCodeInfo): string => {\n assertAny(first, sourceCodeInfo)\n if (second === undefined)\n return JSON.stringify(first)\n\n assertNumber(second, sourceCodeInfo)\n return JSON.stringify(first, null, second)\n },\n arity: { min: 1, max: 2 },\n docs: {\n category: 'misc',\n returns: { type: 'string' },\n args: {\n x: { type: 'any' },\n indent: { type: 'integer', description: 'Number of spaces to use for indentation.' },\n },\n variants: [\n { argumentNames: ['x'] },\n { argumentNames: ['x', 'indent'] },\n ],\n description: 'Returns `JSON.stringify(`$x`)`. If second argument is provided, returns `JSON.stringify(`$x`, null, `$indent`)`.',\n seeAlso: ['json-parse'],\n examples: [\n 'json-stringify([1, 2, 3])',\n 'json-stringify({ a: { b: 10 }}, 2)',\n ],\n hideOperatorForm: true,\n },\n },\n 'import': {\n evaluate: ([importPath], sourceCodeInfo, contextStack): ModuleFunction | Record<string, ModuleFunction> => {\n assertString(importPath, sourceCodeInfo)\n\n // Check if importing a specific function (e.g., \"grid.row\")\n const dotIndex = importPath.indexOf('.')\n if (dotIndex !== -1) {\n const moduleName = importPath.substring(0, dotIndex)\n const functionName = importPath.substring(dotIndex + 1)\n\n const module = contextStack.getModule(moduleName)\n if (!module) {\n throw new LitsError(`Unknown module: '${moduleName}'`, sourceCodeInfo)\n }\n\n const expression = module.functions[functionName]\n\n if (!expression) {\n throw new LitsError(`Function '${functionName}' not found in module '${moduleName}'`, sourceCodeInfo)\n }\n\n return {\n [FUNCTION_SYMBOL]: true,\n sourceCodeInfo,\n functionType: 'Module',\n moduleName,\n functionName,\n arity: expression.arity,\n }\n }\n\n // Import entire module\n const moduleName = importPath\n const module = contextStack.getModule(moduleName)\n if (!module) {\n throw new LitsError(`Unknown module: '${moduleName}'`, sourceCodeInfo)\n }\n\n // Create an object where each key is a function name and value is a ModuleFunction\n const result: Record<string, ModuleFunction> = {}\n for (const [functionName, expression] of Object.entries(module.functions)) {\n result[functionName] = {\n [FUNCTION_SYMBOL]: true,\n sourceCodeInfo,\n functionType: 'Module',\n moduleName,\n functionName,\n arity: expression.arity,\n }\n }\n return result\n },\n arity: toFixedArity(1),\n docs: {\n category: 'misc',\n returns: { type: 'any' },\n args: {\n path: {\n type: 'string',\n description: 'The module path to import. Can be a module name (e.g., \"vector\", \"grid\") or a fully qualified function name (e.g., \"vector.mean\", \"grid.row\").',\n },\n },\n variants: [{ argumentNames: ['path'] }],\n description: 'Imports module functions. Use a module name (e.g., \"vector\") to import all functions as an object, or a fully qualified name (e.g., \"vector.mean\") to import a single function directly.',\n examples: [\n 'let v = import(\"vector\"); v.mean([1, 2, 3, 4])',\n 'let v-sum = import(\"vector.sum\"); v-sum([1, 2, 3])',\n 'let g = import(\"grid\"); g.row([[1, 2], [3, 4]], 0)',\n ],\n },\n },\n}\n","import type { Any, Arr, Obj } from '../../interface'\nimport { assertArray, assertStringArray } from '../../typeGuards/array'\nimport { assertFunctionLike, assertObj } from '../../typeGuards/lits'\nimport { asString, assertString } from '../../typeGuards/string'\nimport { collHasKey, toAny } from '../../utils'\nimport { toFixedArity } from '../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../interface'\n\nexport const objectNormalExpression: BuiltinNormalExpressions = {\n 'keys': {\n evaluate: ([obj], sourceCodeInfo): string[] => {\n assertObj(obj, sourceCodeInfo)\n return Object.keys(obj)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'object',\n returns: { type: 'any', array: true },\n args: { obj: { type: 'object' } },\n variants: [{ argumentNames: ['obj'] }],\n description: 'Returns array of all keys in $obj.',\n seeAlso: ['vals', 'entries', 'zipmap', 'select-keys'],\n examples: [\n 'keys({})',\n 'keys({ x: 10, y: true, z: \"A string\" })',\n 'keys(object(\"x\", 10, \"y\", true, \"z\", \"A string\"))',\n ],\n },\n },\n\n 'vals': {\n evaluate: ([obj], sourceCodeInfo): Arr => {\n assertObj(obj, sourceCodeInfo)\n return Object.values(obj)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'object',\n returns: { type: 'any', array: true },\n args: { obj: { type: 'object' } },\n variants: [{ argumentNames: ['obj'] }],\n description: 'Returns array of all values in $obj.',\n seeAlso: ['keys', 'entries', 'zipmap'],\n examples: [\n 'vals({})',\n 'vals({ x: 10, y: true, z: \"A string\" })',\n 'vals(object(\"x\", 10, \"y\", true, \"z\", \"A string\"))',\n ],\n },\n },\n\n 'entries': {\n evaluate: ([obj], sourceCodeInfo): Array<[string, unknown]> => {\n assertObj(obj, sourceCodeInfo)\n return Object.entries(obj)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'object',\n returns: { type: 'array' },\n args: { obj: { type: 'object' } },\n variants: [{ argumentNames: ['obj'] }],\n description: 'Returns nested array of all key - value pairs in $obj.',\n seeAlso: ['keys', 'vals', 'zipmap', 'find'],\n examples: [\n 'entries({})',\n 'entries({ x: 10, y: true, z: \"A string\" })',\n 'entries(object(\"x\", 10, \"y\", true, \"z\", \"A string\"))',\n ],\n },\n },\n\n 'find': {\n evaluate: ([obj, key], sourceCodeInfo): [string, unknown] | null => {\n assertObj(obj, sourceCodeInfo)\n assertString(key, sourceCodeInfo)\n if (collHasKey(obj, key))\n return [key, obj[key]]\n\n return null\n },\n arity: toFixedArity(2),\n docs: {\n category: 'object',\n returns: { type: ['array', 'null'] },\n args: {\n a: { type: 'object' },\n b: { type: 'string' },\n obj: { type: 'object' },\n key: { type: 'string' },\n },\n variants: [{ argumentNames: ['obj', 'key'] }],\n description: 'Returns entry (key-value pair) for $key, or `null` if $key not present in $obj.',\n seeAlso: ['get', 'contains?', 'entries', 'sequence.position', 'some'],\n examples: [\n '{ a: 1, \"b\": 2 } find \"a\"',\n 'find(object(\"a\", 1, \"b\", 2), \"b\")',\n 'find(object(\"a\", 1, \"b\", 2), \"c\")',\n ],\n },\n },\n\n 'dissoc': {\n evaluate: ([obj, key], sourceCodeInfo): Any => {\n assertObj(obj, sourceCodeInfo)\n assertString(key, sourceCodeInfo)\n const newObj = { ...obj }\n delete newObj[key]\n return newObj\n },\n arity: toFixedArity(2),\n docs: {\n category: 'object',\n returns: { type: 'object' },\n args: {\n a: { type: 'object' },\n b: { type: 'string' },\n obj: { type: 'object' },\n key: { type: 'string' },\n },\n variants: [{ argumentNames: ['obj', 'key'] }],\n description: 'Return shallow copy of $obj with $key deleted.',\n seeAlso: ['assoc', 'select-keys'],\n examples: [\n '{ x: 10, y: 20 } dissoc \"y\"',\n 'dissoc({ x: 10, y: 20 }, \"x\")',\n 'dissoc({ x: 10 }, \"y\")',\n `\nlet o = { a: 5 };\ndissoc(o, \"a\");\no`,\n ],\n },\n },\n\n 'merge': {\n evaluate: (params, sourceCodeInfo): Any => {\n if (params.length === 0)\n return null\n\n const [first, ...rest] = params\n assertObj(first, sourceCodeInfo)\n\n return rest.reduce(\n (result: Obj, obj) => {\n assertObj(obj, sourceCodeInfo)\n return { ...result, ...obj }\n },\n { ...first },\n )\n },\n arity: { min: 0 },\n docs: {\n category: 'object',\n returns: { type: 'object' },\n args: {\n a: { type: 'object' },\n b: { type: 'object' },\n objs: { type: 'object', rest: true },\n },\n variants: [{ argumentNames: ['objs'] }],\n description: `Returns a new object created by merging together all arguments.\n\nIf two keys appears in more than one object the value from the last object is used.\nIf no arguments are provided \\`null\\` is returned.`,\n seeAlso: ['merge-with', 'assoc'],\n examples: [\n '{ x: 10 } merge { y: 20 }',\n 'merge(object(\"x\", 10), object(\"y\", 20))',\n 'merge(object(\"x\", 10), object(\"x\", 15, \"y\", 20))',\n ],\n },\n },\n\n 'merge-with': {\n evaluate: (params: Arr, sourceCodeInfo, contextStack, { executeFunction }): Any => {\n const first = params[0]\n const fn = params.at(-1)\n const rest = params.slice(1, -1)\n\n assertObj(first, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n\n return rest.reduce(\n (result: Obj, obj) => {\n assertObj(obj, sourceCodeInfo)\n Object.entries(obj).forEach((entry) => {\n const key = asString(entry[0], sourceCodeInfo)\n const val = toAny(entry[1])\n if (collHasKey(result, key))\n result[key] = executeFunction(fn, [result[key], val], contextStack, sourceCodeInfo)\n else\n result[key] = val\n })\n return result\n },\n { ...first },\n )\n },\n arity: { min: 2 },\n docs: {\n category: 'object',\n returns: { type: 'object' },\n args: {\n objs: { type: 'object', rest: true },\n fun: { type: 'function' },\n },\n variants: [{ argumentNames: ['objs', 'fun'] }],\n description: `\nReturns a new object created by merging together all arguments.\nIf two keys appears in more than one object $fun is used to calculate the new value.\n\nIf no arguments are provided \\`null\\` is returned.`,\n seeAlso: ['merge'],\n examples: [\n 'merge-with(object(\"x\", 10), object(\"y\", 20), +)',\n 'merge-with(object(\"x\", 10), object(\"x\", 15, \"y\", 20), +)',\n 'merge-with({ x: 10 }, { x: 20 }, { x: 30 }, { x: 40 }, -)',\n ],\n hideOperatorForm: true,\n },\n },\n\n 'zipmap': {\n evaluate: ([keys, values], sourceCodeInfo): Any => {\n assertStringArray(keys, sourceCodeInfo)\n assertArray(values, sourceCodeInfo)\n\n const length = Math.min(keys.length, values.length)\n\n const result: Obj = {}\n\n for (let i = 0; i < length; i += 1) {\n const key = asString(keys[i], sourceCodeInfo)\n result[key] = toAny(values[i])\n }\n return result\n },\n arity: toFixedArity(2),\n docs: {\n category: 'object',\n returns: { type: 'object' },\n args: {\n a: { type: 'array' },\n b: { type: 'array' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns a new object created by mapping $a to $b.',\n seeAlso: ['entries', 'keys', 'vals', 'sequence.interleave'],\n examples: [\n '[\"a\", \"b\", \"c\"] zipmap [1, 2, 3]',\n 'zipmap([\"a\", \"b\", \"c\"], [10, null, [1, 2, 3]])',\n 'zipmap([\"a\", \"b\", \"c\"], [1])',\n 'zipmap([], [10, null, [1, 2, 3]])',\n ],\n },\n },\n\n 'select-keys': {\n evaluate: ([obj, keys], sourceCodeInfo): Any => {\n assertStringArray(keys, sourceCodeInfo)\n assertObj(obj, sourceCodeInfo)\n\n return keys.reduce((result: Obj, key) => {\n if (collHasKey(obj, key))\n result[key] = toAny(obj[key])\n\n return result\n }, {})\n },\n arity: toFixedArity(2),\n docs: {\n category: 'object',\n returns: { type: 'object' },\n args: {\n a: { type: 'object' },\n b: { type: 'array' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns an object containing only those entries in $a whose key is in $b.',\n seeAlso: ['dissoc', 'keys'],\n examples: [\n '{ a: 1, b: 2, c: 3 } select-keys [\"a\", \"b\"]',\n 'select-keys({ a: 1, b: 2, c: 3 }, [\"a\", \"b\"])',\n 'select-keys({ a: 1 }, [\"a\", \"b\"])',\n ],\n },\n },\n}\n","import { isLitsFunction } from '../../typeGuards/litsFunction'\nimport { assertColl, isColl, isObj, isRegularExpression, isSeq } from '../../typeGuards/lits'\nimport { assertNumber, isNumber } from '../../typeGuards/number'\nimport type { BuiltinNormalExpressions } from '../interface'\nimport { isGrid, isMatrix, isVector } from '../../typeGuards/annotatedArrays'\nimport { EPSILON } from '../../utils'\nimport { toFixedArity } from '../../utils/arity'\n\nexport const predicatesNormalExpression: BuiltinNormalExpressions = {\n 'function?': {\n evaluate: ([first]): boolean => isLitsFunction(first),\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is a function, otherwise `false`.',\n seeAlso: ['string?', 'number?', 'boolean?', 'null?', 'array?', 'object?', 'regexp?'],\n examples: [\n 'function?(+)',\n 'function?(/)',\n 'function?((x, y) -> x + y)',\n 'function?(false)',\n 'function?(\"false\")',\n 'function?([1, 2, 3])',\n ],\n },\n },\n\n 'string?': {\n evaluate: ([first]): boolean => typeof first === 'string',\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is a string, otherwise `false`.',\n seeAlso: ['blank?', 'number?', 'boolean?', 'null?', 'array?', 'object?', 'regexp?', 'function?', 'collection?', 'sequence?'],\n examples: [\n 'string?(\"\")',\n 'string?(\"A string\")',\n 'string?(true ? \"A string\" : false)',\n 'string?(false)',\n 'string?([1, 2, 3])',\n 'string?(100)',\n ],\n },\n },\n\n 'number?': {\n evaluate: ([first]): boolean => typeof first === 'number',\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is a number, otherwise `false`.',\n seeAlso: ['integer?', 'zero?', 'pos?', 'neg?', 'finite?', 'number', 'string?', 'boolean?', 'null?', 'function?'],\n examples: [\n 'number?(0)',\n 'number?(2)',\n 'number?(-0.12)',\n 'number?(false)',\n 'number?([1, 2, 3])',\n 'number?(\"A string\")',\n ],\n },\n },\n\n 'integer?': {\n evaluate: ([first]): boolean => typeof first === 'number' && isNumber(first, { integer: true }),\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is an integer, otherwise `false`.',\n seeAlso: ['number?', 'number', 'even?', 'odd?'],\n examples: [\n 'integer?(0)',\n 'integer?(-12)',\n 'integer?(42)',\n 'integer?(10.1)',\n 'integer?((x, y) -> x + y)',\n 'integer?(false)',\n 'integer?(\"false\")',\n 'integer?([1, 2, 3])',\n ],\n },\n },\n\n 'boolean?': {\n evaluate: ([first]): boolean => typeof first === 'boolean',\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is a `boolean`, otherwise `false`.',\n seeAlso: ['true?', 'false?', 'boolean', 'string?', 'number?', 'null?', 'function?'],\n examples: [\n 'boolean?(true)',\n 'boolean?(false)',\n 'boolean?([1, 2, 3])',\n 'boolean?(0)',\n 'boolean?(\"A string\")',\n ],\n },\n },\n\n 'null?': {\n evaluate: ([first]): boolean => first === null || first === undefined,\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is `null`, otherwise `false`.',\n seeAlso: ['empty?', 'not-empty?', 'string?', 'number?', 'boolean?', 'function?'],\n examples: [\n 'null?(null)',\n 'null?(false)',\n 'null?([1, 2, 3])',\n 'null?(0)',\n 'null?(\"A string\")',\n ],\n },\n },\n\n 'zero?': {\n evaluate: ([value], sourceCodeInfo): boolean => {\n assertNumber(value, sourceCodeInfo, { finite: true })\n return Math.abs(value) < EPSILON\n },\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'number' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is `0`, otherwise `false`.',\n seeAlso: ['pos?', 'neg?', 'even?', 'number?'],\n examples: [\n 'zero?(0)',\n 'zero?(-0.0)',\n 'zero?(1)',\n 'zero?(0.1)',\n ],\n },\n },\n\n 'pos?': {\n evaluate: ([first], sourceCodeInfo): boolean => {\n assertNumber(first, sourceCodeInfo, { finite: true })\n return first > 0\n },\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'number' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is greater than `0`, otherwise `false`.',\n seeAlso: ['neg?', 'zero?', 'number?'],\n examples: [\n 'pos?(0)',\n 'pos?(-0.0)',\n 'pos?(1)',\n 'pos?(-0.1)',\n ],\n },\n },\n\n 'neg?': {\n evaluate: ([first], sourceCodeInfo): boolean => {\n assertNumber(first, sourceCodeInfo, { finite: true })\n return first < 0\n },\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'number' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is less than `0`, otherwise `false`.',\n seeAlso: ['pos?', 'zero?', 'number?'],\n examples: [\n 'neg?(0)',\n 'neg?(-0.0)',\n 'neg?(1)',\n 'neg?(-0.1)',\n ],\n },\n },\n\n 'even?': {\n evaluate: ([first], sourceCodeInfo): boolean => {\n assertNumber(first, sourceCodeInfo, { finite: true })\n return first % 2 === 0\n },\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'number' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is even, otherwise `false`.',\n seeAlso: ['odd?', 'integer?', 'zero?'],\n examples: [\n 'even?(0)',\n 'even?(-0.0)',\n 'even?(-1)',\n 'even?(2.1)',\n ],\n },\n },\n\n 'odd?': {\n evaluate: ([first], sourceCodeInfo): boolean => {\n assertNumber(first, sourceCodeInfo, { finite: true })\n return isNumber(first, { integer: true }) && first % 2 !== 0\n },\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'number' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is odd, otherwise `false`.',\n seeAlso: ['even?', 'integer?'],\n examples: [\n 'odd?(1.0)',\n 'odd?(1.001)',\n 'odd?(-1)',\n 'odd?(2.1)',\n ],\n },\n },\n\n 'array?': {\n evaluate: ([first]): boolean => {\n return Array.isArray(first)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is an array, otherwise `false`.',\n seeAlso: ['sequence?', 'collection?', 'object?', 'string?', 'vector?', 'matrix?', 'grid?', 'function?'],\n examples: [\n 'array?([])',\n 'array?([1, 2, 3])',\n 'array?(object(\"a\", 10))',\n 'array?(42)',\n 'array?(10.1)',\n 'array?((x, y) -> x + y)',\n ],\n },\n },\n\n 'collection?': {\n evaluate: ([first]): boolean => {\n return isColl(first)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is a collection i.e. an array, an object or a string, otherwise `false`.',\n seeAlso: ['sequence?', 'array?', 'object?', 'string?'],\n examples: [\n 'collection?([])',\n 'collection?([1, 2, 3])',\n 'collection?(object(\"a\", 10))',\n 'collection?(\"Albert\")',\n 'collection?(42)',\n 'collection?(10.1)',\n 'collection?((x, y) -> x + y)',\n ],\n },\n },\n\n 'sequence?': {\n evaluate: ([first]): boolean => {\n return isSeq(first)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is a sequence i.e. an array or a string, otherwise `false`.',\n seeAlso: ['collection?', 'array?', 'string?'],\n examples: [\n 'sequence?([])',\n 'sequence?([1, 2, 3])',\n 'sequence?(object(\"a\", 10))',\n 'sequence?(\"Albert\")',\n 'sequence?(42)',\n 'sequence?(10.1)',\n 'sequence?((x, y) -> x + y)',\n ],\n },\n },\n\n 'object?': {\n evaluate: ([first]): boolean => isObj(first),\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is an object, otherwise `false`.',\n seeAlso: ['collection?', 'array?', 'string?', 'function?'],\n examples: [\n 'object?(object(\"a\", 10))',\n 'object?(42)',\n 'object?(10.1)',\n 'object?((x, y) -> x + y)',\n 'object?(#\"^start\")',\n 'object?(\"false\")',\n 'object?([1, 2, 3])',\n ],\n },\n },\n\n 'regexp?': {\n evaluate: ([value]): boolean => isRegularExpression(value),\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is a regexp, otherwise `false`.',\n seeAlso: ['regexp', 'match', 'string?', 'function?'],\n examples: [\n 'regexp?(regexp(\"^start\"))',\n 'regexp?(#\"^start\")',\n 'regexp?(-12)',\n 'regexp?({})',\n 'regexp?(10.1)',\n 'regexp?((x, y) -> x + y)',\n 'regexp?(false)',\n 'regexp?(\"false\")',\n 'regexp?([1, 2, 3])',\n ],\n },\n },\n\n 'finite?': {\n evaluate: ([value], sourceCodeInfo): boolean => {\n assertNumber(value, sourceCodeInfo)\n return Number.isFinite(value)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'number' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is finite, otherwise `false`.',\n seeAlso: ['positive-infinity?', 'negative-infinity?', 'number?'],\n examples: [\n 'finite?(1.0)',\n 'finite?(1 / 0)',\n 'finite?(-1 / 0)',\n ],\n },\n },\n\n 'positive-infinity?': {\n evaluate: ([value], sourceCodeInfo): boolean => {\n assertNumber(value, sourceCodeInfo)\n return value === Number.POSITIVE_INFINITY\n },\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'number' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x equals positive infinity, otherwise `false`.',\n seeAlso: ['negative-infinity?', 'finite?'],\n examples: [\n 'positive-infinity?(1.0)',\n 'positive-infinity?(1 / 0)',\n 'positive-infinity?(-1 / 0)',\n ],\n },\n },\n\n 'negative-infinity?': {\n evaluate: ([value], sourceCodeInfo): boolean => {\n assertNumber(value, sourceCodeInfo)\n return value === Number.NEGATIVE_INFINITY\n },\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'number' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x equals negative infinity, otherwise `false`.',\n seeAlso: ['positive-infinity?', 'finite?'],\n examples: [\n 'negative-infinity?(1.0)',\n 'negative-infinity?(1 / 0)',\n 'negative-infinity?(-1 / 0)',\n ],\n },\n },\n\n 'true?': {\n evaluate: ([value]): boolean => {\n return value === true\n },\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is `true`, otherwise `false`.',\n seeAlso: ['false?', 'boolean?', 'boolean'],\n examples: [\n 'true?(false)',\n 'true?(true)',\n 'true?(1)',\n 'true?(0)',\n ],\n },\n },\n\n 'false?': {\n evaluate: ([value]): boolean => {\n return value === false\n },\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is `true`, otherwise `false`.',\n seeAlso: ['true?', 'boolean?', 'boolean'],\n examples: [\n 'false?(false)',\n 'false?(true)',\n 'false?(1)',\n 'false?(0)',\n ],\n },\n },\n\n 'empty?': {\n evaluate: ([coll], sourceCodeInfo): boolean => {\n if (coll === null)\n return true\n\n assertColl(coll, sourceCodeInfo)\n if (typeof coll === 'string')\n return coll.length === 0\n\n if (Array.isArray(coll))\n return coll.length === 0\n\n return Object.keys(coll).length === 0\n },\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: ['collection', 'string', 'null'] } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `true` if $x is empty or `null`, otherwise `false`.',\n seeAlso: ['not-empty?', 'collection.not-empty', 'null?', 'blank?', 'count'],\n examples: [\n 'empty?([])',\n 'empty?([1, 2, 3])',\n 'empty?({})',\n 'empty?({ a: 2 })',\n 'empty?(\"\")',\n 'empty?(\"Albert\")',\n 'empty?(null)',\n ],\n },\n },\n 'not-empty?': {\n evaluate: ([coll], sourceCodeInfo): boolean => {\n if (coll === null)\n return false\n\n assertColl(coll, sourceCodeInfo)\n if (typeof coll === 'string')\n return coll.length > 0\n\n if (Array.isArray(coll))\n return coll.length > 0\n\n return Object.keys(coll).length > 0\n },\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n returns: { type: 'boolean' },\n args: { x: { type: ['collection', 'string', 'null'] } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns `false` if $x is empty or `null`, otherwise `true`.',\n seeAlso: ['empty?', 'collection.not-empty', 'null?'],\n examples: [\n 'not-empty?([])',\n 'not-empty?([1, 2, 3])',\n 'not-empty?({})',\n 'not-empty?({ a: 2 })',\n 'not-empty?(\"\")',\n 'not-empty?(\"Albert\")',\n 'not-empty?(null)',\n ],\n },\n },\n 'vector?': {\n evaluate: ([vector]): boolean => isVector(vector),\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n description: 'Checks if a value is a `vector`. A `vector` is an array of `numbers`.',\n seeAlso: ['matrix?', 'grid?', 'array?'],\n returns: { type: 'boolean' },\n args: { value: { type: 'any', description: 'The value to check.' } },\n variants: [{ argumentNames: ['value'] }],\n examples: [\n 'vector?(1)',\n 'vector?([1, 2, 3])',\n 'vector?([1, 2, \"3\"])',\n ],\n },\n },\n 'matrix?': {\n evaluate: ([matrix]): boolean => isMatrix(matrix),\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n description: 'Checks if a value is a `matrix`. A `matrix` is an array of arrays of `numbers`.',\n seeAlso: ['vector?', 'grid?', 'array?'],\n returns: { type: 'boolean' },\n args: { value: { type: 'any', description: 'The value to check.' } },\n variants: [{ argumentNames: ['value'] }],\n examples: [\n 'matrix?(1)',\n 'matrix?([1, 2, 3])',\n 'matrix?([[1, 2], [3, 4]])',\n 'matrix?([[1, 2], [3, \"4\"]])',\n 'matrix?([[1, 2], [3]])',\n ],\n },\n },\n 'grid?': {\n evaluate: ([table]): boolean => isGrid(table),\n arity: toFixedArity(1),\n docs: {\n category: 'predicate',\n description: 'Checks if a `value` is a `grid`. A `grid` is an `array` of `arrays` where all inner `arrays` have the same length.',\n seeAlso: ['vector?', 'matrix?', 'array?'],\n returns: { type: 'boolean' },\n args: { value: { type: 'any', description: 'The value to check.' } },\n variants: [{ argumentNames: ['value'] }],\n examples: [\n 'grid?(\"1\")',\n 'grid?([\"1\", 2, 3])',\n 'grid?([[\"1\", 2], [3, 4]])',\n 'grid?([[\"1\", 2], [3, \"4\"]])',\n 'grid?([[\"1\", 2], [3]])',\n ],\n },\n },\n\n}\n","import { LitsError } from '../../errors'\nimport type { RegularExpression } from '../../parser/types'\nimport { assertRegularExpression, assertStringOrRegularExpression, isRegularExpression } from '../../typeGuards/lits'\nimport { assertString, isString } from '../../typeGuards/string'\nimport { toFixedArity } from '../../utils/arity'\nimport { REGEXP_SYMBOL } from '../../utils/symbols'\nimport type { BuiltinNormalExpressions } from '../interface'\n\nexport const regexpNormalExpression: BuiltinNormalExpressions = {\n 'regexp': {\n evaluate: ([sourceArg, flagsArg], sourceCodeInfo): RegularExpression => {\n assertString(sourceArg, sourceCodeInfo)\n const source = sourceArg || '(?:)'\n const flags = typeof flagsArg === 'string' ? flagsArg : ''\n\n try {\n // eslint-disable-next-line no-new\n new RegExp(source, flags) // Throws if invalid regexp\n }\n catch (e) {\n throw new LitsError(`Invalid regular expression: ${source} ${flags}`, sourceCodeInfo)\n }\n return {\n [REGEXP_SYMBOL]: true,\n sourceCodeInfo,\n s: source,\n f: flags,\n }\n },\n arity: { min: 1, max: 2 },\n docs: {\n category: 'regular-expression',\n returns: { type: 'regexp' },\n args: {\n pattern: { type: 'string' },\n flags: { type: 'string', description: 'Optional flags for the regular expression. Possible values are the same as Javascript RegExp takes.' },\n },\n variants: [\n { argumentNames: ['pattern'] },\n { argumentNames: ['pattern', 'flags'] },\n ],\n description: 'Creates a RegExp from $pattern and $flags.',\n examples: [\n 'regexp(\"^\\\\s*(.*)$\")',\n '#\"^\\\\s*(.*)$\"',\n 'regexp(\"albert\", \"ig\")',\n '#\"albert\"ig',\n ],\n seeAlso: ['-short-regexp', 'match', 'replace', 'replace-all', 'regexp?'],\n hideOperatorForm: true,\n },\n },\n 'match': {\n evaluate: ([text, regexp], sourceCodeInfo): string[] | null => {\n assertRegularExpression(regexp, sourceCodeInfo)\n if (!isString(text))\n return null\n\n const regExp = new RegExp(regexp.s, regexp.f)\n const match = regExp.exec(text)\n if (match)\n return [...match]\n\n return null\n },\n arity: toFixedArity(2),\n docs: {\n category: 'regular-expression',\n returns: { type: 'any', array: true },\n args: {\n a: { type: 'regexp' },\n b: { type: 'string' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: `Matches $b against regular expression $a.\nIf $b is a string and matches the regular expression, a \\`match\\`-array is returned, otherwise \\`null\\` is returned.`,\n seeAlso: ['regexp', 'replace', 'replace-all', '-short-regexp', 'regexp?'],\n examples: [\n 'match(\" A string\", regexp(\"^\\\\\\\\s*(.*)$\"))',\n 'match(\" A string\", #\"^\\\\s*(.*)$\")',\n 'match(\"My name is Albert\", #\"albert\"i)',\n 'match(\"My name is Ben\", #\"albert\"i)',\n 'match(null, #\"albert\"i)',\n 'match(1, #\"albert\"i)',\n 'match({}, #\"albert\"i)',\n ],\n },\n },\n 'replace': {\n evaluate: ([str, regexp, value], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n assertStringOrRegularExpression(regexp, sourceCodeInfo)\n assertString(value, sourceCodeInfo)\n\n const matcher = isRegularExpression(regexp) ? new RegExp(regexp.s, `${regexp.f}`) : regexp\n return str.replace(matcher, value)\n },\n arity: toFixedArity(3),\n docs: {\n category: 'regular-expression',\n returns: { type: 'any', array: true },\n args: {\n a: { type: 'string' },\n b: { type: ['regexp', 'string'] },\n x: { type: 'string' },\n },\n variants: [{ argumentNames: ['a', 'b', 'x'] }],\n description: 'Returns a new string with first match of regular expression $b replaced by $x.',\n seeAlso: ['replace-all', 'regexp', 'match', '-short-regexp'],\n examples: [\n 'replace(\"Duck duck\", \"u\", \"i\")',\n 'replace(\"Duck duck\", #\"u\", \"i\")',\n 'replace(\"abcABC\", regexp(\"a\", \"i\"), \"-\")',\n 'replace(\"abcABC\", regexp(\"a\", \"gi\"), \"-\")',\n 'replace(\"abcABC\", #\"a\"i, \"-\")',\n 'replace(\"abcABC\", #\"a\"gi, \"-\")',\n ],\n },\n },\n 'replace-all': {\n evaluate: ([str, regexp, value], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n assertStringOrRegularExpression(regexp, sourceCodeInfo)\n assertString(value, sourceCodeInfo)\n const matcher = isRegularExpression(regexp) ? new RegExp(regexp.s, `${regexp.f.includes('g') ? regexp.f : `${regexp.f}g`}`) : regexp\n return str.replaceAll(matcher, value)\n },\n arity: toFixedArity(3),\n docs: {\n category: 'regular-expression',\n returns: { type: 'any', array: true },\n args: {\n a: { type: 'string' },\n b: { type: ['regexp', 'string'] },\n x: { type: 'string' },\n },\n variants: [{ argumentNames: ['a', 'b', 'x'] }],\n description: 'Returns a new string with all matches of regular expression $b replaced by $x.',\n seeAlso: ['replace', 'regexp', 'match', '-short-regexp'],\n examples: [\n 'replace-all(\"Duck duck\", \"u\", \"i\")',\n 'replace-all(\"Duck duck\", regexp(\"u\"), \"i\")',\n 'replace-all(\"abcABC\", regexp(\"a\", \"i\"), \"-\")',\n 'replace-all(\"abcABC\", regexp(\"a\", \"gi\"), \"-\")',\n 'replace-all(\"abcABC\", #\"a\"i, \"-\")',\n 'replace-all(\"abcABC\", #\"a\"gi, \"-\")',\n ],\n },\n },\n}\n","import { LitsError } from '../../errors'\nimport type { Arr } from '../../interface'\nimport { assertArray } from '../../typeGuards/array'\nimport { assertStringOrRegularExpression, isObj } from '../../typeGuards/lits'\nimport { assertNumber } from '../../typeGuards/number'\nimport { assertString, assertStringOrNumber } from '../../typeGuards/string'\nimport { toFixedArity } from '../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../interface'\n\nconst blankRegexp = /^\\s*$/\nexport const stringNormalExpression: BuiltinNormalExpressions = {\n 'str': {\n evaluate: (params: Arr) => {\n return params.reduce((result: string, param) => {\n const paramStr\n = param === undefined || param === null\n ? ''\n : isObj(param)\n ? JSON.stringify(param)\n : Array.isArray(param)\n ? JSON.stringify(param)\n : `${param}`\n return result + paramStr\n }, '')\n },\n arity: {},\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: { values: { type: 'any', rest: true } },\n variants: [{ argumentNames: ['values'] }],\n description: 'Concatenats $values into one string. If `value` equals `null` empty string is returned.',\n seeAlso: ['++', 'join', 'string.template', 'string.string-repeat', 'number'],\n examples: [\n 'str(\"A string\", \", and another string\", \" ...and more\")',\n 'str(\"Just one string\")',\n 'str()',\n 'str(0, false, true, null, #\"^kalle\", [1, 2, 3], {a: \"a\"})',\n ],\n hideOperatorForm: true,\n },\n },\n\n 'number': {\n evaluate: ([str], sourceCodeInfo): number => {\n assertString(str, sourceCodeInfo)\n const number = Number(str)\n if (Number.isNaN(number))\n throw new LitsError(`Could not convert '${str}' to a number.`, sourceCodeInfo)\n\n return number\n },\n arity: toFixedArity(1),\n docs: {\n category: 'string',\n returns: { type: 'number' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Parses $s to a number.',\n seeAlso: ['str', 'number?', 'integer?'],\n examples: [\n 'number(\"10\")',\n 'number(\"010\")',\n 'number(\"-1.01\")',\n ],\n },\n },\n\n 'lower-case': {\n evaluate: ([str], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n return str.toLowerCase()\n },\n arity: toFixedArity(1),\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Returns $s converted to lower case.',\n seeAlso: ['upper-case', 'string.capitalize'],\n examples: [\n 'lower-case(\"Albert\")',\n 'lower-case(\"\")',\n ],\n },\n },\n\n 'upper-case': {\n evaluate: ([str], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n return str.toUpperCase()\n },\n arity: toFixedArity(1),\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Returns $s converted to upper case.',\n seeAlso: ['lower-case', 'string.capitalize'],\n examples: [\n 'upper-case(\"Albert\")',\n 'upper-case(\"\")',\n ],\n },\n },\n\n 'trim': {\n evaluate: ([str], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n return str.trim()\n },\n arity: toFixedArity(1),\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Returns a new string with leading and trailing whitespaces removed.',\n seeAlso: ['string.trim-left', 'string.trim-right', 'blank?'],\n examples: [\n 'trim(\" Albert \")',\n 'trim(\" \")',\n 'trim(\"\")',\n ],\n },\n },\n\n 'join': {\n evaluate: ([stringList, delimiter], sourceCodeInfo): string => {\n assertArray(stringList, sourceCodeInfo)\n stringList.forEach(str => assertStringOrNumber(str, sourceCodeInfo))\n assertString(delimiter, sourceCodeInfo)\n return stringList.join(delimiter)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: {\n a: { type: 'array' },\n b: { type: 'string' },\n arr: { type: 'array' },\n delimiter: { type: 'string' },\n },\n variants: [{ argumentNames: ['arr', 'delimiter'] }],\n description: 'Returns a new string by concatenating all of the elements in $arr, separated by $delimiter.',\n seeAlso: ['split', 'str', '++', 'sequence.interpose'],\n examples: [\n 'map([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], str) join \", \"',\n '([0, 1, 2, 3, 4, 5, 6, 7, 8, 9] map str) join \", \"',\n 'join([\"Albert\", 10], \", \")',\n 'join([\"Albert\", \"Mojir\"], \" \")',\n 'join(map([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], str), \", \")',\n ],\n },\n },\n\n 'split': {\n evaluate: ([str, stringOrRegExpValue, limit], sourceCodeInfo): string[] => {\n assertString(str, sourceCodeInfo)\n assertStringOrRegularExpression(stringOrRegExpValue, sourceCodeInfo)\n if (limit !== undefined)\n assertNumber(limit, sourceCodeInfo, { integer: true, nonNegative: true })\n\n const delimiter\n = typeof stringOrRegExpValue === 'string'\n ? stringOrRegExpValue\n : new RegExp(stringOrRegExpValue.s, stringOrRegExpValue.f)\n return str.split(delimiter, limit)\n },\n arity: { min: 2, max: 3 },\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: {\n a: { type: 'string' },\n b: { type: 'string' },\n s: { type: 'string' },\n delimiter: { type: 'string' },\n limit: { type: 'integer' },\n },\n variants: [\n { argumentNames: ['s', 'delimiter'] },\n { argumentNames: ['s', 'delimiter', 'limit'] },\n ],\n description: 'Divides $s into an array of substrings. The division is done by searching for `delimiter`. If `limit` as provided, at most `limit` number of substrings are returned.',\n seeAlso: ['join', 'string.split-lines'],\n examples: [\n '\"Albert Mojir\" split \" \"',\n 'split(\"Albert Mojir\", \" \")',\n 'split(\"abcdefghijklmnopqrstuvw\", #\"[aoueiy]\")',\n 'split(\"0123456789\", \"\")',\n 'split(\"0123456789\", \"\", 5) map number',\n ],\n },\n },\n 'blank?': {\n evaluate: ([value], sourceCodeInfo): boolean => {\n if (value === null) {\n return true\n }\n assertString(value, sourceCodeInfo)\n return blankRegexp.test(value)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'string',\n returns: { type: 'boolean' },\n args: { s: { type: ['string', 'null'] } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Returns true if $s is null or only contains whitespace characters.',\n seeAlso: ['trim', 'empty?', 'string?'],\n examples: [\n 'blank?(\"\")',\n 'blank?(null)',\n 'blank?(\"\\n\")',\n 'blank?(\" \")',\n 'blank?(\".\")',\n ],\n },\n },\n}\n","import type { Any, Arr } from '../../interface'\nimport type {\n CompFunction,\n ConstantlyFunction,\n FunctionLike,\n} from '../../parser/types'\nimport { toAny } from '../../utils'\nimport { getArityFromFunction, toFixedArity } from '../../utils/arity'\nimport { FUNCTION_SYMBOL } from '../../utils/symbols'\nimport type { BuiltinNormalExpressions } from '../interface'\nimport { assertArray } from '../../typeGuards/array'\nimport { assertFunctionLike } from '../../typeGuards/lits'\n\nexport const functionalNormalExpression: BuiltinNormalExpressions = {\n '|>': {\n evaluate: ([value, func], sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertFunctionLike(func, sourceCodeInfo)\n return executeFunction(func, [value], contextStack, sourceCodeInfo)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'functional',\n returns: { type: 'any' },\n args: {\n a: { type: 'any' },\n b: { type: 'function' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Takes a value $a and a function $b, and returns the result of applying $b to $a.',\n seeAlso: ['apply', 'comp'],\n examples: [\n `\n1 |> inc |> inc`,\n `range(10)\n |> map(_, -> $ ^ 2) // [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]\n |> filter(_, odd?) // [1, 9, 25, 49, 81]\n |> reduce(_, +, 0) // 165\n |> sqrt // 12.84523257866513\n |> round(_, 2)`,\n ],\n },\n },\n 'apply': {\n evaluate: ([func, ...params]: Arr, sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertFunctionLike(func, sourceCodeInfo)\n const paramsLength = params.length\n const last = params[paramsLength - 1]\n assertArray(last, sourceCodeInfo)\n const applyArray = [...params.slice(0, -1), ...last]\n return executeFunction(func, applyArray, contextStack, sourceCodeInfo)\n },\n arity: { min: 2 },\n docs: {\n category: 'functional',\n returns: { type: 'any' },\n args: {\n a: { type: 'function' },\n b: { type: 'array' },\n fun: { type: 'function' },\n args: { type: 'array' },\n },\n variants: [{ argumentNames: ['fun', 'args'] }],\n description: 'Call supplied function $fun with specified arguments $args.',\n seeAlso: ['|>'],\n examples: [\n `\napply(+, [1, 2, 3])`,\n `\napply(\n (x, y) -> sqrt(x ^ 2 + y ^ 2),\n [3, 4]\n)`,\n `\n(x, y) -> sqrt(x ^ 2 + y ^ 2) apply [3, 4]`,\n ],\n },\n },\n\n 'identity': {\n evaluate: ([value]): Any => {\n return toAny(value)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'functional',\n returns: { type: 'any' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns $x.',\n seeAlso: ['constantly', 'functional.fnull'],\n examples: ['identity(1)', 'identity(\"Albert\")', 'identity({ a: 1 })', 'identity(null)'],\n },\n },\n\n 'comp': {\n evaluate: (params, sourceCodeInfo): CompFunction => {\n params.forEach(param => assertFunctionLike(param, sourceCodeInfo))\n return {\n [FUNCTION_SYMBOL]: true,\n sourceCodeInfo,\n functionType: 'Comp',\n params,\n arity: params.length > 0 ? getArityFromFunction(params.at(-1) as FunctionLike) : { min: 1, max: 1 },\n }\n },\n arity: {},\n docs: {\n category: 'functional',\n returns: { type: 'function' },\n args: {\n a: { type: 'function' },\n b: { type: 'function' },\n fns: { type: 'function', rest: true },\n },\n variants: [{ argumentNames: ['fns'] }],\n description: `Takes a variable number of functions and returns a function that is the composition of those.\n\n The returned function takes a variable number of arguments,\n applies the rightmost function to the args,\n the next function (right-to-left) to the result, etc.`,\n seeAlso: ['|>', 'functional.juxt', 'functional.complement'],\n examples: [\n `\nlet negative-quotient = comp(-, /);\nnegative-quotient(9, 3)`,\n `\nlet x = { bar: { foo: 42 } };\ncomp(\"foo\", \"bar\")(x)`,\n ],\n },\n },\n\n 'constantly': {\n evaluate: ([value], sourceCodeInfo): ConstantlyFunction => {\n return {\n [FUNCTION_SYMBOL]: true,\n sourceCodeInfo,\n functionType: 'Constantly',\n value: toAny(value),\n arity: {},\n }\n },\n arity: toFixedArity(1),\n docs: {\n category: 'functional',\n returns: { type: 'function' },\n args: { x: { type: 'any' } },\n variants: [{ argumentNames: ['x'] }],\n description: 'Returns a function that takes any number of arguments and always returns $x.',\n seeAlso: ['identity', 'functional.fnull'],\n examples: [\n `\nlet always-true = constantly(true);\nalways-true(9, 3)`,\n ],\n },\n },\n\n}\n","import { smartTrim } from '..'\nimport type { Argument, FunctionReference, TypedValue } from '../../../reference'\n\nexport function generateDocString(reference: FunctionReference): string {\n return smartTrim(`\n ${reference.title}\n\n ${reference.description\n .replace(/`(.+?)`/g, '$1')\n .replace(/\\$(\\w+)/g, '$1')\n .replace(/\\*\\*\\*(.+)\\*\\*\\*/g, '$1')\n .replace(/\\*\\*(.+)\\*\\*/g, '$1')\n }\n\n Signature:\n ${signature(reference).join('\\n ')}\n\n Arguments:\n ${argStrings(reference).join('\\n ')}\n\n Examples:\n${reference.examples.map(example => smartTrim(example, 4)).join('\\n\\n')}`)\n}\n\nfunction signature({ title, variants, args, returns, _isOperator }: FunctionReference): string[] {\n const functionForms = variants.map((variant) => {\n const form = ` ${title}(${variant.argumentNames.map((argName) => {\n let result = ''\n const arg = args[argName]!\n if (arg.rest) {\n result += '...'\n }\n result += argName\n return result\n }).join(', ')})`\n\n return `${form} -> ${type(returns)}`\n })\n\n const operatorForm = _isOperator ? ['', 'Operator:', ` a ${title} b -> ${type(returns)}`] : []\n\n return [\n ...functionForms,\n ...operatorForm,\n ]\n}\n\nfunction type(arg: Argument | TypedValue) {\n const argType = arg.type\n const types = Array.isArray(argType) ? argType : [argType]\n const typeString = types.join(' | ')\n return arg.array || arg.rest ? `Array<${typeString}>` : typeString\n}\n\nfunction argStrings(reference: FunctionReference): string[] {\n return Object.entries(reference.args).map(([argName, arg]) => `${argName}: ${type(arg)}`)\n}\n","import type { FunctionReference } from '../../../reference'\nimport { assertNonUndefined } from '../../typeGuards'\nimport { assertFunctionLike } from '../../typeGuards/lits'\nimport { isLitsFunction } from '../../typeGuards/litsFunction'\nimport { toFixedArity } from '../../utils/arity'\nimport { generateDocString } from '../../utils/docString/generateDocString'\nimport type { Arity, BuiltinNormalExpressions } from '../interface'\n\nexport function getMetaNormalExpression(normalExpressionReference: Record<string, FunctionReference>): BuiltinNormalExpressions {\n return {\n doc: {\n evaluate: ([fn], sourceCodeInfo): string => {\n assertNonUndefined(normalExpressionReference)\n assertFunctionLike(fn, sourceCodeInfo)\n if (!isLitsFunction(fn)) {\n return ''\n }\n if (fn.functionType === 'Builtin') {\n const reference = normalExpressionReference[fn.name]\n return reference ? generateDocString(reference) : ''\n }\n if (fn.functionType === 'UserDefined' || fn.functionType === 'NativeJsFunction') {\n return fn.docString\n }\n return ''\n },\n arity: toFixedArity(1),\n docs: {\n category: 'meta',\n returns: { type: 'string' },\n args: { fun: { type: 'function' } },\n variants: [{ argumentNames: ['fun'] }],\n description: 'Returns documentation string of the $fun.',\n seeAlso: ['arity'],\n examples: [\n 'doc(+)',\n `\nlet add = (x, y) -> do\n \"\"\"\n Adds two numbers.\n Args:\n x: First number.\n y: Second number.\n Returns:\n Sum of x and y.\n \"\"\"\n x + y;\nend;\n\ndoc(add)`,\n ],\n },\n },\n arity: {\n evaluate: ([fn], sourceCodeInfo): Arity => {\n assertFunctionLike(fn, sourceCodeInfo)\n return isLitsFunction(fn) ? fn.arity : toFixedArity(1)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'meta',\n returns: { type: 'object' },\n args: { fun: { type: 'function' } },\n variants: [{ argumentNames: ['fun'] }],\n description: 'Returns arity of the $fun. The arity is an object with the properties: `min` and `max`. If the function has fixed arity, `min` and `max` are equal to the number of required parameters. If no restrictions apply, empty object is returned.',\n seeAlso: ['doc'],\n examples: [\n 'arity(+)',\n 'arity(defined?)',\n `\nlet add = (x, y = 0) -> do\n x + y;\nend;\n\narity(add)`,\n `\nlet foo = (k, ...x) -> do\n k + x;\nend;\n arity(foo)`,\n ],\n },\n },\n }\n}\n","import { assertNonEmptyVector, assertVector } from '../../typeGuards/annotatedArrays'\nimport { toFixedArity } from '../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../interface'\n\nfunction calcMedian(vector: number[]): number {\n const sorted = [...vector].sort((a, b) => a - b)\n const mid = Math.floor(sorted.length / 2)\n return sorted.length % 2 === 0\n ? (sorted[mid - 1]! + sorted[mid]!) / 2\n : sorted[mid]!\n}\n\nexport const vectorNormalExpression: BuiltinNormalExpressions = {\n sum: {\n evaluate: ([vector], sourceCodeInfo): number => {\n assertVector(vector, sourceCodeInfo)\n return vector.reduce((acc, val) => acc + val, 0)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'vector',\n returns: { type: 'number' },\n args: {\n vector: { type: 'vector', description: 'The vector to sum.' },\n },\n variants: [{ argumentNames: ['vector'] }],\n description: 'Returns the **sum** of all elements in the `vector`. Returns `0` for an empty vector.',\n seeAlso: ['prod', 'mean', 'median', 'vector.sum'],\n examples: [\n 'sum([1, 2, 3, 4, 5])',\n 'sum([1, -2, 3])',\n 'sum([])',\n ],\n },\n },\n\n prod: {\n evaluate: ([vector], sourceCodeInfo): number => {\n assertVector(vector, sourceCodeInfo)\n return vector.reduce((acc, val) => acc * val, 1)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'vector',\n returns: { type: 'number' },\n args: {\n vector: { type: 'vector', description: 'The vector to multiply.' },\n },\n variants: [{ argumentNames: ['vector'] }],\n description: 'Returns the **product** of all elements in the `vector`. Returns `1` for an empty vector.',\n seeAlso: ['sum', 'mean', 'median', 'vector.prod'],\n examples: [\n 'prod([1, 2, 3, 4, 5])',\n 'prod([1, -2, 3])',\n 'prod([])',\n ],\n },\n },\n\n mean: {\n evaluate: ([vector], sourceCodeInfo): number => {\n assertNonEmptyVector(vector, sourceCodeInfo)\n return vector.reduce((acc, val) => acc + val, 0) / vector.length\n },\n arity: toFixedArity(1),\n docs: {\n category: 'vector',\n returns: { type: 'number' },\n args: {\n vector: { type: 'vector', description: 'The vector to calculate the mean of.' },\n },\n variants: [{ argumentNames: ['vector'] }],\n description: 'Returns the arithmetic **mean** of all elements in the `vector`. Throws for an empty vector.',\n seeAlso: ['median', 'sum', 'prod', 'vector.mean'],\n examples: [\n 'mean([1, 2, 3, 4, 5])',\n 'mean([1, -2, 3])',\n ],\n },\n },\n\n median: {\n evaluate: ([vector], sourceCodeInfo): number => {\n assertNonEmptyVector(vector, sourceCodeInfo)\n return calcMedian(vector)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'vector',\n returns: { type: 'number' },\n args: {\n vector: { type: 'vector', description: 'The vector to calculate the median of.' },\n },\n variants: [{ argumentNames: ['vector'] }],\n description: 'Returns the **median** of all elements in the `vector`. For even-length vectors, returns the average of the two middle values. Throws for an empty vector.',\n seeAlso: ['mean', 'sum', 'prod', 'vector.median'],\n examples: [\n 'median([1, 2, 3, 4, 5])',\n 'median([1, 2, 3, 4])',\n 'median([3, 1, 4, 1, 5])',\n ],\n },\n },\n}\n","import type { BuiltinNormalExpression, BuiltinNormalExpressions } from '../interface'\nimport type { Any } from '../../interface'\nimport type { FunctionReference } from '../../../reference'\nimport type { CoreNormalExpressionName } from '../../../reference/api'\n\n// Core categories - always available\nimport { bitwiseNormalExpression } from '../core/bitwise'\nimport { collectionNormalExpression } from '../core/collection'\nimport { arrayNormalExpression } from '../core/array'\nimport { sequenceNormalExpression } from '../core/sequence'\nimport { mathNormalExpression } from '../core/math'\nimport { miscNormalExpression } from '../core/misc'\nimport { objectNormalExpression } from '../core/object'\nimport { predicatesNormalExpression } from '../core/predicates'\nimport { regexpNormalExpression } from '../core/regexp'\nimport { stringNormalExpression } from '../core/string'\nimport { functionalNormalExpression } from '../core/functional'\nimport { getMetaNormalExpression } from '../core/meta'\nimport { vectorNormalExpression } from '../core/vector'\n\nconst normalExpressionReference: Record<string, FunctionReference> = {}\n\nexport function setNormalExpressionReference(reference: Record<CoreNormalExpressionName, FunctionReference>) {\n Object.assign(normalExpressionReference, reference)\n}\n\nconst expressions: BuiltinNormalExpressions = {\n // Core categories\n ...bitwiseNormalExpression,\n ...collectionNormalExpression,\n ...arrayNormalExpression,\n ...sequenceNormalExpression,\n ...mathNormalExpression,\n ...getMetaNormalExpression(normalExpressionReference),\n ...miscNormalExpression,\n ...objectNormalExpression,\n ...predicatesNormalExpression,\n ...regexpNormalExpression,\n ...stringNormalExpression,\n ...functionalNormalExpression,\n ...vectorNormalExpression,\n}\n\nObject.entries(expressions).forEach(([name, expression]) => {\n expression.name = name\n})\n\nexport const normalExpressions: BuiltinNormalExpressions = {\n ...expressions,\n}\n\nexport const normalExpressionTypes: Record<string, number> = {}\nexport const allNormalExpressions: BuiltinNormalExpression<Any>[] = []\n\nObject.entries(normalExpressions).forEach(([key, value], index) => {\n normalExpressionTypes[key] = index\n allNormalExpressions.push(value)\n})\n","import type { Any } from '../../interface'\nimport type { Node, SpecialExpressionNode } from '../../parser/types'\nimport { asAny } from '../../typeGuards/lits'\nimport type { BuiltinSpecialExpression, FunctionDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type AndNode = SpecialExpressionNode<[typeof specialExpressionTypes['&&'], Node[]]>\n\nconst docs: FunctionDocs = {\n category: 'special-expression',\n returns: {\n type: 'any',\n },\n args: {\n a: { type: 'any' },\n b: { type: 'any' },\n c: {\n type: 'any',\n rest: true,\n },\n },\n variants: [\n { argumentNames: ['a', 'b'] },\n { argumentNames: ['a', 'b', 'c'] },\n ],\n description: `\nComputes logical \\`and\\`. Evaluation of expressions starts from left.\nAs soon as an \\`expression\\` evaluates to a falsy value, the result is returned.\n\nIf all expressions evaluate to truthy values, the value of the last expression is returned.`,\n examples: [\n 'true && 1',\n '&&(1, 1)',\n '&&(3 > 2, \"string\")',\n '&&(3 < 2, \"string\")',\n '&&(true, true, true, true)',\n '&&(true, true, 0, true)',\n ],\n}\n\nexport const andSpecialExpression: BuiltinSpecialExpression<Any, AndNode> = {\n arity: {},\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n let value: Any = true\n\n for (const param of node[1][1]) {\n value = evaluateNode(param, contextStack)\n if (!value)\n break\n }\n\n return value\n },\n evaluateAsNormalExpression: (params, sourceCodeInfo) => {\n let value: Any = true\n for (const param of params) {\n value = asAny(param, sourceCodeInfo)\n if (!value)\n break\n }\n return value\n },\n\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => getUndefinedSymbols(node[1][1], contextStack, builtin, evaluateNode),\n}\n","import type { Any } from '../../interface'\nimport type { Node, SpecialExpressionNode } from '../../parser/types'\nimport type { BuiltinSpecialExpression, CustomDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type CondNode = SpecialExpressionNode<[typeof specialExpressionTypes['cond'], [Node, Node][]]>\n\nconst docs: CustomDocs = {\n category: 'special-expression',\n customVariants: ['cond cond-branch cond-branch ... end'],\n details: [\n ['cond-branch', 'case test then body', 'A branch of the cond expression.'],\n ['test', 'expression', 'The condition to test.'],\n ['body', 'expressions', 'The expressions to evaluate if the test is truthy.'],\n ],\n description: 'Used for branching. `cond-branches` are tested sequentially from the top. If no branch is tested truthy, `null` is returned.',\n examples: [\n `\ncond\n case false then write!(\"FALSE\")\n case true then write!(\"TRUE\")\nend`,\n `\ncond\n case false then write!(\"FALSE\")\n case null then write!(\"null\")\nend ?? write!(\"TRUE\")`,\n `\ncond\n case false then write!(\"FALSE\")\n case null then write!(\"null\")\nend ?? write!(\"TRUE\")`,\n ],\n}\n\nexport const condSpecialExpression: BuiltinSpecialExpression<Any, CondNode> = {\n arity: {},\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n const params = node[1][1]\n for (const [test, form] of params) {\n const value = evaluateNode(test, contextStack)\n if (!value)\n continue\n\n return evaluateNode(form, contextStack)\n }\n return null\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => getUndefinedSymbols(node[1][1].flat(), contextStack, builtin, evaluateNode),\n}\n","import type { Any } from '../../interface'\nimport type { Node, SpecialExpressionNode } from '../../parser/types'\nimport type { BuiltinSpecialExpression, CustomDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type SwitchNode = SpecialExpressionNode<[typeof specialExpressionTypes['switch'], Node, [Node, Node][]]>\n\nconst docs: CustomDocs = {\n category: 'special-expression',\n customVariants: ['switch value switch-branch switch-branch ... end'],\n details: [\n ['value', 'any', 'The value to test.'],\n ['switch-branch', 'case test then body', 'A branch of the switch expression.'],\n ['test', 'expression', 'The condition to test.'],\n ['body', 'expressions', 'The expressions to evaluate if the test is truthy.'],\n ],\n description: 'Used for branching. `switch-branches` are tested sequentially from the top against `value`. If no branch is tested truthy, `null` is returned.',\n examples: [\n `\nswitch 1\n case 1 then write!(\"One\")\n case 2 then write!(\"Two\")\nend`,\n `\nswitch 2\n case 1 then write!(\"One\")\n case 2 then write!(\"Two\")\nend`,\n `\nswitch 3\n case 1 then write!(\"One\")\n case 2 then write!(\"Two\")\nend`,\n ],\n}\n\nexport const switchSpecialExpression: BuiltinSpecialExpression<Any, SwitchNode> = {\n arity: {},\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n const [, switchValueNode, cases] = node[1]\n const switchValue = evaluateNode(switchValueNode, contextStack)\n for (const [test, form] of cases) {\n const value = evaluateNode(test, contextStack)\n if (value === switchValue) {\n return evaluateNode(form, contextStack)\n }\n }\n return null\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => getUndefinedSymbols([node[1][1], ...node[1][2].flat()], contextStack, builtin, evaluateNode),\n}\n","import { NodeTypes } from '../constants/constants'\nimport type {\n ExpressionNode,\n Node,\n NormalBuiltinSymbolNode,\n NormalExpressionNode,\n NormalExpressionNodeWithName,\n SpecialBuiltinSymbolNode,\n SpreadNode,\n SymbolNode,\n UserDefinedSymbolNode,\n} from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\n\nexport function isSymbolNode(node: Node): node is SymbolNode {\n const nodeType = node[0]\n return NodeTypes.UserDefinedSymbol === nodeType\n || NodeTypes.NormalBuiltinSymbol === nodeType\n || NodeTypes.SpecialBuiltinSymbol === nodeType\n}\nexport function asSymbolNode(node: Node, sourceCodeInfo?: SourceCodeInfo): SymbolNode {\n assertSymbolNode(node, sourceCodeInfo)\n return node\n}\nexport function assertSymbolNode(node: Node, sourceCodeInfo?: SourceCodeInfo): asserts node is SymbolNode {\n if (!isSymbolNode(node))\n throw getAssertionError('SymbolNode', node, sourceCodeInfo)\n}\n\nexport function isUserDefinedSymbolNode(node: Node): node is UserDefinedSymbolNode {\n return NodeTypes.UserDefinedSymbol === node[0]\n}\nexport function asUserDefinedSymbolNode(node: Node, sourceCodeInfo?: SourceCodeInfo): UserDefinedSymbolNode {\n assertUserDefinedSymbolNode(node, sourceCodeInfo)\n return node\n}\nexport function assertUserDefinedSymbolNode(node: Node, sourceCodeInfo?: SourceCodeInfo): asserts node is UserDefinedSymbolNode {\n if (!isUserDefinedSymbolNode(node))\n throw getAssertionError('UserDefinedSymbolNode', node, sourceCodeInfo)\n}\n\nexport function isNormalBuiltinSymbolNode(node: Node): node is NormalBuiltinSymbolNode {\n return NodeTypes.NormalBuiltinSymbol === node[0]\n}\n\nexport function isSpecialBuiltinSymbolNode(node: Node): node is SpecialBuiltinSymbolNode {\n return NodeTypes.SpecialBuiltinSymbol === node[0]\n}\n\nexport function isNormalExpressionNode(node: Node): node is NormalExpressionNode {\n return node[0] === NodeTypes.NormalExpression\n}\nexport function asNormalExpressionNode(node: Node, sourceCodeInfo?: SourceCodeInfo): NormalExpressionNode {\n assertNormalExpressionNode(node, sourceCodeInfo)\n return node\n}\nexport function assertNormalExpressionNode(\n node: Node,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts node is NormalExpressionNode {\n if (!isNormalExpressionNode(node))\n throw getAssertionError('NormalExpressionNode', node, sourceCodeInfo)\n}\n\nexport function isNormalExpressionNodeWithName(node: Node): node is NormalExpressionNodeWithName {\n if (!isNormalExpressionNode(node)) {\n return false\n }\n return isSymbolNode(node[1][0])\n}\nexport function asNormalExpressionNodeWithName(\n node: Node,\n sourceCodeInfo?: SourceCodeInfo,\n): NormalExpressionNodeWithName {\n assertNormalExpressionNodeWithName(node, sourceCodeInfo)\n return node\n}\nexport function assertNormalExpressionNodeWithName(\n node: Node,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts node is NormalExpressionNodeWithName {\n if (!isNormalExpressionNodeWithName(node))\n throw getAssertionError('NormalExpressionNodeWithName', node, sourceCodeInfo)\n}\n\nexport function isExpressionNode(node: Node): node is ExpressionNode {\n return isNormalExpressionNode(node)\n || node[0] === NodeTypes.SpecialExpression\n || node[0] === NodeTypes.Number\n || node[0] === NodeTypes.String\n}\nexport function asExpressionNode(node: Node, sourceCodeInfo?: SourceCodeInfo): ExpressionNode {\n assertExpressionNode(node, sourceCodeInfo)\n return node\n}\nexport function assertExpressionNode(node: Node, sourceCodeInfo?: SourceCodeInfo): asserts node is ExpressionNode {\n if (!isExpressionNode(node))\n throw getAssertionError('ExpressionNode', node, sourceCodeInfo)\n}\n\nexport function isSpreadNode(node: Node): node is SpreadNode {\n return node[0] === NodeTypes.Spread\n}\n","import type { SpecialExpressionNode, SymbolNode } from '../../parser/types'\nimport { assertSymbolNode, isUserDefinedSymbolNode } from '../../typeGuards/astNode'\nimport { toFixedArity } from '../../utils/arity'\nimport type { BuiltinSpecialExpression, FunctionDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type DefinedNode = SpecialExpressionNode<[typeof specialExpressionTypes['defined?'], SymbolNode]>\n\nconst docs: FunctionDocs = {\n category: 'special-expression',\n returns: {\n type: 'boolean',\n },\n args: {\n symbol: { type: 'any' },\n },\n variants: [\n { argumentNames: ['symbol'] },\n ],\n description: `Returns \\`true\\` if \\`symbol\\` is defined, \\`false\\` otherwise.\n\nBuilt-in symbols are always considered defined. For user-defined symbols, checks if the symbol exists in the current scope.`,\n examples: [\n 'let x = 42; defined?(x)',\n 'defined?(x)',\n 'defined?(+)',\n ],\n}\n\nexport const definedSpecialExpression: BuiltinSpecialExpression<boolean, DefinedNode> = {\n arity: toFixedArity(1),\n docs,\n evaluate: (node, contextStack) => {\n const symbolNode = node[1][1]\n assertSymbolNode(symbolNode)\n if (!isUserDefinedSymbolNode(symbolNode)) {\n return true // If the symbol is not a user defined symbol, it is defined. normal or special builtin\n }\n const lookUpResult = contextStack.lookUp(symbolNode)\n return lookUpResult !== null\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => getUndefinedSymbols([node[1][1]], contextStack, builtin, evaluateNode),\n}\n","import type { JsFunction } from '../Lits/Lits'\nimport type { SpecialExpressionType } from '../builtin'\nimport type { Arity } from '../builtin/interface'\nimport type { specialExpressionTypes } from '../builtin/specialExpressionTypes'\nimport type { FunctionType, NodeType, NodeTypes } from '../constants/constants'\nimport type { Context } from '../evaluator/interface'\nimport type { Any, Arr, Coll } from '../interface'\nimport type { ReservedSymbol } from '../tokenizer/reservedNames'\nimport type { SourceCodeInfo, Token } from '../tokenizer/token'\nimport type { FUNCTION_SYMBOL, REGEXP_SYMBOL } from '../utils/symbols'\n\nexport interface ParseState {\n position: number\n}\n\nexport type EvaluatedFunction = [BindingTarget[], Node[], Context]\n\ninterface GenericLitsFunction {\n [FUNCTION_SYMBOL]: true\n sourceCodeInfo?: SourceCodeInfo\n functionType: FunctionType\n arity: Arity\n}\n\nexport interface RegularExpression {\n [REGEXP_SYMBOL]: true\n sourceCodeInfo?: SourceCodeInfo\n s: string\n f: string\n}\n\nexport interface NativeJsFunction extends GenericLitsFunction {\n functionType: 'NativeJsFunction'\n name: string | undefined // name\n nativeFn: JsFunction\n docString: string // documentation string\n}\n\nexport function isJsFunction(fn: unknown): fn is JsFunction {\n return typeof fn === 'object' && fn !== null && 'fn' in fn && typeof (fn as JsFunction).fn === 'function'\n}\n\nexport function assertJsFunction(fn: unknown): asserts fn is JsFunction {\n if (!isJsFunction(fn)) {\n throw new TypeError('Expected a NativeJsFunction')\n }\n}\n\nexport interface NativeJsModule {\n [key: string]: NativeJsFunction | NativeJsModule\n}\n\nexport interface UserDefinedFunction extends GenericLitsFunction {\n functionType: 'UserDefined'\n name: string | undefined // name\n evaluatedfunction: EvaluatedFunction\n docString: string // documentation string\n}\n\nexport interface PartialFunction extends GenericLitsFunction {\n functionType: 'Partial'\n function: FunctionLike\n params: Arr\n placeholders: number[] // indexes of the placeholders\n}\n\nexport interface CompFunction extends GenericLitsFunction {\n functionType: 'Comp'\n params: Arr\n}\n\nexport interface ConstantlyFunction extends GenericLitsFunction {\n functionType: 'Constantly'\n value: Any\n}\n\nexport interface JuxtFunction extends GenericLitsFunction {\n functionType: 'Juxt'\n params: Arr\n}\n\nexport interface ComplementFunction extends GenericLitsFunction {\n functionType: 'Complement'\n function: FunctionLike\n}\n\nexport interface EveryPredFunction extends GenericLitsFunction {\n functionType: 'EveryPred'\n params: Arr\n}\n\nexport interface SomePredFunction extends GenericLitsFunction {\n functionType: 'SomePred'\n params: Arr\n}\n\nexport interface FNullFunction extends GenericLitsFunction {\n functionType: 'Fnull'\n function: FunctionLike\n params: Arr\n}\n\nexport interface NormalBuiltinFunction extends GenericLitsFunction {\n functionType: 'Builtin'\n normalBuiltinSymbolType: number\n name: string\n}\n\nexport interface SpecialBuiltinFunction extends GenericLitsFunction {\n functionType: 'SpecialBuiltin'\n specialBuiltinSymbolType:\n | typeof specialExpressionTypes['&&']\n | typeof specialExpressionTypes['||']\n | typeof specialExpressionTypes['array']\n | typeof specialExpressionTypes['object']\n | typeof specialExpressionTypes['defined?']\n | typeof specialExpressionTypes['recur']\n | typeof specialExpressionTypes['throw']\n | typeof specialExpressionTypes['??']\n}\n\nexport interface ModuleFunction extends GenericLitsFunction {\n functionType: 'Module'\n moduleName: string\n functionName: string\n}\n\nexport type LitsFunction =\n | NativeJsFunction\n | UserDefinedFunction\n | NormalBuiltinFunction\n | SpecialBuiltinFunction\n | ModuleFunction\n | PartialFunction\n | CompFunction\n | ConstantlyFunction\n | JuxtFunction\n | ComplementFunction\n | EveryPredFunction\n | SomePredFunction\n | FNullFunction\n\nexport type LitsFunctionType = LitsFunction['functionType']\n\nexport type FunctionLike = LitsFunction | Coll | number\n\nexport type DebugData = {\n token: Token\n nameToken?: Token\n}\nexport type Node<T extends NodeType = NodeType, Payload = unknown> = [T, Payload] | [T, Payload, SourceCodeInfo]\n\nexport type ExpressionNode = NormalExpressionNode | SpecialExpressionNode | NumberNode | StringNode\n\nexport type SpreadNode = Node<typeof NodeTypes.Spread, Node> // Payload should be array or object depending on context\nexport type NumberNode = Node<typeof NodeTypes.Number, number>\nexport type StringNode = Node<typeof NodeTypes.String, string>\nexport type UserDefinedSymbolNode = Node<typeof NodeTypes.UserDefinedSymbol, string>\nexport type NormalBuiltinSymbolNode = Node<typeof NodeTypes.NormalBuiltinSymbol, number>\nexport type SpecialBuiltinSymbolNode = Node<typeof NodeTypes.SpecialBuiltinSymbol, SpecialExpressionType>\nexport type SymbolNode = UserDefinedSymbolNode | NormalBuiltinSymbolNode | SpecialBuiltinSymbolNode\nexport type ReservedSymbolNode = Node<typeof NodeTypes.ReservedSymbol, ReservedSymbol>\nexport type SpecialExpressionNode<T extends [SpecialExpressionType, ...unknown[]] = [SpecialExpressionType, ...unknown[]]> = Node<typeof NodeTypes.SpecialExpression, T> // [name, params]\n\nexport type NormalExpressionNodeWithName = Node<typeof NodeTypes.NormalExpression, [NormalBuiltinSymbolNode | UserDefinedSymbolNode, Node[]]> // [params, name]\nexport type NormalExpressionNodeExpression = Node<typeof NodeTypes.NormalExpression, [Node, Node[]]> // [name, node as function] node can be string number object or array\nexport type NormalExpressionNode = NormalExpressionNodeWithName | NormalExpressionNodeExpression\nexport const bindingTargetTypes = {\n symbol: 11,\n rest: 12,\n object: 13,\n array: 14,\n} as const\n\nexport type BindingTargetType = typeof bindingTargetTypes[keyof typeof bindingTargetTypes]\n\ntype GenericTarget<T extends BindingTargetType, Payload extends unknown[]> = [T, Payload] | [T, Payload, SourceCodeInfo]\n\nexport type SymbolBindingTarget = GenericTarget<typeof bindingTargetTypes.symbol, [SymbolNode, Node | undefined /* default value */]>\nexport type RestBindingTarget = GenericTarget<typeof bindingTargetTypes.rest, [string, Node | undefined /* default value */]>\nexport type ObjectBindingTarget = GenericTarget<typeof bindingTargetTypes.object, [Record<string, BindingTarget>, Node | undefined /* default value */]>\nexport type ArrayBindingTarget = GenericTarget<typeof bindingTargetTypes.array, [(BindingTarget | null)[], Node | undefined /* default value */]>\n\nexport type BindingTarget = SymbolBindingTarget | RestBindingTarget | ObjectBindingTarget | ArrayBindingTarget\n\nexport type BindingNode = Node<typeof NodeTypes.Binding, [BindingTarget, Node]> // [target, value]\n\ntype AstBody = Node[]\nexport interface Ast {\n body: AstBody // body\n hasDebugData: boolean\n}\n","import { LitsError } from '../errors'\nimport type { Any } from '../interface'\nimport { type BindingTarget, type Node, type RestBindingTarget, type UserDefinedSymbolNode, bindingTargetTypes } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { assertUnknownRecord } from '../typeGuards'\nimport { assertArray } from '../typeGuards/array'\nimport { asAny, assertAny } from '../typeGuards/lits'\n\nexport function walkDefaults(\n bindingTarget: BindingTarget,\n onDefault: (Node: Node) => void,\n): void {\n if (bindingTarget[0] === bindingTargetTypes.object) {\n Object.values(bindingTarget[1][0]).forEach((element) => {\n if (element[1][1]) {\n onDefault(element[1][1])\n }\n walkDefaults(element, onDefault)\n })\n }\n else if (bindingTarget[0] === bindingTargetTypes.array) {\n for (let index = 0; index < bindingTarget[1][0].length; index += 1) {\n const element = bindingTarget[1][0][index] ?? null\n if (element === null) {\n continue\n }\n if (element[1][1]) {\n onDefault(element[1][1])\n }\n walkDefaults(element, onDefault)\n }\n }\n}\n\nexport function evaluateBindingNodeValues(\n target: BindingTarget,\n value: Any,\n evaluate: (Node: Node) => Any,\n): Record<string, Any> {\n const sourceCodeInfo = target[2]\n const record: Record<string, Any> = {}\n createRecord(target, value, evaluate, sourceCodeInfo, record)\n return record\n}\n\nfunction createRecord(\n bindingTarget: BindingTarget,\n value: Any,\n evaluate: (Node: Node) => Any,\n sourceCodeInfo: SourceCodeInfo | undefined,\n record: Record<string, Any>,\n): void {\n if (bindingTarget[0] === bindingTargetTypes.object) {\n assertUnknownRecord(value, sourceCodeInfo)\n const capturedKeys = new Set<string>()\n let restElement: RestBindingTarget | undefined\n Object.entries(bindingTarget[1][0]).forEach(([key, element]) => {\n if (element[0] === bindingTargetTypes.rest) {\n restElement = element\n return\n }\n capturedKeys.add(key)\n const val = (value[key] !== undefined ? value[key] : element[1][1] && evaluate(element[1][1])) ?? null\n assertAny(val, sourceCodeInfo)\n createRecord(element, val, evaluate, sourceCodeInfo, record)\n })\n if (restElement) {\n const restValues = Object.entries(value)\n .filter(([key]) => !capturedKeys.has(key))\n .reduce((acc: Record<string, Any>, [key, val]) => {\n acc[key] = asAny(val)\n return acc\n }, {})\n\n record[restElement[1][0]] = restValues\n }\n }\n else if (bindingTarget[0] === bindingTargetTypes.array) {\n let restIndex: number | null = null\n assertArray(value, sourceCodeInfo)\n for (let index = 0; index < bindingTarget[1][0].length; index += 1) {\n const element = bindingTarget[1][0][index] ?? null\n if (element === null) {\n continue\n }\n if (element[0] === bindingTargetTypes.rest) {\n restIndex = index\n break\n }\n const val = (value[index] !== undefined ? value[index] : element[1][1] && evaluate(element[1][1])) ?? null\n assertAny(val, sourceCodeInfo)\n createRecord(element, val, evaluate, sourceCodeInfo, record)\n }\n if (restIndex !== null) {\n const restValues = value.slice(restIndex)\n const restElement = bindingTarget[1][0][restIndex]! as RestBindingTarget\n record[restElement[1][0]] = restValues\n }\n }\n else if (bindingTarget[0] === bindingTargetTypes.rest) {\n record[bindingTarget[1][0]] = asAny(value)\n }\n else {\n record[(bindingTarget[1][0] as UserDefinedSymbolNode)[1]] = asAny(value)\n }\n}\n\nexport function getAllBindingTargetNames(bindingTarget: BindingTarget): Record<string, true> {\n const names: Record<string, true> = {}\n getNamesFromBindingTarget(bindingTarget, names)\n return names\n}\n\nfunction getNamesFromBindingTarget(target: BindingTarget | null, names: Record<string, true>): void {\n if (target === null) {\n return\n }\n if (target[0] === bindingTargetTypes.array) {\n for (const element of target[1][0]) {\n getNamesFromBindingTarget(element, names)\n }\n }\n else if (target[0] === bindingTargetTypes.object) {\n for (const element of Object.values(target[1][0])) {\n getNamesFromBindingTarget(element, names)\n }\n }\n else if (target[0] === bindingTargetTypes.rest) {\n if (names[target[1][0]]) {\n throw new LitsError(`Duplicate binding name: ${target[1][0]}`, target[2])\n }\n names[target[1][0]] = true\n }\n else {\n if (names[target[1][0][1]]) {\n throw new LitsError(`Duplicate binding name: ${target[1][0]}`, target[2])\n }\n names[target[1][0][1]] = true\n }\n}\n","import type { Any } from '../../interface'\nimport type { BindingNode, SpecialExpressionNode } from '../../parser/types'\nimport { addToSet } from '../../utils'\nimport { evaluateBindingNodeValues as evaluateBindingTargetValues, getAllBindingTargetNames, walkDefaults } from '../bindingNode'\nimport type { BuiltinSpecialExpression } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type DefNode = SpecialExpressionNode<[typeof specialExpressionTypes['0_def'], BindingNode]> // binding, value\n\nexport const defSpecialExpression: BuiltinSpecialExpression<Any, DefNode> = {\n arity: {},\n evaluate: (node, contextStack, { evaluateNode }) => {\n const bindingNode: BindingNode = node[1][1]\n const target = bindingNode[1][0]\n const value = bindingNode[1][1]\n const bindingValue = evaluateNode(value, contextStack)\n const values = evaluateBindingTargetValues(target, bindingValue, Node => evaluateNode(Node, contextStack))\n contextStack.exportValues(values, target[2])\n return bindingValue\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => {\n const bindingNode: BindingNode = node[1][1]\n const target = bindingNode[1][0]\n const value = bindingNode[1][1]\n const bindingResult = getUndefinedSymbols([value], contextStack, builtin, evaluateNode)\n walkDefaults(target, (defaultNode) => {\n addToSet(bindingResult, getUndefinedSymbols([defaultNode], contextStack, builtin, evaluateNode))\n })\n contextStack.addValues(getAllBindingTargetNames(target), target[2])\n return bindingResult\n },\n}\n","import type { Context } from '../../evaluator/interface'\nimport type { Any } from '../../interface'\nimport type { Node, SpecialExpressionNode } from '../../parser/types'\nimport type { BuiltinSpecialExpression, CustomDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type DoNode = SpecialExpressionNode<[typeof specialExpressionTypes['block'], Node[]]>\n\nconst docs: CustomDocs = {\n category: 'special-expression',\n customVariants: ['do body end'],\n details: [\n ['body', 'expressions', 'The expressions to evaluate.'],\n ],\n description: 'Evaluates `body`. Resulting value is the value of the last expression.',\n examples: [\n `\ndo\n let a = 1 + 2 + 3 + 4;\n let b = -> $ * ( $ + 1 );\n b(a)\nend`,\n ],\n}\n\nexport const doSpecialExpression: BuiltinSpecialExpression<Any, DoNode> = {\n arity: {},\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n const newContext: Context = {}\n\n const newContextStack = contextStack.create(newContext)\n let result: Any = null\n for (const form of node[1][1])\n result = evaluateNode(form, newContextStack)\n\n return result\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => {\n return getUndefinedSymbols(node[1][1], contextStack.create({}), builtin, evaluateNode)\n },\n}\n","import type { ContextStack } from '../../evaluator/ContextStack'\nimport type { Context, EvaluateNode } from '../../evaluator/interface'\nimport type { GetUndefinedSymbols, UndefinedSymbols } from '../../getUndefinedSymbols'\nimport {\n type EvaluatedFunction,\n type LitsFunction,\n type SpecialExpressionNode,\n bindingTargetTypes,\n} from '../../parser/types'\nimport { isAny } from '../../typeGuards/lits'\nimport { addToSet } from '../../utils'\nimport { FUNCTION_SYMBOL } from '../../utils/symbols'\nimport { getAllBindingTargetNames, walkDefaults } from '../bindingNode'\nimport type { Builtin, BuiltinSpecialExpression } from '../interface'\nimport type { Function } from '../utils'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type LambdaNode = SpecialExpressionNode<[typeof specialExpressionTypes['0_lambda'], Function, string]>\n\nexport const lambdaSpecialExpression: BuiltinSpecialExpression<LitsFunction, LambdaNode> = {\n arity: {},\n evaluate: (node, contextStack, { builtin, getUndefinedSymbols, evaluateNode }) => {\n const fn = node[1][1]\n const docString = node[1][2]\n const evaluatedFunction = evaluateFunction(fn, contextStack, builtin, getUndefinedSymbols, evaluateNode)\n\n const min = evaluatedFunction[0].filter(arg => arg[0] !== bindingTargetTypes.rest && arg[1][1] === undefined).length\n const max = evaluatedFunction[0].some(arg => arg[0] === bindingTargetTypes.rest) ? undefined : evaluatedFunction[0].length\n const arity = { min: min > 0 ? min : undefined, max }\n\n const litsFunction: LitsFunction = {\n [FUNCTION_SYMBOL]: true,\n sourceCodeInfo: node[2],\n functionType: 'UserDefined',\n name: undefined,\n evaluatedfunction: evaluatedFunction,\n arity,\n docString,\n }\n\n return litsFunction\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => {\n const fn = node[1][1]\n return getFunctionUnresolvedSymbols(fn, contextStack, getUndefinedSymbols, builtin, evaluateNode)\n },\n\n}\n\nfunction evaluateFunction(\n fn: Function,\n contextStack: ContextStack,\n builtin: Builtin,\n getUndefinedSymbols: GetUndefinedSymbols,\n evaluateNode: EvaluateNode,\n): EvaluatedFunction {\n const functionContext: Context = {}\n\n const context = fn[0].reduce((ctx: Context, arg) => {\n Object.keys(getAllBindingTargetNames(arg)).forEach((name) => {\n ctx[name] = { value: null }\n })\n return ctx\n }, {})\n const undefinedSymbols = getUndefinedSymbols(fn[1], contextStack.new(context), builtin, evaluateNode)\n undefinedSymbols.forEach((name) => {\n const value = contextStack.getValue(name)\n if (isAny(value)) {\n functionContext[name] = { value }\n }\n })\n\n const evaluatedFunction: EvaluatedFunction = [\n fn[0],\n fn[1],\n functionContext,\n ]\n\n return evaluatedFunction\n}\n\nfunction getFunctionUnresolvedSymbols(\n fn: Function,\n contextStack: ContextStack,\n getUndefinedSymbols: GetUndefinedSymbols,\n builtin: Builtin,\n evaluateNode: EvaluateNode,\n): UndefinedSymbols {\n const result = new Set<string>()\n const newContext: Context = { self: { value: null } }\n\n fn[0].forEach((arg) => {\n Object.assign(newContext, getAllBindingTargetNames(arg))\n\n walkDefaults(arg, (defaultNode) => {\n addToSet(result, getUndefinedSymbols([defaultNode], contextStack, builtin, evaluateNode))\n })\n })\n\n const newContextStack = contextStack.create(newContext)\n const overloadResult = getUndefinedSymbols(fn[1], newContextStack, builtin, evaluateNode)\n addToSet(result, overloadResult)\n return result\n}\n","import type { Any } from '../../interface'\nimport type { Node, SpecialExpressionNode } from '../../parser/types'\nimport type { BuiltinSpecialExpression, CustomDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type IfNode = SpecialExpressionNode<[typeof specialExpressionTypes['if'], [Node, Node, Node?]]>\n\nconst docs: CustomDocs = {\n category: 'special-expression',\n customVariants: ['if test then true-expr else false-expr', 'if test then true-expr'],\n details: [\n ['test', 'expression', 'The condition to test.'],\n ['true-expr', 'expression', 'The expression to evaluate if the test is truthy.'],\n ['false-expr', 'expression', 'The expression to evaluate if the test is falsy.'],\n ],\n description: 'Either `true-expr` or `false-expr` branch is taken. `true-expr` is selected when $test is truthy. If $test is falsy `false-expr` is executed, if no `false-expr` exists, `null` is returned.',\n examples: [\n `\nif true then\n write!(\"TRUE\")\nelse\n write!(\"FALSE\")\nend`,\n 'if false then write!(\"TRUE\") else write!(\"FALSE\") end',\n 'if true then write!(\"TRUE\") end',\n 'if false then write!(\"TRUE\") end',\n ],\n}\n\nexport const ifSpecialExpression: BuiltinSpecialExpression<Any, IfNode> = {\n arity: { min: 2, max: 3 },\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n const [conditionNode, trueNode, falseNode] = node[1][1]\n if (evaluateNode(conditionNode, contextStack)) {\n return evaluateNode(trueNode, contextStack)\n }\n else if (falseNode) {\n return evaluateNode(falseNode, contextStack)\n }\n return null\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) =>\n getUndefinedSymbols(node[1][1].filter(n => !!n), contextStack, builtin, evaluateNode),\n}\n","import type { Any } from '../../interface'\nimport type { Node, SpecialExpressionNode } from '../../parser/types'\nimport type { BuiltinSpecialExpression, CustomDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type UnlessNode = SpecialExpressionNode<[typeof specialExpressionTypes['unless'], [Node, Node, Node?]]>\n\nconst docs: CustomDocs = {\n category: 'special-expression',\n customVariants: ['unless test then true-expr else false-expr end', 'unless test true-expr end'],\n details: [\n ['test', 'expression', 'The condition to test.'],\n ['true-expr', 'expression', 'The expressions to evaluate if the test is falsy.'],\n ['false-expr', 'expression', 'The expressions to evaluate if the test is truthy.'],\n ],\n description: 'Either `true-expr` or `false-expr` branch is taken. `true-expr` is selected when $test is falsy. If $test is truthy `false-expr` is executed, if no `false-expr` exists, `null` is returned.',\n examples: [\n `\nunless true then\n write!(\"TRUE\")\nelse\n write!(\"FALSE\")\nend`,\n 'unless false then write!(\"TRUE\") else write!(\"FALSE\") end',\n 'unless true then write!(\"TRUE\") end',\n 'unless false then write!(\"TRUE\") end',\n ],\n}\n\nexport const unlessSpecialExpression: BuiltinSpecialExpression<Any, UnlessNode> = {\n arity: {},\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n const [conditionNode, trueNode, falseNode] = node[1][1]\n if (!evaluateNode(conditionNode, contextStack)) {\n return evaluateNode(trueNode, contextStack)\n }\n else if (falseNode) {\n return evaluateNode(falseNode, contextStack)\n }\n return null\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) =>\n getUndefinedSymbols(node[1][1].filter(n => !!n), contextStack, builtin, evaluateNode),\n}\n","import type { Any } from '../../interface'\nimport type { BindingNode, SpecialExpressionNode } from '../../parser/types'\nimport { addToSet } from '../../utils'\nimport { toFixedArity } from '../../utils/arity'\nimport { evaluateBindingNodeValues, getAllBindingTargetNames, walkDefaults } from '../bindingNode'\nimport type { BuiltinSpecialExpression, CustomDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type LetNode = SpecialExpressionNode<[typeof specialExpressionTypes['let'], BindingNode]>\n\nconst docs: CustomDocs = {\n category: 'special-expression',\n customVariants: ['let s = value;'],\n details: [\n ['s', 'symbol', 'The name of the variable to bind.'],\n ['value', 'any', 'The value to bind to the variable.'],\n ],\n description: `\n Binds local variables s to \\`value\\`. \\`value\\` can be any expression. The scope of the variables is the body of the let expression.`,\n examples: [`\nlet a = 1 + 2 + 3 + 4;\nlet b = -> $ * ( $ + 1 );\nwrite!(\"a\", a, \"b\", b)`],\n}\n\nexport const letSpecialExpression: BuiltinSpecialExpression<Any, LetNode> = {\n arity: toFixedArity(0),\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n const bindingNode = node[1][1]\n const target = bindingNode[1][0]\n const value = bindingNode[1][1]\n const bindingValue = evaluateNode(value, contextStack)\n const values = evaluateBindingNodeValues(target, bindingValue, Node => evaluateNode(Node, contextStack))\n contextStack.addValues(values, target[2])\n return bindingValue\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => {\n const bindingNode = node[1][1]\n const target = bindingNode[1][0]\n const value = bindingNode[1][1]\n const bindingResult = getUndefinedSymbols([value], contextStack, builtin, evaluateNode)\n walkDefaults(target, (defaultNode) => {\n addToSet(bindingResult, getUndefinedSymbols([defaultNode], contextStack, builtin, evaluateNode))\n })\n contextStack.addValues(getAllBindingTargetNames(target), target[2])\n return bindingResult\n },\n}\n","import { LitsError, RecurSignal } from '../../errors'\nimport type { Context } from '../../evaluator/interface'\nimport type { Any } from '../../interface'\nimport type { BindingNode, Node, SpecialExpressionNode } from '../../parser/types'\nimport { asAny } from '../../typeGuards/lits'\nimport { joinSets } from '../../utils'\nimport { valueToString } from '../../utils/debug/debugTools'\nimport { evaluateBindingNodeValues, getAllBindingTargetNames } from '../bindingNode'\nimport type { BuiltinSpecialExpression, CustomDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type LoopNode = SpecialExpressionNode<[typeof specialExpressionTypes['loop'], BindingNode[], Node]> // bindings, body\n\nconst docs: CustomDocs = {\n category: 'special-expression',\n customVariants: ['loop (bindings) -> body'],\n details: [\n ['bindings', 'binding pairs', 'Comma-separated bindings with initial values, e.g. `n = 10, acc = 0`.'],\n ['body', 'expression', 'The expression to evaluate repeatedly. Use `recur` to loop back with new values.'],\n ],\n description: `Creates a loop with initial bindings. Use \\`recur\\` inside the body to jump back to the loop head with new binding values.\n\nIf \\`recur\\` is not called, the loop terminates and returns the value of the body expression.`,\n examples: [\n `loop (n = 10, acc = 0) -> do\n if n == 0 then\n acc\n else\n recur(n - 1, acc + n)\n end\nend`,\n `loop (n = 5, acc = 1) -> do\n if n <= 1 then\n acc\n else\n recur(n - 1, acc * n)\n end\nend`,\n ],\n}\n\nexport const loopSpecialExpression: BuiltinSpecialExpression<Any, LoopNode> = {\n arity: {},\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n const bindingNodes = node[1][1]\n const bindingContext: Context = bindingNodes.reduce((result: Context, bindingNode) => {\n const val = evaluateNode(bindingNode[1][1], contextStack.create(result))\n const valueRecord = evaluateBindingNodeValues(bindingNode[1][0], val, Node => evaluateNode(Node, contextStack))\n Object.entries(valueRecord).forEach(([name, value]) => {\n result[name] = { value }\n })\n return result\n }, {})\n const newContextStack = contextStack.create(bindingContext)\n\n const body = node[1][2]\n for (;;) {\n let result: Any = null\n try {\n result = evaluateNode(body, newContextStack)\n }\n catch (error) {\n if (error instanceof RecurSignal) {\n const params = error.params\n if (params.length !== bindingNodes.length) {\n throw new LitsError(\n `recur expected ${bindingNodes.length} parameters, got ${valueToString(params.length)}`,\n node[2],\n )\n }\n bindingNodes.forEach((bindingNode, index) => {\n const valueRecord = evaluateBindingNodeValues(bindingNode[1][0], asAny(params[index]), Node => evaluateNode(Node, contextStack))\n for (const [name, value] of Object.entries(valueRecord)) {\n bindingContext[name]!.value = value\n }\n })\n continue\n }\n throw error\n }\n return result\n }\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => {\n const bindingNodes = node[1][1]\n\n const newContext = bindingNodes\n .reduce((context: Context, bindingNode) => {\n const names = getAllBindingTargetNames(bindingNode[1][0])\n\n Object.keys(names).forEach((name) => {\n context[name] = { value: true }\n })\n return context\n }, {})\n\n const bindingValueNodes = bindingNodes.map(bindingNode => bindingNode[1][1])\n const bindingsResult = getUndefinedSymbols(bindingValueNodes, contextStack, builtin, evaluateNode)\n const paramsResult = getUndefinedSymbols([node[1][2]], contextStack.create(newContext), builtin, evaluateNode)\n return joinSets(bindingsResult, paramsResult)\n },\n}\n","import type { GetUndefinedSymbols, UndefinedSymbols } from '../../getUndefinedSymbols'\nimport type { ContextStack } from '../../evaluator/ContextStack'\nimport type { Context, EvaluateNode } from '../../evaluator/interface'\nimport type { Any, Arr } from '../../interface'\nimport type { BindingNode, Node, SpecialExpressionNode } from '../../parser/types'\nimport { asNonUndefined } from '../../typeGuards'\nimport { asAny, asColl, isSeq } from '../../typeGuards/lits'\nimport type { Builtin, BuiltinSpecialExpression, CustomDocs } from '../interface'\nimport { evaluateBindingNodeValues, getAllBindingTargetNames } from '../bindingNode'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\nimport { toFixedArity } from '../../utils/arity'\n\nexport type LoopBindingNode = [BindingNode, BindingNode[], Node?, Node?] // Binding, Let-Bindings, When, While\n\nexport type ForNode = SpecialExpressionNode<[typeof specialExpressionTypes['for'], LoopBindingNode[], Node]> // LoopBindings, body\nexport type DoSeqNode = SpecialExpressionNode<[typeof specialExpressionTypes['doseq'], LoopBindingNode[], Node]> // LoopBindings, body\n\ntype LoopNode = ForNode | DoSeqNode\n\nfunction addToContext(\n bindings: BindingNode[],\n context: Context,\n contextStack: ContextStack,\n evaluateNode: EvaluateNode,\n) {\n for (const bindingNode of bindings) {\n const [target, bindingValue] = bindingNode[1]\n const val = evaluateNode(bindingValue, contextStack)\n const valueRecord = evaluateBindingNodeValues(target, val, Node => evaluateNode(Node, contextStack))\n Object.entries(valueRecord).forEach(([name, value]) => {\n context[name] = { value }\n })\n }\n}\n\nfunction evaluateLoop(\n returnResult: boolean,\n loopNode: LoopNode,\n contextStack: ContextStack,\n evaluateNode: EvaluateNode,\n) {\n const sourceCodeInfo = loopNode[2]\n const [, loopBindings, body] = loopNode[1]\n\n const result: Arr = []\n\n const bindingIndices = loopBindings.map(() => 0)\n let abort = false\n while (!abort) {\n const context: Context = {}\n const newContextStack = contextStack.create(context)\n let skip = false\n bindingsLoop: for (let bindingIndex = 0; bindingIndex < loopBindings.length; bindingIndex += 1) {\n const [bindingNode, letBindings, whenNode, whileNode] = loopBindings[bindingIndex]!\n const [targetNode, valueNode] = bindingNode[1]\n const coll = asColl(evaluateNode(valueNode, newContextStack), sourceCodeInfo)\n const seq = isSeq(coll) ? coll : Object.entries(coll)\n if (seq.length === 0) {\n skip = true\n abort = true\n break\n }\n const index = asNonUndefined(bindingIndices[bindingIndex], sourceCodeInfo)\n if (index >= seq.length) {\n skip = true\n if (bindingIndex === 0) {\n abort = true\n break\n }\n bindingIndices[bindingIndex] = 0\n bindingIndices[bindingIndex - 1] = asNonUndefined(bindingIndices[bindingIndex - 1], sourceCodeInfo) + 1\n break\n }\n\n const val = asAny(seq[index], sourceCodeInfo)\n const valueRecord = evaluateBindingNodeValues(targetNode, val, Node => evaluateNode(Node, newContextStack))\n Object.entries(valueRecord).forEach(([name, value]) => {\n context[name] = { value }\n })\n if (letBindings) {\n addToContext(\n letBindings,\n context,\n newContextStack,\n evaluateNode,\n )\n }\n if (whenNode && !evaluateNode(whenNode, newContextStack)) {\n bindingIndices[bindingIndex] = asNonUndefined(bindingIndices[bindingIndex], sourceCodeInfo) + 1\n skip = true\n break bindingsLoop\n }\n if (whileNode && !evaluateNode(whileNode, newContextStack)) {\n bindingIndices[bindingIndex] = Number.POSITIVE_INFINITY\n skip = true\n break bindingsLoop\n }\n }\n if (!skip) {\n const value: Any = evaluateNode(body, newContextStack)\n if (returnResult)\n result.push(value)\n\n if (bindingIndices.length > 0)\n bindingIndices[bindingIndices.length - 1]! += 1\n }\n }\n\n return returnResult ? result : null\n}\n\nfunction analyze(\n loopNode: LoopNode,\n contextStack: ContextStack,\n getUndefinedSymbols: GetUndefinedSymbols,\n builtin: Builtin,\n evaluateNode: EvaluateNode,\n): UndefinedSymbols {\n const result = new Set<string>()\n const newContext: Context = {}\n const [, loopBindings, body] = loopNode[1]\n loopBindings.forEach((loopBindingNode) => {\n const [bindingNode, letBindings, whenNode, whileNode] = loopBindingNode\n const [target, value] = bindingNode[1]\n getUndefinedSymbols([value], contextStack.create(newContext), builtin, evaluateNode).forEach(symbol =>\n result.add(symbol),\n )\n Object.assign(newContext, getAllBindingTargetNames(target))\n if (letBindings) {\n letBindings.forEach((letBindingNode) => {\n const [letTarget, letValue] = letBindingNode[1]\n\n getUndefinedSymbols([letValue], contextStack.create(newContext), builtin, evaluateNode).forEach(symbol =>\n result.add(symbol),\n )\n Object.assign(newContext, getAllBindingTargetNames(letTarget))\n })\n }\n if (whenNode) {\n getUndefinedSymbols([whenNode], contextStack.create(newContext), builtin, evaluateNode).forEach(symbol =>\n result.add(symbol),\n )\n }\n if (whileNode) {\n getUndefinedSymbols([whileNode], contextStack.create(newContext), builtin, evaluateNode).forEach(symbol =>\n result.add(symbol),\n )\n }\n })\n getUndefinedSymbols([body], contextStack.create(newContext), builtin, evaluateNode).forEach(symbol =>\n result.add(symbol),\n )\n return result\n}\n\nconst forDocs: CustomDocs = {\n category: 'special-expression',\n customVariants: ['for (...binding) -> body'],\n details: [\n ['binding', 'loop-var in collection [...let-binding] [where whereExpr] [while whileExp]', 'A for loop binding'],\n ['loop-var', 'symbol', 'The name of the loop variable.'],\n ['collection', 'any', 'The collection to iterate over.'],\n ['let-binding', 'let binding', 'A let binding to create a local variable.'],\n ['whereExpr', 'expression', 'An expression that must evaluate to truthy for the loop body to be executed.'],\n ['whileExp', 'expression', 'An expression that must evaluate to truthy for the loop to continue.'],\n ['body', 'expressions', 'The expressions to evaluate for each iteration of the loop.'],\n ],\n returns: {\n type: 'any',\n array: true,\n },\n description: 'Iterates over `bindings`, evaluates `body` for each `binding` and returns an `array` of results.',\n examples: [\n `\nfor (i in [1, 2, 3]) -> i * 2\n `,\n `\nfor (\n i in range(10) let ii = i ^ 2 while ii < 40 when ii % 3 == 0,\n j in range(10) when j % 2 == 1\n) -> ii + j\n `,\n ],\n}\n\nexport const forSpecialExpression: BuiltinSpecialExpression<Any, ForNode> = {\n arity: toFixedArity(1),\n docs: forDocs,\n evaluate: (node, contextStack, helpers) => evaluateLoop(true, node, contextStack, helpers.evaluateNode),\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => analyze(node, contextStack, getUndefinedSymbols, builtin, evaluateNode),\n}\n\nconst doseqDocs: CustomDocs = {\n category: 'special-expression',\n customVariants: ['doseq (...binding) -> body'],\n details: [\n ['binding', 'loop-var in collection [...let-binding] [where whereExpr] [while whileExp]', 'A doseq loop binding'],\n ['loop-var', 'symbol', 'The name of the loop variable.'],\n ['collection', 'any', 'The collection to iterate over.'],\n ['let-binding', 'let binding', 'A let binding to create a local variable.'],\n ['whereExpr', 'expression', 'An expression that must evaluate to truthy for the loop body to be executed.'],\n ['whileExp', 'expression', 'An expression that must evaluate to truthy for the loop to continue.'],\n ['body', 'expressions', 'The expressions to evaluate for each iteration of the loop.'],\n ],\n returns: {\n type: 'null',\n },\n description: 'Iterates over `bindings`, evaluates `body` for each `binding` and returns `null`. This is useful for side effects.',\n examples: [\n `\ndoseq (i in [1, 2, 3]) -> write!(i * 2)\n `,\n ],\n}\n\nexport const doseqSpecialExpression: BuiltinSpecialExpression<null, DoSeqNode> = {\n arity: toFixedArity(1),\n docs: doseqDocs,\n evaluate: (node, contextStack, helpers) => {\n evaluateLoop(false, node, contextStack, helpers.evaluateNode)\n return null\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => analyze(node, contextStack, getUndefinedSymbols, builtin, evaluateNode),\n}\n","import type { Any } from '../../interface'\nimport type { Node, SpecialExpressionNode } from '../../parser/types'\nimport { asAny } from '../../typeGuards/lits'\nimport type { BuiltinSpecialExpression, FunctionDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type OrNode = SpecialExpressionNode<[typeof specialExpressionTypes['||'], Node[]]>\n\nconst docs: FunctionDocs = {\n category: 'special-expression',\n returns: {\n type: 'boolean',\n },\n args: {\n a: { type: 'any' },\n b: { type: 'any' },\n c: {\n type: 'any',\n rest: true,\n },\n },\n variants: [\n { argumentNames: ['a', 'b'] },\n { argumentNames: ['a', 'b', 'c'] },\n ],\n description: `\n Computes logical \\`or\\`. Evaluation of expressions evaluation starts from left.\n As soon as a \\`expression\\` evaluates to a truthy value, the result is returned.\n\n If all expressions evaluate to falsy values, the value of the last expression is returned.`,\n examples: [\n 'false || 1',\n '||(1, 1)',\n '||(3 > 2, \"string\")',\n '||(3 < 2, \"string\")',\n '||(false, false, false, true)',\n '||(1, 2, 3, 4)',\n ],\n}\n\nexport const orSpecialExpression: BuiltinSpecialExpression<Any, OrNode> = {\n arity: {},\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n let value: Any = false\n\n for (const param of node[1][1]) {\n value = evaluateNode(param, contextStack)\n if (value)\n break\n }\n\n return value\n },\n evaluateAsNormalExpression: (params, sourceCodeInfo) => {\n let value: Any = false\n for (const param of params) {\n value = asAny(param, sourceCodeInfo)\n if (value)\n break\n }\n return value\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => getUndefinedSymbols(node[1][1], contextStack, builtin, evaluateNode),\n}\n","import type { Any } from '../../interface'\nimport type { Node, SpecialExpressionNode } from '../../parser/types'\nimport { isUserDefinedSymbolNode } from '../../typeGuards/astNode'\nimport { asAny } from '../../typeGuards/lits'\nimport type { BuiltinSpecialExpression, FunctionDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type QqNode = SpecialExpressionNode<[typeof specialExpressionTypes['??'], Node[]]>\n\nconst docs: FunctionDocs = {\n category: 'special-expression',\n returns: {\n type: 'any',\n },\n args: {\n a: { type: 'any' },\n b: { type: 'any' },\n c: {\n type: 'any',\n rest: true,\n },\n },\n variants: [\n { argumentNames: ['a'] },\n { argumentNames: ['a', 'b'] },\n { argumentNames: ['a', 'b', 'c'] },\n ],\n description: `Nullish coalescing operator. Returns the first non-\\`null\\` value.\n\nEvaluation is short-circuited — as soon as a non-\\`null\\` value is found, the remaining expressions are not evaluated.\n\nIf all values are \\`null\\`, returns \\`null\\`.\n\nAlso works with undefined symbols — if a symbol is undefined, it is treated as \\`null\\`.`,\n examples: [\n '1 ?? 2',\n 'null ?? 2',\n '??(null)',\n '??(null, \"default\")',\n '??(1, \"default\")',\n 'false ?? \"default\"',\n '??(null, null, 3)',\n ],\n}\n\nexport const qqSpecialExpression: BuiltinSpecialExpression<Any, QqNode> = {\n arity: { min: 1 },\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n for (const param of node[1][1]) {\n if (isUserDefinedSymbolNode(param) && contextStack.lookUp(param) === null) {\n continue\n }\n const result = evaluateNode(param, contextStack)\n if (result !== null) {\n return result\n }\n }\n return null\n },\n\n evaluateAsNormalExpression: (params, sourceCodeInfo) => {\n for (const param of params) {\n const value = asAny(param, sourceCodeInfo)\n if (value !== null) {\n return value\n }\n }\n return null\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => getUndefinedSymbols(node[1][1], contextStack, builtin, evaluateNode),\n}\n","import { RecurSignal } from '../../errors'\nimport type { Node, SpecialExpressionNode } from '../../parser/types'\nimport type { BuiltinSpecialExpression, CustomDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type RecurNode = SpecialExpressionNode<[typeof specialExpressionTypes['recur'], Node[]]>\n\nconst docs: CustomDocs = {\n category: 'special-expression',\n customVariants: ['recur(...recur-args)'],\n description: 'Recursevly calls enclosing function or loop with its evaluated `recur-args`.',\n examples: [\n `\nlet foo = (n) -> do\n write!(n);\n if !(zero?(n)) then\n recur(n - 1)\n end\nend;\nfoo(3)`,\n `\n(n -> do\n write!(n);\n if !(zero?(n)) then\n recur(n - 1)\n end\nend)(3)`,\n `\nloop (n = 3) -> do\n write!(n);\n if !(zero?(n)) then\n recur(n - 1)\n end\nend`,\n ],\n}\n\nexport const recurSpecialExpression: BuiltinSpecialExpression<null, RecurNode> = {\n arity: {},\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n const params = node[1][1]\n const evaluatedParams = params.map(paramNode => evaluateNode(paramNode, contextStack))\n throw new RecurSignal(evaluatedParams)\n },\n evaluateAsNormalExpression: (params) => {\n throw new RecurSignal(params)\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) =>\n getUndefinedSymbols(node[1][1], contextStack, builtin, evaluateNode),\n}\n","import { UserDefinedError } from '../../errors'\nimport type { Node, SpecialExpressionNode } from '../../parser/types'\nimport { asString } from '../../typeGuards/string'\nimport { toFixedArity } from '../../utils/arity'\nimport type { BuiltinSpecialExpression, FunctionDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type ThrowNode = SpecialExpressionNode<[typeof specialExpressionTypes['throw'], Node]>\n\nconst docs: FunctionDocs = {\n category: 'special-expression',\n returns: {\n type: 'never',\n },\n args: {\n expr: {\n type: 'any',\n },\n },\n variants: [\n { argumentNames: ['expr'] },\n ],\n description: 'Throws `UserDefinedError` with message set to $expr evaluated. $expr must evaluate to a string.',\n examples: [\n 'try throw(\"You shall not pass!\") catch(error) \"Error: \" ++ error.message end',\n 'try throw(slice(\"You shall not pass!\", 0, 3)) catch(error) \"Error: \" ++ error.message end',\n ],\n}\n\nexport const throwSpecialExpression: BuiltinSpecialExpression<null, ThrowNode> = {\n arity: toFixedArity(1),\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n const message = asString(evaluateNode(node[1][1], contextStack), node[2], {\n nonEmpty: true,\n })\n throw new UserDefinedError(message, node[2])\n },\n evaluateAsNormalExpression: (params, sourceCodeInfo) => {\n const message = asString(params[0], sourceCodeInfo, {\n nonEmpty: true,\n })\n throw new UserDefinedError(message, undefined)\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => getUndefinedSymbols([node[1][1]], contextStack, builtin, evaluateNode),\n}\n","import type { Context } from '../../evaluator/interface'\nimport type { Any } from '../../interface'\nimport type { Node, SpecialExpressionNode, SymbolNode } from '../../parser/types'\nimport { joinSets } from '../../utils'\nimport type { BuiltinSpecialExpression, CustomDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type TryNode = SpecialExpressionNode<[typeof specialExpressionTypes['try'], Node, SymbolNode | undefined, Node]>\n\nconst docs: CustomDocs = {\n category: 'special-expression',\n customVariants: ['try { try-body } catch { catch-body }', 'try { try-body } catch(error) { catch-body }'],\n details: [\n ['try-body', 'expressions', 'The expressions to try.'],\n ['error', 'symbol', 'The error variable to bind.'],\n ['catch-body', 'expression', 'The expressions to evaluate if the try-body throws an error.'],\n ],\n description: 'Executes `try-body`. If that throws, the `catch-body` gets executed. See examples for details.',\n examples: [\n `\ntry\n 2 / 4\ncatch\n \"Oops!\"\nend`,\n `\ntry\n foo()\ncatch(error)\n \"Error: \" ++ error.message\nend`,\n `\ntry\n foo()\ncatch\n 42\nend`,\n ],\n}\n\nexport const trySpecialExpression: BuiltinSpecialExpression<Any, TryNode> = {\n arity: {},\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n const [, tryExpression, errorSymbol, catchExpression] = node[1]\n try {\n return evaluateNode(tryExpression, contextStack)\n }\n catch (error) {\n const newContext: Context = errorSymbol\n ? {\n [errorSymbol[1]]: { value: error as Any },\n }\n : {}\n return evaluateNode(catchExpression, contextStack.create(newContext))\n }\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => {\n const [, tryExpression, errorSymbol, catchExpression] = node[1]\n const tryResult = getUndefinedSymbols([tryExpression], contextStack, builtin, evaluateNode)\n const newContext: Context = errorSymbol\n ? {\n [errorSymbol[1]]: { value: true },\n }\n : {}\n const catchResult = getUndefinedSymbols([catchExpression], contextStack.create(newContext), builtin, evaluateNode)\n return joinSets(tryResult, catchResult)\n },\n}\n","import { LitsError } from '../../errors'\nimport type { Any, Arr } from '../../interface'\nimport type { Node, SpecialExpressionNode } from '../../parser/types'\nimport { isSpreadNode } from '../../typeGuards/astNode'\nimport { asAny } from '../../typeGuards/lits'\nimport type { BuiltinSpecialExpression, FunctionDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type ArrayNode = SpecialExpressionNode<[typeof specialExpressionTypes['array'], Node[]]>\n\nconst docs: FunctionDocs = {\n category: 'special-expression',\n returns: {\n type: 'any',\n array: true,\n },\n args: {\n values: {\n type: 'any',\n rest: true,\n },\n },\n variants: [\n { argumentNames: ['values'] },\n ],\n description: 'Makes new array from $values.',\n examples: [\n 'array(1, 2, 3)',\n 'array(array(null, false, true))',\n '[]',\n '[1, 2, 3]',\n '[1, 2, ...[3, 4, 5], 6]',\n '[[null, false, true]]',\n '[1, 2, 3][1]',\n ],\n hideOperatorForm: true,\n}\n\nexport const arraySpecialExpression: BuiltinSpecialExpression<Any, ArrayNode> = {\n arity: {},\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n const result: Arr = []\n\n for (const param of node[1][1]) {\n if (isSpreadNode(param)) {\n const spreadValue = evaluateNode(param[1], contextStack)\n if (!Array.isArray(spreadValue)) {\n throw new LitsError('Spread value is not an array', param[2])\n }\n result.push(...spreadValue)\n }\n else {\n result.push(evaluateNode(param, contextStack))\n }\n }\n\n return result\n },\n evaluateAsNormalExpression: (params, sourceCodeInfo) => {\n const result: Arr = []\n\n for (const param of params) {\n result.push(asAny(param, sourceCodeInfo))\n }\n\n return result\n },\n\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => getUndefinedSymbols(node[1][1], contextStack, builtin, evaluateNode),\n}\n","import { LitsError } from '../../errors'\nimport type { Any, Obj } from '../../interface'\nimport type { Node, SpecialExpressionNode } from '../../parser/types'\nimport { isUnknownRecord } from '../../typeGuards'\nimport { isSpreadNode } from '../../typeGuards/astNode'\nimport { assertString } from '../../typeGuards/string'\nimport type { BuiltinSpecialExpression, FunctionDocs } from '../interface'\nimport type { specialExpressionTypes } from '../specialExpressionTypes'\n\nexport type ObjectNode = SpecialExpressionNode<[typeof specialExpressionTypes['object'], Node[]]>\n\nconst docs: FunctionDocs = {\n category: 'special-expression',\n returns: {\n type: 'object',\n },\n args: {\n kvps: {\n type: 'any',\n rest: true,\n description: 'key - value pairs, where key is a string',\n },\n },\n variants: [\n { argumentNames: ['kvps'] },\n ],\n description: 'Constructs a new object. Object members are created from the $kvps key-value pairs. Requires an even number of arguments.',\n examples: [\n 'object()',\n `\nlet default = {\n type: \"Person\",\n name: \"John Doe\",\n age: 42\n};\n\n{\n ...default,\n name: \"Lisa\"\n}`,\n 'object(\"x\", 10, \"y\", true, \"z\", \"A string\")',\n '{}',\n '{ a: 1, b: 2 }',\n ],\n hideOperatorForm: true,\n}\n\nexport const objectSpecialExpression: BuiltinSpecialExpression<Any, ObjectNode> = {\n arity: {},\n docs,\n evaluate: (node, contextStack, { evaluateNode }) => {\n const result: Obj = {}\n\n const params = node[1][1]\n for (let i = 0; i < params.length; i += 2) {\n const keyNode = params[i]!\n if (isSpreadNode(keyNode)) {\n const spreadObject = evaluateNode(keyNode[1], contextStack)\n if (!isUnknownRecord(spreadObject)) {\n throw new LitsError('Spread value is not an object', keyNode[2])\n }\n Object.assign(result, spreadObject)\n i -= 1\n }\n else {\n const key = evaluateNode(keyNode, contextStack)\n const valueNode = params[i + 1]\n if (valueNode === undefined) {\n throw new LitsError('Missing value for key', keyNode[2])\n }\n const value = evaluateNode(valueNode, contextStack)\n assertString(key, keyNode[2])\n result[key] = value\n }\n }\n return result\n },\n evaluateAsNormalExpression: (params, sourceCodeInfo) => {\n const result: Obj = {}\n\n for (let i = 0; i < params.length; i += 2) {\n const key = params[i]\n const value = params[i + 1]\n assertString(key, sourceCodeInfo)\n result[key] = value ?? null\n }\n\n return result\n },\n getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => getUndefinedSymbols(node[1][1], contextStack, builtin, evaluateNode),\n}\n","export const specialExpressionTypes = {\n '??': 0,\n '&&': 1,\n '||': 2,\n 'array': 3,\n 'cond': 4,\n '0_def': 5,\n 'defined?': 6,\n // '0_defn': 7,\n 'block': 7,\n 'doseq': 8,\n '0_lambda': 9,\n 'for': 10,\n // 'function': 10,\n 'if': 11,\n 'let': 12,\n 'loop': 13,\n 'object': 14,\n 'recur': 15,\n 'switch': 16,\n 'throw': 17,\n 'try': 18,\n 'unless': 19,\n} as const\n\nexport type SpecialExpressionTypes = typeof specialExpressionTypes\n","import type { Builtin } from './interface'\nimport { allNormalExpressions, normalExpressions } from './normalExpressions'\nimport { andSpecialExpression } from './specialExpressions/and'\nimport { condSpecialExpression } from './specialExpressions/cond'\nimport { switchSpecialExpression } from './specialExpressions/switch'\nimport { definedSpecialExpression } from './specialExpressions/defined'\nimport { defSpecialExpression } from './specialExpressions/def'\nimport { doSpecialExpression } from './specialExpressions/block'\nimport { lambdaSpecialExpression } from './specialExpressions/functions'\nimport { ifSpecialExpression } from './specialExpressions/if'\nimport { unlessSpecialExpression } from './specialExpressions/unless'\nimport { letSpecialExpression } from './specialExpressions/let'\nimport { loopSpecialExpression } from './specialExpressions/loop'\nimport { doseqSpecialExpression, forSpecialExpression } from './specialExpressions/loops'\nimport { orSpecialExpression } from './specialExpressions/or'\nimport { qqSpecialExpression } from './specialExpressions/qq'\nimport { recurSpecialExpression } from './specialExpressions/recur'\nimport { throwSpecialExpression } from './specialExpressions/throw'\nimport { trySpecialExpression } from './specialExpressions/try'\nimport { arraySpecialExpression } from './specialExpressions/array'\nimport { objectSpecialExpression } from './specialExpressions/object'\nimport { specialExpressionTypes } from './specialExpressionTypes'\n\nexport const specialExpressions = [\n qqSpecialExpression,\n andSpecialExpression,\n orSpecialExpression,\n arraySpecialExpression,\n condSpecialExpression,\n defSpecialExpression,\n definedSpecialExpression,\n doSpecialExpression,\n doseqSpecialExpression,\n lambdaSpecialExpression,\n forSpecialExpression,\n ifSpecialExpression,\n letSpecialExpression,\n loopSpecialExpression,\n objectSpecialExpression,\n recurSpecialExpression,\n switchSpecialExpression,\n throwSpecialExpression,\n trySpecialExpression,\n unlessSpecialExpression,\n] as const\n\nexport type SpecialExpressions = typeof specialExpressions\nexport type SpecialExpression = SpecialExpressions[number]\nexport type SpecialExpressionName = keyof typeof specialExpressionTypes\nexport type CommonSpecialExpressionType = [\n | typeof specialExpressionTypes['??']\n | typeof specialExpressionTypes['&&']\n | typeof specialExpressionTypes['cond']\n | typeof specialExpressionTypes['switch']\n | typeof specialExpressionTypes['defined?']\n | typeof specialExpressionTypes['block']\n | typeof specialExpressionTypes['if']\n | typeof specialExpressionTypes['unless']\n | typeof specialExpressionTypes['||']\n | typeof specialExpressionTypes['throw']\n | typeof specialExpressionTypes['array']\n | typeof specialExpressionTypes['object'],\n]\n\nexport type SpecialExpressionType = typeof specialExpressionTypes[SpecialExpressionName]\n\nexport const builtin: Builtin = {\n normalExpressions,\n specialExpressions,\n allNormalExpressions,\n}\n\nexport const normalExpressionKeys = Object.keys(normalExpressions)\nexport const specialExpressionKeys = Object.keys(specialExpressionTypes)\nexport const specialExpressionNameSet = new Set(specialExpressionKeys)\n","import { LitsError } from '../errors'\n\nconst binaryOperators = [\n '^', // exponentiation\n\n '*', // multiplication\n '/', // division\n '%', // remainder\n\n '+', // addition\n '-', // subtraction\n\n '<<', // left shift\n '>>', // signed right shift\n '>>>', // unsigned right shift\n\n '++', // string concatenation\n\n '<', // less than\n '<=', // less than or equal\n '≤', // less than or equal\n '>', // greater than\n '>=', // greater than or equal\n '≥', // greater than or equal\n\n '==', // equal\n '!=', // not equal\n '≠', // not equal\n\n '&', // bitwise AND\n 'xor', // bitwise XOR\n '|', // bitwise OR\n\n '&&', // logical AND\n '||', // logical OR\n '??', // nullish coalescing\n\n '|>', // pipe\n] as const\n\nconst otherOperators = [\n '?', // conditional operator\n ':', // conditional operator\n '->', // lambda\n '...', // rest\n '.', // property accessor\n ',', // item separator\n '=', // assignment\n ':', // property assignment\n ';', // statement terminator\n] as const\n\nconst symbolicOperators = [\n ...binaryOperators,\n ...otherOperators,\n] as const\n\nconst nonFunctionOperators = [\n 'comment',\n 'cond',\n 'def',\n 'defined?',\n 'block',\n 'doseq',\n 'if',\n 'let',\n 'loop',\n 'recur',\n 'throw',\n 'try',\n 'unless',\n 'while',\n]\n\nconst nonFunctionOperatorSet = new Set(nonFunctionOperators)\nexport function isFunctionOperator(operator: string): boolean {\n return !nonFunctionOperatorSet.has(operator)\n}\n\nexport type SymbolicBinaryOperator = typeof binaryOperators[number]\nexport type SymbolicOperator = typeof symbolicOperators[number]\n\nconst binaryOperatorSet = new Set(binaryOperators)\nexport function isBinaryOperator(operator: string): operator is SymbolicBinaryOperator {\n return binaryOperatorSet.has(operator as SymbolicBinaryOperator)\n}\nexport function assertBinaryOperator(operator: string): asserts operator is SymbolicBinaryOperator {\n if (!isBinaryOperator(operator)) {\n throw new LitsError(`Expected symbolic binary operator, got ${operator}`, undefined)\n }\n}\nexport function asBinaryOperator(operator: string): SymbolicBinaryOperator {\n assertBinaryOperator(operator)\n return operator\n}\n\nconst symbolicOperatorSet = new Set(symbolicOperators)\nexport function isSymbolicOperator(operator: string): operator is SymbolicOperator {\n return symbolicOperatorSet.has(operator as SymbolicOperator)\n}\nexport function assertSymbolicOperator(operator: string): asserts operator is SymbolicOperator {\n if (!isSymbolicOperator(operator)) {\n throw new LitsError(`Expected symbolic operator, got ${operator}`, undefined)\n }\n}\nexport function asSymbolicOperator(operator: string): SymbolicOperator {\n assertSymbolicOperator(operator)\n return operator\n}\n","import type { ContextStack } from '../evaluator/ContextStack'\nimport type { EvaluateNode, ExecuteFunction } from '../evaluator/interface'\nimport type { GetUndefinedSymbols, UndefinedSymbols } from '../getUndefinedSymbols'\nimport type { Any, Arr } from '../interface'\nimport type {\n SpecialExpressionNode,\n} from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport type { SpecialExpressions } from '.'\n\nexport type Arity = { min?: number, max?: number }\n\n// --- Data types used in documentation ---\n\nconst dataTypes = [\n 'number',\n 'string',\n 'object',\n 'array',\n 'vector',\n 'matrix',\n 'grid',\n 'boolean',\n 'function',\n 'integer',\n 'any',\n 'null',\n 'collection',\n 'sequence',\n 'regexp',\n 'never',\n] as const\nexport type DataType = typeof dataTypes[number]\n\nexport function isDataType(arg: string): arg is DataType {\n return dataTypes.includes(arg as DataType)\n}\n\n// --- Category type ---\n\nexport const categoryRecord = {\n 'special-expression': true,\n 'predicate': true,\n 'sequence': true,\n 'collection': true,\n 'array': true,\n 'object': true,\n 'string': true,\n 'math': true,\n 'functional': true,\n 'regular-expression': true,\n 'bitwise': true,\n 'misc': true,\n 'meta': true,\n 'assert': true,\n 'vector': true,\n 'linear-algebra': true,\n 'matrix': true,\n 'grid': true,\n 'number-theory': true,\n 'random': true,\n 'shorthand': true,\n 'datatype': true,\n} as const\n\nexport type Category = keyof typeof categoryRecord\n\nexport const categories = Object.keys(categoryRecord) as Category[]\n\n// Categories that are modules (require import)\nexport const moduleCategories: Category[] = ['assert', 'bitwise', 'collection', 'functional', 'grid', 'linear-algebra', 'math', 'matrix', 'number-theory', 'random', 'sequence', 'string', 'vector']\n\n// Core categories (always available) — special-expression first, rest alphabetical\nexport const coreCategories: Category[] = ['special-expression', 'array', 'bitwise', 'collection', 'datatype', 'functional', 'math', 'meta', 'misc', 'object', 'predicate', 'regular-expression', 'sequence', 'shorthand', 'string', 'vector']\n\n// --- FunctionDocs types ---\n\nexport interface TypedValue {\n type: DataType[] | DataType\n rest?: true\n array?: true\n}\n\nexport type Argument = TypedValue & {\n description?: string\n}\n\nexport interface Variant {\n argumentNames: string[]\n}\n\nexport interface FunctionDocs {\n category: Category\n description: string\n returns: TypedValue\n args: Record<string, Argument>\n variants: Variant[]\n examples: string[]\n seeAlso?: string[]\n hideOperatorForm?: true\n tags?: string[]\n}\n\nexport interface CustomDocs {\n category: Category\n description: string\n customVariants: string[]\n details?: [string, string, string | undefined][]\n returns?: TypedValue\n examples: string[]\n seeAlso?: string[]\n tags?: string[]\n}\n\nexport type SpecialExpressionDocs = FunctionDocs | CustomDocs\n\nexport function isFunctionDocs(docs: SpecialExpressionDocs): docs is FunctionDocs {\n return 'args' in docs && 'variants' in docs\n}\n\nexport function isCustomDocs(docs: SpecialExpressionDocs): docs is CustomDocs {\n return 'customVariants' in docs\n}\n\nexport type NormalExpressionEvaluator<T> = (\n params: Arr,\n sourceCodeInfo: SourceCodeInfo | undefined,\n contextStack: ContextStack,\n { executeFunction }: { executeFunction: ExecuteFunction },\n) => T\n\nexport interface BuiltinNormalExpression<T> {\n evaluate: NormalExpressionEvaluator<T>\n name?: string\n arity: Arity\n docs?: FunctionDocs\n}\n\nexport type BuiltinNormalExpressions = Record<string, BuiltinNormalExpression<Any>>\nexport type BuiltinAllNormalExpressions = BuiltinNormalExpression<Any>[]\n\nexport interface EvaluateHelpers {\n evaluateNode: EvaluateNode\n builtin: Builtin\n getUndefinedSymbols: GetUndefinedSymbols\n}\nexport interface BuiltinSpecialExpression<T, N extends SpecialExpressionNode> {\n evaluate: (node: N, contextStack: ContextStack, helpers: EvaluateHelpers) => T\n evaluateAsNormalExpression?: NormalExpressionEvaluator<T>\n arity: Arity\n docs?: SpecialExpressionDocs\n getUndefinedSymbols: (\n node: N,\n contextStack: ContextStack,\n params: { getUndefinedSymbols: GetUndefinedSymbols, builtin: Builtin, evaluateNode: EvaluateNode },\n ) => UndefinedSymbols\n}\n\nexport interface Builtin {\n normalExpressions: BuiltinNormalExpressions\n allNormalExpressions: BuiltinAllNormalExpressions\n specialExpressions: SpecialExpressions\n}\n","import type { FunctionDocs } from '../../interface'\n\nexport const moduleDocs: Record<string, FunctionDocs> = {\n 'assert': {\n category: 'assert',\n description: 'If $value is falsy it throws `AssertionError` with $message. If no $message is provided, message is set to $value.',\n returns: {\n type: 'any',\n },\n args: {\n value: {\n type: 'any',\n },\n message: {\n type: 'string',\n },\n },\n variants: [\n {\n argumentNames: [\n 'value',\n ],\n },\n {\n argumentNames: [\n 'value',\n 'message',\n ],\n },\n ],\n examples: [\n 'let { assert } = import(\"assert\");\\ntry assert(0, \"Expected a positive value\") catch (e) e.message end',\n ],\n seeAlso: ['assert.assert-truthy', 'assert.assert-true'],\n hideOperatorForm: true,\n },\n 'assert!=': {\n category: 'assert',\n description: 'If $a is the same as $b it throws `AssertionError`.',\n returns: {\n type: 'null',\n },\n args: {\n a: {\n type: 'any',\n },\n b: {\n type: 'any',\n },\n message: {\n type: 'string',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n {\n argumentNames: [\n 'a',\n 'b',\n 'message',\n ],\n },\n ],\n examples: [\n 'let { assert!= } = import(\"assert\");\\ntry assert!=(0, 0, \"Expected different values\") catch (e) e.message end',\n 'let { assert!= } = import(\"assert\");\\ntry assert!=(0, 0) catch (e) e.message end',\n 'let { assert!= } = import(\"assert\");\\ntry 0 assert!= 0 catch (e) e.message end',\n 'let { assert!= } = import(\"assert\");\\ntry assert!=(0, 1) catch (e) e.message end',\n ],\n seeAlso: ['assert.assert='],\n hideOperatorForm: true,\n },\n 'assert=': {\n category: 'assert',\n description: 'If $a is not structural equal to $b it throws `AssertionError`.',\n returns: {\n type: 'null',\n },\n args: {\n a: {\n type: 'any',\n },\n b: {\n type: 'any',\n },\n message: {\n type: 'string',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n {\n argumentNames: [\n 'a',\n 'b',\n 'message',\n ],\n },\n ],\n examples: [\n 'let { assert= } = import(\"assert\");\\ntry assert=({ \"a\": 1 }, { \"a\": 2 }, \"Expected equal values\") catch (e) e.message end',\n 'let { assert= } = import(\"assert\");\\ntry assert=({ \"a\": 1 }, { \"a\": 2 }) catch (e) e.message end',\n 'let { assert= } = import(\"assert\");\\ntry assert=({ \"a\": 1 }, { \"a\": 1 }) catch (e) e.message end',\n ],\n seeAlso: ['assert.assert!='],\n hideOperatorForm: true,\n },\n 'assert-gt': {\n category: 'assert',\n description: 'If $a is not greater than $b it throws `AssertionError`.',\n returns: {\n type: 'null',\n },\n args: {\n a: {\n type: 'any',\n },\n b: {\n type: 'any',\n },\n message: {\n type: 'string',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n {\n argumentNames: [\n 'a',\n 'b',\n 'message',\n ],\n },\n ],\n examples: [\n 'let { assert-gt } = import(\"assert\");\\ntry assert-gt(0, 1, \"Expected greater value\") catch (e) e.message end',\n 'let { assert-gt } = import(\"assert\");\\ntry assert-gt(0, 0) catch (e) e.message end',\n 'let { assert-gt } = import(\"assert\");\\ntry assert-gt(1, 0) catch (e) e.message end',\n ],\n seeAlso: ['assert.assert-lt', 'assert.assert-gte', 'assert.assert-lte'],\n hideOperatorForm: true,\n },\n 'assert-lt': {\n category: 'assert',\n description: 'If $a is not less than $b it throws `AssertionError`.',\n returns: {\n type: 'null',\n },\n args: {\n a: {\n type: 'any',\n },\n b: {\n type: 'any',\n },\n message: {\n type: 'string',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n {\n argumentNames: [\n 'a',\n 'b',\n 'message',\n ],\n },\n ],\n examples: [\n 'let { assert-lt } = import(\"assert\");\\ntry assert-lt(1, 0, \"Expected smaller value value\") catch (e) e.message end',\n 'let { assert-lt } = import(\"assert\");\\ntry assert-lt(1, 1) catch (e) e.message end',\n 'let { assert-lt } = import(\"assert\");\\ntry assert-lt(0, 1) catch (e) e.message end',\n ],\n seeAlso: ['assert.assert-gt', 'assert.assert-lte', 'assert.assert-gte'],\n hideOperatorForm: true,\n },\n 'assert-gte': {\n category: 'assert',\n description: 'If $a is less than $b it throws `AssertionError`.',\n returns: {\n type: 'null',\n },\n args: {\n a: {\n type: 'any',\n },\n b: {\n type: 'any',\n },\n message: {\n type: 'string',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n {\n argumentNames: [\n 'a',\n 'b',\n 'message',\n ],\n },\n ],\n examples: [\n 'let { assert-gte } = import(\"assert\");\\ntry assert-gte(0, 1, \"Expected greater value\") catch (e) e.message end',\n 'let { assert-gte } = import(\"assert\");\\ntry assert-gte(0, 1) catch (e) e.message end',\n 'let { assert-gte } = import(\"assert\");\\ntry assert-gte(1, 1) catch (e) e.message end',\n ],\n seeAlso: ['assert.assert-lte', 'assert.assert-gt', 'assert.assert-lt'],\n hideOperatorForm: true,\n },\n 'assert-lte': {\n category: 'assert',\n description: 'If $a is grater than $b it throws `AssertionError`.',\n returns: {\n type: 'null',\n },\n args: {\n a: {\n type: 'any',\n },\n b: {\n type: 'any',\n },\n message: {\n type: 'string',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n {\n argumentNames: [\n 'a',\n 'b',\n 'message',\n ],\n },\n ],\n examples: [\n 'let { assert-lte } = import(\"assert\");\\ntry assert-lte(1, 0, \"Expected smaller value value\") catch (e) e.message end',\n 'let { assert-lte } = import(\"assert\");\\ntry assert-lte(1, 0) catch (e) e.message end',\n 'let { assert-lte } = import(\"assert\");\\ntry assert-lte(1, 1) catch (e) e.message end',\n ],\n seeAlso: ['assert.assert-gte', 'assert.assert-lt', 'assert.assert-gt'],\n hideOperatorForm: true,\n },\n 'assert-true': {\n category: 'assert',\n description: 'If $value is not `true` it throws `AssertionError`.',\n returns: {\n type: 'null',\n },\n args: {\n value: {\n type: 'any',\n },\n message: {\n type: 'string',\n },\n },\n variants: [\n {\n argumentNames: [\n 'value',\n ],\n },\n {\n argumentNames: [\n 'value',\n 'message',\n ],\n },\n ],\n examples: [\n 'let { assert-true } = import(\"assert\");\\ntry assert-true(false, \"Expected true\") catch (e) e.message end',\n 'let { assert-true } = import(\"assert\");\\ntry assert-true(false) catch (e) e.message end',\n 'let { assert-true } = import(\"assert\");\\ntry assert-true(true) catch (e) e.message end',\n ],\n seeAlso: ['assert.assert-false', 'assert.assert-truthy', 'assert.assert-falsy', 'assert.assert', 'assert.assert-boolean'],\n hideOperatorForm: true,\n },\n 'assert-false': {\n category: 'assert',\n description: 'If $value is not `false` it throws `AssertionError`.',\n returns: {\n type: 'null',\n },\n args: {\n value: {\n type: 'any',\n },\n message: {\n type: 'string',\n },\n },\n variants: [\n {\n argumentNames: [\n 'value',\n ],\n },\n {\n argumentNames: [\n 'value',\n 'message',\n ],\n },\n ],\n examples: [\n 'let { assert-false } = import(\"assert\");\\ntry assert-false(true, \"Expected false\") catch (e) e.message end',\n 'let { assert-false } = import(\"assert\");\\ntry assert-false(true) catch (e) e.message end',\n 'let { assert-false } = import(\"assert\");\\ntry assert-false(false) catch (e) e.message end',\n ],\n seeAlso: ['assert.assert-true', 'assert.assert-falsy', 'assert.assert-truthy', 'assert.assert-boolean'],\n hideOperatorForm: true,\n },\n 'assert-truthy': {\n category: 'assert',\n description: 'If $value is not `truthy` it throws `AssertionError`.',\n returns: {\n type: 'null',\n },\n args: {\n value: {\n type: 'any',\n },\n message: {\n type: 'string',\n },\n },\n variants: [\n {\n argumentNames: [\n 'value',\n ],\n },\n {\n argumentNames: [\n 'value',\n 'message',\n ],\n },\n ],\n examples: [\n 'let { assert-truthy } = import(\"assert\");\\ntry assert-truthy(false, \"Expected truthy\") catch (e) e.message end',\n 'let { assert-truthy } = import(\"assert\");\\ntry assert-truthy(false) catch (e) e.message end',\n 'let { assert-truthy } = import(\"assert\");\\ntry assert-truthy(0) catch (e) e.message end',\n 'let { assert-truthy } = import(\"assert\");\\ntry assert-truthy(null) catch (e) e.message end',\n 'let { assert-truthy } = import(\"assert\");\\ntry assert-truthy(\"\") catch (e) e.message end',\n 'let { assert-truthy } = import(\"assert\");\\ntry assert-truthy(true) catch (e) e.message end',\n 'let { assert-truthy } = import(\"assert\");\\ntry assert-truthy(1) catch (e) e.message end',\n 'let { assert-truthy } = import(\"assert\");\\ntry assert-truthy(\"x\") catch (e) e.message end',\n 'let { assert-truthy } = import(\"assert\");\\ntry assert-truthy([]) catch (e) e.message end',\n 'let { assert-truthy } = import(\"assert\");\\ntry assert-truthy(nd) catch (e) e.message end',\n ],\n seeAlso: ['assert.assert-falsy', 'assert.assert-true', 'assert.assert-false', 'assert.assert', 'assert.assert-null'],\n hideOperatorForm: true,\n },\n 'assert-falsy': {\n category: 'assert',\n description: 'If $value is not `falsy` it throws `AssertionError`.',\n returns: {\n type: 'null',\n },\n args: {\n value: {\n type: 'any',\n },\n message: {\n type: 'string',\n },\n },\n variants: [\n {\n argumentNames: [\n 'value',\n ],\n },\n {\n argumentNames: [\n 'value',\n 'message',\n ],\n },\n ],\n examples: [\n 'let { assert-falsy } = import(\"assert\");\\ntry assert-falsy(true, \"Expected falsy\") catch (e) e.message end',\n 'let { assert-falsy } = import(\"assert\");\\ntry assert-falsy(\"x\") catch (e) e.message end',\n 'let { assert-falsy } = import(\"assert\");\\ntry assert-falsy([]) catch (e) e.message end',\n 'let { assert-falsy } = import(\"assert\");\\ntry assert-falsy(nd) catch (e) e.message end',\n 'let { assert-falsy } = import(\"assert\");\\ntry assert-falsy(1) catch (e) e.message end',\n 'let { assert-falsy } = import(\"assert\");\\ntry assert-falsy(false) catch (e) e.message end',\n 'let { assert-falsy } = import(\"assert\");\\ntry assert-falsy(0) catch (e) e.message end',\n 'let { assert-falsy } = import(\"assert\");\\ntry assert-falsy(null) catch (e) e.message end',\n 'let { assert-falsy } = import(\"assert\");\\ntry assert-falsy(\"\") catch (e) e.message end',\n ],\n seeAlso: ['assert.assert-truthy', 'assert.assert-false', 'assert.assert-true', 'assert.assert-null'],\n hideOperatorForm: true,\n },\n 'assert-null': {\n category: 'assert',\n description: 'If $value is not `null` it throws `AssertionError`.',\n returns: {\n type: 'null',\n },\n args: {\n value: {\n type: 'any',\n },\n message: {\n type: 'string',\n },\n },\n variants: [\n {\n argumentNames: [\n 'value',\n ],\n },\n {\n argumentNames: [\n 'value',\n 'message',\n ],\n },\n ],\n examples: [\n 'let { assert-null } = import(\"assert\");\\ntry assert-null(null) catch (e) e.message end',\n 'let { assert-null } = import(\"assert\");\\ntry assert-null(true, \"Expected null\") catch (e) e.message end',\n 'let { assert-null } = import(\"assert\");\\ntry assert-null(\"x\") catch (e) e.message end',\n 'let { assert-null } = import(\"assert\");\\ntry assert-null([]) catch (e) e.message end',\n 'let { assert-null } = import(\"assert\");\\ntry assert-null(nd) catch (e) e.message end',\n 'let { assert-null } = import(\"assert\");\\ntry assert-null(1) catch (e) e.message end',\n 'let { assert-null } = import(\"assert\");\\ntry assert-null(false) catch (e) e.message end',\n 'let { assert-null } = import(\"assert\");\\ntry assert-null(0) catch (e) e.message end',\n 'let { assert-null } = import(\"assert\");\\ntry assert-null(\"\") catch (e) e.message end',\n ],\n seeAlso: ['assert.assert-truthy', 'assert.assert-falsy'],\n hideOperatorForm: true,\n },\n 'assert-throws': {\n category: 'assert',\n description: 'If $fun does not throw, it throws `AssertionError`.',\n returns: {\n type: 'null',\n },\n args: {\n fun: {\n type: 'function',\n },\n message: {\n type: 'string',\n },\n },\n variants: [\n {\n argumentNames: [\n 'fun',\n ],\n },\n {\n argumentNames: [\n 'fun',\n 'message',\n ],\n },\n ],\n examples: [\n 'let { assert-throws } = import(\"assert\");\\nassert-throws(-> throw(\"Error\"))',\n 'let { assert-throws } = import(\"assert\");\\ntry assert-throws(-> identity(\"Error\")) catch (e) e.message end',\n ],\n seeAlso: ['assert.assert-throws-error', 'assert.assert-not-throws'],\n hideOperatorForm: true,\n },\n 'assert-throws-error': {\n category: 'assert',\n description: 'If $fun does not throw $error-message, it throws `AssertionError`.',\n returns: {\n type: 'null',\n },\n args: {\n 'fun': {\n type: 'function',\n },\n 'error-message': {\n type: 'string',\n },\n 'message': {\n type: 'string',\n },\n },\n variants: [\n {\n argumentNames: [\n 'value',\n 'error-message',\n ],\n },\n {\n argumentNames: [\n 'value',\n 'error-message',\n 'message',\n ],\n },\n ],\n examples: [\n 'let { assert-throws-error } = import(\"assert\");\\ntry assert-throws-error(-> throw(\"Error\"), \"Error\") catch (e) e.message end',\n 'let { assert-throws-error } = import(\"assert\");\\ntry assert-throws-error(-> identity(\"Error\"), \"Error\") catch (e) e.message end',\n ],\n seeAlso: ['assert.assert-throws', 'assert.assert-not-throws'],\n hideOperatorForm: true,\n },\n 'assert-not-throws': {\n category: 'assert',\n description: 'If $fun throws, it throws `AssertionError`.',\n returns: {\n type: 'null',\n },\n args: {\n fun: {\n type: 'function',\n },\n message: {\n type: 'string',\n },\n },\n variants: [\n {\n argumentNames: [\n 'fun',\n ],\n },\n {\n argumentNames: [\n 'fun',\n 'message',\n ],\n },\n ],\n examples: [\n 'let { assert-not-throws } = import(\"assert\");\\ntry assert-not-throws(-> identity(\"Error\")) catch (e) e.message end',\n 'let { assert-not-throws } = import(\"assert\");\\ntry assert-not-throws(-> throw(\"Error\")) catch (e) e.message end',\n ],\n seeAlso: ['assert.assert-throws', 'assert.assert-throws-error'],\n hideOperatorForm: true,\n },\n 'assert-array': {\n category: 'assert',\n description: 'If $value is not an `array` it throws `AssertionError`.',\n returns: {\n type: 'null',\n },\n args: {\n value: {\n type: 'any',\n },\n message: {\n type: 'string',\n },\n },\n variants: [\n {\n argumentNames: [\n 'value',\n ],\n },\n {\n argumentNames: [\n 'value',\n 'message',\n ],\n },\n ],\n examples: [\n 'let { assert-array } = import(\"assert\");\\ntry assert-array([1, 2, 3]) catch (e) e.message end',\n 'let { assert-array } = import(\"assert\");\\ntry assert-array(\"string\") catch (e) e.message end',\n 'let { assert-array } = import(\"assert\");\\ntry assert-array(42, \"Expected an array\") catch (e) e.message end',\n ],\n seeAlso: ['assert.assert-object', 'assert.assert-collection', 'assert.assert-sequence'],\n hideOperatorForm: true,\n },\n 'assert-boolean': {\n category: 'assert',\n description: 'If $value is not a `boolean` it throws `AssertionError`.',\n returns: {\n type: 'null',\n },\n args: {\n value: {\n type: 'any',\n },\n message: {\n type: 'string',\n },\n },\n variants: [\n {\n argumentNames: [\n 'value',\n ],\n },\n {\n argumentNames: [\n 'value',\n 'message',\n ],\n },\n ],\n examples: [\n 'let { assert-boolean } = import(\"assert\");\\ntry assert-boolean(true) catch (e) e.message end',\n 'let { assert-boolean } = import(\"assert\");\\ntry assert-boolean(false) catch (e) e.message end',\n 'let { assert-boolean } = import(\"assert\");\\ntry assert-boolean(1, \"Expected a boolean\") catch (e) e.message end',\n ],\n seeAlso: ['assert.assert-true', 'assert.assert-false', 'assert.assert-number', 'assert.assert-string'],\n hideOperatorForm: true,\n },\n 'assert-collection': {\n category: 'assert',\n description: 'If $value is not a `collection` (array, object, or string) it throws `AssertionError`.',\n returns: {\n type: 'null',\n },\n args: {\n value: {\n type: 'any',\n },\n message: {\n type: 'string',\n },\n },\n variants: [\n {\n argumentNames: [\n 'value',\n ],\n },\n {\n argumentNames: [\n 'value',\n 'message',\n ],\n },\n ],\n examples: [\n 'let { assert-collection } = import(\"assert\");\\ntry assert-collection([1, 2]) catch (e) e.message end',\n 'let { assert-collection } = import(\"assert\");\\ntry assert-collection({ a: 1 }) catch (e) e.message end',\n 'let { assert-collection } = import(\"assert\");\\ntry assert-collection(\"hello\") catch (e) e.message end',\n 'let { assert-collection } = import(\"assert\");\\ntry assert-collection(42, \"Expected a collection\") catch (e) e.message end',\n ],\n seeAlso: ['assert.assert-sequence', 'assert.assert-array', 'assert.assert-object'],\n hideOperatorForm: true,\n },\n 'assert-function': {\n category: 'assert',\n description: 'If $value is not a `function` it throws `AssertionError`.',\n returns: {\n type: 'null',\n },\n args: {\n value: {\n type: 'any',\n },\n message: {\n type: 'string',\n },\n },\n variants: [\n {\n argumentNames: [\n 'value',\n ],\n },\n {\n argumentNames: [\n 'value',\n 'message',\n ],\n },\n ],\n examples: [\n 'let { assert-function } = import(\"assert\");\\ntry assert-function(-> $ + 1) catch (e) e.message end',\n 'let { assert-function } = import(\"assert\");\\ntry assert-function(42, \"Expected a function\") catch (e) e.message end',\n ],\n seeAlso: ['assert.assert-number', 'assert.assert-string'],\n hideOperatorForm: true,\n },\n 'assert-grid': {\n category: 'assert',\n description: 'If $value is not a `grid` it throws `AssertionError`.',\n returns: {\n type: 'null',\n },\n args: {\n value: {\n type: 'any',\n },\n message: {\n type: 'string',\n },\n },\n variants: [\n {\n argumentNames: [\n 'value',\n ],\n },\n {\n argumentNames: [\n 'value',\n 'message',\n ],\n },\n ],\n examples: [\n 'let { assert-grid } = import(\"assert\");\\ntry assert-grid([[1, 2], [3, 4]]) catch (e) e.message end',\n 'let { assert-grid } = import(\"assert\");\\ntry assert-grid([1, 2], \"Expected a grid\") catch (e) e.message end',\n ],\n seeAlso: ['assert.assert-matrix', 'assert.assert-vector'],\n hideOperatorForm: true,\n },\n 'assert-integer': {\n category: 'assert',\n description: 'If $value is not an `integer` it throws `AssertionError`.',\n returns: {\n type: 'null',\n },\n args: {\n value: {\n type: 'any',\n },\n message: {\n type: 'string',\n },\n },\n variants: [\n {\n argumentNames: [\n 'value',\n ],\n },\n {\n argumentNames: [\n 'value',\n 'message',\n ],\n },\n ],\n examples: [\n 'let { assert-integer } = import(\"assert\");\\ntry assert-integer(42) catch (e) e.message end',\n 'let { assert-integer } = import(\"assert\");\\ntry assert-integer(3.14, \"Expected an integer\") catch (e) e.message end',\n ],\n seeAlso: ['assert.assert-number'],\n hideOperatorForm: true,\n },\n 'assert-matrix': {\n category: 'assert',\n description: 'If $value is not a `matrix` it throws `AssertionError`.',\n returns: {\n type: 'null',\n },\n args: {\n value: {\n type: 'any',\n },\n message: {\n type: 'string',\n },\n },\n variants: [\n {\n argumentNames: [\n 'value',\n ],\n },\n {\n argumentNames: [\n 'value',\n 'message',\n ],\n },\n ],\n examples: [\n 'let { assert-matrix } = import(\"assert\");\\ntry assert-matrix([[1, 2], [3, 4]]) catch (e) e.message end',\n 'let { assert-matrix } = import(\"assert\");\\ntry assert-matrix([1, 2], \"Expected a matrix\") catch (e) e.message end',\n ],\n seeAlso: ['assert.assert-vector', 'assert.assert-grid'],\n hideOperatorForm: true,\n },\n 'assert-number': {\n category: 'assert',\n description: 'If $value is not a `number` it throws `AssertionError`.',\n returns: {\n type: 'null',\n },\n args: {\n value: {\n type: 'any',\n },\n message: {\n type: 'string',\n },\n },\n variants: [\n {\n argumentNames: [\n 'value',\n ],\n },\n {\n argumentNames: [\n 'value',\n 'message',\n ],\n },\n ],\n examples: [\n 'let { assert-number } = import(\"assert\");\\ntry assert-number(42) catch (e) e.message end',\n 'let { assert-number } = import(\"assert\");\\ntry assert-number(\"hello\", \"Expected a number\") catch (e) e.message end',\n ],\n seeAlso: ['assert.assert-integer', 'assert.assert-boolean', 'assert.assert-string', 'assert.assert-function'],\n hideOperatorForm: true,\n },\n 'assert-object': {\n category: 'assert',\n description: 'If $value is not an `object` it throws `AssertionError`.',\n returns: {\n type: 'null',\n },\n args: {\n value: {\n type: 'any',\n },\n message: {\n type: 'string',\n },\n },\n variants: [\n {\n argumentNames: [\n 'value',\n ],\n },\n {\n argumentNames: [\n 'value',\n 'message',\n ],\n },\n ],\n examples: [\n 'let { assert-object } = import(\"assert\");\\ntry assert-object({ a: 1 }) catch (e) e.message end',\n 'let { assert-object } = import(\"assert\");\\ntry assert-object([1, 2], \"Expected an object\") catch (e) e.message end',\n ],\n seeAlso: ['assert.assert-array', 'assert.assert-collection'],\n hideOperatorForm: true,\n },\n 'assert-regexp': {\n category: 'assert',\n description: 'If $value is not a `regexp` it throws `AssertionError`.',\n returns: {\n type: 'null',\n },\n args: {\n value: {\n type: 'any',\n },\n message: {\n type: 'string',\n },\n },\n variants: [\n {\n argumentNames: [\n 'value',\n ],\n },\n {\n argumentNames: [\n 'value',\n 'message',\n ],\n },\n ],\n examples: [\n 'let { assert-regexp } = import(\"assert\");\\ntry assert-regexp(#\"^start\") catch (e) e.message end',\n 'let { assert-regexp } = import(\"assert\");\\ntry assert-regexp(\"hello\", \"Expected a regexp\") catch (e) e.message end',\n ],\n seeAlso: ['assert.assert-string'],\n hideOperatorForm: true,\n },\n 'assert-sequence': {\n category: 'assert',\n description: 'If $value is not a `sequence` (array or string) it throws `AssertionError`.',\n returns: {\n type: 'null',\n },\n args: {\n value: {\n type: 'any',\n },\n message: {\n type: 'string',\n },\n },\n variants: [\n {\n argumentNames: [\n 'value',\n ],\n },\n {\n argumentNames: [\n 'value',\n 'message',\n ],\n },\n ],\n examples: [\n 'let { assert-sequence } = import(\"assert\");\\ntry assert-sequence([1, 2]) catch (e) e.message end',\n 'let { assert-sequence } = import(\"assert\");\\ntry assert-sequence(\"hello\") catch (e) e.message end',\n 'let { assert-sequence } = import(\"assert\");\\ntry assert-sequence({ a: 1 }, \"Expected a sequence\") catch (e) e.message end',\n ],\n seeAlso: ['assert.assert-collection', 'assert.assert-array'],\n hideOperatorForm: true,\n },\n 'assert-string': {\n category: 'assert',\n description: 'If $value is not a `string` it throws `AssertionError`.',\n returns: {\n type: 'null',\n },\n args: {\n value: {\n type: 'any',\n },\n message: {\n type: 'string',\n },\n },\n variants: [\n {\n argumentNames: [\n 'value',\n ],\n },\n {\n argumentNames: [\n 'value',\n 'message',\n ],\n },\n ],\n examples: [\n 'let { assert-string } = import(\"assert\");\\ntry assert-string(\"hello\") catch (e) e.message end',\n 'let { assert-string } = import(\"assert\");\\ntry assert-string(42, \"Expected a string\") catch (e) e.message end',\n ],\n seeAlso: ['assert.assert-number', 'assert.assert-boolean', 'assert.assert-regexp', 'assert.assert-function'],\n hideOperatorForm: true,\n },\n 'assert-vector': {\n category: 'assert',\n description: 'If $value is not a `vector` it throws `AssertionError`.',\n returns: {\n type: 'null',\n },\n args: {\n value: {\n type: 'any',\n },\n message: {\n type: 'string',\n },\n },\n variants: [\n {\n argumentNames: [\n 'value',\n ],\n },\n {\n argumentNames: [\n 'value',\n 'message',\n ],\n },\n ],\n examples: [\n 'let { assert-vector } = import(\"assert\");\\ntry assert-vector([1, 2, 3]) catch (e) e.message end',\n 'let { assert-vector } = import(\"assert\");\\ntry assert-vector([\"a\", \"b\"], \"Expected a vector\") catch (e) e.message end',\n ],\n seeAlso: ['assert.assert-matrix', 'assert.assert-grid'],\n hideOperatorForm: true,\n },\n}\n","import type { LitsError } from '../../../errors'\nimport { AssertionError } from '../../../errors'\nimport type { Any } from '../../../interface'\nimport { compare, deepEqual } from '../../../utils'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\nimport { asAny, assertFunctionLike, isColl, isObj, isRegularExpression, isSeq } from '../../../typeGuards/lits'\nimport { isLitsFunction } from '../../../typeGuards/litsFunction'\nimport { isNumber } from '../../../typeGuards/number'\nimport { assertString, assertStringOrNumber } from '../../../typeGuards/string'\nimport { isGrid, isMatrix, isVector } from '../../../typeGuards/annotatedArrays'\nimport type { LitsModule } from '../interface'\nimport { moduleDocs } from './docs'\n\nconst assertNormalExpression: BuiltinNormalExpressions = {\n 'assert': {\n evaluate: (params, sourceCodeInfo): Any => {\n const value = params[0]\n const message = params.length === 2 ? params[1] : `${value}`\n assertString(message, sourceCodeInfo)\n if (!value)\n throw new AssertionError(message, sourceCodeInfo)\n\n return asAny(value, sourceCodeInfo)\n },\n arity: { min: 1, max: 2 },\n },\n 'assert=': {\n evaluate: ([first, second, message], sourceCodeInfo): null => {\n if (message !== undefined) {\n assertString(message, sourceCodeInfo)\n message = ` ${message}`\n }\n message ??= ''\n if (!deepEqual(asAny(first, sourceCodeInfo), asAny(second, sourceCodeInfo), sourceCodeInfo)) {\n throw new AssertionError(\n `Expected ${JSON.stringify(first, null, 2)} to deep equal ${JSON.stringify(second, null, 2)}.${message}`,\n sourceCodeInfo,\n )\n }\n return null\n },\n arity: { min: 2, max: 3 },\n },\n 'assert!=': {\n evaluate: ([first, second, message], sourceCodeInfo): null => {\n if (message !== undefined) {\n assertString(message, sourceCodeInfo)\n message = ` ${message}`\n }\n message ??= ''\n if (deepEqual(asAny(first, sourceCodeInfo), asAny(second, sourceCodeInfo), sourceCodeInfo)) {\n throw new AssertionError(\n `Expected ${JSON.stringify(first)} not to deep equal ${JSON.stringify(second)}.${message}`,\n sourceCodeInfo,\n )\n }\n return null\n },\n arity: { min: 2, max: 3 },\n },\n 'assert-gt': {\n evaluate: ([first, second, message], sourceCodeInfo): null => {\n assertStringOrNumber(first, sourceCodeInfo)\n assertStringOrNumber(second, sourceCodeInfo)\n if (message !== undefined) {\n assertString(message, sourceCodeInfo)\n message = ` ${message}`\n }\n message ??= ''\n if (compare(first, second, sourceCodeInfo) <= 0)\n throw new AssertionError(`Expected ${first} to be grater than ${second}.${message}`, sourceCodeInfo)\n\n return null\n },\n arity: { min: 2, max: 3 },\n },\n 'assert-gte': {\n evaluate: ([first, second, message], sourceCodeInfo): null => {\n assertStringOrNumber(first, sourceCodeInfo)\n assertStringOrNumber(second, sourceCodeInfo)\n if (message !== undefined) {\n assertString(message, sourceCodeInfo)\n message = ` ${message}`\n }\n message ??= ''\n if (compare(first, second, sourceCodeInfo) < 0)\n throw new AssertionError(`Expected ${first} to be grater than or equal to ${second}.${message}`, sourceCodeInfo)\n\n return null\n },\n arity: { min: 2, max: 3 },\n },\n 'assert-lt': {\n evaluate: ([first, second, message], sourceCodeInfo): null => {\n assertStringOrNumber(first, sourceCodeInfo)\n assertStringOrNumber(second, sourceCodeInfo)\n if (message !== undefined) {\n assertString(message, sourceCodeInfo)\n message = ` ${message}`\n }\n message ??= ''\n if (compare(first, second, sourceCodeInfo) >= 0)\n throw new AssertionError(`Expected ${first} to be less than ${second}.${message}`, sourceCodeInfo)\n\n return null\n },\n arity: { min: 2, max: 3 },\n },\n 'assert-lte': {\n evaluate: ([first, second, message], sourceCodeInfo): null => {\n assertStringOrNumber(first, sourceCodeInfo)\n assertStringOrNumber(second, sourceCodeInfo)\n if (message !== undefined) {\n assertString(message, sourceCodeInfo)\n message = ` ${message}`\n }\n message ??= ''\n if (compare(first, second, sourceCodeInfo) > 0)\n throw new AssertionError(`Expected ${first} to be less than or equal to ${second}.${message}`, sourceCodeInfo)\n\n return null\n },\n arity: { min: 2, max: 3 },\n },\n 'assert-true': {\n evaluate: ([first, message], sourceCodeInfo): null => {\n if (message !== undefined) {\n assertString(message, sourceCodeInfo)\n message = ` ${message}`\n }\n message ??= ''\n if (first !== true)\n throw new AssertionError(`Expected ${first} to be true.${message}`, sourceCodeInfo)\n\n return null\n },\n arity: { min: 1, max: 2 },\n },\n 'assert-false': {\n evaluate: ([first, message], sourceCodeInfo): null => {\n if (message !== undefined) {\n assertString(message, sourceCodeInfo)\n message = ` ${message}`\n }\n message ??= ''\n if (first !== false)\n throw new AssertionError(`Expected ${first} to be false.${message}`, sourceCodeInfo)\n\n return null\n },\n arity: { min: 1, max: 2 },\n },\n 'assert-truthy': {\n evaluate: ([first, message], sourceCodeInfo): null => {\n if (message !== undefined) {\n assertString(message, sourceCodeInfo)\n message = ` ${message}`\n }\n message ??= ''\n if (!first)\n throw new AssertionError(`Expected ${first} to be truthy.${message}`, sourceCodeInfo)\n\n return null\n },\n arity: { min: 1, max: 2 },\n },\n 'assert-falsy': {\n evaluate: ([first, message], sourceCodeInfo): null => {\n if (message !== undefined) {\n assertString(message, sourceCodeInfo)\n message = ` ${message}`\n }\n message ??= ''\n if (first)\n throw new AssertionError(`Expected ${first} to be falsy.${message}`, sourceCodeInfo)\n\n return null\n },\n arity: { min: 1, max: 2 },\n },\n 'assert-null': {\n evaluate: ([first, message], sourceCodeInfo): null => {\n if (message !== undefined) {\n assertString(message, sourceCodeInfo)\n message = ` ${message}`\n }\n message ??= ''\n if (first !== null)\n throw new AssertionError(`Expected ${first} to be null.${message}`, sourceCodeInfo)\n\n return null\n },\n arity: { min: 1, max: 2 },\n },\n 'assert-throws': {\n evaluate: ([func, message], sourceCodeInfo, contextStack, { executeFunction }): null => {\n if (message !== undefined) {\n assertString(message, sourceCodeInfo)\n message = ` ${message}`\n }\n message ??= ''\n assertFunctionLike(func, sourceCodeInfo)\n try {\n executeFunction(func, [], contextStack, sourceCodeInfo)\n }\n catch {\n return null\n }\n throw new AssertionError(`Expected function to throw.${message}`, sourceCodeInfo)\n },\n arity: { min: 1, max: 2 },\n },\n 'assert-throws-error': {\n evaluate: ([func, throwMessage, message], sourceCodeInfo, contextStack, { executeFunction }): null => {\n if (message !== undefined) {\n assertString(message, sourceCodeInfo)\n message = ` ${message}`\n }\n message ??= ''\n assertString(throwMessage, sourceCodeInfo)\n assertFunctionLike(func, sourceCodeInfo)\n try {\n executeFunction(func, [], contextStack, sourceCodeInfo)\n }\n catch (error) {\n const errorMessage = (error as LitsError).shortMessage\n if (errorMessage !== throwMessage) {\n throw new AssertionError(\n `Expected function to throw \"${throwMessage}\", but thrown \"${errorMessage}\".${message}`,\n sourceCodeInfo,\n )\n }\n return null\n }\n throw new AssertionError(`Expected function to throw \"${throwMessage}\".${message}`, sourceCodeInfo)\n },\n arity: { min: 2, max: 3 },\n },\n 'assert-not-throws': {\n evaluate: ([func, message], sourceCodeInfo, contextStack, { executeFunction }): null => {\n if (message !== undefined) {\n assertString(message, sourceCodeInfo)\n message = ` ${message}`\n }\n message ??= ''\n assertFunctionLike(func, sourceCodeInfo)\n try {\n executeFunction(func, [], contextStack, sourceCodeInfo)\n }\n catch {\n throw new AssertionError(`Expected function not to throw.${message}`, sourceCodeInfo)\n }\n return null\n },\n arity: { min: 1, max: 2 },\n },\n 'assert-array': {\n evaluate: ([first, message], sourceCodeInfo): null => {\n if (message !== undefined) {\n assertString(message, sourceCodeInfo)\n message = ` ${message}`\n }\n message ??= ''\n if (!Array.isArray(first))\n throw new AssertionError(`Expected ${JSON.stringify(first)} to be an array.${message}`, sourceCodeInfo)\n\n return null\n },\n arity: { min: 1, max: 2 },\n },\n 'assert-boolean': {\n evaluate: ([first, message], sourceCodeInfo): null => {\n if (message !== undefined) {\n assertString(message, sourceCodeInfo)\n message = ` ${message}`\n }\n message ??= ''\n if (typeof first !== 'boolean')\n throw new AssertionError(`Expected ${JSON.stringify(first)} to be a boolean.${message}`, sourceCodeInfo)\n\n return null\n },\n arity: { min: 1, max: 2 },\n },\n 'assert-collection': {\n evaluate: ([first, message], sourceCodeInfo): null => {\n if (message !== undefined) {\n assertString(message, sourceCodeInfo)\n message = ` ${message}`\n }\n message ??= ''\n if (!isColl(first))\n throw new AssertionError(`Expected ${JSON.stringify(first)} to be a collection.${message}`, sourceCodeInfo)\n\n return null\n },\n arity: { min: 1, max: 2 },\n },\n 'assert-function': {\n evaluate: ([first, message], sourceCodeInfo): null => {\n if (message !== undefined) {\n assertString(message, sourceCodeInfo)\n message = ` ${message}`\n }\n message ??= ''\n if (!isLitsFunction(first))\n throw new AssertionError(`Expected ${JSON.stringify(first)} to be a function.${message}`, sourceCodeInfo)\n\n return null\n },\n arity: { min: 1, max: 2 },\n },\n 'assert-grid': {\n evaluate: ([first, message], sourceCodeInfo): null => {\n if (message !== undefined) {\n assertString(message, sourceCodeInfo)\n message = ` ${message}`\n }\n message ??= ''\n if (!isGrid(first))\n throw new AssertionError(`Expected ${JSON.stringify(first)} to be a grid.${message}`, sourceCodeInfo)\n\n return null\n },\n arity: { min: 1, max: 2 },\n },\n 'assert-integer': {\n evaluate: ([first, message], sourceCodeInfo): null => {\n if (message !== undefined) {\n assertString(message, sourceCodeInfo)\n message = ` ${message}`\n }\n message ??= ''\n if (typeof first !== 'number' || !isNumber(first, { integer: true }))\n throw new AssertionError(`Expected ${JSON.stringify(first)} to be an integer.${message}`, sourceCodeInfo)\n\n return null\n },\n arity: { min: 1, max: 2 },\n },\n 'assert-matrix': {\n evaluate: ([first, message], sourceCodeInfo): null => {\n if (message !== undefined) {\n assertString(message, sourceCodeInfo)\n message = ` ${message}`\n }\n message ??= ''\n if (!isMatrix(first))\n throw new AssertionError(`Expected ${JSON.stringify(first)} to be a matrix.${message}`, sourceCodeInfo)\n\n return null\n },\n arity: { min: 1, max: 2 },\n },\n 'assert-number': {\n evaluate: ([first, message], sourceCodeInfo): null => {\n if (message !== undefined) {\n assertString(message, sourceCodeInfo)\n message = ` ${message}`\n }\n message ??= ''\n if (typeof first !== 'number')\n throw new AssertionError(`Expected ${JSON.stringify(first)} to be a number.${message}`, sourceCodeInfo)\n\n return null\n },\n arity: { min: 1, max: 2 },\n },\n 'assert-object': {\n evaluate: ([first, message], sourceCodeInfo): null => {\n if (message !== undefined) {\n assertString(message, sourceCodeInfo)\n message = ` ${message}`\n }\n message ??= ''\n if (!isObj(first))\n throw new AssertionError(`Expected ${JSON.stringify(first)} to be an object.${message}`, sourceCodeInfo)\n\n return null\n },\n arity: { min: 1, max: 2 },\n },\n 'assert-regexp': {\n evaluate: ([first, message], sourceCodeInfo): null => {\n if (message !== undefined) {\n assertString(message, sourceCodeInfo)\n message = ` ${message}`\n }\n message ??= ''\n if (!isRegularExpression(first))\n throw new AssertionError(`Expected ${JSON.stringify(first)} to be a regexp.${message}`, sourceCodeInfo)\n\n return null\n },\n arity: { min: 1, max: 2 },\n },\n 'assert-sequence': {\n evaluate: ([first, message], sourceCodeInfo): null => {\n if (message !== undefined) {\n assertString(message, sourceCodeInfo)\n message = ` ${message}`\n }\n message ??= ''\n if (!isSeq(first))\n throw new AssertionError(`Expected ${JSON.stringify(first)} to be a sequence.${message}`, sourceCodeInfo)\n\n return null\n },\n arity: { min: 1, max: 2 },\n },\n 'assert-string': {\n evaluate: ([first, message], sourceCodeInfo): null => {\n if (message !== undefined) {\n assertString(message, sourceCodeInfo)\n message = ` ${message}`\n }\n message ??= ''\n if (typeof first !== 'string')\n throw new AssertionError(`Expected ${JSON.stringify(first)} to be a string.${message}`, sourceCodeInfo)\n\n return null\n },\n arity: { min: 1, max: 2 },\n },\n 'assert-vector': {\n evaluate: ([first, message], sourceCodeInfo): null => {\n if (message !== undefined) {\n assertString(message, sourceCodeInfo)\n message = ` ${message}`\n }\n message ??= ''\n if (!isVector(first))\n throw new AssertionError(`Expected ${JSON.stringify(first)} to be a vector.${message}`, sourceCodeInfo)\n\n return null\n },\n arity: { min: 1, max: 2 },\n },\n}\n\nfor (const [key, docs] of Object.entries(moduleDocs)) {\n if (assertNormalExpression[key])\n assertNormalExpression[key].docs = docs\n}\n\nexport const assertModule: LitsModule = {\n name: 'assert',\n functions: assertNormalExpression,\n}\n","import type { FunctionDocs } from '../../interface'\n\nexport const moduleDocs: Record<string, FunctionDocs> = {\n 'every?': {\n category: 'grid',\n 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.',\n returns: {\n type: 'boolean',\n },\n args: {\n a: {\n type: 'grid',\n },\n b: {\n type: 'function',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n '// Using \"as\" alias because \"every?\" shadows a builtin function\\nlet { every? as grid-every? } = import(\"grid\");\\ngrid-every?([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n], string?)',\n '// Using \"as\" alias because \"every?\" shadows a builtin function\\nlet { every? as grid-every? } = import(\"grid\");\\ngrid-every?([\\n [\"Albert\", \"father\"],\\n [\"Nina\", \"mother\"],\\n [\"Kian\", \"son\"],\\n], string?)',\n '// Using \"as\" alias because \"every?\" shadows a builtin function\\nlet { every? as grid-every? } = import(\"grid\");\\ngrid-every?([\\n [1, 2],\\n [3, 4],\\n], string?)',\n ],\n seeAlso: ['collection.every?', 'grid.some?', 'grid.every-row?', 'grid.every-col?'],\n },\n 'some?': {\n category: 'grid',\n 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.',\n returns: {\n type: 'boolean',\n },\n args: {\n a: {\n type: 'grid',\n },\n b: {\n type: 'function',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { some? } = import(\"grid\");\\nsome?([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n], string?)',\n 'let { some? } = import(\"grid\");\\nsome?([\\n [\"Albert\", \"father\"],\\n [\"Nina\", \"mother\"],\\n [\"Kian\", \"son\"],\\n], string?)',\n 'let { some? } = import(\"grid\");\\nsome?([\\n [1, 2],\\n [3, 4],\\n], string?)',\n ],\n seeAlso: ['collection.any?', 'grid.every?', 'grid.some-row?', 'grid.some-col?'],\n },\n 'every-row?': {\n category: 'grid',\n 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.',\n returns: {\n type: 'boolean',\n },\n args: {\n a: {\n type: 'grid',\n },\n b: {\n type: 'function',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { every-row? } = import(\"grid\");\\nevery-row?([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n], -> string?($[0]))',\n 'let { every-row? } = import(\"grid\");\\nevery-row?([\\n [\"Albert\", \"father\"],\\n [\"Nina\", \"mother\"],\\n [\"Kian\", \"son\"],\\n], -> string?($[0]))',\n 'let { every-row? } = import(\"grid\");\\nevery-row?([\\n [1, 2],\\n [3, 4],\\n], -> string?($[0]))',\n ],\n seeAlso: ['grid.some-row?', 'grid.every-col?', 'grid.every?'],\n },\n 'some-row?': {\n category: 'grid',\n 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.',\n returns: {\n type: 'boolean',\n },\n args: {\n a: {\n type: 'grid',\n },\n b: {\n type: 'function',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { some-row? } = import(\"grid\");\\nsome-row?([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n], -> $ contains? \"Albert\")',\n 'let { some-row? } = import(\"grid\");\\nsome-row?([\\n [\"Albert\", \"father\"],\\n [\"Nina\", \"mother\"],\\n [\"Kian\", \"son\"],\\n], -> $ contains? \"Albert\")',\n 'let { some-row? } = import(\"grid\");\\nsome-row?([\\n [1, 2],\\n [3, 4],\\n], -> $ contains? \"Albert\")',\n ],\n seeAlso: ['grid.every-row?', 'grid.some-col?', 'grid.some?'],\n },\n 'every-col?': {\n category: 'grid',\n 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.',\n returns: {\n type: 'boolean',\n },\n args: {\n a: {\n type: 'grid',\n },\n b: {\n type: 'function',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { every-col? } = import(\"grid\");\\nevery-col?([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n], -> string?($[0]))',\n 'let { every-col? } = import(\"grid\");\\nevery-col?([\\n [\"Albert\", \"father\"],\\n [\"Nina\", \"mother\"],\\n [\"Kian\", \"son\"],\\n], -> string?($[0]))',\n 'let { every-col? } = import(\"grid\");\\nevery-col?([\\n [1, 2],\\n [3, 4],\\n], -> string?($[0]))',\n ],\n seeAlso: ['grid.some-col?', 'grid.every-row?', 'grid.every?'],\n },\n 'some-col?': {\n category: 'grid',\n 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.',\n returns: {\n type: 'boolean',\n },\n args: {\n a: {\n type: 'grid',\n },\n b: {\n type: 'function',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { some-col? } = import(\"grid\");\\nsome-col?([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n], -> $ contains? \"Albert\")',\n 'let { some-col? } = import(\"grid\");\\nsome-col?([\\n [\"Albert\", \"father\"],\\n [\"Nina\", \"mother\"],\\n [\"Kian\", \"son\"],\\n], -> $ contains? \"Albert\")',\n 'let { some-col? } = import(\"grid\");\\nsome-col?([\\n [1, 2],\\n [3, 4],\\n], -> $ contains? \"Albert\")',\n ],\n seeAlso: ['grid.every-col?', 'grid.some-row?', 'grid.some?'],\n },\n 'row': {\n category: 'grid',\n description: 'Returns the row at index $a in the grid $b.',\n returns: {\n type: 'any',\n },\n args: {\n a: {\n type: 'grid',\n },\n b: {\n type: 'number',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { row } = import(\"grid\");\\nrow([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n], 0)',\n 'let { row } = import(\"grid\");\\nrow([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n], 1)',\n 'let { row } = import(\"grid\");\\nrow([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n], 2)',\n ],\n seeAlso: ['grid.col', 'grid.shape'],\n },\n 'col': {\n category: 'grid',\n description: 'Returns the column at index $a in the grid $b.',\n returns: {\n type: 'any',\n },\n args: {\n a: {\n type: 'grid',\n },\n b: {\n type: 'number',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { col } = import(\"grid\");\\ncol([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n], 0)',\n 'let { col } = import(\"grid\");\\ncol([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n], 1)',\n 'let { col } = import(\"grid\");\\ncol([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n], 2)',\n ],\n seeAlso: ['grid.row', 'grid.shape'],\n },\n 'shape': {\n category: 'grid',\n 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.',\n returns: {\n type: 'vector',\n },\n args: {\n g: {\n type: 'grid',\n description: 'The grid to get the shape of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'g',\n ],\n },\n ],\n examples: [\n 'let { shape } = import(\"grid\");\\nshape([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n])',\n 'let { shape } = import(\"grid\");\\nshape([\\n [\"Albert\", \"father\"],\\n [\"Nina\", \"mother\"],\\n [\"Kian\", \"son\"],\\n])',\n 'let { shape } = import(\"grid\");\\nshape([\\n [1, 2],\\n [3, 4],\\n])',\n ],\n seeAlso: ['grid.row', 'grid.col', 'grid.reshape'],\n },\n 'fill': {\n category: 'grid',\n description: 'Creates a grid of the specified size, filled with the specified value.',\n returns: {\n type: 'grid',\n },\n args: {\n rows: {\n type: 'integer',\n description: 'The number of rows in the grid.',\n },\n cols: {\n type: 'integer',\n description: 'The number of columns in the grid.',\n },\n value: {\n type: 'any',\n description: 'The value to fill the grid with.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'rows',\n 'cols',\n 'value',\n ],\n },\n ],\n examples: [\n 'let { fill } = import(\"grid\");\\nfill(2, 3, 0)',\n 'let { fill } = import(\"grid\");\\nfill(2, 3, \"x\")',\n ],\n seeAlso: ['grid.generate', 'grid.from-array', 'vector.fill'],\n },\n 'generate': {\n category: 'grid',\n description: 'Generates a grid of the specified size, where each element is generated by the provided function.',\n returns: {\n type: 'grid',\n },\n args: {\n rows: {\n type: 'number',\n description: 'The number of rows in the grid.',\n },\n cols: {\n type: 'number',\n description: 'The number of columns in the grid.',\n },\n fn: {\n type: 'function',\n description: 'The function to generate the grid. It takes two arguments: the row index and the column index.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'rows',\n 'cols',\n 'fn',\n ],\n },\n ],\n examples: [\n 'let { generate } = import(\"grid\");\\ngenerate(3, 3, (i, j) -> i + j)',\n ],\n seeAlso: ['grid.fill', 'grid.from-array', 'vector.generate'],\n },\n 'reshape': {\n category: 'grid',\n 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.',\n returns: {\n type: 'grid',\n },\n args: {\n a: {\n type: 'grid',\n },\n b: {\n type: 'number',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { reshape } = import(\"grid\");\\nreshape([\\n [\"Albert\", \"father\"],\\n [\"Nina\", \"mother\"],\\n [\"Kian\", \"son\"],\\n], 2)',\n ],\n seeAlso: ['grid.shape', 'grid.from-array'],\n },\n 'transpose': {\n category: 'grid',\n description: 'Transposes the grid `g`, swapping its rows and columns.',\n returns: {\n type: 'grid',\n },\n args: {\n g: {\n type: 'grid',\n description: 'The grid to transpose.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'g',\n ],\n },\n ],\n examples: [\n 'let { transpose } = import(\"grid\");\\ntranspose([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n])',\n 'let { transpose } = import(\"grid\");\\ntranspose([\\n [\"Albert\", \"father\"],\\n [\"Nina\", \"mother\"],\\n [\"Kian\", \"son\"],\\n])',\n 'let { transpose } = import(\"grid\");\\ntranspose([\\n [1, 2],\\n [3, 4],\\n])',\n ],\n seeAlso: ['grid.flip-h', 'grid.flip-v', 'grid.rotate'],\n },\n 'flip-h': {\n category: 'grid',\n description: 'Flips the grid `g` horizontally.',\n returns: {\n type: 'grid',\n },\n args: {\n g: {\n type: 'grid',\n description: 'The grid to flip horizontally.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'g',\n ],\n },\n ],\n examples: [\n 'let { flip-h } = import(\"grid\");\\nflip-h([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n])',\n 'let { flip-h } = import(\"grid\");\\nflip-h([\\n [\"Albert\", \"father\"],\\n [\"Nina\", \"mother\"],\\n [\"Kian\", \"son\"],\\n])',\n 'let { flip-h } = import(\"grid\");\\nflip-h([\\n [1, 2],\\n [3, 4],\\n])',\n ],\n seeAlso: ['grid.flip-v', 'grid.transpose', 'grid.rotate', 'grid.reverse-cols'],\n },\n 'flip-v': {\n category: 'grid',\n description: 'Flips the grid `g` vertically.',\n returns: {\n type: 'grid',\n },\n args: {\n g: {\n type: 'grid',\n description: 'The grid to flip vertically.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'g',\n ],\n },\n ],\n examples: [\n 'let { flip-v } = import(\"grid\");\\nflip-v([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n])',\n 'let { flip-v } = import(\"grid\");\\nflip-v([\\n [\"Albert\", \"father\"],\\n [\"Nina\", \"mother\"],\\n [\"Kian\", \"son\"],\\n])',\n 'let { flip-v } = import(\"grid\");\\nflip-v([\\n [1, 2],\\n [3, 4],\\n])',\n ],\n seeAlso: ['grid.flip-h', 'grid.transpose', 'grid.rotate', 'grid.reverse-rows'],\n },\n 'rotate': {\n category: 'grid',\n 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.',\n returns: {\n type: 'grid',\n },\n args: {\n a: {\n type: 'grid',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { rotate } = import(\"grid\");\\nrotate([\\n [1, 2],\\n [3, 4],\\n], 1)',\n 'let { rotate } = import(\"grid\");\\nrotate([\\n [1, 2],\\n [3, 4],\\n], 2)',\n 'let { rotate } = import(\"grid\");\\nrotate([\\n [1, 2],\\n [3, 4],\\n], 3)',\n 'let { rotate } = import(\"grid\");\\nrotate([\\n [1, 2],\\n [3, 4],\\n], 4)',\n 'let { rotate } = import(\"grid\");\\nrotate([\\n [1, 2],\\n [3, 4],\\n], -1)',\n 'let { rotate } = import(\"grid\");\\nrotate([\\n [1, 2],\\n [3, 4],\\n], -2)',\n 'let { rotate } = import(\"grid\");\\nrotate([\\n [1, 2],\\n [3, 4],\\n], -3)',\n ],\n seeAlso: ['grid.transpose', 'grid.flip-h', 'grid.flip-v'],\n },\n 'reverse-rows': {\n category: 'grid',\n description: 'Reverses the order of rows in the grid `g`.',\n returns: {\n type: 'grid',\n },\n args: {\n g: {\n type: 'grid',\n description: 'The grid to reverse rows.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'g',\n ],\n },\n ],\n examples: [\n 'let { reverse-rows } = import(\"grid\");\\nreverse-rows([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n])',\n 'let { reverse-rows } = import(\"grid\");\\nreverse-rows([\\n [\"Albert\", \"father\"],\\n [\"Nina\", \"mother\"],\\n [\"Kian\", \"son\"],\\n])',\n 'let { reverse-rows } = import(\"grid\");\\nreverse-rows([\\n [1, 2],\\n [3, 4],\\n])',\n ],\n seeAlso: ['grid.reverse-cols', 'grid.flip-v'],\n },\n 'reverse-cols': {\n category: 'grid',\n description: 'Reverses the order of columns in the grid `g`.',\n returns: {\n type: 'grid',\n },\n args: {\n g: {\n type: 'grid',\n description: 'The grid to reverse columns.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'g',\n ],\n },\n ],\n examples: [\n 'let { reverse-cols } = import(\"grid\");\\nreverse-cols([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n])',\n 'let { reverse-cols } = import(\"grid\");\\nreverse-cols([\\n [\"Albert\", \"father\"],\\n [\"Nina\", \"mother\"],\\n [\"Kian\", \"son\"],\\n])',\n 'let { reverse-cols } = import(\"grid\");\\nreverse-cols([\\n [1, 2],\\n [3, 4],\\n])',\n ],\n seeAlso: ['grid.reverse-rows', 'grid.flip-h'],\n },\n 'slice': {\n category: 'grid',\n description: 'Slices 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.',\n returns: {\n type: 'grid',\n },\n args: {\n g: {\n type: 'grid',\n description: 'The grid to slice.',\n },\n begin: {\n type: 'vector',\n description: 'The starting index of the slice as a vector of two numbers: `[row, col]`.',\n },\n stop: {\n type: 'vector',\n description: 'Optional ending index of the slice as a vector of two numbers: `[row, col]`.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'g',\n 'begin',\n ],\n },\n {\n argumentNames: [\n 'g',\n 'begin',\n 'stop',\n ],\n },\n ],\n examples: [\n '// Using \"as\" alias because \"slice\" shadows a builtin function\\nlet { slice as grid-slice } = import(\"grid\");\\ngrid-slice([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n], [1, 1], [2, 2])',\n '// Using \"as\" alias because \"slice\" shadows a builtin function\\nlet { slice as grid-slice } = import(\"grid\");\\ngrid-slice([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n], [1, 1])',\n ],\n hideOperatorForm: true,\n seeAlso: ['grid.slice-rows', 'grid.slice-cols'],\n },\n 'slice-rows': {\n category: 'grid',\n 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.',\n returns: {\n type: 'grid',\n },\n args: {\n g: {\n type: 'grid',\n description: 'The grid to slice.',\n },\n begin: {\n type: 'number',\n description: 'The starting index of the slice.',\n },\n stop: {\n type: 'number',\n description: 'Optional ending index of the slice.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'g',\n 'begin',\n ],\n },\n {\n argumentNames: [\n 'g',\n 'begin',\n 'stop',\n ],\n },\n ],\n examples: [\n 'let { slice-rows } = import(\"grid\");\\nslice-rows([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n], 1, 2)',\n 'let { slice-rows } = import(\"grid\");\\nslice-rows([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n], 1)',\n ],\n hideOperatorForm: true,\n seeAlso: ['grid.slice', 'grid.slice-cols', 'grid.splice-rows'],\n },\n 'slice-cols': {\n category: 'grid',\n 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.',\n returns: {\n type: 'grid',\n },\n args: {\n g: {\n type: 'grid',\n description: 'The grid to slice.',\n },\n begin: {\n type: 'number',\n description: 'The starting index of the slice.',\n },\n stop: {\n type: 'number',\n description: 'Optional ending index of the slice.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'g',\n 'begin',\n ],\n },\n {\n argumentNames: [\n 'g',\n 'begin',\n 'stop',\n ],\n },\n ],\n examples: [\n 'let { slice-cols } = import(\"grid\");\\nslice-cols([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n], 1, 2)',\n 'let { slice-cols } = import(\"grid\");\\nslice-cols([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n], 1)',\n ],\n hideOperatorForm: true,\n seeAlso: ['grid.slice', 'grid.slice-rows', 'grid.splice-cols'],\n },\n 'splice-rows': {\n category: 'grid',\n description: 'Splices rows of the grid `g` starting from the index `begin`. Deletes `deleteCount` rows and inserts the specified `items` at that position.',\n returns: {\n type: 'grid',\n },\n args: {\n g: {\n type: 'grid',\n description: 'The grid to splice.',\n },\n begin: {\n type: 'number',\n description: 'The starting index of the splice.',\n },\n deleteCount: {\n type: 'number',\n description: 'The number of rows to delete.',\n },\n items: {\n type: 'array',\n rest: true,\n description: 'The rows to insert.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'g',\n 'begin',\n 'deleteCount',\n ],\n },\n {\n argumentNames: [\n 'g',\n 'begin',\n 'deleteCount',\n 'items',\n ],\n },\n ],\n examples: [\n 'let { splice-rows } = import(\"grid\");\\nsplice-rows([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n], 1, 2)',\n '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])',\n ],\n hideOperatorForm: true,\n seeAlso: ['grid.splice-cols', 'grid.slice-rows'],\n },\n 'splice-cols': {\n category: 'grid',\n description: 'Splices columns of the grid `g` starting from the index `begin`. Deletes `deleteCount` columns and inserts the specified `items` at that position.',\n returns: {\n type: 'grid',\n },\n args: {\n g: {\n type: 'grid',\n description: 'The grid to splice.',\n },\n begin: {\n type: 'number',\n description: 'The starting index of the splice.',\n },\n deleteCount: {\n type: 'number',\n description: 'The number of columns to delete.',\n },\n items: {\n type: 'array',\n rest: true,\n description: 'The columns to insert.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'g',\n 'begin',\n 'deleteCount',\n ],\n },\n {\n argumentNames: [\n 'g',\n 'begin',\n 'deleteCount',\n 'items',\n ],\n },\n ],\n examples: [\n 'let { splice-cols } = import(\"grid\");\\nsplice-cols([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n], 1, 2)',\n '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\"])',\n ],\n hideOperatorForm: true,\n seeAlso: ['grid.splice-rows', 'grid.slice-cols'],\n },\n 'concat-rows': {\n category: 'grid',\n description: 'Concatenates two grids `a` and `b` by rows. The number of columns in both grids must be the same.',\n returns: {\n type: 'grid',\n },\n args: {\n a: {\n type: 'grid',\n },\n b: {\n type: 'grid',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { concat-rows } = import(\"grid\");\\nconcat-rows([\\n [\"Albert\", \"father\"],\\n [\"Nina\", \"mother\"],\\n [\"Kian\", \"son\"],\\n], [\\n [1, 2],\\n [3, 4],\\n])',\n ],\n seeAlso: ['grid.concat-cols', 'grid.push-rows'],\n },\n 'concat-cols': {\n category: 'grid',\n description: 'Concatenates two grids `a` and `b` by columns. The number of rows in both grids must be the same.',\n returns: {\n type: 'grid',\n },\n args: {\n a: {\n type: 'grid',\n },\n b: {\n type: 'grid',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n '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])',\n ],\n seeAlso: ['grid.concat-rows', 'grid.push-cols'],\n },\n 'map': {\n category: 'grid',\n description: 'Maps a function `a` over each element of the grid `b`, returning a new grid with the results.',\n returns: {\n type: 'grid',\n },\n args: {\n a: {\n type: 'grid',\n },\n b: {\n type: 'function',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n '// Using \"as\" alias because \"map\" shadows a builtin function\\nlet { map as grid-map } = import(\"grid\");\\ngrid-map([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n], str)',\n ],\n seeAlso: ['map', 'grid.mapi', 'grid.reduce'],\n },\n 'mapi': {\n category: 'grid',\n description: 'Maps a function `a` over each element of the grid `b`, passing the row and column index as additional arguments to the function.',\n returns: {\n type: 'grid',\n },\n args: {\n a: {\n type: 'grid',\n },\n b: {\n type: 'function',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n '// Using \"as\" alias because \"mapi\" shadows a builtin function\\nlet { mapi as grid-mapi } = import(\"grid\");\\ngrid-mapi([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n], -> $1 ++ \"(\" ++ $2 ++ \", \" ++ $3 ++ \")\")',\n ],\n seeAlso: ['grid.map', 'grid.reducei', 'map'],\n },\n 'reduce': {\n category: 'grid',\n description: 'Reduces the grid `a` using the function `b`, returning a single value.',\n returns: {\n type: 'any',\n },\n args: {\n 'g': {\n type: 'grid',\n description: 'The grid to reduce.',\n },\n 'fn': {\n type: 'function',\n description: 'The function to reduce the grid. It takes two arguments: the accumulator and the current element.',\n },\n 'initial-value': {\n type: 'any',\n description: 'The initial value for the accumulator.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'g',\n 'fn',\n 'initial-value',\n ],\n },\n ],\n examples: [\n '// Using \"as\" alias because \"reduce\" shadows a builtin function\\nlet { reduce as grid-reduce } = import(\"grid\");\\ngrid-reduce([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n], ++, \"\")',\n ],\n seeAlso: ['reduce', 'grid.reducei', 'grid.map'],\n },\n 'reducei': {\n category: 'grid',\n description: 'Reduces the grid `a` using the function `b`, passing the row and column indices as additional arguments to the function.',\n returns: {\n type: 'any',\n },\n args: {\n 'g': {\n type: 'grid',\n description: 'The grid to reduce.',\n },\n 'fn': {\n type: 'function',\n description: 'The function to reduce the grid. It takes four arguments: the accumulator, the current element, the row index, and the column index.',\n },\n 'initial-value': {\n type: 'any',\n description: 'The initial value for the accumulator.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'g',\n 'fn',\n 'initial-value',\n ],\n },\n ],\n examples: [\n '// Using \"as\" alias because \"reducei\" shadows a builtin function\\nlet { reducei as grid-reducei } = import(\"grid\");\\ngrid-reducei([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n], ++, \"\")',\n ],\n seeAlso: ['grid.reduce', 'grid.mapi', 'reduce'],\n },\n 'push-rows': {\n category: 'grid',\n description: 'Pushes the specified rows into the grid `g` and returns the new grid.',\n returns: {\n type: 'grid',\n },\n args: {\n g: {\n type: 'grid',\n description: 'The grid to push rows into.',\n },\n rows: {\n type: 'array',\n rest: true,\n description: 'The rows to push into the grid.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'g',\n 'rows',\n ],\n },\n ],\n examples: [\n 'let { push-rows } = import(\"grid\");\\npush-rows([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n], [\"Nazanin\", \"mother\", 40])',\n ],\n hideOperatorForm: true,\n seeAlso: ['grid.unshift-rows', 'grid.pop-row', 'grid.shift-row', 'grid.concat-rows'],\n },\n 'unshift-rows': {\n category: 'grid',\n description: 'Unshifts the specified rows into the grid `g` and returns the new grid.',\n returns: {\n type: 'grid',\n },\n args: {\n g: {\n type: 'grid',\n description: 'The grid to unshift rows into.',\n },\n rows: {\n type: 'array',\n rest: true,\n description: 'The rows to unshift into the grid.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'g',\n 'rows',\n ],\n },\n ],\n examples: [\n 'let { unshift-rows } = import(\"grid\");\\nunshift-rows([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n], [\"Nazanin\", \"mother\", 40])',\n ],\n hideOperatorForm: true,\n seeAlso: ['grid.push-rows', 'grid.shift-row', 'grid.pop-row'],\n },\n 'pop-row': {\n category: 'grid',\n description: 'Pops the last row from the grid `g` and returns the new grid.',\n returns: {\n type: 'grid',\n },\n args: {\n g: {\n type: 'grid',\n description: 'The grid to pop a row from.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'g',\n ],\n },\n ],\n examples: [\n 'let { pop-row } = import(\"grid\");\\npop-row([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n])',\n ],\n seeAlso: ['grid.shift-row', 'grid.push-rows', 'grid.unshift-rows'],\n },\n 'shift-row': {\n category: 'grid',\n description: 'Shifts the first row from the grid `g` and returns the new grid.',\n returns: {\n type: 'grid',\n },\n args: {\n g: {\n type: 'grid',\n description: 'The grid to shift a row from.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'g',\n ],\n },\n ],\n examples: [\n 'let { shift-row } = import(\"grid\");\\nshift-row([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n])',\n ],\n seeAlso: ['grid.pop-row', 'grid.push-rows', 'grid.unshift-rows'],\n },\n 'push-cols': {\n category: 'grid',\n description: 'Pushes the specified columns into the grid `g` and returns the new grid.',\n returns: {\n type: 'grid',\n },\n args: {\n g: {\n type: 'grid',\n description: 'The grid to push columns into.',\n },\n cols: {\n type: 'array',\n rest: true,\n description: 'The columns to push into the grid.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'g',\n 'cols',\n ],\n },\n ],\n examples: [\n 'let { push-cols } = import(\"grid\");\\npush-cols([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n], [\"f\", \"m\", \"s\"])',\n ],\n hideOperatorForm: true,\n seeAlso: ['grid.unshift-cols', 'grid.pop-col', 'grid.shift-col', 'grid.concat-cols'],\n },\n 'unshift-cols': {\n category: 'grid',\n description: 'Unshifts the specified columns into the grid `g` and returns the new grid.',\n returns: {\n type: 'grid',\n },\n args: {\n g: {\n type: 'grid',\n description: 'The grid to unshift columns into.',\n },\n cols: {\n type: 'array',\n rest: true,\n description: 'The columns to unshift into the grid.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'g',\n 'cols',\n ],\n },\n ],\n examples: [\n 'let { unshift-cols } = import(\"grid\");\\nunshift-cols([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n], [\"f\", \"m\", \"s\"])',\n ],\n hideOperatorForm: true,\n seeAlso: ['grid.push-cols', 'grid.shift-col', 'grid.pop-col'],\n },\n 'pop-col': {\n category: 'grid',\n description: 'Pops the last column from the grid `g` and returns the new grid.',\n returns: {\n type: 'grid',\n },\n args: {\n g: {\n type: 'grid',\n description: 'The grid to pop a column from.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'g',\n ],\n },\n ],\n examples: [\n 'let { pop-col } = import(\"grid\");\\npop-col([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n])',\n ],\n seeAlso: ['grid.shift-col', 'grid.push-cols', 'grid.unshift-cols'],\n },\n 'shift-col': {\n category: 'grid',\n description: 'Shifts the first column from the grid `g` and returns the new grid.',\n returns: {\n type: 'grid',\n },\n args: {\n g: {\n type: 'grid',\n description: 'The grid to shift a column from.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'g',\n ],\n },\n ],\n examples: [\n 'let { shift-col } = import(\"grid\");\\nshift-col([\\n [\"Albert\", \"father\", 10],\\n [\"Nina\", \"mother\", 20],\\n [\"Kian\", \"son\", 30],\\n])',\n ],\n seeAlso: ['grid.pop-col', 'grid.push-cols', 'grid.unshift-cols'],\n },\n 'from-array': {\n category: 'grid',\n 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.',\n returns: {\n type: 'grid',\n },\n args: {\n a: {\n type: 'array',\n },\n b: {\n type: 'number',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { from-array } = import(\"grid\");\\nfrom-array([1, 2, 3, 4], 2)',\n 'let { from-array } = import(\"grid\");\\nfrom-array([1, 2, 3, 4], 4)',\n ],\n seeAlso: ['grid.fill', 'grid.generate', 'grid.reshape'],\n },\n}\n","import type { Any } from '../../../interface'\n\nexport function transpose<T extends Any>(grid: T[][]): T[][] {\n const result: T[][] = []\n\n for (let i = 0; i < grid[0]!.length; i += 1) {\n const row: T[] = []\n for (let j = 0; j < grid.length; j += 1) {\n row.push(grid[j]![i]!)\n }\n result.push(row)\n }\n return result\n}\n","import { LitsError } from '../../../errors'\nimport type { Any } from '../../../interface'\nimport { assertGrid, assertVector } from '../../../typeGuards/annotatedArrays'\nimport { assertArray } from '../../../typeGuards/array'\nimport { asAny, asFunctionLike, assertAny, assertFunctionLike } from '../../../typeGuards/lits'\nimport { assertNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\nimport type { LitsModule } from '../interface'\nimport { moduleDocs } from './docs'\nimport { fromArray } from './fromArray'\nimport { transpose } from './transpose'\n\nconst gridFunctions: BuiltinNormalExpressions = {\n 'every?': {\n evaluate: ([grid, predicate], sourceCodeInfo, contextStack, { executeFunction }): boolean => {\n assertGrid(grid, sourceCodeInfo)\n assertFunctionLike(predicate, sourceCodeInfo)\n\n for (const row of grid) {\n for (const cell of row) {\n if (!executeFunction(predicate, [cell], contextStack, sourceCodeInfo)) {\n return false\n }\n }\n }\n return true\n },\n arity: toFixedArity(2),\n },\n 'some?': {\n evaluate: ([grid, predicate], sourceCodeInfo, contextStack, { executeFunction }): boolean => {\n assertGrid(grid, sourceCodeInfo)\n assertFunctionLike(predicate, sourceCodeInfo)\n\n for (const row of grid) {\n for (const cell of row) {\n if (executeFunction(predicate, [cell], contextStack, sourceCodeInfo)) {\n return true\n }\n }\n }\n return false\n },\n arity: toFixedArity(2),\n },\n 'every-row?': {\n evaluate: ([grid, predicate], sourceCodeInfo, contextStack, { executeFunction }): boolean => {\n assertGrid(grid, sourceCodeInfo)\n assertFunctionLike(predicate, sourceCodeInfo)\n\n for (const row of grid) {\n if (!executeFunction(predicate, [row], contextStack, sourceCodeInfo)) {\n return false\n }\n }\n return true\n },\n arity: toFixedArity(2),\n },\n 'some-row?': {\n evaluate: ([grid, predicate], sourceCodeInfo, contextStack, { executeFunction }): boolean => {\n assertGrid(grid, sourceCodeInfo)\n assertFunctionLike(predicate, sourceCodeInfo)\n\n for (const row of grid) {\n if (executeFunction(predicate, [row], contextStack, sourceCodeInfo)) {\n return true\n }\n }\n return false\n },\n arity: toFixedArity(2),\n },\n 'every-col?': {\n evaluate: ([grid, predicate], sourceCodeInfo, contextStack, { executeFunction }): boolean => {\n assertGrid(grid, sourceCodeInfo)\n assertFunctionLike(predicate, sourceCodeInfo)\n\n const transposed = transpose(grid)\n for (const row of transposed) {\n if (!executeFunction(predicate, [row], contextStack, sourceCodeInfo)) {\n return false\n }\n }\n return true\n },\n arity: toFixedArity(2),\n },\n 'some-col?': {\n evaluate: ([grid, predicate], sourceCodeInfo, contextStack, { executeFunction }): boolean => {\n assertGrid(grid, sourceCodeInfo)\n assertFunctionLike(predicate, sourceCodeInfo)\n\n const transposed = transpose(grid)\n for (const row of transposed) {\n if (executeFunction(predicate, [row], contextStack, sourceCodeInfo)) {\n return true\n }\n }\n return false\n },\n arity: toFixedArity(2),\n },\n 'row': {\n evaluate: ([grid, row], sourceCodeInfo): Any[] => {\n assertGrid(grid, sourceCodeInfo)\n assertNumber(row, sourceCodeInfo, { integer: true, nonNegative: true, lt: grid.length })\n return grid[row]!\n },\n arity: toFixedArity(2),\n },\n 'col': {\n evaluate: ([grid, col], sourceCodeInfo): Any[] => {\n assertGrid(grid, sourceCodeInfo)\n assertNumber(col, sourceCodeInfo, { integer: true, nonNegative: true, lt: grid[0]!.length })\n return grid.map(row => row[col]!)\n },\n arity: toFixedArity(2),\n },\n 'shape': {\n evaluate: ([grid], sourceCodeInfo): Any[] => {\n assertGrid(grid, sourceCodeInfo)\n return [grid.length, grid[0]!.length]\n },\n arity: toFixedArity(1),\n },\n 'fill': {\n evaluate: ([rows, cols, value], sourceCodeInfo): Any[][] => {\n assertNumber(rows, sourceCodeInfo, { integer: true, positive: true })\n assertNumber(cols, sourceCodeInfo, { integer: true, positive: true })\n assertAny(value, sourceCodeInfo)\n const result: Any[][] = []\n for (let i = 0; i < rows; i += 1) {\n const row: Any[] = []\n for (let j = 0; j < cols; j += 1) {\n row.push(value)\n }\n result.push(row)\n }\n return result\n },\n arity: toFixedArity(3),\n },\n 'generate': {\n evaluate: ([rows, cols, generator], sourceCodeInfo, contextStack, { executeFunction }): Any[][] => {\n assertNumber(rows, sourceCodeInfo, { integer: true, positive: true })\n assertNumber(cols, sourceCodeInfo, { integer: true, positive: true })\n assertFunctionLike(generator, sourceCodeInfo)\n\n const result: Any[][] = []\n for (let i = 0; i < rows; i += 1) {\n const row: Any[] = []\n for (let j = 0; j < cols; j += 1) {\n const value = executeFunction(generator, [i, j], contextStack, sourceCodeInfo)\n assertAny(value, sourceCodeInfo)\n row.push(value)\n }\n result.push(row)\n }\n return result\n },\n arity: toFixedArity(3),\n },\n 'reshape': {\n evaluate: ([grid, rows], sourceCodeInfo): Any[][] => {\n assertGrid(grid, sourceCodeInfo)\n assertNumber(rows, sourceCodeInfo, { integer: true, positive: true })\n\n const flatTable = grid.flat()\n if (flatTable.length % rows !== 0) {\n throw new LitsError(`The number of elements in the grid must be divisible by rows, but got ${flatTable.length} and ${rows}`, sourceCodeInfo)\n }\n const cols = flatTable.length / rows\n\n const result: Any[][] = []\n for (let i = 0; i < rows; i += 1) {\n const row: Any[] = []\n for (let j = 0; j < cols; j += 1) {\n row.push(flatTable[i * cols + j]!)\n }\n result.push(row)\n }\n return result\n },\n arity: toFixedArity(2),\n },\n 'transpose': {\n evaluate: ([grid], sourceCodeInfo): Any[][] => {\n assertGrid(grid, sourceCodeInfo)\n return transpose(grid)\n },\n arity: toFixedArity(1),\n },\n 'flip-h': {\n evaluate: ([grid], sourceCodeInfo): Any[][] => {\n assertGrid(grid, sourceCodeInfo)\n return grid.map(row => row.reverse())\n },\n arity: toFixedArity(1),\n },\n 'flip-v': {\n evaluate: ([grid], sourceCodeInfo): Any[][] => {\n assertGrid(grid, sourceCodeInfo)\n return grid.reverse()\n },\n arity: toFixedArity(1),\n },\n 'rotate': {\n evaluate: ([grid, times], sourceCodeInfo): Any[][] => {\n assertGrid(grid, sourceCodeInfo)\n assertNumber(times, sourceCodeInfo, { integer: true })\n // Normalize times to be between 0 and 3\n times = ((times % 4) + 4) % 4\n\n // If times is 0, return the original grid\n if (times === 0 || grid.length === 0) {\n return grid.map(row => [...row])\n }\n\n const height = grid.length\n const width = grid[0]!.length\n\n let result: Any[][]\n\n switch (times) {\n case 1: // 90 degrees clockwise\n result = Array<Any>(width).fill(null).map(() => Array<Any>(height).fill(null))\n for (let y = 0; y < height; y++) {\n for (let x = 0; x < width; x++) {\n result[x]![height - 1 - y] = grid[y]![x]!\n }\n }\n break\n\n case 2: // 180 degrees\n result = Array<Any>(height).fill(null).map(() => Array<Any>(width).fill(null))\n for (let y = 0; y < height; y++) {\n for (let x = 0; x < width; x++) {\n result[height - 1 - y]![width - 1 - x] = grid[y]![x]!\n }\n }\n break\n\n case 3: // 270 degrees clockwise (or 90 degrees counter-clockwise)\n result = Array<Any>(width).fill(null).map(() => Array<Any>(height).fill(null))\n for (let y = 0; y < height; y++) {\n for (let x = 0; x < width; x++) {\n result[width - 1 - x]![y] = grid[y]![x]!\n }\n }\n break\n }\n\n return result!\n },\n arity: toFixedArity(2),\n },\n 'reverse-rows': {\n evaluate: ([grid], sourceCodeInfo): Any[][] => {\n assertGrid(grid, sourceCodeInfo)\n return grid.reverse()\n },\n arity: toFixedArity(1),\n },\n 'reverse-cols': {\n evaluate: ([grid], sourceCodeInfo): Any[][] => {\n assertGrid(grid, sourceCodeInfo)\n return grid.map(row => row.reverse())\n },\n arity: toFixedArity(1),\n },\n 'slice': {\n evaluate: ([grid, start, end], sourceCodeInfo): Any[][] => {\n assertGrid(grid, sourceCodeInfo)\n assertVector(start, sourceCodeInfo)\n if (start.length !== 2) {\n throw new LitsError(`The start vector must have 2 elements, but got ${start.length}`, sourceCodeInfo)\n }\n const [rowStart, colStart] = start\n assertNumber(rowStart, sourceCodeInfo, { integer: true, nonNegative: true, lt: grid.length })\n assertNumber(colStart, sourceCodeInfo, { integer: true, nonNegative: true, lt: grid[0]!.length })\n\n end ??= [grid.length, grid[0]!.length]\n assertVector(end, sourceCodeInfo)\n if (end.length !== 2) {\n throw new LitsError(`The end vector must have 2 elements, but got ${end.length}`, sourceCodeInfo)\n }\n const [rowEnd, colEnd] = end\n assertNumber(rowEnd, sourceCodeInfo, { gt: rowStart, lte: grid.length })\n assertNumber(colEnd, sourceCodeInfo, { gt: colStart, lte: grid[0]!.length })\n\n const result: Any[][] = []\n for (let i = rowStart; i < rowEnd; i += 1) {\n const row: Any[] = []\n for (let j = colStart; j < colEnd; j += 1) {\n row.push(grid[i]![j]!)\n }\n result.push(row)\n }\n return result\n },\n arity: { min: 2, max: 3 },\n },\n 'slice-rows': {\n evaluate: ([grid, rowStart, rowEnd], sourceCodeInfo): Any[][] => {\n assertGrid(grid, sourceCodeInfo)\n\n if (typeof rowEnd === 'undefined') {\n assertNumber(rowStart, sourceCodeInfo, { integer: true, lte: grid.length, gte: -grid.length })\n if (rowStart < 0) {\n return grid.slice(grid.length + rowStart)\n }\n return grid.slice(rowStart)\n }\n\n assertNumber(rowStart, sourceCodeInfo, { integer: true, nonNegative: true, lte: grid.length })\n assertNumber(rowEnd, sourceCodeInfo, { integer: true })\n rowEnd = rowEnd < 0 ? grid.length + rowEnd : rowEnd\n assertNumber(rowEnd, sourceCodeInfo, { gt: rowStart, lte: grid.length })\n\n return grid.slice(rowStart, rowEnd)\n },\n arity: { min: 2, max: 3 },\n },\n 'slice-cols': {\n evaluate: ([grid, colStart, colEnd], sourceCodeInfo): Any[][] => {\n assertGrid(grid, sourceCodeInfo)\n const trMatrix = transpose(grid)\n\n if (typeof colEnd === 'undefined') {\n assertNumber(colStart, sourceCodeInfo, { integer: true, lte: trMatrix.length, gte: -trMatrix.length })\n if (colStart < 0) {\n return transpose(trMatrix.slice(trMatrix.length + colStart))\n }\n return transpose(trMatrix.slice(colStart))\n }\n\n assertNumber(colStart, sourceCodeInfo, { integer: true, nonNegative: true, lte: trMatrix.length })\n assertNumber(colEnd, sourceCodeInfo, { integer: true })\n colEnd = colEnd < 0 ? trMatrix.length + colEnd : colEnd\n assertNumber(colEnd, sourceCodeInfo, { gt: colStart, lte: trMatrix.length })\n\n return transpose(trMatrix.slice(colStart, colEnd))\n },\n arity: { min: 2, max: 3 },\n },\n 'splice-rows': {\n evaluate: ([grid, rowStart, rowDeleteCount, ...rows], sourceCodeInfo): Any[][] => {\n assertGrid(grid, sourceCodeInfo)\n assertNumber(rowStart, sourceCodeInfo, { integer: true, nonNegative: true, lte: grid.length })\n assertNumber(rowDeleteCount, sourceCodeInfo, { integer: true, nonNegative: true })\n if (rows.length !== 0) {\n assertGrid(rows, sourceCodeInfo)\n rows.every((row) => {\n assertArray(row, sourceCodeInfo)\n if (grid[0]!.length !== row.length) {\n throw new LitsError(`All rows must have the same length as the number of columns in grid, but got ${row.length}`, sourceCodeInfo)\n }\n return true\n })\n }\n\n const result: Any[][] = []\n for (let i = 0; i < rowStart; i += 1) {\n result.push(grid[i]!)\n }\n if (rows.length > 0) {\n result.push(...(rows as Any[][]))\n }\n for (let i = rowStart + rowDeleteCount; i < grid.length; i += 1) {\n result.push(grid[i]!)\n }\n return result\n },\n arity: { min: 3 },\n },\n 'splice-cols': {\n evaluate: ([grid, colStart, colDeleteCount, ...cols], sourceCodeInfo): Any[][] => {\n assertGrid(grid, sourceCodeInfo)\n const trMatrix = transpose(grid)\n assertNumber(colStart, sourceCodeInfo, { integer: true, nonNegative: true, lte: trMatrix.length })\n assertNumber(colDeleteCount, sourceCodeInfo, { integer: true, nonNegative: true })\n\n if (cols.length !== 0) {\n assertGrid(cols, sourceCodeInfo)\n cols.every((row) => {\n assertArray(row, sourceCodeInfo)\n if (trMatrix[0]!.length !== row.length) {\n throw new LitsError(`All rows must have the same length as the number of rows in grid, but got ${row.length}`, sourceCodeInfo)\n }\n return true\n })\n }\n\n const result: Any[][] = []\n for (let i = 0; i < colStart; i += 1) {\n result.push(trMatrix[i]!)\n }\n result.push(...(cols as Any[][]))\n for (let i = colStart + colDeleteCount; i < trMatrix.length; i += 1) {\n result.push(trMatrix[i]!)\n }\n return transpose(result)\n },\n arity: { min: 3 },\n },\n 'concat-rows': {\n evaluate: (params, sourceCodeInfo): Any[][] => {\n assertArray(params, sourceCodeInfo)\n params.every(grid => assertGrid(grid, sourceCodeInfo))\n const cols = (params[0] as Any[][])[0]!.length\n ;(params as Any[][][]).slice(1).every((grid) => {\n if (grid[0]!.length !== cols) {\n throw new LitsError(`All grids must have the same number of columns, but got ${cols} and ${grid[0]!.length}`, sourceCodeInfo)\n }\n return true\n })\n\n const result: Any[][] = []\n ;(params as Any[][][]).forEach((grid) => {\n grid.forEach((row) => {\n result.push(row)\n })\n })\n return result\n },\n arity: { min: 1 },\n },\n 'concat-cols': {\n evaluate: (params, sourceCodeInfo): Any[][] => {\n assertArray(params, sourceCodeInfo)\n params.every(grid => assertGrid(grid, sourceCodeInfo))\n const rows = (params[0] as Any[][]).length\n ;(params as Any[][][]).slice(1).every((grid) => {\n if (grid.length !== rows) {\n throw new LitsError(`All grids must have the same number of rows, but got ${rows} and ${grid.length}`, sourceCodeInfo)\n }\n return true\n })\n\n const result: Any[][] = []\n for (let i = 0; i < rows; i += 1) {\n const row: Any[] = []\n ;(params as Any[][][]).forEach((grid) => {\n row.push(...grid[i]!)\n })\n result.push(row)\n }\n return result\n },\n arity: { min: 1 },\n },\n 'map': {\n evaluate: (params, sourceCodeInfo, contextStack, { executeFunction }): Any[][] => {\n const fn = asFunctionLike(params.at(-1), sourceCodeInfo)\n const grids = params.slice(0, -1)\n assertGrid(grids[0], sourceCodeInfo)\n const rows = grids[0].length\n const cols = grids[0][0]!.length\n grids.slice(1).forEach((grid) => {\n assertGrid(grid, sourceCodeInfo)\n if (grid.length !== rows) {\n throw new LitsError(`All grids must have the same number of rows, but got ${rows} and ${grid.length}`, sourceCodeInfo)\n }\n if (grid[0]!.length !== cols) {\n throw new LitsError(`All grids must have the same number of columns, but got ${cols} and ${grid[0]!.length}`, sourceCodeInfo)\n }\n })\n\n const result: Any[][] = []\n for (let i = 0; i < rows; i += 1) {\n const row: Any[] = []\n for (let j = 0; j < cols; j += 1) {\n const args = grids.map(grid => (grid as Any[][])[i]![j])\n row.push(asAny(executeFunction(fn, args, contextStack, sourceCodeInfo)))\n }\n result.push(row)\n }\n return result\n },\n arity: { min: 2 },\n },\n 'mapi': {\n evaluate: ([grid, fn], sourceCodeInfo, contextStack, { executeFunction }): Any[][] => {\n assertGrid(grid, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n\n const rows = grid.length\n const cols = grid[0]!.length\n\n const result: Any[][] = []\n for (let i = 0; i < rows; i += 1) {\n const row: Any[] = []\n for (let j = 0; j < cols; j += 1) {\n row.push(asAny(executeFunction(fn, [grid[i]![j], i, j], contextStack, sourceCodeInfo)))\n }\n result.push(row)\n }\n return result\n },\n arity: toFixedArity(2),\n },\n 'reduce': {\n evaluate: ([grid, fn, initialValue], sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertGrid(grid, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n\n let accumulator = asAny(initialValue)\n for (const row of grid) {\n for (const cell of row) {\n accumulator = executeFunction(fn, [accumulator, cell], contextStack, sourceCodeInfo)\n }\n }\n return accumulator\n },\n arity: toFixedArity(3),\n },\n 'reducei': {\n evaluate: ([grid, fn, initialValue], sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertGrid(grid, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n\n let accumulator = asAny(initialValue)\n for (let i = 0; i < grid.length; i += 1) {\n for (let j = 0; j < grid[i]!.length; j += 1) {\n accumulator = executeFunction(fn, [accumulator, grid[i]![j], i, j], contextStack, sourceCodeInfo)\n }\n }\n return accumulator\n },\n arity: toFixedArity(3),\n },\n 'push-rows': {\n evaluate: ([grid, ...rows], sourceCodeInfo): Any[][] => {\n assertGrid(grid, sourceCodeInfo)\n assertGrid(rows, sourceCodeInfo)\n if (grid[0]!.length !== rows[0]!.length) {\n throw new LitsError(`All rows must have the same length as the number of columns in grid, but got ${grid[0]!.length} and ${rows[0]!.length}`, sourceCodeInfo)\n }\n return [...grid, ...rows]\n },\n arity: { min: 2 },\n },\n 'unshift-rows': {\n evaluate: ([grid, ...rows], sourceCodeInfo): Any[][] => {\n assertGrid(grid, sourceCodeInfo)\n assertGrid(rows, sourceCodeInfo)\n if (grid[0]!.length !== rows[0]!.length) {\n throw new LitsError(`All rows must have the same length as the number of columns in grid, but got ${grid[0]!.length} and ${rows[0]!.length}`, sourceCodeInfo)\n }\n return [...rows, ...grid]\n },\n arity: { min: 2 },\n },\n 'pop-row': {\n evaluate: ([grid], sourceCodeInfo): Any[][] | null => {\n assertGrid(grid, sourceCodeInfo)\n if (grid.length === 1) {\n return null\n }\n return grid.slice(0, -1)\n },\n arity: toFixedArity(1),\n\n },\n 'shift-row': {\n evaluate: ([grid], sourceCodeInfo): Any[][] | null => {\n assertGrid(grid, sourceCodeInfo)\n if (grid.length === 1) {\n return null\n }\n return grid.slice(1)\n },\n arity: toFixedArity(1),\n },\n 'push-cols': {\n evaluate: ([grid, ...cols], sourceCodeInfo): Any[][] => {\n assertGrid(grid, sourceCodeInfo)\n assertGrid(cols, sourceCodeInfo)\n if (grid.length !== cols[0]!.length) {\n throw new LitsError(`All columns must have the same length as the number of rows in grid, but got ${cols.length}`, sourceCodeInfo)\n }\n\n const result: Any[][] = []\n\n for (let i = 0; i < grid.length; i += 1) {\n const row: Any[] = []\n row.push(...grid[i]!)\n cols.forEach((col) => {\n row.push(col[i]!)\n })\n result.push(row)\n }\n return result\n },\n arity: { min: 2 },\n },\n 'unshift-cols': {\n evaluate: ([grid, ...cols], sourceCodeInfo): Any[][] => {\n assertGrid(grid, sourceCodeInfo)\n assertGrid(cols, sourceCodeInfo)\n if (grid.length !== cols[0]!.length) {\n throw new LitsError(`All columns must have the same length as the number of rows in grid, but got ${cols.length}`, sourceCodeInfo)\n }\n\n const result: Any[][] = []\n\n for (let i = 0; i < grid.length; i += 1) {\n const row: Any[] = []\n cols.forEach((col) => {\n row.push(col[i]!)\n })\n row.push(...grid[i]!)\n result.push(row)\n }\n return result\n },\n arity: { min: 2 },\n },\n 'pop-col': {\n evaluate: ([grid], sourceCodeInfo): Any[][] | null => {\n assertGrid(grid, sourceCodeInfo)\n if (grid[0]!.length === 1) {\n return null\n }\n return grid.map(row => row.slice(0, -1))\n },\n arity: toFixedArity(1),\n },\n 'shift-col': {\n evaluate: ([grid], sourceCodeInfo): Any[][] | null => {\n assertGrid(grid, sourceCodeInfo)\n if (grid[0]!.length === 1) {\n return null\n }\n return grid.map(row => row.slice(1))\n },\n arity: toFixedArity(1),\n },\n 'from-array': {\n evaluate: ([array, rows], sourceCodeInfo): unknown[][] => {\n assertArray(array, sourceCodeInfo)\n assertNumber(rows, sourceCodeInfo, { integer: true, positive: true })\n if (array.length % rows !== 0) {\n throw new LitsError(`The number of elements in the array must be divisible by rows, but got ${array.length} and ${rows}`, sourceCodeInfo)\n }\n return fromArray(array, rows)\n },\n arity: toFixedArity(2),\n },\n}\n\n/**\n * The grid module containing 2D array manipulation functions.\n */\nfor (const [key, docs] of Object.entries(moduleDocs)) {\n if (gridFunctions[key])\n gridFunctions[key].docs = docs\n}\n\nexport const gridModule: LitsModule = {\n name: 'grid',\n functions: gridFunctions,\n}\n","/**\n * Creates a grid from a flat array with specified dimensions\n *\n * @param flatArray The flat array of values\n * @param rows Number of rows in the resulting grid\n * @returns A 2D array representing the grid\n */\nexport function fromArray(flatArray: unknown[], rows: number): unknown[][] {\n // Create the grid\n const grid: unknown[][] = []\n const cols = flatArray.length / rows\n // Reshape the flat array into rows and columns\n for (let i = 0; i < rows; i++) {\n const start = i * cols\n const end = start + cols\n grid.push(flatArray.slice(start, end))\n }\n\n return grid\n}\n","import type { FunctionDocs } from '../../interface'\n\nexport const moduleDocs: Record<string, FunctionDocs> = {\n 'random!': {\n category: 'random',\n description: 'Returns a random number between 0 and 1.',\n returns: {\n type: 'number',\n },\n args: {},\n variants: [\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { random! } = import(\"random\"); random!()',\n ],\n seeAlso: ['random.random-float!', 'random.random-int!', 'random.random-boolean!'],\n },\n 'random-int!': {\n category: 'random',\n description: 'Returns a random integer between min and max (exclusive).',\n returns: {\n type: 'integer',\n },\n args: {\n a: {\n type: 'integer',\n description: 'The minimum value.',\n },\n b: {\n type: 'integer',\n description: 'The maximum value (exclusive).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { random-int! } = import(\"random\"); random-int!(0, 10)',\n 'let { random-int! } = import(\"random\"); random-int!(1, 100)',\n ],\n seeAlso: ['random.random-int-inclusive!', 'random.random-float!', 'random.random!'],\n },\n 'random-int-inclusive!': {\n category: 'random',\n description: 'Returns a random integer between min and max (inclusive).',\n returns: {\n type: 'integer',\n },\n args: {\n a: {\n type: 'integer',\n description: 'The minimum value.',\n },\n b: {\n type: 'integer',\n description: 'The maximum value (inclusive).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { random-int-inclusive! } = import(\"random\"); random-int-inclusive!(0, 10)',\n ],\n seeAlso: ['random.random-int!', 'random.random-float!'],\n },\n 'random-float!': {\n category: 'random',\n description: 'Returns a random float between min and max.',\n returns: {\n type: 'number',\n },\n args: {\n a: {\n type: 'number',\n description: 'The minimum value.',\n },\n b: {\n type: 'number',\n description: 'The maximum value.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { random-float! } = import(\"random\"); random-float!(0, 10)',\n 'let { random-float! } = import(\"random\"); random-float!(1, 100)',\n ],\n seeAlso: ['random.random!', 'random.random-int!', 'random.random-int-inclusive!'],\n },\n 'random-boolean!': {\n category: 'random',\n description: 'Returns a random boolean.',\n returns: {\n type: 'boolean',\n },\n args: {\n prob: {\n type: 'number',\n description: 'The probability of returning true (between 0 and 1).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'prob',\n ],\n },\n ],\n examples: [\n 'let { random-boolean! } = import(\"random\"); random-boolean!()',\n 'let { random-boolean! } = import(\"random\"); random-boolean!(0.99)',\n ],\n seeAlso: ['random.random!'],\n },\n 'random-item!': {\n category: 'random',\n description: 'Returns a random item from the array.',\n returns: {\n type: 'any',\n },\n args: {\n a: {\n type: 'array',\n description: 'The array to sample from.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n ],\n },\n ],\n examples: [\n 'let { random-item! } = import(\"random\"); random-item!([1, 2, 3, 4, 5])',\n 'let { random-item! } = import(\"random\"); random-item!([\"apple\", \"banana\", \"cherry\"])',\n ],\n seeAlso: ['random.random-sample!', 'random.random-sample-unique!', 'random.random-char!'],\n },\n 'random-sample-unique!': {\n category: 'random',\n description: 'Returns a random sample of n unique items from the array.',\n returns: {\n type: 'array',\n },\n args: {\n a: {\n type: 'array',\n description: 'The array to sample from.',\n },\n b: {\n type: 'integer',\n description: 'The number of items to sample.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { random-sample-unique! } = import(\"random\"); random-sample-unique!([1, 2, 3, 4, 5], 3)',\n 'let { random-sample-unique! } = import(\"random\"); random-sample-unique!([\"apple\", \"banana\", \"cherry\"], 2)',\n ],\n seeAlso: ['random.random-sample!', 'random.random-item!', 'random.shuffle!'],\n },\n 'random-sample!': {\n category: 'random',\n description: 'Returns a random sample of n items from the array.',\n returns: {\n type: 'array',\n },\n args: {\n a: {\n type: 'array',\n description: 'The array to sample from.',\n },\n b: {\n type: 'integer',\n description: 'The number of items to sample.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { random-sample! } = import(\"random\"); random-sample!([1, 2, 3, 4, 5], 3)',\n 'let { random-sample! } = import(\"random\"); random-sample!([\"apple\", \"banana\", \"cherry\"], 10)',\n ],\n seeAlso: ['random.random-sample-unique!', 'random.random-item!', 'random.shuffle!'],\n },\n 'shuffle!': {\n category: 'random',\n description: 'Returns a shuffled version of the array.',\n returns: {\n type: 'array',\n },\n args: {\n a: {\n type: 'array',\n description: 'The array to shuffle.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n ],\n },\n ],\n examples: [\n 'let { shuffle! } = import(\"random\"); shuffle!([1, 2, 3, 4, 5])',\n 'let { shuffle! } = import(\"random\"); shuffle!([\"apple\", \"banana\", \"cherry\"])',\n ],\n seeAlso: ['random.random-sample!', 'random.random-sample-unique!'],\n },\n 'random-normal!': {\n category: 'random',\n description: 'Returns a random number from a normal distribution with the given mean and standard deviation.',\n returns: {\n type: 'number',\n },\n args: {\n mean: {\n type: 'number',\n description: 'The mean of the normal distribution.',\n },\n stdDev: {\n type: 'number',\n description: 'The standard deviation of the normal distribution.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'mean',\n 'stdDev',\n ],\n },\n ],\n examples: [\n 'let { random-normal! } = import(\"random\"); random-normal!(0, 1)',\n 'let { random-normal! } = import(\"random\"); random-normal!(5, 2)',\n ],\n seeAlso: ['random.random-exponential!', 'random.random-binomial!', 'random.random-poisson!'],\n hideOperatorForm: true,\n },\n 'random-exponential!': {\n category: 'random',\n description: 'Returns a random number from an exponential distribution with the given rate parameter.',\n returns: {\n type: 'number',\n },\n args: {\n lambda: {\n type: 'number',\n description: 'The rate parameter of the exponential distribution.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'lambda',\n ],\n },\n ],\n examples: [\n 'let { random-exponential! } = import(\"random\"); random-exponential!(1)',\n 'let { random-exponential! } = import(\"random\"); random-exponential!(0.5)',\n ],\n seeAlso: ['random.random-normal!', 'random.random-poisson!', 'random.random-gamma!', 'random.random-pareto!'],\n },\n 'random-binomial!': {\n category: 'random',\n description: 'Returns a random number from a binomial distribution with the given number of trials and probability of success.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number of trials.',\n },\n p: {\n type: 'number',\n description: 'The probability of success on each trial.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n 'p',\n ],\n },\n ],\n examples: [\n 'let { random-binomial! } = import(\"random\"); random-binomial!(10, 0.5)',\n 'let { random-binomial! } = import(\"random\"); random-binomial!(20, 0.3)',\n ],\n seeAlso: ['random.random-normal!', 'random.random-poisson!'],\n hideOperatorForm: true,\n },\n 'random-poisson!': {\n category: 'random',\n description: 'Returns a random number from a Poisson distribution with the given rate parameter.',\n returns: {\n type: 'integer',\n },\n args: {\n lambda: {\n type: 'number',\n description: 'The rate parameter of the Poisson distribution.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'lambda',\n ],\n },\n ],\n examples: [\n 'let { random-poisson! } = import(\"random\"); random-poisson!(1)',\n 'let { random-poisson! } = import(\"random\"); random-poisson!(5)',\n ],\n seeAlso: ['random.random-binomial!', 'random.random-normal!', 'random.random-exponential!'],\n },\n 'random-gamma!': {\n category: 'random',\n description: 'Returns a random number from a gamma distribution with the given shape and scale parameters.',\n returns: {\n type: 'number',\n },\n args: {\n shape: {\n type: 'number',\n description: 'The shape parameter of the gamma distribution.',\n },\n scale: {\n type: 'number',\n description: 'The scale parameter of the gamma distribution.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'shape',\n 'scale',\n ],\n },\n ],\n examples: [\n 'let { random-gamma! } = import(\"random\"); random-gamma!(2, 2)',\n 'let { random-gamma! } = import(\"random\"); random-gamma!(5, 1)',\n ],\n seeAlso: ['random.random-exponential!', 'random.random-pareto!'],\n hideOperatorForm: true,\n },\n 'random-pareto!': {\n category: 'random',\n description: 'Returns a random number from a Pareto distribution with the given shape parameter.',\n returns: {\n type: 'number',\n },\n args: {\n alpha: {\n type: 'number',\n description: 'The shape parameter of the Pareto distribution.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'alpha',\n ],\n },\n ],\n examples: [\n 'let { random-pareto! } = import(\"random\"); random-pareto!(1)',\n 'let { random-pareto! } = import(\"random\"); random-pareto!(2)',\n ],\n seeAlso: ['random.random-gamma!', 'random.random-exponential!'],\n },\n 'uuid!': {\n category: 'random',\n description: 'Returns a random UUID v4 (Universally Unique Identifier).',\n returns: {\n type: 'string',\n },\n args: {},\n variants: [\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { uuid! } = import(\"random\"); uuid!()',\n ],\n seeAlso: ['random.random-id!', 'random.random-string!'],\n },\n 'random-char!': {\n category: 'random',\n description: 'Returns a random character from the given string.',\n returns: {\n type: 'string',\n },\n args: {\n charSet: {\n type: 'string',\n description: 'The string to sample from.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'charSet',\n ],\n },\n ],\n examples: [\n 'let { random-char! } = import(\"random\"); random-char!(\"abcde\")',\n 'let { random-char! } = import(\"random\"); random-char!(\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\")',\n ],\n seeAlso: ['random.random-string!', 'random.random-item!'],\n },\n 'random-string!': {\n category: 'random',\n description: 'Returns a random string of the given length from the given string.',\n returns: {\n type: 'string',\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the random string.',\n },\n charSet: {\n type: 'string',\n description: 'The string to sample from.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n 'charSet',\n ],\n },\n ],\n examples: [\n 'let { random-string! } = import(\"random\"); random-string!(10, \"abcde\")',\n 'let { random-string! } = import(\"random\"); random-string!(5, \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\")',\n ],\n seeAlso: ['random.random-char!', 'random.random-id!', 'random.uuid!'],\n hideOperatorForm: true,\n },\n 'random-id!': {\n category: 'random',\n description: 'Returns a random ID of the given length.',\n returns: {\n type: 'string',\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the random ID.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { random-id! } = import(\"random\"); random-id!(10)',\n 'let { random-id! } = import(\"random\"); random-id!(5)',\n ],\n seeAlso: ['random.random-string!', 'random.uuid!'],\n },\n 'random-color!': {\n category: 'random',\n description: 'Returns a random color in hex format.',\n returns: {\n type: 'string',\n },\n args: {},\n variants: [\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { random-color! } = import(\"random\"); random-color!()',\n ],\n },\n}\n","import { LitsError } from '../../../errors'\nimport type { Any, Arr } from '../../../interface'\nimport { assertArray } from '../../../typeGuards/array'\nimport { asAny } from '../../../typeGuards/lits'\nimport { assertNumber } from '../../../typeGuards/number'\nimport { assertString } from '../../../typeGuards/string'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\nimport type { LitsModule } from '../interface'\nimport { moduleDocs } from './docs'\n\nconst randomFunctions: BuiltinNormalExpressions = {\n 'random!': {\n evaluate: (): number => {\n return Math.random()\n },\n arity: toFixedArity(0),\n },\n 'random-int!': {\n evaluate: ([min, max], sourceCodeInfo): number => {\n assertNumber(min, sourceCodeInfo, { integer: true })\n assertNumber(max, sourceCodeInfo, { integer: true, gt: min })\n return Math.floor(Math.random() * (max - min)) + min\n },\n arity: toFixedArity(2),\n },\n 'random-int-inclusive!': {\n evaluate: ([min, max], sourceCodeInfo): number => {\n assertNumber(min, sourceCodeInfo, { integer: true })\n assertNumber(max, sourceCodeInfo, { integer: true, gte: min })\n return Math.floor(Math.random() * (max - min + 1)) + min\n },\n arity: toFixedArity(2),\n },\n 'random-float!': {\n evaluate: ([min, max], sourceCodeInfo): number => {\n assertNumber(min, sourceCodeInfo)\n assertNumber(max, sourceCodeInfo, { gt: min })\n return Math.random() * (max - min) + min\n },\n arity: toFixedArity(2),\n },\n 'random-boolean!': {\n evaluate: ([prob], sourceCodeInfo): boolean => {\n const probability = prob ?? 0.5\n assertNumber(probability, sourceCodeInfo, { gte: 0, lte: 1 })\n return Math.random() < probability\n },\n arity: { min: 0, max: 1 },\n },\n 'random-item!': {\n evaluate: ([array], sourceCodeInfo): Any => {\n assertArray(array, sourceCodeInfo)\n const index = Math.floor(Math.random() * array.length)\n return asAny(array[index])\n },\n arity: toFixedArity(1),\n },\n 'random-sample!': {\n evaluate: ([array, n], sourceCodeInfo): Arr => {\n assertArray(array, sourceCodeInfo)\n assertNumber(n, sourceCodeInfo, { integer: true, nonNegative: true })\n if (array.length === 0) {\n throw new LitsError('Cannot sample from an empty array.', sourceCodeInfo)\n }\n\n const result: Arr = []\n\n for (let i = 0; i < n; i++) {\n // Pick a random index from the array\n const randomIndex = Math.floor(Math.random() * array.length)\n // Add the randomly selected item to the result\n result.push(array[randomIndex])\n }\n\n return result\n },\n arity: toFixedArity(2),\n },\n 'random-sample-unique!': {\n evaluate: ([array, n], sourceCodeInfo): Arr => {\n assertArray(array, sourceCodeInfo)\n assertNumber(n, sourceCodeInfo, { integer: true, nonNegative: true, lte: array.length })\n if (array.length === 0) {\n throw new LitsError('Cannot sample from an empty array.', sourceCodeInfo)\n }\n const result: Arr = []\n\n const copyArray = [...array]\n for (let i = 0; i < n; i++) {\n // Pick a random index from the array\n const randomIndex = Math.floor(Math.random() * copyArray.length)\n // Add the randomly selected item to the result\n result.push(copyArray[randomIndex])\n // Remove the used item from the copy array\n copyArray.splice(randomIndex, 1)\n }\n\n return result\n },\n arity: toFixedArity(2),\n },\n 'shuffle!': {\n evaluate: ([array], sourceCodeInfo): Arr => {\n assertArray(array, sourceCodeInfo)\n const shuffledArray = [...array]\n for (let i = shuffledArray.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1))\n ;[shuffledArray[i], shuffledArray[j]] = [shuffledArray[j], shuffledArray[i]]\n }\n return shuffledArray\n },\n arity: toFixedArity(1),\n },\n 'random-normal!': {\n evaluate: ([mean, stdDev], sourceCodeInfo): number => {\n assertNumber(mean, sourceCodeInfo)\n assertNumber(stdDev, sourceCodeInfo, { gt: 0 })\n const u1 = Math.random()\n const u2 = Math.random()\n const z0 = Math.sqrt(-2.0 * Math.log(u1)) * Math.cos(2.0 * Math.PI * u2)\n return z0 * stdDev + mean\n },\n arity: toFixedArity(2),\n },\n 'random-exponential!': {\n evaluate: ([lambda], sourceCodeInfo): number => {\n assertNumber(lambda, sourceCodeInfo, { gt: 0 })\n const u = Math.random()\n return -Math.log(u) / lambda\n },\n arity: toFixedArity(1),\n },\n 'random-binomial!': {\n evaluate: ([n, p], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, nonNegative: true })\n assertNumber(p, sourceCodeInfo, { gte: 0, lte: 1 })\n let k = 0\n for (let i = 0; i < n; i++) {\n if (Math.random() < p) {\n k++\n }\n }\n return k\n },\n arity: toFixedArity(2),\n },\n 'random-poisson!': {\n evaluate: ([lambda], sourceCodeInfo): number => {\n assertNumber(lambda, sourceCodeInfo, { gt: 0 })\n\n const L = Math.exp(-lambda)\n let k = 0\n let p = 1\n\n do {\n k++\n p *= Math.random()\n } while (p > L)\n\n return k - 1\n },\n arity: toFixedArity(1),\n },\n 'random-gamma!': {\n evaluate: ([shape, scale], sourceCodeInfo): number => {\n assertNumber(shape, sourceCodeInfo, { gt: 0 })\n assertNumber(scale, sourceCodeInfo, { gt: 0 })\n return randomGamma(shape, scale)\n },\n arity: toFixedArity(2),\n },\n 'random-pareto!': {\n evaluate: ([alpha], sourceCodeInfo): number => {\n assertNumber(alpha, sourceCodeInfo, { gt: 0 })\n const u = Math.random()\n return (1 / u) ** (1 / alpha)\n },\n arity: toFixedArity(1),\n },\n 'uuid!': {\n evaluate: (): string => {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (char) => {\n const random = Math.random() * 16 | 0\n const value = char === 'x' ? random : (random & 0x3 | 0x8)\n return value.toString(16)\n })\n },\n arity: toFixedArity(0),\n },\n 'random-char!': {\n evaluate: ([charSet], sourceCodeInfo): string => {\n assertString(charSet, sourceCodeInfo)\n if (charSet.length === 0) {\n throw new LitsError('Character set cannot be empty.', sourceCodeInfo)\n }\n const randomIndex = Math.floor(Math.random() * charSet.length)\n return charSet[randomIndex]!\n },\n arity: toFixedArity(1),\n },\n 'random-string!': {\n evaluate: ([length, charSet], sourceCodeInfo): string => {\n assertNumber(length, sourceCodeInfo, { integer: true, positive: true })\n assertString(charSet, sourceCodeInfo)\n if (charSet.length === 0) {\n throw new LitsError('Character set cannot be empty.', sourceCodeInfo)\n }\n let result = ''\n for (let i = 0; i < length; i++) {\n const randomIndex = Math.floor(Math.random() * charSet.length)\n result += charSet[randomIndex]!\n }\n return result\n },\n arity: toFixedArity(2),\n },\n 'random-id!': {\n evaluate: ([length], sourceCodeInfo): string => {\n assertNumber(length, sourceCodeInfo, { integer: true, positive: true })\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'\n let result = ''\n for (let i = 0; i < length; i++) {\n const randomIndex = Math.floor(Math.random() * chars.length)\n result += chars[randomIndex]!\n }\n return result\n },\n arity: toFixedArity(1),\n },\n 'random-color!': {\n evaluate: (): string => {\n const randomColor = Math.floor(Math.random() * 0x1000000).toString(16)\n return `#${randomColor.padStart(6, '0')}`\n },\n arity: toFixedArity(0),\n },\n}\n\n/**\n * Generates a random number from a gamma distribution\n * @param shape The shape parameter (alpha) - must be positive\n * @param scale The scale parameter (beta) - must be positive\n * @returns A random number following the gamma distribution\n */\nfunction randomGamma(shape: number, scale: number = 1): number {\n // Special case for shape < 1\n if (shape < 1) {\n const d = shape + 1.0 - 1.0 / 3.0\n return randomGamma(d, scale) * Math.random() ** (1.0 / shape)\n }\n\n // Marsaglia and Tsang method for shape >= 1\n const d = shape - 1.0 / 3.0\n const c = 1.0 / Math.sqrt(9.0 * d)\n\n let x: number, v: number, u: number\n\n while (true) {\n do {\n x = randn() // Standard normal random variable\n v = 1.0 + c * x\n } while (v <= 0)\n\n v = v * v * v\n u = Math.random()\n\n if (u < 1.0 - 0.0331 * x * x * x * x) {\n return scale * d * v\n }\n\n if (Math.log(u) < 0.5 * x * x + d * (1.0 - v + Math.log(v))) {\n return scale * d * v\n }\n }\n}\n\n/**\n * Helper function to generate standard normal random variables\n * using Box-Muller transform\n */\nfunction randn(): number {\n let u = 0\n let v = 0\n while (u === 0) u = Math.random()\n while (v === 0) v = Math.random()\n\n return Math.sqrt(-2.0 * Math.log(u)) * Math.cos(2.0 * Math.PI * v)\n}\n\nfor (const [key, docs] of Object.entries(moduleDocs)) {\n if (randomFunctions[key])\n randomFunctions[key].docs = docs\n}\n\nexport const randomModule: LitsModule = {\n name: 'random',\n functions: randomFunctions,\n}\n","import type { FunctionDocs } from '../../interface'\n\nexport const moduleDocs: Record<string, FunctionDocs> = {\n 'mean': {\n category: 'vector',\n description: 'Returns the **mean** of all elements in the `vector`.',\n returns: {\n type: 'number',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **mean** of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'mean([1, 2, 3])',\n 'mean([1, 2, -3])',\n ],\n seeAlso: ['mean', 'vector.moving-mean', 'vector.centered-moving-mean', 'vector.running-mean', 'vector.geometric-mean', 'vector.harmonic-mean', 'vector.median', 'vector.mode', 'vector.sum', 'vector.rms'],\n },\n 'moving-mean': {\n category: 'vector',\n description: 'Returns the **moving mean** of the `vector` with a given window size.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **moving mean** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n ],\n examples: [\n 'let { moving-mean } = import(\"vector\");\\nmoving-mean([1, 2, 3, 4, 5], 3)',\n 'let { moving-mean } = import(\"vector\");\\nmoving-mean([1, 2, 3, 4, 5], 5)',\n ],\n seeAlso: ['moving-fn', 'vector.mean', 'vector.centered-moving-mean', 'vector.running-mean'],\n },\n 'centered-moving-mean': {\n category: 'vector',\n description: 'Returns the **centered moving mean** of the `vector` with a given window size.',\n returns: {\n type: 'array',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **centered moving mean** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the centered moving window.',\n },\n leftPadding: {\n type: 'number',\n description: 'Optional value to use for padding. Default is `null`.',\n },\n rightPadding: {\n type: 'number',\n description: 'Optional value to use for right padding. Default is `null`.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n 'rightPadding',\n ],\n },\n ],\n examples: [\n 'let { centered-moving-mean } = import(\"vector\");\\ncentered-moving-mean([1, 2, 3, 4, 5], 3)',\n 'let { centered-moving-mean } = import(\"vector\");\\ncentered-moving-mean([1, 2, 3, 4, 5], 3, 0, 10)',\n 'let { centered-moving-mean } = import(\"vector\");\\ncentered-moving-mean([1, 2, 3, 4, 5], 3, 10)',\n ],\n seeAlso: ['vector.mean', 'vector.moving-mean', 'vector.running-mean'],\n },\n 'running-mean': {\n category: 'vector',\n description: 'Returns the **running mean** of the `vector`.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **running mean** of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { running-mean } = import(\"vector\");\\nrunning-mean([1, 2, 3, 4, 5])',\n ],\n seeAlso: ['running-fn', 'vector.mean', 'vector.moving-mean', 'vector.centered-moving-mean'],\n },\n 'geometric-mean': {\n category: 'vector',\n description: 'Returns the **geometric mean** of all elements in the `vector`.',\n returns: {\n type: 'number',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **geometric mean** of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { geometric-mean } = import(\"vector\");\\ngeometric-mean([1, 2, 3])',\n 'let { geometric-mean } = import(\"vector\");\\ngeometric-mean([1, 2, 9])',\n ],\n seeAlso: ['vector.moving-geometric-mean', 'vector.centered-moving-geometric-mean', 'vector.running-geometric-mean', 'vector.mean', 'vector.harmonic-mean'],\n },\n 'moving-geometric-mean': {\n category: 'vector',\n description: 'Returns the **moving geometric mean** of the `vector` with a given window size.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **moving geometric mean** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n ],\n examples: [\n 'let { moving-geometric-mean } = import(\"vector\");\\nmoving-geometric-mean([1, 2, 3, 4, 5], 3)',\n 'let { moving-geometric-mean } = import(\"vector\");\\nmoving-geometric-mean([1, 2, 3, 4, 5], 5)',\n ],\n seeAlso: ['vector.geometric-mean', 'vector.centered-moving-geometric-mean', 'vector.running-geometric-mean'],\n },\n 'centered-moving-geometric-mean': {\n category: 'vector',\n description: 'Returns the **centered moving geometric mean** of the `vector` with a given window size.',\n returns: {\n type: 'array',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **centered moving geometric mean** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the centered moving window.',\n },\n leftPadding: {\n type: 'number',\n description: 'Optional value to use for padding. Default is `null`.',\n },\n rightPadding: {\n type: 'number',\n description: 'Optional value to use for right padding. Default is `null`.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n 'rightPadding',\n ],\n },\n ],\n examples: [\n 'let { centered-moving-geometric-mean } = import(\"vector\");\\ncentered-moving-geometric-mean([1, 2, 3, 4, 5], 3)',\n 'let { centered-moving-geometric-mean } = import(\"vector\");\\ncentered-moving-geometric-mean([1, 2, 3, 4, 5], 3, 0, 10)',\n 'let { centered-moving-geometric-mean } = import(\"vector\");\\ncentered-moving-geometric-mean([1, 2, 3, 4, 5], 3, 10)',\n ],\n seeAlso: ['vector.geometric-mean', 'vector.moving-geometric-mean', 'vector.running-geometric-mean'],\n },\n 'running-geometric-mean': {\n category: 'vector',\n description: 'Returns the **running geometric mean** of the `vector`.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **running geometric mean** of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { running-geometric-mean } = import(\"vector\");\\nrunning-geometric-mean([1, 2, 3, 4, 5])',\n ],\n seeAlso: ['vector.geometric-mean', 'vector.moving-geometric-mean', 'vector.centered-moving-geometric-mean'],\n },\n 'harmonic-mean': {\n category: 'vector',\n description: 'Returns the **harmonic mean** of all elements in the `vector`.',\n returns: {\n type: 'number',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **harmonic mean** of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { harmonic-mean } = import(\"vector\");\\nharmonic-mean([1, 2, 3])',\n 'let { harmonic-mean } = import(\"vector\");\\nharmonic-mean([1, 2, 9])',\n ],\n seeAlso: ['vector.moving-harmonic-mean', 'vector.centered-moving-harmonic-mean', 'vector.running-harmonic-mean', 'vector.mean', 'vector.geometric-mean'],\n },\n 'moving-harmonic-mean': {\n category: 'vector',\n description: 'Returns the **moving harmonic mean** of the `vector` with a given window size.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **moving harmonic mean** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n ],\n examples: [\n 'let { moving-harmonic-mean } = import(\"vector\");\\nmoving-harmonic-mean([1, 2, 3, 4, 5], 3)',\n 'let { moving-harmonic-mean } = import(\"vector\");\\nmoving-harmonic-mean([1, 2, 3, 4, 5], 5)',\n ],\n seeAlso: ['vector.harmonic-mean', 'vector.centered-moving-harmonic-mean', 'vector.running-harmonic-mean'],\n },\n 'centered-moving-harmonic-mean': {\n category: 'vector',\n description: 'Returns the **centered moving harmonic mean** of the `vector` with a given window size.',\n returns: {\n type: 'array',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **centered moving harmonic mean** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the centered moving window.',\n },\n leftPadding: {\n type: 'number',\n description: 'Optional value to use for padding. Default is `null`.',\n },\n rightPadding: {\n type: 'number',\n description: 'Optional value to use for right padding. Default is `null`.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n 'rightPadding',\n ],\n },\n ],\n examples: [\n 'let { centered-moving-harmonic-mean } = import(\"vector\");\\ncentered-moving-harmonic-mean([1, 2, 3, 4, 5], 3)',\n 'let { centered-moving-harmonic-mean } = import(\"vector\");\\ncentered-moving-harmonic-mean([1, 2, 3, 4, 5], 3, 0, 10)',\n 'let { centered-moving-harmonic-mean } = import(\"vector\");\\ncentered-moving-harmonic-mean([1, 2, 3, 4, 5], 3, 10)',\n ],\n seeAlso: ['vector.harmonic-mean', 'vector.moving-harmonic-mean', 'vector.running-harmonic-mean'],\n },\n 'running-harmonic-mean': {\n category: 'vector',\n description: 'Returns the **running harmonic mean** of the `vector`.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **running harmonic mean** of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { running-harmonic-mean } = import(\"vector\");\\nrunning-harmonic-mean([1, 2, 3, 4, 5])',\n ],\n seeAlso: ['vector.harmonic-mean', 'vector.moving-harmonic-mean', 'vector.centered-moving-harmonic-mean'],\n },\n 'median': {\n category: 'vector',\n description: 'Returns the median of all elements in the vector.',\n returns: {\n type: 'number',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The vector to calculate the median of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'median([1, 2, 3])',\n 'median([1, 2, -3])',\n 'median([1, 2, 3, 4])',\n 'median([1, 2, -3, 4])',\n ],\n seeAlso: ['median', 'vector.moving-median', 'vector.centered-moving-median', 'vector.running-median', 'vector.mean', 'vector.mode', 'vector.quartiles', 'vector.percentile', 'vector.iqr', 'vector.medad'],\n },\n 'moving-median': {\n category: 'vector',\n description: 'Returns the **moving median** of the `vector` with a given window size.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **moving median** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n ],\n examples: [\n 'let { moving-median } = import(\"vector\");\\nmoving-median([1, 2, 3, 4, 5], 3)',\n 'let { moving-median } = import(\"vector\");\\nmoving-median([1, 2, 3, 4, 5], 5)',\n ],\n seeAlso: ['vector.median', 'vector.centered-moving-median', 'vector.running-median'],\n },\n 'centered-moving-median': {\n category: 'vector',\n description: 'Returns the **centered moving median** of the `vector` with a given window size.',\n returns: {\n type: 'array',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **centered moving median** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the centered moving window.',\n },\n leftPadding: {\n type: 'number',\n description: 'Optional value to use for padding. Default is `null`.',\n },\n rightPadding: {\n type: 'number',\n description: 'Optional value to use for right padding. Default is `null`.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n 'rightPadding',\n ],\n },\n ],\n examples: [\n 'let { centered-moving-median } = import(\"vector\");\\ncentered-moving-median([1, 2, 3, 4, 5], 3)',\n 'let { centered-moving-median } = import(\"vector\");\\ncentered-moving-median([1, 2, 3, 4, 5], 3, 0, 10)',\n 'let { centered-moving-median } = import(\"vector\");\\ncentered-moving-median([1, 2, 3, 4, 5], 3, 10)',\n ],\n seeAlso: ['vector.median', 'vector.moving-median', 'vector.running-median'],\n },\n 'running-median': {\n category: 'vector',\n description: 'Returns the **running median** of the `vector`.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **running median** of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { running-median } = import(\"vector\");\\nrunning-median([1, 2, 3, 4, 5])',\n ],\n seeAlso: ['vector.median', 'vector.moving-median', 'vector.centered-moving-median'],\n },\n 'variance': {\n category: 'vector',\n description: 'Returns the **variance** of all elements in the `vector`.',\n returns: {\n type: 'number',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **variance** of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { variance } = import(\"vector\");\\nvariance([1, 2, 3])',\n 'let { variance } = import(\"vector\");\\nvariance([1, 2, -3])',\n ],\n seeAlso: ['linear-algebra.cov', 'vector.moving-variance', 'vector.centered-moving-variance', 'vector.running-variance', 'vector.stdev', 'vector.sample-variance', 'vector.mad'],\n },\n 'moving-variance': {\n category: 'vector',\n description: 'Returns the **moving variance** of the `vector` with a given window size.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **moving variance** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n ],\n examples: [\n 'let { moving-variance } = import(\"vector\");\\nmoving-variance([1, 2, 3, 4, 5], 3)',\n 'let { moving-variance } = import(\"vector\");\\nmoving-variance([1, 2, 3, 4, 5], 5)',\n ],\n seeAlso: ['vector.variance', 'vector.centered-moving-variance', 'vector.running-variance'],\n },\n 'centered-moving-variance': {\n category: 'vector',\n description: 'Returns the **centered moving variance** of the `vector` with a given window size.',\n returns: {\n type: 'array',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **centered moving variance** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the centered moving window.',\n },\n leftPadding: {\n type: 'number',\n description: 'Optional value to use for padding. Default is `null`.',\n },\n rightPadding: {\n type: 'number',\n description: 'Optional value to use for right padding. Default is `null`.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n 'rightPadding',\n ],\n },\n ],\n examples: [\n 'let { centered-moving-variance } = import(\"vector\");\\ncentered-moving-variance([1, 2, 3, 4, 5], 3)',\n 'let { centered-moving-variance } = import(\"vector\");\\ncentered-moving-variance([1, 2, 3, 4, 5], 3, 1)',\n 'let { centered-moving-variance } = import(\"vector\");\\ncentered-moving-variance([1, 2, 3, 4, 5], 3, 1, 5)',\n 'let { centered-moving-variance } = import(\"vector\");\\ncentered-moving-variance([1, 2, 3, 4, 5], 3, 0, 6)',\n ],\n seeAlso: ['vector.variance', 'vector.moving-variance', 'vector.running-variance'],\n },\n 'running-variance': {\n category: 'vector',\n description: 'Returns the **running variance** of the `vector`.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **running variance** of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { running-variance } = import(\"vector\");\\nrunning-variance([1, 2, 3, 4, 5])',\n ],\n seeAlso: ['vector.variance', 'vector.moving-variance', 'vector.centered-moving-variance'],\n },\n 'sample-variance': {\n category: 'vector',\n description: 'Returns the sample variance of all elements in the vector.',\n returns: {\n type: 'number',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'Non emtpy vector to calculate the sample variance of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { sample-variance } = import(\"vector\");\\nsample-variance([1, 2, 3])',\n 'let { sample-variance } = import(\"vector\");\\nsample-variance([1, 2, -3])',\n 'let { sample-variance } = import(\"vector\");\\nsample-variance([1, 2, 3, 4])',\n 'let { sample-variance } = import(\"vector\");\\nsample-variance([1, 2, -3, 4])',\n 'let { sample-variance } = import(\"vector\");\\nsample-variance([1, 2, 3, 40, 50])',\n ],\n seeAlso: ['vector.moving-sample-variance', 'vector.centered-moving-sample-variance', 'vector.running-sample-variance', 'vector.variance', 'vector.sample-stdev'],\n },\n 'moving-sample-variance': {\n category: 'vector',\n description: 'Returns the **moving sample variance** of the `vector` with a given window size.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **moving sample variance** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n ],\n examples: [\n 'let { moving-sample-variance } = import(\"vector\");\\nmoving-sample-variance([1, 2, 3, 4, 5], 3)',\n 'let { moving-sample-variance } = import(\"vector\");\\nmoving-sample-variance([1, 2, 3, 4, 5], 5)',\n ],\n seeAlso: ['vector.sample-variance', 'vector.centered-moving-sample-variance', 'vector.running-sample-variance'],\n },\n 'centered-moving-sample-variance': {\n category: 'vector',\n description: 'Returns the **centered moving sample variance** of the `vector` with a given window size.',\n returns: {\n type: 'array',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **centered moving sample variance** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the centered moving window.',\n },\n leftPadding: {\n type: 'number',\n description: 'Optional value to use for padding. Default is `null`.',\n },\n rightPadding: {\n type: 'number',\n description: 'Optional value to use for right padding. Default is `null`.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n 'rightPadding',\n ],\n },\n ],\n examples: [\n 'let { centered-moving-sample-variance } = import(\"vector\");\\ncentered-moving-sample-variance([1, 2, 3, 4, 5], 3)',\n 'let { centered-moving-sample-variance } = import(\"vector\");\\ncentered-moving-sample-variance([1, 2, 3, 4, 5], 3, 1)',\n 'let { centered-moving-sample-variance } = import(\"vector\");\\ncentered-moving-sample-variance([1, 2, 3, 4, 5], 3, 1, 5)',\n 'let { centered-moving-sample-variance } = import(\"vector\");\\ncentered-moving-sample-variance([1, 2, 3, 4, 5], 3, 0, 6)',\n ],\n seeAlso: ['vector.sample-variance', 'vector.moving-sample-variance', 'vector.running-sample-variance'],\n },\n 'running-sample-variance': {\n category: 'vector',\n description: 'Returns the **running sample variance** of the `vector`.',\n returns: {\n type: 'array',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **running sample variance** of. First element in result is `null` since **sample variance** is not defined for a single element.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { running-sample-variance } = import(\"vector\");\\nrunning-sample-variance([1, 2, 3, 4, 5])',\n ],\n seeAlso: ['vector.sample-variance', 'vector.moving-sample-variance', 'vector.centered-moving-sample-variance'],\n },\n 'stdev': {\n category: 'vector',\n description: 'Returns the standard deviation of all elements in the vector.',\n returns: {\n type: 'number',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'Non emtpy vector to calculate the standard deviation of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { stdev } = import(\"vector\");\\nstdev([1, 2, 3])',\n 'let { stdev } = import(\"vector\");\\nstdev([1, 2, -3])',\n 'let { stdev } = import(\"vector\");\\nstdev([1, 2, 3, 4])',\n 'let { stdev } = import(\"vector\");\\nstdev([1, 2, -3, 4])',\n 'let { stdev } = import(\"vector\");\\nstdev([1, 2, 3, 40, 50])',\n ],\n seeAlso: ['vector.moving-stdev', 'vector.centered-moving-stdev', 'vector.running-stdev', 'vector.variance', 'vector.sample-stdev', 'vector.rms', 'vector.mad'],\n },\n 'moving-stdev': {\n category: 'vector',\n description: 'Returns the **moving standard deviation** of the `vector` with a given window size.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **moving standard deviation** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n ],\n examples: [\n 'let { moving-stdev } = import(\"vector\");\\nmoving-stdev([1, 2, 3, 4, 5], 3)',\n 'let { moving-stdev } = import(\"vector\");\\nmoving-stdev([1, 2, 3, 4, 5], 5)',\n ],\n seeAlso: ['vector.stdev', 'vector.centered-moving-stdev', 'vector.running-stdev'],\n },\n 'centered-moving-stdev': {\n category: 'vector',\n description: 'Returns the **centered moving standard deviation** of the `vector` with a given window size.',\n returns: {\n type: 'array',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **centered moving standard deviation** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the centered moving window.',\n },\n leftPadding: {\n type: 'number',\n description: 'Optional value to use for padding. Default is `null`.',\n },\n rightPadding: {\n type: 'number',\n description: 'Optional value to use for right padding. Default is `null`.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n 'rightPadding',\n ],\n },\n ],\n examples: [\n 'let { centered-moving-stdev } = import(\"vector\");\\ncentered-moving-stdev([1, 2, 3, 4, 5], 3)',\n 'let { centered-moving-stdev } = import(\"vector\");\\ncentered-moving-stdev([1, 2, 3, 4, 5], 3, 1)',\n 'let { centered-moving-stdev } = import(\"vector\");\\ncentered-moving-stdev([1, 2, 3, 4, 5], 3, 1, 5)',\n 'let { centered-moving-stdev } = import(\"vector\");\\ncentered-moving-stdev([1, 2, 3, 4, 5], 3, 0, 6)',\n ],\n seeAlso: ['vector.stdev', 'vector.moving-stdev', 'vector.running-stdev'],\n },\n 'running-stdev': {\n category: 'vector',\n description: 'Returns the **running standard deviation** of the `vector`.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **running standard deviation** of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { running-stdev } = import(\"vector\");\\nrunning-stdev([1, 2, 3, 4, 5])',\n ],\n seeAlso: ['vector.stdev', 'vector.moving-stdev', 'vector.centered-moving-stdev'],\n },\n 'sample-stdev': {\n category: 'vector',\n description: 'Returns the sample standard deviation of all elements in the vector.',\n returns: {\n type: 'number',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'Non emtpy vector to calculate the sample standard deviation of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { sample-stdev } = import(\"vector\");\\nsample-stdev([1, 2, 3])',\n 'let { sample-stdev } = import(\"vector\");\\nsample-stdev([1, 2, -3])',\n 'let { sample-stdev } = import(\"vector\");\\nsample-stdev([1, 2, 3, 4])',\n 'let { sample-stdev } = import(\"vector\");\\nsample-stdev([1, 2, -3, 4])',\n 'let { sample-stdev } = import(\"vector\");\\nsample-stdev([1, 2, 3, 40, 50])',\n ],\n seeAlso: ['vector.moving-sample-stdev', 'vector.centered-moving-sample-stdev', 'vector.running-sample-stdev', 'vector.stdev', 'vector.sample-variance'],\n },\n 'moving-sample-stdev': {\n category: 'vector',\n description: 'Returns the **moving sample standard deviation** of the `vector` with a given window size.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **moving sample standard deviation** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n ],\n examples: [\n 'let { moving-sample-stdev } = import(\"vector\");\\nmoving-sample-stdev([1, 2, 3, 4, 5], 3)',\n 'let { moving-sample-stdev } = import(\"vector\");\\nmoving-sample-stdev([1, 2, 3, 4, 5], 5)',\n ],\n seeAlso: ['vector.sample-stdev', 'vector.centered-moving-sample-stdev', 'vector.running-sample-stdev'],\n },\n 'centered-moving-sample-stdev': {\n category: 'vector',\n description: 'Returns the **centered moving sample standard deviation** of the `vector` with a given window size.',\n returns: {\n type: 'array',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **centered moving sample standard deviation** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the centered moving window.',\n },\n leftPadding: {\n type: 'number',\n description: 'Optional value to use for padding. Default is `null`.',\n },\n rightPadding: {\n type: 'number',\n description: 'Optional value to use for right padding. Default is `null`.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n 'rightPadding',\n ],\n },\n ],\n examples: [\n 'let { centered-moving-sample-stdev } = import(\"vector\");\\ncentered-moving-sample-stdev([1, 2, 3, 4, 5], 3)',\n 'let { centered-moving-sample-stdev } = import(\"vector\");\\ncentered-moving-sample-stdev([1, 2, 3, 4, 5], 3, 1)',\n 'let { centered-moving-sample-stdev } = import(\"vector\");\\ncentered-moving-sample-stdev([1, 2, 3, 4, 5], 3, 1, 5)',\n 'let { centered-moving-sample-stdev } = import(\"vector\");\\ncentered-moving-sample-stdev([1, 2, 3, 4, 5], 3, 0, 6)',\n ],\n seeAlso: ['vector.sample-stdev', 'vector.moving-sample-stdev', 'vector.running-sample-stdev'],\n },\n 'running-sample-stdev': {\n category: 'vector',\n description: 'Returns the **running sample standard deviation** of the `vector`.',\n returns: {\n type: 'array',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **running sample standard deviation** of. First element in result is `null` since **sample standard deviation** is not defined for a single element.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { running-sample-stdev } = import(\"vector\");\\nrunning-sample-stdev([1, 2, 3, 4, 5])',\n ],\n seeAlso: ['vector.sample-stdev', 'vector.moving-sample-stdev', 'vector.centered-moving-sample-stdev'],\n },\n 'iqr': {\n category: 'vector',\n description: 'Calculates the **interquartile range** of a `vector`. Returns the difference between the third and first quartiles.',\n returns: {\n type: 'number',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **interquartile range** of. Minimum length is 4.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { iqr } = import(\"vector\");\\niqr([1, 2, 3, 4])',\n 'let { iqr } = import(\"vector\");\\niqr([5, 4, 3, 2, 1, 2, 3, 4, 5])',\n 'let { iqr } = import(\"vector\");\\niqr(range(1, 1000))',\n 'let { iqr, generate } = import(\"vector\");\\niqr(generate(1000, -> 1e6 / ($ + 1) ^ 2))',\n 'let { iqr, generate } = import(\"vector\");\\nlet { ln } = import(\"math\");\\niqr(generate(1000, -> ln($ + 1)))',\n ],\n seeAlso: ['vector.moving-iqr', 'vector.centered-moving-iqr', 'vector.running-iqr', 'vector.quartiles', 'vector.median', 'vector.mad', 'vector.medad', 'vector.outliers?', 'vector.outliers'],\n },\n 'moving-iqr': {\n category: 'vector',\n description: 'Calculates the **moving interquartile range** of a `vector` with a given window size.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **moving interquartile range** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n ],\n examples: [\n 'let { moving-iqr } = import(\"vector\");\\nmoving-iqr([1, 2, 4, 7, 11, 16], 4)',\n 'let { moving-iqr } = import(\"vector\");\\nmoving-iqr([1, 2, 4, 7, 11, 16], 5)',\n 'let { moving-iqr } = import(\"vector\");\\nmoving-iqr([1, 2, 4, 7, 11, 16], 6)',\n ],\n seeAlso: ['vector.iqr', 'vector.centered-moving-iqr', 'vector.running-iqr'],\n },\n 'centered-moving-iqr': {\n category: 'vector',\n description: 'Calculates the **centered moving interquartile range** of a `vector` with a given window size.',\n returns: {\n type: 'array',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **centered moving interquartile range** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n leftPadding: {\n type: 'number',\n description: 'Optional value to use for padding. Default is `null`.',\n },\n rightPadding: {\n type: 'number',\n description: 'Optional value to use for right padding. Default is `null`.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n 'rightPadding',\n ],\n },\n ],\n examples: [\n 'let { centered-moving-iqr } = import(\"vector\");\\ncentered-moving-iqr([1, 2, 4, 7, 11, 16], 4)',\n 'let { centered-moving-iqr } = import(\"vector\");\\ncentered-moving-iqr([1, 2, 4, 7, 11, 16], 4, 0, 0)',\n ],\n seeAlso: ['vector.iqr', 'vector.moving-iqr', 'vector.running-iqr'],\n },\n 'running-iqr': {\n category: 'vector',\n description: 'Calculates the **running interquartile range** of a `vector`. First three element in result is `null` since **running interquartile range** is not defined for less than four elements.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **running interquartile range** of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { running-iqr } = import(\"vector\");\\nrunning-iqr([1, 2, 3, 4, 5, 6])',\n 'let { running-iqr } = import(\"vector\");\\nrunning-iqr([-1, -2, -3, 1, 2, 3])',\n ],\n seeAlso: ['vector.iqr', 'vector.moving-iqr', 'vector.centered-moving-iqr'],\n },\n 'sum': {\n category: 'vector',\n description: 'Returns the sum of all elements in the vector.',\n returns: {\n type: 'number',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The vector to sum.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'sum([1, 2, 3])',\n 'sum([1, 2, -3])',\n ],\n seeAlso: ['sum', 'vector.moving-sum', 'vector.centered-moving-sum', 'vector.running-sum', 'vector.prod', 'vector.cumsum', 'vector.mean'],\n },\n 'moving-sum': {\n category: 'vector',\n description: 'Returns the **moving sum** of the `vector` with a given window size.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **moving sum** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n ],\n examples: [\n 'let { moving-sum } = import(\"vector\");\\nmoving-sum([1, 2, 3, 4, 5], 3)',\n 'let { moving-sum } = import(\"vector\");\\nmoving-sum([1, 2, 3, 4, 5], 5)',\n ],\n seeAlso: ['vector.sum', 'vector.centered-moving-sum', 'vector.running-sum'],\n },\n 'centered-moving-sum': {\n category: 'vector',\n description: 'Returns the **centered moving sum** of the `vector` with a given window size.',\n returns: {\n type: 'array',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **centered moving sum** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the centered moving window.',\n },\n leftPadding: {\n type: 'number',\n description: 'Optional value to use for padding. Default is `null`.',\n },\n rightPadding: {\n type: 'number',\n description: 'Optional value to use for right padding. Default is `null`.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n 'rightPadding',\n ],\n },\n ],\n examples: [\n 'let { centered-moving-sum } = import(\"vector\");\\ncentered-moving-sum([1, 2, 3, 4, 5], 3)',\n 'let { centered-moving-sum } = import(\"vector\");\\ncentered-moving-sum([1, 2, 3, 4, 5], 3, 0, 0)',\n 'let { centered-moving-sum } = import(\"vector\");\\ncentered-moving-sum([1, 2, 3, 4, 5], 3, 10)',\n ],\n seeAlso: ['vector.sum', 'vector.moving-sum', 'vector.running-sum'],\n },\n 'running-sum': {\n category: 'vector',\n description: 'Returns the **running sum** of the `vector`.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **running sum** of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { running-sum } = import(\"vector\");\\nrunning-sum([1, 2, 3])',\n 'let { running-sum } = import(\"vector\");\\nrunning-sum([1, -2, -3])',\n ],\n seeAlso: ['vector.sum', 'vector.moving-sum', 'vector.centered-moving-sum', 'vector.cumsum'],\n },\n 'prod': {\n category: 'vector',\n description: 'Returns the **product** of all elements in the `vector`.',\n returns: {\n type: 'number',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **product** of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'prod([1, 2, 3])',\n 'prod([1, 2, -3])',\n ],\n seeAlso: ['prod', 'vector.moving-prod', 'vector.centered-moving-prod', 'vector.running-prod', 'vector.sum', 'vector.cumprod'],\n },\n 'moving-prod': {\n category: 'vector',\n description: 'Returns the **moving product** of the `vector` with a given window size.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **moving product** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n ],\n examples: [\n 'let { moving-prod } = import(\"vector\");\\nmoving-prod([1, 2, 3, 4, 5], 3)',\n 'let { moving-prod } = import(\"vector\");\\nmoving-prod([1, 2, 3, 4, 5], 5)',\n ],\n seeAlso: ['vector.prod', 'vector.centered-moving-prod', 'vector.running-prod'],\n },\n 'centered-moving-prod': {\n category: 'vector',\n description: 'Returns the **centered moving product** of the `vector` with a given window size.',\n returns: {\n type: 'array',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **centered moving product** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n leftPadding: {\n type: 'number',\n description: 'Optional value to use for padding. Default is `null`.',\n },\n rightPadding: {\n type: 'number',\n description: 'Optional value to use for right padding. Default is `null`.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n 'rightPadding',\n ],\n },\n ],\n examples: [\n 'let { centered-moving-prod } = import(\"vector\");\\ncentered-moving-prod([1, 2, 3, 4, 5], 3)',\n 'let { centered-moving-prod } = import(\"vector\");\\ncentered-moving-prod([1, 2, 3, 4, 5], 3, 0, 0)',\n ],\n seeAlso: ['vector.prod', 'vector.moving-prod', 'vector.running-prod'],\n },\n 'running-prod': {\n category: 'vector',\n description: 'Returns the **running product** of the `vector`.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **running product** of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { running-prod } = import(\"vector\");\\nrunning-prod([1, 2, 3, 4, 5])',\n 'let { running-prod } = import(\"vector\");\\nrunning-prod([1, -2, -3])',\n ],\n seeAlso: ['vector.prod', 'vector.moving-prod', 'vector.centered-moving-prod', 'vector.cumprod'],\n },\n 'span': {\n category: 'vector',\n description: 'Returns the difference between the maximum and minimum values in a vector.',\n returns: {\n type: 'number',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The vector to calculate the span of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { span } = import(\"vector\");\\nspan([1, 2, 3])',\n 'let { span } = import(\"vector\");\\nspan([1, 1, 2, 3, 3])',\n 'let { span } = import(\"vector\");\\nspan([1, 2, -3])',\n ],\n seeAlso: ['vector.moving-span', 'vector.centered-moving-span', 'vector.running-span', 'min', 'max'],\n },\n 'moving-span': {\n category: 'vector',\n description: 'Calculates the **moving span** of a `vector` with a given window size.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **moving span** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n ],\n examples: [\n 'let { moving-span } = import(\"vector\");\\nmoving-span([1, 2, 4, 7, 11, 16], 4)',\n 'let { moving-span } = import(\"vector\");\\nmoving-span([1, 2, 4, 7, 11, 16], 5)',\n 'let { moving-span } = import(\"vector\");\\nmoving-span([1, 2, 4, 7, 11, 16], 6)',\n ],\n seeAlso: ['vector.span', 'vector.centered-moving-span', 'vector.running-span'],\n },\n 'centered-moving-span': {\n category: 'vector',\n description: 'Calculates the **centered moving span** of a `vector` with a given window size. The result is padded with `leftPadding` on the left and right.',\n returns: {\n type: 'array',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **centered moving span** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n leftPadding: {\n type: 'number',\n description: 'The value to pad the result with on the left.',\n },\n rightPadding: {\n type: 'number',\n description: 'The value to pad the result with on the right.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n 'rightPadding',\n ],\n },\n ],\n examples: [\n 'let { centered-moving-span } = import(\"vector\");\\ncentered-moving-span([1, 2, 4, 7, 11, 16], 4)',\n 'let { centered-moving-span } = import(\"vector\");\\ncentered-moving-span([1, 2, 4, 7, 11, 16], 3, 0, 100)',\n ],\n seeAlso: ['vector.span', 'vector.moving-span', 'vector.running-span'],\n },\n 'running-span': {\n category: 'vector',\n description: 'Calculates the **running span** of a `vector` with a given window size.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **running span** of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { running-span } = import(\"vector\");\\nrunning-span([1, 2, 4])',\n ],\n seeAlso: ['vector.span', 'vector.moving-span', 'vector.centered-moving-span'],\n },\n 'skewness': {\n category: 'vector',\n description: 'Calculates the **skewness** of a `vector`. Returns the third standardized moment.',\n returns: {\n type: 'number',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **skewness** of. Minimum length is 3.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { skewness } = import(\"vector\");\\nskewness([1, 2, 3, 6, 20])',\n 'let { skewness } = import(\"vector\");\\nskewness([1, 2, 2, 3])',\n ],\n seeAlso: ['vector.moving-skewness', 'vector.centered-moving-skewness', 'vector.running-skewness', 'vector.kurtosis', 'vector.sample-skewness', 'vector.excess-kurtosis'],\n },\n 'moving-skewness': {\n category: 'vector',\n description: 'Calculates the **moving skewness** of a `vector` with a given window size.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **moving skewness** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n ],\n examples: [\n 'let { moving-skewness } = import(\"vector\");\\nmoving-skewness([1, 2, 4, 7, 11, 16], 4)',\n 'let { moving-skewness } = import(\"vector\");\\nmoving-skewness([1, 2, 4, 7, 11, 16], 5)',\n ],\n seeAlso: ['vector.skewness', 'vector.centered-moving-skewness', 'vector.running-skewness'],\n },\n 'centered-moving-skewness': {\n category: 'vector',\n description: 'Calculates the **centered moving skewness** of a `vector` with a given window size and padding.',\n returns: {\n type: 'array',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **centered moving skewness** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n leftPadding: {\n type: 'number',\n description: 'Optional value to use for padding. Default is `null`.',\n },\n rightPadding: {\n type: 'number',\n description: 'Optional value to use for right padding. Default is `null`.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n 'rightPadding',\n ],\n },\n ],\n examples: [\n 'let { centered-moving-skewness } = import(\"vector\");\\ncentered-moving-skewness([1, 2, 4, 7, 11, 16], 4)',\n 'let { centered-moving-skewness } = import(\"vector\");\\ncentered-moving-skewness([1, 2, 4, 7, 11, 16], 4, 0, 0)',\n ],\n seeAlso: ['vector.skewness', 'vector.moving-skewness', 'vector.running-skewness'],\n },\n 'running-skewness': {\n category: 'vector',\n description: 'Calculates the **running skewness** of a `vector` with a given window size. First two element in result is `null` since **running skewness** is not defined for less than three elements.',\n returns: {\n type: 'array',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **running skewness** of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { running-skewness } = import(\"vector\");\\nrunning-skewness([1, 2, 4, 7, 11])',\n ],\n seeAlso: ['vector.skewness', 'vector.moving-skewness', 'vector.centered-moving-skewness'],\n },\n 'sample-skewness': {\n category: 'vector',\n description: 'Calculates the **sample skewness** of a `vector`. Returns the third standardized moment.',\n returns: {\n type: 'number',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **sample skewness** of. Minimum length is 3.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { sample-skewness } = import(\"vector\");\\nsample-skewness([1, 2, 3, 6, 20])',\n 'let { sample-skewness } = import(\"vector\");\\nsample-skewness([1, 2, 2, 3])',\n ],\n seeAlso: ['vector.moving-sample-skewness', 'vector.centered-moving-sample-skewness', 'vector.running-sample-skewness', 'vector.skewness', 'vector.sample-kurtosis'],\n },\n 'moving-sample-skewness': {\n category: 'vector',\n description: 'Calculates the **moving sample skewness** of a `vector` with a given window size.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **moving sample skewness** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n ],\n examples: [\n 'let { moving-sample-skewness } = import(\"vector\");\\nmoving-sample-skewness([1, 2, 4, 7, 11, 16], 4)',\n 'let { moving-sample-skewness } = import(\"vector\");\\nmoving-sample-skewness([1, 2, 4, 7, 11, 16], 5)',\n ],\n seeAlso: ['vector.sample-skewness', 'vector.centered-moving-sample-skewness', 'vector.running-sample-skewness'],\n },\n 'centered-moving-sample-skewness': {\n category: 'vector',\n description: 'Calculates the **centered moving sample skewness** of a `vector` with a given window size and padding.',\n returns: {\n type: 'array',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **centered moving sample skewness** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n leftPadding: {\n type: 'number',\n description: 'Optional value to use for padding. Default is `null`.',\n },\n rightPadding: {\n type: 'number',\n description: 'Optional value to use for right padding. Default is `null`.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n 'rightPadding',\n ],\n },\n ],\n examples: [\n 'let { centered-moving-sample-skewness } = import(\"vector\");\\ncentered-moving-sample-skewness([1, 2, 4, 7, 11, 16], 4)',\n 'let { centered-moving-sample-skewness } = import(\"vector\");\\ncentered-moving-sample-skewness([1, 2, 4, 7, 11, 16], 3, 0, 100)',\n ],\n seeAlso: ['vector.sample-skewness', 'vector.moving-sample-skewness', 'vector.running-sample-skewness'],\n },\n 'running-sample-skewness': {\n category: 'vector',\n description: 'Calculates the **running sample skewness** of a `vector` with a given window size. First two element in result is `null` since **running sample skewness** is not defined for less than three elements.',\n returns: {\n type: 'array',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **running sample skewness** of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { running-sample-skewness } = import(\"vector\");\\nrunning-sample-skewness([1, 2, 4, 7, 11])',\n ],\n seeAlso: ['vector.sample-skewness', 'vector.moving-sample-skewness', 'vector.centered-moving-sample-skewness'],\n },\n 'excess-kurtosis': {\n category: 'vector',\n description: 'Calculates the **excess kurtosis** of a `vector`. Returns the third standardized moment.',\n returns: {\n type: 'number',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **excess kurtosis** of. Minimum length is 3.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { excess-kurtosis } = import(\"vector\");\\nexcess-kurtosis([1, 2, 3, 6, 20])',\n 'let { excess-kurtosis } = import(\"vector\");\\nexcess-kurtosis([1, 2, 2, 3])',\n ],\n seeAlso: ['vector.moving-excess-kurtosis', 'vector.centered-moving-excess-kurtosis', 'vector.running-excess-kurtosis', 'vector.kurtosis', 'vector.sample-excess-kurtosis', 'vector.skewness'],\n },\n 'moving-excess-kurtosis': {\n category: 'vector',\n description: 'Calculates the **moving excess kurtosis** of a `vector` with a given window size.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **moving excess kurtosis** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n ],\n examples: [\n 'let { moving-excess-kurtosis } = import(\"vector\");\\nmoving-excess-kurtosis([1, 2, 4, 7, 11, 16], 4)',\n 'let { moving-excess-kurtosis } = import(\"vector\");\\nmoving-excess-kurtosis([1, 2, 4, 7, 11, 16], 5)',\n ],\n seeAlso: ['vector.excess-kurtosis', 'vector.centered-moving-excess-kurtosis', 'vector.running-excess-kurtosis'],\n },\n 'centered-moving-excess-kurtosis': {\n category: 'vector',\n description: 'Calculates the **centered moving excess kurtosis** of a `vector` with a given window size and padding.',\n returns: {\n type: 'array',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **centered moving excess kurtosis** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n leftPadding: {\n type: 'number',\n description: 'Optional value to use for padding. Default is `null`.',\n },\n rightPadding: {\n type: 'number',\n description: 'Optional value to use for right padding. Default is `null`.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n 'rightPadding',\n ],\n },\n ],\n examples: [\n 'let { centered-moving-excess-kurtosis } = import(\"vector\");\\ncentered-moving-excess-kurtosis([1, 2, 4, 7, 11, 16], 4)',\n 'let { centered-moving-excess-kurtosis } = import(\"vector\");\\ncentered-moving-excess-kurtosis([1, 2, 4, 7, 11, 16], 4, 0, 0)',\n ],\n seeAlso: ['vector.excess-kurtosis', 'vector.moving-excess-kurtosis', 'vector.running-excess-kurtosis'],\n },\n 'running-excess-kurtosis': {\n category: 'vector',\n description: 'Calculates the **running excess kurtosis** of a `vector` with a given window size. First two element in result is `null` since **running excess kurtosis** is not defined for less than three elements.',\n returns: {\n type: 'array',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **running excess kurtosis** of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { running-excess-kurtosis } = import(\"vector\");\\nrunning-excess-kurtosis([1, 2, 4, 7, 11])',\n ],\n seeAlso: ['vector.excess-kurtosis', 'vector.moving-excess-kurtosis', 'vector.centered-moving-excess-kurtosis'],\n },\n 'kurtosis': {\n category: 'vector',\n description: 'Calculates the **kurtosis** of a `vector`. Returns the third standardized moment.',\n returns: {\n type: 'number',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **kurtosis** of. Minimum length is 3.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { kurtosis } = import(\"vector\");\\nkurtosis([1, 2, 3, 6, 20])',\n 'let { kurtosis } = import(\"vector\");\\nkurtosis([1, 2, 2, 3])',\n ],\n seeAlso: ['vector.moving-kurtosis', 'vector.centered-moving-kurtosis', 'vector.running-kurtosis', 'vector.excess-kurtosis', 'vector.sample-kurtosis', 'vector.skewness'],\n },\n 'moving-kurtosis': {\n category: 'vector',\n description: 'Calculates the **moving kurtosis** of a `vector` with a given window size.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **moving kurtosis** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n ],\n examples: [\n 'let { moving-kurtosis } = import(\"vector\");\\nmoving-kurtosis([1, 2, 4, 7, 11, 16], 4)',\n 'let { moving-kurtosis } = import(\"vector\");\\nmoving-kurtosis([1, 2, 4, 7, 11, 16], 5)',\n ],\n seeAlso: ['vector.kurtosis', 'vector.centered-moving-kurtosis', 'vector.running-kurtosis'],\n },\n 'centered-moving-kurtosis': {\n category: 'vector',\n description: 'Calculates the **centered moving kurtosis** of a `vector` with a given window size and padding.',\n returns: {\n type: 'array',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **centered moving kurtosis** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n leftPadding: {\n type: 'number',\n description: 'Optional value to use for padding. Default is `null`.',\n },\n rightPadding: {\n type: 'number',\n description: 'Optional value to use for right padding. Default is `null`.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n 'rightPadding',\n ],\n },\n ],\n examples: [\n 'let { centered-moving-kurtosis } = import(\"vector\");\\ncentered-moving-kurtosis([1, 2, 4, 7, 11, 16], 4)',\n 'let { centered-moving-kurtosis } = import(\"vector\");\\ncentered-moving-kurtosis([1, 2, 4, 7, 11, 16], 4, 0, 0)',\n ],\n seeAlso: ['vector.kurtosis', 'vector.moving-kurtosis', 'vector.running-kurtosis'],\n },\n 'running-kurtosis': {\n category: 'vector',\n description: 'Calculates the **running kurtosis** of a `vector` with a given window size. First two element in result is `null` since **running kurtosis** is not defined for less than three elements.',\n returns: {\n type: 'array',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **running kurtosis** of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { running-kurtosis } = import(\"vector\");\\nrunning-kurtosis([1, 2, 4, 7, 11])',\n ],\n seeAlso: ['vector.kurtosis', 'vector.moving-kurtosis', 'vector.centered-moving-kurtosis'],\n },\n 'sample-excess-kurtosis': {\n category: 'vector',\n description: 'Calculates the **sample excess kurtosis** of a `vector`. Returns the third standardized moment.',\n returns: {\n type: 'number',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **sample excess kurtosis** of. Minimum length is 3.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { sample-excess-kurtosis } = import(\"vector\");\\nsample-excess-kurtosis([1, 2, 3, 6, 20])',\n 'let { sample-excess-kurtosis } = import(\"vector\");\\nsample-excess-kurtosis([1, 2, 2, 3])',\n ],\n seeAlso: ['vector.moving-sample-excess-kurtosis', 'vector.centered-moving-sample-excess-kurtosis', 'vector.running-sample-excess-kurtosis', 'vector.sample-kurtosis', 'vector.excess-kurtosis'],\n },\n 'moving-sample-excess-kurtosis': {\n category: 'vector',\n description: 'Calculates the **moving sample excess kurtosis** of a `vector` with a given window size.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **moving sample excess kurtosis** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n ],\n examples: [\n 'let { moving-sample-excess-kurtosis } = import(\"vector\");\\nmoving-sample-excess-kurtosis([1, 2, 4, 7, 11, 16], 4)',\n 'let { moving-sample-excess-kurtosis } = import(\"vector\");\\nmoving-sample-excess-kurtosis([1, 2, 4, 7, 11, 16], 5)',\n ],\n seeAlso: ['vector.sample-excess-kurtosis', 'vector.centered-moving-sample-excess-kurtosis', 'vector.running-sample-excess-kurtosis'],\n },\n 'centered-moving-sample-excess-kurtosis': {\n category: 'vector',\n description: 'Calculates the **centered moving sample excess kurtosis** of a `vector` with a given window size and padding.',\n returns: {\n type: 'array',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **centered moving sample excess kurtosis** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n leftPadding: {\n type: 'number',\n description: 'Optional value to use for padding. Default is `null`.',\n },\n rightPadding: {\n type: 'number',\n description: 'Optional value to use for right padding. Default is `null`.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n 'rightPadding',\n ],\n },\n ],\n examples: [\n 'let { centered-moving-sample-excess-kurtosis } = import(\"vector\");\\ncentered-moving-sample-excess-kurtosis([1, 2, 4, 7, 11, 16], 4)',\n 'let { centered-moving-sample-excess-kurtosis } = import(\"vector\");\\ncentered-moving-sample-excess-kurtosis([1, 2, 4, 7, 11, 16], 4, 0, 100)',\n ],\n seeAlso: ['vector.sample-excess-kurtosis', 'vector.moving-sample-excess-kurtosis', 'vector.running-sample-excess-kurtosis'],\n },\n 'running-sample-excess-kurtosis': {\n category: 'vector',\n description: 'Calculates the **running sample excess kurtosis** of a `vector` with a given window size. First two element in result is `null` since **running sample excess kurtosis** is not defined for less than three elements.',\n returns: {\n type: 'array',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **running sample excess kurtosis** of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { running-sample-excess-kurtosis } = import(\"vector\");\\nrunning-sample-excess-kurtosis([1, 2, 4, 7, 11])',\n ],\n seeAlso: ['vector.sample-excess-kurtosis', 'vector.moving-sample-excess-kurtosis', 'vector.centered-moving-sample-excess-kurtosis'],\n },\n 'sample-kurtosis': {\n category: 'vector',\n description: 'Calculates the **sample kurtosis** of a `vector`. Returns the third standardized moment.',\n returns: {\n type: 'number',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **sample kurtosis** of. Minimum length is 3.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { sample-kurtosis } = import(\"vector\");\\nsample-kurtosis([1, 2, 3, 6, 20])',\n 'let { sample-kurtosis } = import(\"vector\");\\nsample-kurtosis([1, 2, 2, 3])',\n ],\n seeAlso: ['vector.moving-sample-kurtosis', 'vector.centered-moving-sample-kurtosis', 'vector.running-sample-kurtosis', 'vector.sample-excess-kurtosis', 'vector.kurtosis', 'vector.sample-skewness'],\n },\n 'moving-sample-kurtosis': {\n category: 'vector',\n description: 'Calculates the **moving sample kurtosis** of a `vector` with a given window size.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **moving sample kurtosis** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n ],\n examples: [\n 'let { moving-sample-kurtosis } = import(\"vector\");\\nmoving-sample-kurtosis([1, 2, 4, 7, 11, 16], 4)',\n 'let { moving-sample-kurtosis } = import(\"vector\");\\nmoving-sample-kurtosis([1, 2, 4, 7, 11, 16], 5)',\n ],\n seeAlso: ['vector.sample-kurtosis', 'vector.centered-moving-sample-kurtosis', 'vector.running-sample-kurtosis'],\n },\n 'centered-moving-sample-kurtosis': {\n category: 'vector',\n description: 'Calculates the **centered moving sample kurtosis** of a `vector` with a given window size and padding.',\n returns: {\n type: 'array',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **centered moving sample kurtosis** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n leftPadding: {\n type: 'number',\n description: 'Optional value to use for padding. Default is `null`.',\n },\n rightPadding: {\n type: 'number',\n description: 'Optional value to use for right padding. Default is `null`.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n 'rightPadding',\n ],\n },\n ],\n examples: [\n 'let { centered-moving-sample-kurtosis } = import(\"vector\");\\ncentered-moving-sample-kurtosis([1, 2, 4, 7, 11, 16], 4)',\n 'let { centered-moving-sample-kurtosis } = import(\"vector\");\\ncentered-moving-sample-kurtosis([1, 2, 4, 7, 11, 16], 4, 0, 100)',\n ],\n seeAlso: ['vector.sample-kurtosis', 'vector.moving-sample-kurtosis', 'vector.running-sample-kurtosis'],\n },\n 'running-sample-kurtosis': {\n category: 'vector',\n description: 'Calculates the **running sample kurtosis** of a `vector` with a given window size. First two element in result is `null` since **running sample kurtosis** is not defined for less than three elements.',\n returns: {\n type: 'array',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **running sample kurtosis** of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { running-sample-kurtosis } = import(\"vector\");\\nrunning-sample-kurtosis([1, 2, 4, 7, 11])',\n ],\n seeAlso: ['vector.sample-kurtosis', 'vector.moving-sample-kurtosis', 'vector.centered-moving-sample-kurtosis'],\n },\n 'rms': {\n category: 'vector',\n description: 'Calculates the **root mean square** of a `vector`. Returns the square root of the average of the squares of the elements.',\n returns: {\n type: 'number',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **root mean square** of. Minimum length is 1.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { rms } = import(\"vector\");\\nrms([1, 2, 3, 4])',\n 'let { rms } = import(\"vector\");\\nrms([5, 4, 3, 2, 1])',\n 'let { rms } = import(\"vector\");\\nrms(range(1, 1000))',\n 'let { rms, generate } = import(\"vector\");\\nrms(generate(1000, -> 1e6 / ($ + 1) ^ 2))',\n 'let { rms, generate } = import(\"vector\");\\nlet { ln } = import(\"math\");\\nrms(generate(1000, -> ln($ + 1)))',\n ],\n seeAlso: ['vector.moving-rms', 'vector.centered-moving-rms', 'vector.running-rms', 'vector.mean', 'vector.stdev'],\n },\n 'moving-rms': {\n category: 'vector',\n description: 'Calculates the **moving root mean square** of a `vector` with a given window size.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **moving root mean square** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n ],\n examples: [\n 'let { moving-rms } = import(\"vector\");\\nmoving-rms([1, 2, 4, 7, 11, 16], 4)',\n 'let { moving-rms } = import(\"vector\");\\nmoving-rms([1, 2, 4, 7, 11, 16], 5)',\n 'let { moving-rms } = import(\"vector\");\\nmoving-rms([1, 2, 4, 7, 11, 16], 6)',\n ],\n seeAlso: ['vector.rms', 'vector.centered-moving-rms', 'vector.running-rms'],\n },\n 'centered-moving-rms': {\n category: 'vector',\n description: 'Calculates the **centered moving root mean square** of a `vector` with a given window size and padding value.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **centered moving root mean square** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n leftPadding: {\n type: 'number',\n description: 'Optional value to use for padding. Default is `null`.',\n },\n rightPadding: {\n type: 'number',\n description: 'Optional value to use for right padding. Default is `null`.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n 'rightPadding',\n ],\n },\n ],\n examples: [\n 'let { centered-moving-rms } = import(\"vector\");\\ncentered-moving-rms([1, 2, 4, 7, 11, 16], 4)',\n 'let { centered-moving-rms } = import(\"vector\");\\ncentered-moving-rms([1, 2, 4, 7, 11, 16], 5, 0)',\n 'let { centered-moving-rms } = import(\"vector\");\\ncentered-moving-rms([1, 2, 4, 7, 11, 16], 6, 0, 0)',\n ],\n seeAlso: ['vector.rms', 'vector.moving-rms', 'vector.running-rms'],\n },\n 'running-rms': {\n category: 'vector',\n description: 'Calculates the **running root mean square** of a `vector`.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **running root mean square** of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { running-rms } = import(\"vector\");\\nrunning-rms([1, 2, 3, 4, 5, 6])',\n 'let { running-rms } = import(\"vector\");\\nrunning-rms([1, -3, 2])',\n 'let { running-rms } = import(\"vector\");\\nrunning-rms([-1, -2, -3])',\n 'let { running-rms } = import(\"vector\");\\nrunning-rms([0])',\n ],\n seeAlso: ['vector.rms', 'vector.moving-rms', 'vector.centered-moving-rms'],\n },\n 'mad': {\n category: 'vector',\n description: 'Returns the **mean absolute deviation** of all elements in the `vector`.',\n returns: {\n type: 'number',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **mean absolute deviation** of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { mad } = import(\"vector\");\\nmad([1, 2, 3])',\n 'let { mad } = import(\"vector\");\\nmad([1, 2, -3])',\n ],\n seeAlso: ['vector.moving-mad', 'vector.centered-moving-mad', 'vector.running-mad', 'vector.medad', 'vector.stdev', 'vector.variance', 'vector.iqr'],\n },\n 'moving-mad': {\n category: 'vector',\n description: 'Returns the **moving mean absolute deviation** of the `vector` with a given window size.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **moving mean absolute deviation** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n ],\n examples: [\n 'let { moving-mad } = import(\"vector\");\\nmoving-mad([1, 2, 3, 4, 5], 3)',\n 'let { moving-mad } = import(\"vector\");\\nmoving-mad([1, 2, 3, 4, 5], 5)',\n ],\n seeAlso: ['vector.mad', 'vector.centered-moving-mad', 'vector.running-mad'],\n },\n 'centered-moving-mad': {\n category: 'vector',\n description: 'Returns the **centered moving mean absolute deviation** of the `vector` with a given window size.',\n returns: {\n type: 'array',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **centered moving mean absolute deviation** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n leftPadding: {\n type: 'number',\n description: 'Optional value to use for padding. Default is `null`.',\n },\n rightPadding: {\n type: 'number',\n description: 'Optional value to use for right padding. Default is `null`.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n 'rightPadding',\n ],\n },\n ],\n examples: [\n 'let { centered-moving-mad } = import(\"vector\");\\ncentered-moving-mad([1, 2, 3, 4, 5], 3)',\n 'let { centered-moving-mad } = import(\"vector\");\\ncentered-moving-mad([1, 2, 3, 4, 5], 5)',\n ],\n seeAlso: ['vector.mad', 'vector.moving-mad', 'vector.running-mad'],\n },\n 'running-mad': {\n category: 'vector',\n description: 'Returns the **running mean absolute deviation** of the `vector`.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **running mean absolute deviation** of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { running-mad } = import(\"vector\");\\nrunning-mad([1, 2, 3])',\n 'let { running-mad } = import(\"vector\");\\nrunning-mad([1, 2, -3])',\n ],\n seeAlso: ['vector.mad', 'vector.moving-mad', 'vector.centered-moving-mad'],\n },\n 'medad': {\n category: 'vector',\n description: 'Returns the **median absolute deviation** of all elements in the `vector`.',\n returns: {\n type: 'number',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **median absolute deviation** of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { medad } = import(\"vector\");\\nmedad([1, 2, 3])',\n 'let { medad } = import(\"vector\");\\nmedad([1, 2, -3])',\n ],\n seeAlso: ['vector.moving-medad', 'vector.centered-moving-medad', 'vector.running-medad', 'vector.mad', 'vector.median', 'vector.iqr'],\n },\n 'moving-medad': {\n category: 'vector',\n description: 'Returns the **moving median absolute deviation** of the `vector` with a given window size.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **moving median absolute deviation** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n ],\n examples: [\n 'let { moving-medad } = import(\"vector\");\\nmoving-medad([1, 2, 3, 4, 5], 3)',\n 'let { moving-medad } = import(\"vector\");\\nmoving-medad([1, 2, 3, 4, 5], 5)',\n ],\n seeAlso: ['vector.medad', 'vector.centered-moving-medad', 'vector.running-medad'],\n },\n 'centered-moving-medad': {\n category: 'vector',\n description: 'Returns the **centered moving median absolute deviation** of the `vector` with a given window size.',\n returns: {\n type: 'array',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **centered moving median absolute deviation** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n leftPadding: {\n type: 'number',\n description: 'Optional value to use for padding. Default is `null`.',\n },\n rightPadding: {\n type: 'number',\n description: 'Optional value to use for right padding. Default is `null`.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n 'rightPadding',\n ],\n },\n ],\n examples: [\n 'let { centered-moving-medad } = import(\"vector\");\\ncentered-moving-medad([1, 2, 3, 4, 5], 3)',\n 'let { centered-moving-medad } = import(\"vector\");\\ncentered-moving-medad([1, 2, 3, 4, 5], 5)',\n ],\n seeAlso: ['vector.medad', 'vector.moving-medad', 'vector.running-medad'],\n },\n 'running-medad': {\n category: 'vector',\n description: 'Returns the **running median absolute deviation** of the `vector`.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **running median absolute deviation** of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { running-medad } = import(\"vector\");\\nrunning-medad([1, 2, 3])',\n 'let { running-medad } = import(\"vector\");\\nrunning-medad([1, 2, -3])',\n ],\n seeAlso: ['vector.medad', 'vector.moving-medad', 'vector.centered-moving-medad'],\n },\n 'gini-coefficient': {\n category: 'vector',\n description: 'Returns the **gini coefficient** of all elements in the `vector`.',\n returns: {\n type: 'number',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **gini coefficient** of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { gini-coefficient } = import(\"vector\");\\ngini-coefficient([1, 2, 3])',\n 'let { gini-coefficient } = import(\"vector\");\\ngini-coefficient([1, 1, 3])',\n ],\n seeAlso: ['vector.moving-gini-coefficient', 'vector.centered-moving-gini-coefficient', 'vector.running-gini-coefficient', 'vector.entropy'],\n },\n 'moving-gini-coefficient': {\n category: 'vector',\n description: 'Returns the **moving gini coefficient** of the `vector` with a given window size.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **moving gini coefficient** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n ],\n examples: [\n 'let { moving-gini-coefficient } = import(\"vector\");\\nmoving-gini-coefficient([1, 2, 3], 2)',\n 'let { moving-gini-coefficient } = import(\"vector\");\\nmoving-gini-coefficient([1, 1, 3], 2)',\n ],\n seeAlso: ['vector.gini-coefficient', 'vector.centered-moving-gini-coefficient', 'vector.running-gini-coefficient'],\n },\n 'centered-moving-gini-coefficient': {\n category: 'vector',\n description: 'Returns the **centered moving gini coefficient** of the `vector` with a given window size.',\n returns: {\n type: 'array',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **centered moving gini coefficient** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n leftPadding: {\n type: 'number',\n description: 'Optional value to use for padding. Default is `null`.',\n },\n rightPadding: {\n type: 'number',\n description: 'Optional value to use for right padding. Default is `null`.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n 'rightPadding',\n ],\n },\n ],\n examples: [\n 'let { centered-moving-gini-coefficient } = import(\"vector\");\\ncentered-moving-gini-coefficient([1, 2, 3], 2)',\n 'let { centered-moving-gini-coefficient } = import(\"vector\");\\ncentered-moving-gini-coefficient([1, 1, 3], 2)',\n ],\n seeAlso: ['vector.gini-coefficient', 'vector.moving-gini-coefficient', 'vector.running-gini-coefficient'],\n },\n 'running-gini-coefficient': {\n category: 'vector',\n description: 'Returns the **running gini coefficient** of the `vector`.',\n returns: {\n type: 'array',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **running gini coefficient** of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { running-gini-coefficient } = import(\"vector\");\\nrunning-gini-coefficient([1, 2, 3])',\n 'let { running-gini-coefficient } = import(\"vector\");\\nrunning-gini-coefficient([1, 1, 3])',\n ],\n seeAlso: ['vector.gini-coefficient', 'vector.moving-gini-coefficient', 'vector.centered-moving-gini-coefficient'],\n },\n 'entropy': {\n category: 'vector',\n description: 'Calculates the **entropy** of a `vector`. The entropy is a measure of the uncertainty associated with a random variable.',\n returns: {\n type: 'number',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **entropy** of. Minimum length is 1.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { entropy } = import(\"vector\");\\nentropy([1, 1, 2, 3, 3, 3])',\n 'let { entropy } = import(\"vector\");\\nentropy([1, 2, 3])',\n 'let { entropy } = import(\"vector\");\\nentropy([1, 2, 2, 3])',\n 'let { entropy } = import(\"vector\");\\nentropy([0])',\n 'let { entropy } = import(\"vector\");\\nentropy([1])',\n 'let { entropy } = import(\"vector\");\\nentropy([1, 2])',\n ],\n seeAlso: ['vector.moving-entropy', 'vector.centered-moving-entropy', 'vector.running-entropy', 'vector.gini-coefficient'],\n },\n 'moving-entropy': {\n category: 'vector',\n description: 'Calculates the **moving entropy** of a `vector` with a given window size.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **moving entropy** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n ],\n examples: [\n 'let { moving-entropy } = import(\"vector\");\\nmoving-entropy([1, 1, 2, 3, 3, 3], 4)',\n 'let { moving-entropy } = import(\"vector\");\\nmoving-entropy([1, 1, 2, 3, 3, 3], 3)',\n 'let { moving-entropy } = import(\"vector\");\\nmoving-entropy([1, 2], 2)',\n ],\n seeAlso: ['vector.entropy', 'vector.centered-moving-entropy', 'vector.running-entropy'],\n },\n 'centered-moving-entropy': {\n category: 'vector',\n description: 'Calculates the **centered moving entropy** of a `vector` with a given window size.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **centered moving entropy** of.',\n },\n windowSize: {\n type: 'integer',\n description: 'The size of the moving window.',\n },\n leftPadding: {\n type: 'number',\n description: 'Optional value to use for padding. Default is `null`.',\n },\n rightPadding: {\n type: 'number',\n description: 'Optional value to use for right padding. Default is `null`.',\n },\n a: {\n type: 'vector',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'windowSize',\n 'leftPadding',\n 'rightPadding',\n ],\n },\n ],\n examples: [\n 'let { centered-moving-entropy } = import(\"vector\");\\ncentered-moving-entropy([1, 1, 2, 3, 3, 3], 4)',\n 'let { centered-moving-entropy } = import(\"vector\");\\ncentered-moving-entropy([1, 1, 2, 3, 3, 3], 3)',\n 'let { centered-moving-entropy } = import(\"vector\");\\ncentered-moving-entropy([1, 2], 2)',\n ],\n seeAlso: ['vector.entropy', 'vector.moving-entropy', 'vector.running-entropy'],\n },\n 'running-entropy': {\n category: 'vector',\n description: 'Calculates the **running entropy** of a `vector`.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to calculate the **running entropy** of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { running-entropy } = import(\"vector\");\\nrunning-entropy([1, 1, 2, 3, 3, 3])',\n 'let { running-entropy } = import(\"vector\");\\nrunning-entropy([1, 2])',\n ],\n seeAlso: ['vector.entropy', 'vector.moving-entropy', 'vector.centered-moving-entropy'],\n },\n 'monotonic?': {\n category: 'vector',\n description: 'Checks if a vector is monotonic.',\n returns: {\n type: 'boolean',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The vector to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { monotonic? } = import(\"vector\");\\nmonotonic?([1, 2, 3])',\n 'let { monotonic? } = import(\"vector\");\\nmonotonic?([1, 2, 2, 3])',\n 'let { monotonic? } = import(\"vector\");\\nmonotonic?([3, 2, 1])',\n 'let { monotonic? } = import(\"vector\");\\nmonotonic?([3, 2, 1, 1])',\n 'let { monotonic? } = import(\"vector\");\\nmonotonic?([3, 2, 1, 2])',\n 'let { monotonic? } = import(\"vector\");\\nmonotonic?([1])',\n 'let { monotonic? } = import(\"vector\");\\nmonotonic?([])',\n ],\n seeAlso: ['vector.strictly-monotonic?', 'vector.increasing?', 'vector.decreasing?'],\n },\n 'strictly-monotonic?': {\n category: 'vector',\n description: 'Checks if a vector is strictly monotonic.',\n returns: {\n type: 'boolean',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The vector to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { strictly-monotonic? } = import(\"vector\");\\nstrictly-monotonic?([1, 2, 3])',\n 'let { strictly-monotonic? } = import(\"vector\");\\nstrictly-monotonic?([1, 2, 2, 3])',\n 'let { strictly-monotonic? } = import(\"vector\");\\nstrictly-monotonic?([3, 2, 1])',\n 'let { strictly-monotonic? } = import(\"vector\");\\nstrictly-monotonic?([3, 2, 1, 1])',\n 'let { strictly-monotonic? } = import(\"vector\");\\nstrictly-monotonic?([3, 2, 1, 2])',\n 'let { strictly-monotonic? } = import(\"vector\");\\nstrictly-monotonic?([1])',\n 'let { strictly-monotonic? } = import(\"vector\");\\nstrictly-monotonic?([])',\n ],\n seeAlso: ['vector.monotonic?', 'vector.strictly-increasing?', 'vector.strictly-decreasing?'],\n },\n 'increasing?': {\n category: 'vector',\n description: 'Checks if a vector is increasing.',\n returns: {\n type: 'boolean',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The vector to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { increasing? } = import(\"vector\");\\nincreasing?([1, 2, 3])',\n 'let { increasing? } = import(\"vector\");\\nincreasing?([1, 2, 2, 3])',\n 'let { increasing? } = import(\"vector\");\\nincreasing?([3, 2, 1])',\n 'let { increasing? } = import(\"vector\");\\nincreasing?([3, 2, 1, 1])',\n 'let { increasing? } = import(\"vector\");\\nincreasing?([3, 2, 1, 2])',\n 'let { increasing? } = import(\"vector\");\\nincreasing?([1])',\n 'let { increasing? } = import(\"vector\");\\nincreasing?([])',\n ],\n seeAlso: ['vector.strictly-increasing?', 'vector.decreasing?', 'vector.strictly-decreasing?', 'vector.monotonic?'],\n },\n 'decreasing?': {\n category: 'vector',\n description: 'Checks if a vector is decreasing.',\n returns: {\n type: 'boolean',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The vector to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { decreasing? } = import(\"vector\");\\ndecreasing?([1, 2, 3])',\n 'let { decreasing? } = import(\"vector\");\\ndecreasing?([1, 2, 2, 3])',\n 'let { decreasing? } = import(\"vector\");\\ndecreasing?([3, 2, 1])',\n 'let { decreasing? } = import(\"vector\");\\ndecreasing?([3, 2, 1, 1])',\n 'let { decreasing? } = import(\"vector\");\\ndecreasing?([3, 2, 1, 2])',\n 'let { decreasing? } = import(\"vector\");\\ndecreasing?([1])',\n 'let { decreasing? } = import(\"vector\");\\ndecreasing?([])',\n ],\n seeAlso: ['vector.strictly-decreasing?', 'vector.increasing?', 'vector.strictly-increasing?', 'vector.monotonic?'],\n },\n 'strictly-increasing?': {\n category: 'vector',\n description: 'Checks if a vector is strictly increasing.',\n returns: {\n type: 'boolean',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The vector to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { strictly-increasing? } = import(\"vector\");\\nstrictly-increasing?([1, 2, 3])',\n 'let { strictly-increasing? } = import(\"vector\");\\nstrictly-increasing?([1, 2, 2, 3])',\n 'let { strictly-increasing? } = import(\"vector\");\\nstrictly-increasing?([3, 2, 1])',\n 'let { strictly-increasing? } = import(\"vector\");\\nstrictly-increasing?([3, 2, 1, 1])',\n 'let { strictly-increasing? } = import(\"vector\");\\nstrictly-increasing?([3, 2, 1, 2])',\n 'let { strictly-increasing? } = import(\"vector\");\\nstrictly-increasing?([1])',\n 'let { strictly-increasing? } = import(\"vector\");\\nstrictly-increasing?([])',\n ],\n seeAlso: ['vector.increasing?', 'vector.decreasing?', 'vector.strictly-decreasing?', 'vector.strictly-monotonic?'],\n },\n 'strictly-decreasing?': {\n category: 'vector',\n description: 'Checks if a vector is strictly decreasing.',\n returns: {\n type: 'boolean',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The vector to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { strictly-decreasing? } = import(\"vector\");\\nstrictly-decreasing?([1, 2, 3])',\n 'let { strictly-decreasing? } = import(\"vector\");\\nstrictly-decreasing?([1, 2, 2, 3])',\n 'let { strictly-decreasing? } = import(\"vector\");\\nstrictly-decreasing?([3, 2, 1])',\n 'let { strictly-decreasing? } = import(\"vector\");\\nstrictly-decreasing?([3, 2, 1, 1])',\n 'let { strictly-decreasing? } = import(\"vector\");\\nstrictly-decreasing?([3, 2, 1, 2])',\n 'let { strictly-decreasing? } = import(\"vector\");\\nstrictly-decreasing?([1])',\n 'let { strictly-decreasing? } = import(\"vector\");\\nstrictly-decreasing?([])',\n ],\n seeAlso: ['vector.increasing?', 'vector.strictly-increasing?', 'vector.decreasing?', 'vector.strictly-monotonic?'],\n },\n 'mode': {\n category: 'vector',\n description: 'Returns the mode of all elements in the vector.',\n returns: {\n type: 'number',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The vector to calculate the mode of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { mode } = import(\"vector\");\\nmode([1, 2, 3])',\n 'let { mode } = import(\"vector\");\\nmode([1, 2, -3, 1])',\n 'let { mode } = import(\"vector\");\\nmode([2, 2, 3, 3, 4])',\n 'let { mode } = import(\"vector\");\\nmode([2, 2, 3, 3])',\n 'let { mode } = import(\"vector\");\\nmode([1, 2, 3, 2, 1, 2])',\n ],\n seeAlso: ['vector.mean', 'vector.median'],\n },\n 'min-index': {\n category: 'vector',\n description: 'Returns the index of the minimum value of all elements in the vector.',\n returns: {\n type: 'integer',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'Non emtpy vector to calculate the minimum index of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { min-index } = import(\"vector\");\\nmin-index([1, 2, 3])',\n 'let { min-index } = import(\"vector\");\\nmin-index([1, 1, 2, 3, 3])',\n 'let { min-index } = import(\"vector\");\\nmin-index([1, 2, -3])',\n 'let { min-index } = import(\"vector\");\\nmin-index([1, 2, 3, 4])',\n 'let { min-index } = import(\"vector\");\\nmin-index([1, 2, -3, 4])',\n ],\n seeAlso: ['vector.max-index', 'min'],\n },\n 'max-index': {\n category: 'vector',\n description: 'Returns the index of the maximum value of all elements in the vector.',\n returns: {\n type: 'integer',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'Non emtpy vector to calculate the maximum index of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { max-index } = import(\"vector\");\\nmax-index([1, 2, 3])',\n 'let { max-index } = import(\"vector\");\\nmax-index([1, 1, 2, 3, 3])',\n 'let { max-index } = import(\"vector\");\\nmax-index([1, 2, -3])',\n 'let { max-index } = import(\"vector\");\\nmax-index([1, 2, 3, 4])',\n 'let { max-index } = import(\"vector\");\\nmax-index([1, 2, -3, 4])',\n ],\n seeAlso: ['vector.min-index', 'max'],\n },\n 'sort-indices': {\n category: 'vector',\n description: 'Returns the indices of the elements in the vector sorted in ascending order.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'Non emtpy vector to calculate the sorted indices of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { sort-indices } = import(\"vector\");\\nsort-indices([1, 2, 3])',\n 'let { sort-indices } = import(\"vector\");\\nsort-indices([1, 1, 2, 3, 3])',\n 'let { sort-indices } = import(\"vector\");\\nsort-indices([1, 2, -3])',\n 'let { sort-indices } = import(\"vector\");\\nsort-indices([1, 2, 3, 4])',\n 'let { sort-indices } = import(\"vector\");\\nsort-indices([1, 2, -3, 4])',\n ],\n seeAlso: ['sort'],\n },\n 'count-values': {\n category: 'vector',\n description: 'Counts the number of occurrences of each value in the vector.',\n returns: {\n type: 'number',\n array: true,\n },\n args: {\n vector: {\n type: 'vector',\n description: 'Vector to count the values of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { count-values } = import(\"vector\");\\ncount-values([1, 2, 3])',\n 'let { count-values } = import(\"vector\");\\ncount-values([1, 1, 2, 3, 3])',\n 'let { count-values } = import(\"vector\");\\ncount-values([1, 2, -3])',\n 'let { count-values } = import(\"vector\");\\ncount-values([1, 2, 2, 1, 3, 2, 4, 2, 1, 2, 2, 1, 3, 2, 4])',\n ],\n seeAlso: ['sequence.frequencies', 'vector.bincount'],\n },\n 'linspace': {\n category: 'vector',\n description: 'Generates a vector of evenly spaced numbers between two values.',\n returns: {\n type: 'number',\n array: true,\n },\n args: {\n start: {\n type: 'number',\n description: 'The starting value.',\n },\n stop: {\n type: 'number',\n description: 'The ending value.',\n },\n n: {\n type: 'integer',\n description: 'The number of values to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n 'stop',\n 'n',\n ],\n },\n ],\n examples: [\n 'let { linspace } = import(\"vector\");\\nlinspace(0, 10, 6)',\n 'let { linspace } = import(\"vector\");\\nlinspace(10, 20, 25)',\n ],\n seeAlso: [\n 'range',\n 'vector.ones',\n 'vector.zeros',\n 'vector.fill',\n 'vector.generate',\n ],\n },\n 'ones': {\n category: 'vector',\n description: 'Generates a vector of ones.',\n returns: {\n type: 'number',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the vector.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { ones } = import(\"vector\");\\nones(5)',\n 'let { ones } = import(\"vector\");\\nones(10)',\n 'let { ones } = import(\"vector\");\\nones(0)',\n ],\n seeAlso: [\n 'repeat',\n 'vector.zeros',\n 'vector.fill',\n 'vector.generate',\n 'vector.linspace',\n ],\n },\n 'zeros': {\n category: 'vector',\n description: 'Generates a vector of zeros.',\n returns: {\n type: 'number',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the vector.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { zeros } = import(\"vector\");\\nzeros(5)',\n 'let { zeros } = import(\"vector\");\\nzeros(10)',\n 'let { zeros } = import(\"vector\");\\nzeros(0)',\n ],\n seeAlso: [\n 'repeat',\n 'vector.ones',\n 'vector.fill',\n 'vector.generate',\n 'vector.linspace',\n ],\n },\n 'fill': {\n category: 'vector',\n description: 'Generates a vector filled with a number.',\n returns: {\n type: 'number',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the vector.',\n },\n value: {\n type: 'number',\n description: 'The value to fill the vector with.',\n },\n a: {\n type: 'number',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n 'value',\n ],\n },\n ],\n examples: [\n 'let { fill } = import(\"vector\");\\nfill(5, PI)',\n 'let { fill } = import(\"vector\");\\nfill(10, -1)',\n ],\n seeAlso: [\n 'repeat',\n 'vector.ones',\n 'vector.zeros',\n 'vector.generate',\n 'vector.linspace',\n 'grid.fill',\n ],\n },\n 'generate': {\n category: 'vector',\n description: 'Generates a vector of numbers based on a function.',\n returns: {\n type: 'number',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the vector.',\n },\n func: {\n type: 'function',\n description: 'A function that takes an index and returns a number.',\n },\n a: {\n type: 'number',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n 'func',\n ],\n },\n ],\n examples: [\n 'let { generate } = import(\"vector\");\\ngenerate(5, -> $ * 2)',\n 'let { generate } = import(\"vector\");\\ngenerate(10, -> $ + 1)',\n 'let { generate } = import(\"vector\");\\ngenerate(0, -> $ + 1)',\n ],\n seeAlso: [\n 'repeat',\n 'vector.ones',\n 'vector.zeros',\n 'vector.fill',\n 'vector.linspace',\n 'grid.generate',\n ],\n },\n 'cumsum': {\n category: 'vector',\n description: 'Calculates the cumulative sum of a vector.',\n returns: {\n type: 'number',\n array: true,\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The vector to calculate the cumulative sum of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { cumsum } = import(\"vector\");\\ncumsum([1, 2, 3])',\n 'let { cumsum } = import(\"vector\");\\ncumsum([1, 2, -3])',\n 'let { cumsum } = import(\"vector\");\\ncumsum([])',\n ],\n seeAlso: ['vector.cumprod', 'vector.sum', 'vector.running-sum'],\n },\n 'cumprod': {\n category: 'vector',\n description: 'Calculates the cumulative product of a vector.',\n returns: {\n type: 'number',\n array: true,\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The vector to calculate the cumulative product of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { cumprod } = import(\"vector\");\\ncumprod([1, 2, 3])',\n 'let { cumprod } = import(\"vector\");\\ncumprod([1, 2, -3, 0, 10])',\n 'let { cumprod } = import(\"vector\");\\ncumprod([])',\n ],\n seeAlso: ['vector.cumsum', 'vector.prod', 'vector.running-prod'],\n },\n 'quartiles': {\n category: 'vector',\n description: 'Calculates the quartiles of a vector. Returns an array containing the first, second (median), and third quartiles.',\n returns: {\n type: 'number',\n array: true,\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The vector to calculate the quartiles of. Minimum length is 4.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { quartiles } = import(\"vector\");\\nquartiles([1, 2, 3, 4])',\n 'let { quartiles } = import(\"vector\");\\nquartiles([5, 4, 3, 2, 1, 2, 3, 4, 5])',\n 'let { quartiles } = import(\"vector\");\\nquartiles(range(1, 1000))',\n 'let { quartiles, generate } = import(\"vector\");\\nquartiles(generate(1000, -> 1e6 / ($ + 1) ^ 2))',\n 'let { quartiles, generate } = import(\"vector\");\\nlet { ln } = import(\"math\");\\nquartiles(generate(1000, -> ln($ + 1)))',\n ],\n seeAlso: ['vector.percentile', 'vector.quantile', 'vector.median', 'vector.iqr'],\n },\n 'percentile': {\n category: 'vector',\n description: 'Calculates the percentile of a vector. Returns the value at the specified percentile.',\n returns: {\n type: 'number',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The non empty vector to calculate the percentile of.',\n },\n percentile: {\n type: 'number',\n description: 'The percentile to calculate. Must be between 0 and 1.',\n },\n a: {\n type: 'number',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'percentile',\n ],\n },\n ],\n examples: [\n 'let { percentile } = import(\"vector\");\\npercentile([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 35)',\n 'let { percentile } = import(\"vector\");\\npercentile(range(100) ^ 0.5, 0)',\n 'let { percentile } = import(\"vector\");\\npercentile(range(100) ^ 0.5, 10)',\n 'let { percentile } = import(\"vector\");\\npercentile(range(100) ^ 0.5, 20)',\n 'let { percentile } = import(\"vector\");\\npercentile(range(100) ^ 0.5, 30)',\n 'let { percentile } = import(\"vector\");\\npercentile(range(100) ^ 0.5, 40)',\n 'let { percentile } = import(\"vector\");\\npercentile(range(100) ^ 0.5, 50)',\n 'let { percentile } = import(\"vector\");\\npercentile(range(100) ^ 0.5, 60)',\n 'let { percentile } = import(\"vector\");\\npercentile(range(100) ^ 0.5, 70)',\n 'let { percentile } = import(\"vector\");\\npercentile(range(100) ^ 0.5, 80)',\n 'let { percentile } = import(\"vector\");\\npercentile(range(100) ^ 0.5, 90)',\n 'let { percentile } = import(\"vector\");\\npercentile(range(100) ^ 0.5, 100)',\n ],\n seeAlso: ['vector.quantile', 'vector.quartiles', 'vector.median', 'vector.ecdf', 'vector.winsorize'],\n },\n 'quantile': {\n category: 'vector',\n description: 'Calculates the quantile of a vector. Returns the value at the specified quantile.',\n returns: {\n type: 'number',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The non empty vector to calculate the quantile of.',\n },\n quantile: {\n type: 'number',\n description: 'The quantile to calculate. Must be between 0 and 1.',\n },\n a: {\n type: 'number',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'quantile',\n ],\n },\n ],\n examples: [\n 'let { quantile } = import(\"vector\");\\nquantile([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 0.35)',\n 'let { quantile } = import(\"vector\");\\nquantile(range(100) ^ 0.5, 0)',\n 'let { quantile } = import(\"vector\");\\nquantile(range(100) ^ 0.5, 0.1)',\n 'let { quantile } = import(\"vector\");\\nquantile(range(100) ^ 0.5, 0.2)',\n 'let { quantile } = import(\"vector\");\\nquantile(range(100) ^ 0.5, 0.3)',\n 'let { quantile } = import(\"vector\");\\nquantile(range(100) ^ 0.5, 0.4)',\n 'let { quantile } = import(\"vector\");\\nquantile(range(100) ^ 0.5, 0.5)',\n 'let { quantile } = import(\"vector\");\\nquantile(range(100) ^ 0.5, 0.6)',\n 'let { quantile } = import(\"vector\");\\nquantile(range(100) ^ 0.5, 0.7)',\n 'let { quantile } = import(\"vector\");\\nquantile(range(100) ^ 0.5, 0.8)',\n 'let { quantile } = import(\"vector\");\\nquantile(range(100) ^ 0.5, 0.9)',\n 'let { quantile } = import(\"vector\");\\nquantile(range(100) ^ 0.5, 1)',\n ],\n seeAlso: ['vector.percentile', 'vector.quartiles', 'vector.ecdf'],\n },\n 'histogram': {\n category: 'vector',\n description: 'Creates a histogram from a numeric `array` by dividing the data range into the specified number of bins. Returns an `array` of `[binStart, binEnd, count]` tuples representing each bin\\'s range and the number of values within it. Handles empty arrays, identical values, and properly places maximum values in the last bin.',\n returns: {\n type: 'array',\n array: true,\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The numeric array to create a histogram from.',\n },\n bins: {\n type: 'integer',\n description: 'The number of bins to divide the data range into.',\n },\n a: {\n type: 'number',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'bins',\n ],\n },\n ],\n examples: [\n 'let { histogram } = import(\"vector\");\\nhistogram([1, 2, 2, 3, 2, 6, 4, 3, 2, 4, 1, 3, 2, 9], 3)',\n 'let { histogram } = import(\"vector\");\\nhistogram([1, 2, 3, 4, 5], 5)',\n 'let { histogram } = import(\"vector\");\\nhistogram([1, 2, 3, 4, 5], 10)',\n 'let { histogram } = import(\"vector\");\\nhistogram([1, 2, 3, 4, 5], 1)',\n ],\n seeAlso: ['vector.bincount', 'vector.ecdf'],\n },\n 'ecdf': {\n category: 'vector',\n description: 'Calculates the empirical cumulative distribution function value for a given threshold in a non empty dataset. Returns the proportion of values in the `array` that are less than or equal to the specified threshold.',\n returns: {\n type: 'number',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The numeric array to calculate the ECDF from.',\n },\n threshold: {\n type: 'number',\n description: 'The threshold value to calculate the ECDF for.',\n },\n a: {\n type: 'number',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'threshold',\n ],\n },\n ],\n examples: [\n 'let { ecdf } = import(\"vector\");\\necdf([1, 2, 2, 3, 2, 6, 4, 3, 2, 4, 1, 3, 2, 9, 10, 12], 5)',\n 'let { ecdf } = import(\"vector\");\\necdf([1, 2, 3, 4, 5], 3)',\n 'let { ecdf } = import(\"vector\");\\necdf([1, 2, 3, 4, 5], 0)',\n 'let { ecdf } = import(\"vector\");\\necdf([1, 2, 3, 4, 5], 10)',\n 'let { ecdf } = import(\"vector\");\\necdf([1, 2, 3, 4, 5], 2)',\n ],\n seeAlso: ['vector.histogram', 'vector.percentile', 'vector.quantile'],\n },\n 'outliers?': {\n category: 'vector',\n description: 'Checks if the `vector` contains outliers based on the interquartile range (IQR) method. Returns `true` if outliers are present, `false` otherwise.',\n returns: {\n type: 'boolean',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to check for outliers.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { outliers? } = import(\"vector\");\\noutliers?([1, 2, 3])',\n 'let { outliers? } = import(\"vector\");\\noutliers?([1, 2, -3])',\n 'let { outliers? } = import(\"vector\");\\noutliers?([1, 2, 3, 2, 4, 120])',\n ],\n seeAlso: ['vector.outliers', 'vector.winsorize', 'vector.iqr'],\n },\n 'outliers': {\n category: 'vector',\n description: 'Identifies outliers in the `vector` based on the interquartile range (IQR) method. Returns an array of outlier values.',\n returns: {\n type: 'number',\n array: true,\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The `vector` to check for outliers.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { outliers } = import(\"vector\");\\noutliers([1, 2, 3])',\n 'let { outliers } = import(\"vector\");\\noutliers([1, 2, -3])',\n 'let { outliers } = import(\"vector\");\\noutliers([1, 2, 3, 2, 4, 120])',\n ],\n seeAlso: ['vector.outliers?', 'vector.winsorize', 'vector.iqr'],\n },\n 'bincount': {\n category: 'vector',\n description: 'counts occurrences of each `integer` in a vector, returning an array where index `i` contains the count of value `i`, with optional **minimum size** and **weights parameters**.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'The vector to count occurrences in.',\n },\n minSize: {\n type: 'integer',\n description: 'Optional minimum size of the output array.',\n },\n weights: {\n type: 'number',\n array: true,\n description: 'Optional weights for each element in the vector.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'minSize',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'minSize',\n 'weights',\n ],\n },\n ],\n examples: [\n 'let { bincount } = import(\"vector\");\\nbincount([1, 2, 3])',\n 'let { bincount } = import(\"vector\");\\nbincount([1, 2, 2, 3, 3])',\n ],\n seeAlso: ['vector.count-values', 'vector.histogram'],\n hideOperatorForm: true,\n },\n 'winsorize': {\n category: 'vector',\n description: 'Limits extreme values in a `vector` by replacing values below the **lower quantile** and above the **upper quantile** with the values at those quantiles. The function takes a `vector` of values and **quantile thresholds** (between 0 and 1), with the upper quantile. Winsorization reduces the influence of outliers while preserving the overall distribution shape, making statistical analyses more robust.',\n returns: {\n type: 'vector',\n },\n args: {\n 'vector': {\n type: 'vector',\n description: 'The vector to winsorize.',\n },\n 'lower-quantile': {\n type: 'number',\n description: 'The lower quantile threshold (between 0 and 1).',\n },\n 'upper-quantile': {\n type: 'number',\n description: 'Optional Upper quantile threshold (between 0 and 1). Defaults to `(1 - lower-quantile)` if `lower-quantile <= 0.5` otherwise `1`.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'lower-quantile',\n ],\n },\n {\n argumentNames: [\n 'vector',\n 'lower-quantile',\n 'upper-quantile',\n ],\n },\n ],\n examples: [\n 'let { winsorize } = import(\"vector\");\\nwinsorize([2, 5, 8, 10, 15, 18, 20, 35, 60, 100], 0.25)',\n 'let { winsorize } = import(\"vector\");\\nwinsorize([2, 5, 8, 10, 15, 18, 20, 35, 60, 100], 0.25, 0.75)',\n 'let { winsorize } = import(\"vector\");\\nwinsorize([2, 5, 8, 10, 15, 18, 20, 35, 60, 100], 0.25, 0.5)',\n ],\n seeAlso: ['vector.outliers', 'vector.outliers?', 'vector.percentile'],\n hideOperatorForm: true,\n },\n 'mse': {\n category: 'vector',\n description: 'Calculates the **Mean Squared Error (MSE)** between two vectors. Returns the average of the squared differences between corresponding elements.',\n returns: {\n type: 'number',\n },\n args: {\n a: {\n type: 'vector',\n description: 'The first vector.',\n },\n b: {\n type: 'vector',\n description: 'The second vector.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { mse } = import(\"vector\");\\nmse([1, 2, 3], [1, 2, 3])',\n 'let { mse } = import(\"vector\");\\nmse([1, 2, 3], [4, 5, 6])',\n 'let { mse } = import(\"vector\");\\nmse([1, 2, 3], [2, 2, 2])',\n 'let { mse } = import(\"vector\");\\nmse([1, 2], [3, 3])',\n 'let { mse } = import(\"vector\");\\nmse([1], [3])',\n ],\n seeAlso: ['vector.rmse', 'vector.mae', 'vector.smape'],\n },\n 'rmse': {\n category: 'vector',\n description: 'Calculates the **Root Mean Squared Error (RMSE)** between two vectors. Returns the square root of the average of the squared differences between corresponding elements.',\n returns: {\n type: 'number',\n },\n args: {\n a: {\n type: 'vector',\n description: 'The first vector.',\n },\n b: {\n type: 'vector',\n description: 'The second vector.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { rmse } = import(\"vector\");\\nrmse([1, 2, 3], [1, 2, 3])',\n 'let { rmse } = import(\"vector\");\\nrmse([1, 2, 3], [4, 5, 6])',\n 'let { rmse } = import(\"vector\");\\nrmse([1, 2, 3], [2, 2, 2])',\n 'let { rmse } = import(\"vector\");\\nrmse([1, 2], [3, 3])',\n 'let { rmse } = import(\"vector\");\\nrmse([1], [3])',\n ],\n seeAlso: ['vector.mse', 'vector.mae', 'vector.smape'],\n },\n 'mae': {\n category: 'vector',\n description: 'Calculates the **Mean Absolute Error (MAE)** between two vectors. Returns the average of the absolute differences between corresponding elements.',\n returns: {\n type: 'number',\n },\n args: {\n a: {\n type: 'vector',\n description: 'The first vector.',\n },\n b: {\n type: 'vector',\n description: 'The second vector.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { mae } = import(\"vector\");\\nmae([1, 2, 3], [1, 2, 3])',\n 'let { mae } = import(\"vector\");\\nmae([1, 2, 3], [4, 5, 6])',\n 'let { mae } = import(\"vector\");\\nmae([1, 2, 3], [2, 2, 2])',\n 'let { mae } = import(\"vector\");\\nmae([1, 2], [3, 3])',\n 'let { mae } = import(\"vector\");\\nmae([1], [3])',\n ],\n seeAlso: ['vector.mse', 'vector.rmse', 'vector.smape'],\n },\n 'smape': {\n category: 'vector',\n description: 'Calculates the **Symmetric Mean Absolute Percentage Error (SMAPE)** between two vectors. Returns the average of the absolute percentage differences between corresponding elements.',\n returns: {\n type: 'number',\n },\n args: {\n a: {\n type: 'vector',\n description: 'The first vector.',\n },\n b: {\n type: 'vector',\n description: 'The second vector.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { smape } = import(\"vector\");\\nsmape([1, 2, 3], [1, 2, 3])',\n 'let { smape } = import(\"vector\");\\nsmape([1, 2, 3], [4, 5, 6])',\n 'let { smape } = import(\"vector\");\\nsmape([1, 2, 3], [2, 2, 2])',\n 'let { smape } = import(\"vector\");\\nsmape([1, 2], [3, 3])',\n 'let { smape } = import(\"vector\");\\nsmape([1], [3])',\n ],\n seeAlso: ['vector.mse', 'vector.rmse', 'vector.mae'],\n },\n}\n","/**\n * Checks if a vector has no extreme outliers using the IQR method\n * @param vector An array of numbers to check for extreme outliers\n * @returns true if there are no extreme outliers, false otherwise\n */\nexport function hasOutliers(vector: number[]): boolean {\n return outliers(vector).length > 0\n}\n\nexport function outliers(vector: number[]): number[] {\n // Handle edge cases\n if (vector.length <= 1)\n return []\n\n // Sort the vector to calculate quartiles\n const sorted = [...vector].sort((a, b) => a - b)\n\n // Calculate Q1 (25th percentile)\n const q1Index = Math.floor(sorted.length * 0.25)\n const q1 = sorted.length % 4 === 0\n ? (sorted[q1Index - 1]! + sorted[q1Index]!) / 2\n : sorted[q1Index]!\n\n // Calculate Q3 (75th percentile)\n const q3Index = Math.floor(sorted.length * 0.75)\n const q3 = sorted.length % 4 === 0\n ? (sorted[q3Index - 1]! + sorted[q3Index]!) / 2\n : sorted[q3Index]!\n\n // Calculate IQR (Interquartile Range)\n const iqr = q3 - q1\n\n // Define bounds for outliers (using 1.5*IQR for mild outliers and 3*IQR for extreme outliers)\n const lowerBound = q1 - iqr * 1.5\n const upperBound = q3 + iqr * 1.5\n\n // Filter the vector to find outliers\n return vector.filter(val => val < lowerBound || val > upperBound)\n}\n","/**\n * Calculate the percentile value from an array of numbers\n * @param data Array of numbers to calculate percentile from\n * @param percentile The percentile to calculate (0-100)\n * @returns The value at the specified percentile\n */\nexport function calcPercentile(data: number[], percentile: number): number {\n // Sort the data in ascending order\n const sortedData = [...data].sort((a, b) => a - b)\n\n // If percentile is 0, return the minimum value\n if (percentile === 0) {\n return sortedData[0]!\n }\n\n // If percentile is 100, return the maximum value\n if (percentile === 100) {\n return sortedData[sortedData.length - 1]!\n }\n\n // Calculate the index\n const index = (percentile / 100) * (sortedData.length - 1)\n\n // If index is an integer, return the value at that index\n if (Number.isInteger(index)) {\n return sortedData[index]!\n }\n\n // Otherwise, interpolate between the two adjacent values\n const lowerIndex = Math.floor(index)\n const upperIndex = Math.ceil(index)\n const weight = index - lowerIndex\n\n return sortedData[lowerIndex]! * (1 - weight) + sortedData[upperIndex]! * weight\n}\n","export function quartiles(vector: number[]): [number, number, number] {\n const sorted = [...vector].sort((a, b) => a - b)\n\n // Median calculation (Q2)\n const midIndex = sorted.length / 2\n let q2: number\n if (sorted.length % 2 === 0) {\n // Even length - average the two middle values\n q2 = (sorted[midIndex - 1]! + sorted[midIndex]!) / 2\n }\n else {\n // Odd length - take the middle value\n q2 = sorted[Math.floor(midIndex)]!\n }\n\n // Lower half for Q1\n const lowerHalf = sorted.slice(0, Math.floor(sorted.length / 2))\n // Upper half for Q3\n const upperHalf = sorted.slice(Math.ceil(sorted.length / 2))\n\n // Calculate Q1 and Q3 using the same median logic on the halves\n let q1: number, q3: number\n\n if (lowerHalf.length % 2 === 0) {\n const midLower = lowerHalf.length / 2\n q1 = (lowerHalf[midLower - 1]! + lowerHalf[midLower]!) / 2\n }\n else {\n q1 = lowerHalf[Math.floor(lowerHalf.length / 2)]!\n }\n\n if (upperHalf.length % 2 === 0) {\n const midUpper = upperHalf.length / 2\n q3 = (upperHalf[midUpper - 1]! + upperHalf[midUpper]!) / 2\n }\n else {\n q3 = upperHalf[Math.floor(upperHalf.length / 2)]!\n }\n\n return [q1, q2, q3]\n}\n","export function calcMean(vector: number[]): number {\n if (vector.length === 0) {\n return 0\n }\n\n const sum = vector.reduce((acc, val) => acc + val, 0)\n return sum / vector.length\n}\n","import { calcMean } from '../calcMean'\nimport type { ReductionFunctionDefinition } from '.'\n\nexport const meanReductionFunction: ReductionFunctionDefinition<'mean'> = {\n mean: vector => calcMean(vector),\n}\n\nexport const geometricMeanReductionFunction: ReductionFunctionDefinition<'geometric-mean'> = {\n 'geometric-mean': (vector) => {\n if (vector.some(val => val < 0)) {\n throw new Error('Geometric mean is not defined for non-positive numbers')\n }\n return Math.exp(vector.reduce((acc, val) => acc + Math.log(val), 0) / vector.length)\n },\n}\n\nexport const harmonicMeanReductionFunction: ReductionFunctionDefinition<'harmonic-mean'> = {\n 'harmonic-mean': vector => vector.length / vector.reduce((acc, val) => acc + 1 / val, 0),\n}\n","export function calcMedian(vector: number[]): number {\n const sorted = [...vector].sort((a, b) => a - b)\n const mid = Math.floor(sorted.length / 2)\n\n return sorted.length % 2 === 0\n ? (sorted[mid - 1]! + sorted[mid]!) / 2\n : sorted[mid]!\n}\n","import { calcMedian } from '../calcMedian'\nimport type { ReductionFunctionDefinition } from '.'\n\nexport const medianReductionFunction: ReductionFunctionDefinition<'median'> = {\n median: vector => calcMedian(vector),\n}\n","import { calcMean } from './calcMean'\n\nexport function calcVariance(vector: number[], optionalMean?: number): number {\n const mean = optionalMean ?? calcMean(vector)\n return vector.reduce((acc, val) => acc + (val - mean) ** 2, 0) / vector.length\n}\n\nexport function calcSampleVariance(vector: number[], optionalMean?: number): number {\n const mean = optionalMean ?? calcMean(vector)\n return vector.reduce((acc, val) => acc + (val - mean) ** 2, 0) / (vector.length - 1)\n}\n","import { calcSampleVariance, calcVariance } from '../calcVariance'\nimport type { ReductionFunctionDefinition } from '.'\n\nexport const varianceReductionFunction: ReductionFunctionDefinition<'variance'> = {\n variance: vector => calcVariance(vector),\n}\n\nexport const sampleVarianceReductionFunction: ReductionFunctionDefinition<'sample-variance'> = {\n 'sample-variance': vector => calcSampleVariance(vector),\n 'minLength': 2,\n}\n","import { calcVariance } from './calcVariance'\n\nexport function calcStdDev(vector: number[], optionalMean?: number): number {\n const variance = calcVariance(vector, optionalMean)\n return Math.sqrt(variance)\n}\n\nexport function calcSampleStdDev(vector: number[], optionalMean?: number): number {\n const variance = calcVariance(vector, optionalMean)\n return Math.sqrt(variance * (vector.length / (vector.length - 1)))\n}\n","import { calcSampleStdDev, calcStdDev } from '../calcStdDev'\nimport type { ReductionFunctionDefinition } from '.'\n\nexport const stdevReductionFunction: ReductionFunctionDefinition<'stdev'> = {\n stdev: vector => calcStdDev(vector),\n}\n\nexport const sampleStdevReductionFunction: ReductionFunctionDefinition<'sample-stdev'> = {\n 'sample-stdev': vector => calcSampleStdDev(vector),\n 'minLength': 2,\n}\n","import { quartiles } from '../quartiles'\nimport type { ReductionFunctionDefinition } from '.'\n\nexport const iqrReductionFunction: ReductionFunctionDefinition<'iqr'> = {\n iqr: (vector) => {\n const [q1, , q3] = quartiles(vector)\n return q3 - q1\n },\n minLength: 4,\n}\n","import type { ReductionFunctionDefinition } from '.'\n\nexport const spanReductionFunction: ReductionFunctionDefinition<'span'> = {\n span: vector => vector.length === 0 ? 0 : Math.max(...vector) - Math.min(...vector),\n minLength: 0,\n}\n","import { calcMean } from '../calcMean'\nimport { calcStdDev } from '../calcStdDev'\nimport type { ReductionFunctionDefinition } from '.'\n\nfunction skewness(vector: number[]): number {\n const mean = calcMean(vector)\n const stdDev = calcStdDev(vector)\n if (stdDev === 0) {\n throw new Error('Standard deviation is zero, skewness is undefined')\n }\n return vector.reduce((acc, val) => acc + ((val - mean) ** 3), 0) / (vector.length * stdDev ** 3)\n}\n\nfunction sampleSkewness(vector: number[]): number {\n const n = vector.length\n\n // Calculate the mean\n const mean = vector.reduce((acc, val) => acc + val, 0) / n\n\n // Calculate sum of squared differences and sum of cubed differences\n let sumSquaredDiffs = 0\n let sumCubedDiffs = 0\n\n for (const val of vector) {\n const diff = val - mean\n sumSquaredDiffs += diff * diff\n sumCubedDiffs += diff * diff * diff\n }\n\n // Calculate sample standard deviation (using n-1)\n const sampleVariance = sumSquaredDiffs / (n - 1)\n const sampleStdDev = Math.sqrt(sampleVariance)\n\n // If standard deviation is 0, skewness is undefined\n if (sampleStdDev === 0) {\n throw new Error('Cannot calculate sample skewness when standard deviation is 0')\n }\n\n // Calculate sample skewness with Fisher's adjustment\n return (n / ((n - 1) * (n - 2))) * sumCubedDiffs / sampleStdDev ** 3\n}\n\nexport const skewnessReductionFunction: ReductionFunctionDefinition<'skewness'> = {\n skewness: vector => skewness(vector),\n minLength: 3,\n}\n\nexport const sampleSkewnessReductionFunction: ReductionFunctionDefinition<'sample-skewness'> = {\n 'sample-skewness': vector => sampleSkewness(vector),\n 'minLength': 3,\n}\n","import { calcMean } from '../calcMean'\nimport { calcStdDev } from '../calcStdDev'\n\nimport type { ReductionFunctionDefinition } from '.'\n\nfunction kurtosis(vector: number[]): number {\n const mean = calcMean(vector)\n const stdDev = calcStdDev(vector)\n if (stdDev === 0) {\n throw new Error('Standard deviation is zero, kurtosis is undefined')\n }\n return vector.reduce((acc, val) => acc + ((val - mean) ** 4), 0) / (vector.length * stdDev ** 4)\n}\n\nfunction excessKurtosis(vector: number[]): number {\n return kurtosis(vector) - 3\n}\n\n/**\n * Calculates the sample kurtosis (bias-corrected)\n * @param vector Array of numeric values\n * @returns The sample kurtosis\n * @throws Error if sample size is less than 4 or if variance is zero\n */\nfunction sampleKurtosis(vector: number[]): number {\n const n = vector.length\n\n const mean = vector.reduce((sum, val) => sum + val, 0) / n\n const sumSquaredDeviations = vector.reduce((sum, val) => sum + (val - mean) ** 2, 0)\n const variance = sumSquaredDeviations / (n - 1)\n\n if (variance === 0) {\n throw new Error('Variance is zero, kurtosis is undefined')\n }\n\n const fourthMomentSum = vector.reduce((sum, val) => sum + (val - mean) ** 4, 0)\n\n // Correct formula for sample kurtosis\n return (n * (n + 1) * fourthMomentSum) / ((n - 1) * (n - 2) * (n - 3) * variance ** 2)\n}\n/**\n * Calculates the sample excess kurtosis (bias-corrected)\n * @param vector Array of numeric values\n * @returns The sample excess kurtosis\n * @throws Error if sample size is less than 4 or if variance is zero\n */\nfunction sampleExcessKurtosis(vector: number[]): number {\n const n = vector.length\n\n const mean = vector.reduce((sum, val) => sum + val, 0) / n\n const sumSquaredDeviations = vector.reduce((sum, val) => sum + (val - mean) ** 2, 0)\n const variance = sumSquaredDeviations / (n - 1)\n\n if (variance === 0) {\n throw new Error('Variance is zero, kurtosis is undefined')\n }\n\n const fourthMomentSum = vector.reduce((sum, val) => sum + (val - mean) ** 4, 0)\n const rawKurtosis = (n * (n + 1) * fourthMomentSum) / ((n - 1) * (n - 2) * (n - 3) * variance ** 2)\n\n // Compute excess kurtosis by subtracting 3 times the bias correction factor\n return rawKurtosis - (3 * (n - 1) * (n - 1)) / ((n - 2) * (n - 3))\n}\n\nexport const kurtosisReductionFunction: ReductionFunctionDefinition<'kurtosis'> = {\n kurtosis: vector => kurtosis(vector),\n minLength: 4,\n}\n\nexport const eccessKurtosisReductionFunction: ReductionFunctionDefinition<'excess-kurtosis'> = {\n 'excess-kurtosis': vector => excessKurtosis(vector),\n 'minLength': 4,\n}\n\nexport const sampleKurtosisReductionFunction: ReductionFunctionDefinition<'sample-kurtosis'> = {\n 'sample-kurtosis': vector => sampleKurtosis(vector),\n 'minLength': 4,\n}\n\nexport const sampleExcessKurtosisReductionFunction: ReductionFunctionDefinition<'sample-excess-kurtosis'> = {\n 'sample-excess-kurtosis': vector => sampleExcessKurtosis(vector),\n 'minLength': 4,\n}\n","import type { ReductionFunctionDefinition } from '.'\n\nexport const rmsReductionFunction: ReductionFunctionDefinition<'rms'> = {\n rms: vector => Math.sqrt(vector.reduce((acc, val) => acc + val ** 2, 0) / vector.length),\n}\n","import { calcMad } from '../calcMad'\nimport type { ReductionFunctionDefinition } from '.'\n\nexport const madReductionFunction: ReductionFunctionDefinition<'mad'> = {\n mad: vector => calcMad(vector),\n}\n","import { calcMedian } from './calcMedian'\n\nexport function calcMad(vector: number[]): number {\n const median = calcMedian(vector)\n\n // Calculate mean absolute deviation\n return vector.reduce((acc, val) => acc + Math.abs(val - median), 0) / vector.length\n}\n","import { calcMedian } from './calcMedian'\n\nexport function calcMedad(vector: number[]): number {\n const median = calcMedian(vector)\n // Calculate absolute deviations from the median\n const absoluteDeviations = vector.map(val => Math.abs(val - median))\n\n // Calculate the median of the absolute deviations\n const medianOfDeviations = calcMedian(absoluteDeviations)\n const scaleFactor = 1.4826 // Scale factor for robust scaling\n\n return medianOfDeviations * scaleFactor\n}\n","import { calcMedad } from '../calcMedad'\nimport type { ReductionFunctionDefinition } from '.'\n\nexport const medadReductionFunction: ReductionFunctionDefinition<'medad'> = {\n medad: vector => calcMedad(vector),\n}\n","import type { ReductionFunctionDefinition } from '.'\n\nexport const giniCoefficientReductionFunction: ReductionFunctionDefinition<'gini-coefficient'> = {\n 'gini-coefficient': (vector) => {\n if (vector.some(x => x < 0)) {\n throw new Error('Gini coefficient is not defined for negative values')\n }\n const sorted = [...vector].sort((a, b) => a - b)\n const n = sorted.length\n const sum = sorted.reduce((acc, val) => acc + val, 0)\n if (sum === 0) {\n return 0\n }\n const gini = (2 * sorted.reduce((acc, val, i) => acc + (i + 1) * val, 0)) / (n * sum) - (n + 1) / n\n return gini\n },\n 'minLength': 1,\n}\n","import { calculateEntropy } from '../entropy'\nimport type { ReductionFunctionDefinition } from '.'\n\nexport const entropyReductionFunction: ReductionFunctionDefinition<'entropy'> = {\n entropy: vector => calculateEntropy(vector),\n minLength: 1,\n}\n","/**\n * Calculates the Shannon entropy of a vector.\n * Entropy measures the amount of uncertainty or randomness in the data.\n *\n * @param vector - An array of values to calculate entropy for\n * @returns The entropy value (in bits) or 0 for empty arrays\n */\nexport function calculateEntropy<T>(vector: T[]): number {\n // Count occurrences of each value\n const frequencies = new Map<T, number>()\n for (const value of vector) {\n frequencies.set(value, (frequencies.get(value) || 0) + 1)\n }\n\n // Get the total number of elements\n const total = vector.length\n\n // Calculate entropy using Shannon's formula\n let entropy = 0\n for (const frequency of frequencies.values()) {\n const probability = frequency / total\n // Skip cases where probability is 0 (log(0) is undefined)\n if (probability > 0) {\n entropy -= probability * Math.log2(probability)\n }\n }\n\n return entropy\n}\n","import { LitsError } from '../../../../errors'\nimport { assertVector } from '../../../../typeGuards/annotatedArrays'\nimport { assertNumber } from '../../../../typeGuards/number'\nimport type { BuiltinNormalExpression, BuiltinNormalExpressions } from '../../../../builtin/interface'\nimport { toFixedArity } from '../../../../utils/arity'\nimport { geometricMeanReductionFunction, harmonicMeanReductionFunction, meanReductionFunction } from './mean'\nimport { medianReductionFunction } from './median'\nimport { prodReductionFunction } from './prod'\nimport { sumReductionFunction } from './sum'\nimport { sampleVarianceReductionFunction, varianceReductionFunction } from './variance'\nimport { sampleStdevReductionFunction, stdevReductionFunction } from './standardDeviation'\nimport { iqrReductionFunction } from './iqr'\nimport { spanReductionFunction } from './span'\nimport { sampleSkewnessReductionFunction, skewnessReductionFunction } from './skewness'\nimport { eccessKurtosisReductionFunction, kurtosisReductionFunction, sampleExcessKurtosisReductionFunction, sampleKurtosisReductionFunction } from './kurtosis'\nimport { rmsReductionFunction } from './rms'\nimport { madReductionFunction } from './mad'\nimport { medadReductionFunction } from './medad'\nimport { giniCoefficientReductionFunction } from './giniCoefficient'\nimport { entropyReductionFunction } from './entropy'\n\ntype VectorReductionKey<T extends string> = `${T}`\ntype VectorMovingWindowKey<T extends string> = `moving-${T}`\ntype VectorCenteredMovingWindowKey<T extends string> = `centered-moving-${T}`\ntype VectorRunningKey<T extends string> = `running-${T}`\n\nexport type VectorReductionKeys<T extends string> = VectorReductionKey<T> | VectorMovingWindowKey<T> | VectorCenteredMovingWindowKey<T> | VectorRunningKey<T>\n\ntype ReductionFunction = (vector: number[]) => number\n// type MovingWindowFunction = (vector: number[], windowSize: number, sourceCodeInfo: SourceCodeInfo | undefined) => number[]\n\nexport type ReductionFunctionDefinition<T extends string> = Record<VectorReductionKey<T>, ReductionFunction> & {\n minLength?: number\n padding?: number\n}\n\nexport const reductionFunctionNormalExpressions: BuiltinNormalExpressions = {}\n\naddReductionFunctions(meanReductionFunction)\naddReductionFunctions(geometricMeanReductionFunction)\naddReductionFunctions(harmonicMeanReductionFunction)\naddReductionFunctions(medianReductionFunction)\naddReductionFunctions(sumReductionFunction)\naddReductionFunctions(prodReductionFunction)\naddReductionFunctions(varianceReductionFunction)\naddReductionFunctions(sampleVarianceReductionFunction)\naddReductionFunctions(stdevReductionFunction)\naddReductionFunctions(sampleStdevReductionFunction)\naddReductionFunctions(iqrReductionFunction)\naddReductionFunctions(spanReductionFunction)\naddReductionFunctions(skewnessReductionFunction)\naddReductionFunctions(sampleSkewnessReductionFunction)\naddReductionFunctions(eccessKurtosisReductionFunction)\naddReductionFunctions(kurtosisReductionFunction)\naddReductionFunctions(sampleExcessKurtosisReductionFunction)\naddReductionFunctions(sampleKurtosisReductionFunction)\naddReductionFunctions(rmsReductionFunction)\naddReductionFunctions(madReductionFunction)\naddReductionFunctions(medadReductionFunction)\naddReductionFunctions(giniCoefficientReductionFunction)\naddReductionFunctions(entropyReductionFunction)\n\nfunction addReductionFunctions<T extends string>(fns: ReductionFunctionDefinition<T>) {\n for (const [key, value] of Object.entries(fns)) {\n /* v8 ignore next 3 */\n if (reductionFunctionNormalExpressions[key]) {\n throw new Error(`Duplicate normal expression key found: ${key}`)\n }\n if (key !== 'minLength' && key !== 'padding' && typeof value === 'function') {\n const reductionFn = value as ReductionFunction\n const baseKey = key.replace(/^/, '')\n const movingKey = `moving-${baseKey}` as VectorMovingWindowKey<T>\n const centeredMovingKey = `centered-moving-${baseKey}` as VectorCenteredMovingWindowKey<T>\n const runningKey = `running-${baseKey}` as VectorRunningKey<T>\n const minLength = fns.minLength ?? 1\n assertNumber(minLength, undefined, { integer: true, finite: true, gte: 0 })\n reductionFunctionNormalExpressions[key] = createReductionNormalExpression(reductionFn, minLength)\n reductionFunctionNormalExpressions[movingKey] = createMovingNormalExpression(reductionFn, minLength)\n reductionFunctionNormalExpressions[centeredMovingKey] = createCenteredMovingNormalExpression(reductionFn, minLength, fns.padding ?? null)\n reductionFunctionNormalExpressions[runningKey] = createRunningNormalExpression(reductionFn, minLength)\n }\n }\n}\n\nfunction createReductionNormalExpression(\n reductionFunction: ReductionFunction,\n minLength: number,\n): BuiltinNormalExpression<number> {\n return {\n evaluate: ([vector], sourceCodeInfo) => {\n assertVector(vector, sourceCodeInfo)\n if (vector.length < minLength) {\n throw new LitsError(`Vector length must be at least ${minLength}`, sourceCodeInfo)\n }\n\n try {\n return reductionFunction(vector)\n }\n catch (error) {\n throw new LitsError(error, sourceCodeInfo)\n }\n },\n arity: toFixedArity(1),\n }\n}\n\nfunction createMovingNormalExpression(\n reductionFunction: ReductionFunction,\n minLength: number,\n): BuiltinNormalExpression<number[]> {\n return {\n evaluate: ([vector, windowSize], sourceCodeInfo) => {\n assertVector(vector, sourceCodeInfo)\n assertNumber(windowSize, sourceCodeInfo, { integer: true, finite: true, gte: minLength, lte: vector.length })\n if (vector.length === 0) {\n return []\n }\n try {\n if (windowSize >= vector.length) {\n return [reductionFunction(vector)]\n }\n const result = []\n for (let i = 0; i < vector.length - windowSize + 1; i += 1) {\n result.push(reductionFunction(vector.slice(i, i + windowSize)))\n }\n return result\n }\n catch (error) {\n throw new LitsError(error, sourceCodeInfo)\n }\n },\n arity: toFixedArity(2),\n }\n}\n\nfunction createCenteredMovingNormalExpression(\n reductionFunction: ReductionFunction,\n minLength: number,\n padding: number | null,\n): BuiltinNormalExpression<(number | null)[]> {\n return {\n evaluate: ([vector, windowSize, leftPadding, rightPadding], sourceCodeInfo) => {\n assertVector(vector, sourceCodeInfo)\n if (vector.length < minLength) {\n throw new LitsError(`Vector length must be at least ${minLength}`, sourceCodeInfo)\n }\n\n assertNumber(windowSize, sourceCodeInfo, { integer: true, finite: true, gte: minLength, lte: vector.length })\n leftPadding = leftPadding ?? padding\n if (leftPadding !== null) {\n assertNumber(leftPadding, sourceCodeInfo, { finite: true })\n }\n rightPadding = rightPadding ?? padding\n if (rightPadding !== null) {\n assertNumber(rightPadding, sourceCodeInfo, { finite: true })\n }\n\n if (vector.length === 0) {\n return []\n }\n\n const halfWindowSize = Math.floor(windowSize / 2)\n const paddedVector = [\n ...Array<number | null>(halfWindowSize).fill(leftPadding),\n ...vector,\n ...Array<number | null>(halfWindowSize).fill(rightPadding),\n ]\n\n const start = typeof leftPadding === 'number' ? 0 : halfWindowSize\n const end = vector.length - (typeof rightPadding === 'number' ? 0 : (windowSize - halfWindowSize - 1))\n\n const result: (number | null)[] = [\n ...Array<null>(start).fill(null),\n ]\n\n try {\n for (let i = start; i < end; i += 1) {\n result.push(reductionFunction(paddedVector.slice(i, i + windowSize) as number[]))\n }\n }\n catch (error) {\n throw new LitsError(error, sourceCodeInfo)\n }\n\n result.push(...Array<null>(vector.length - end).fill(null))\n return result\n },\n arity: { min: 2, max: 4 },\n }\n}\n\nfunction createRunningNormalExpression(\n reductionFunction: ReductionFunction,\n minLength: number,\n): BuiltinNormalExpression<(number | null)[]> {\n return {\n evaluate: ([vector], sourceCodeInfo) => {\n assertVector(vector, sourceCodeInfo)\n if (vector.length < minLength) {\n throw new LitsError(`Vector length must be at least ${minLength}`, sourceCodeInfo)\n }\n\n if (vector.length === 0) {\n return []\n }\n\n try {\n const nullsCount = Math.max(minLength - 1, 0)\n const result: (number | null)[] = Array<null>(nullsCount).fill(null)\n\n for (let i = nullsCount; i < vector.length; i += 1) {\n result.push(reductionFunction(vector.slice(0, i + 1)))\n }\n return result\n }\n catch (error) {\n throw new LitsError(error, sourceCodeInfo)\n }\n },\n arity: toFixedArity(1),\n }\n}\n","import type { ReductionFunctionDefinition } from '.'\n\nexport const sumReductionFunction: ReductionFunctionDefinition<'sum'> = {\n sum: vector => vector.reduce((acc, val) => acc + val, 0),\n minLength: 0,\n}\n","import type { ReductionFunctionDefinition } from '.'\n\nexport const prodReductionFunction: ReductionFunctionDefinition<'prod'> = {\n prod: vector => vector.reduce((acc, val) => acc * val, 1),\n padding: 1,\n minLength: 0,\n}\n","import { LitsError } from '../../../errors'\nimport { assertNonEmptyVector, assertVector } from '../../../typeGuards/annotatedArrays'\nimport { assertFunctionLike } from '../../../typeGuards/lits'\nimport { assertNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\nimport type { LitsModule } from '../interface'\nimport { moduleDocs } from './docs'\nimport { bincount } from './bincount'\nimport { calcHistogram } from './histogram'\nimport { mode } from './mode'\nimport { hasOutliers, outliers } from './outliers'\nimport { calcPercentile } from './percentile'\nimport { quartiles } from './quartiles'\nimport { reductionFunctionNormalExpressions } from './reductionFunctions'\n\nconst vectorFunctions: BuiltinNormalExpressions = {\n 'monotonic?': {\n evaluate: ([vector], sourceCodeInfo): boolean => {\n assertVector(vector, sourceCodeInfo)\n return vector.every((val, i) => i === 0 || val >= vector[i - 1]!)\n || vector.every((val, i) => i === 0 || val <= vector[i - 1]!)\n },\n arity: toFixedArity(1),\n },\n 'strictly-monotonic?': {\n evaluate: ([vector], sourceCodeInfo): boolean => {\n assertVector(vector, sourceCodeInfo)\n return vector.every((val, i) => i === 0 || val > vector[i - 1]!)\n || vector.every((val, i) => i === 0 || val < vector[i - 1]!)\n },\n arity: toFixedArity(1),\n },\n 'increasing?': {\n evaluate: ([vector], sourceCodeInfo): boolean => {\n assertVector(vector, sourceCodeInfo)\n return vector.every((val, i) => i === 0 || val >= vector[i - 1]!)\n },\n arity: toFixedArity(1),\n },\n 'decreasing?': {\n evaluate: ([vector], sourceCodeInfo): boolean => {\n assertVector(vector, sourceCodeInfo)\n return vector.every((val, i) => i === 0 || val <= vector[i - 1]!)\n },\n arity: toFixedArity(1),\n },\n 'strictly-increasing?': {\n evaluate: ([vector], sourceCodeInfo): boolean => {\n assertVector(vector, sourceCodeInfo)\n return vector.every((val, i) => i === 0 || val > vector[i - 1]!)\n },\n arity: toFixedArity(1),\n },\n 'strictly-decreasing?': {\n evaluate: ([vector], sourceCodeInfo): boolean => {\n assertVector(vector, sourceCodeInfo)\n return vector.every((val, i) => i === 0 || val < vector[i - 1]!)\n },\n arity: toFixedArity(1),\n },\n 'mode': {\n evaluate: ([vector], sourceCodeInfo): number[] => {\n assertNonEmptyVector(vector, sourceCodeInfo)\n return mode(vector)\n },\n arity: toFixedArity(1),\n },\n 'min-index': {\n evaluate: ([vector], sourceCodeInfo): number => {\n assertNonEmptyVector(vector, sourceCodeInfo)\n\n return vector.reduce((acc, val, i) => (val < vector[acc]! ? i : acc), 0)\n },\n arity: toFixedArity(1),\n },\n 'max-index': {\n evaluate: ([vector], sourceCodeInfo): number => {\n assertNonEmptyVector(vector, sourceCodeInfo)\n\n return vector.reduce((acc, val, i) => (val > vector[acc]! ? i : acc), 0)\n },\n arity: toFixedArity(1),\n },\n 'sort-indices': {\n evaluate: ([vector], sourceCodeInfo): number[] => {\n assertVector(vector, sourceCodeInfo)\n\n return [...vector.keys()].sort((a, b) => vector[a]! - vector[b]!)\n },\n arity: toFixedArity(1),\n },\n 'count-values': {\n evaluate: ([vector], sourceCodeInfo): [number, number][] => {\n assertVector(vector, sourceCodeInfo)\n\n const frequencyMap = new Map<number, number>()\n for (const value of vector) {\n frequencyMap.set(value, (frequencyMap.get(value) || 0) + 1)\n }\n return [...frequencyMap.entries()].sort((a, b) => {\n // First compare by count (descending)\n const countDiff = b[1] - a[1]\n if (countDiff !== 0)\n return countDiff\n // If counts are equal, sort by value (ascending)\n return a[0] - b[0]\n })\n },\n arity: toFixedArity(1),\n },\n 'linspace': {\n evaluate: ([start, end, numPoints], sourceCodeInfo): number[] => {\n assertNumber(start, sourceCodeInfo, { finite: true })\n assertNumber(end, sourceCodeInfo, { finite: true })\n assertNumber(numPoints, sourceCodeInfo, { integer: true, nonNegative: true })\n\n if (numPoints === 0) {\n return []\n }\n if (numPoints === 1) {\n return [start]\n }\n const step = (end - start) / (numPoints - 1)\n return Array.from({ length: numPoints }, (_, i) => start + i * step)\n },\n arity: toFixedArity(3),\n },\n 'ones': {\n evaluate: ([length], sourceCodeInfo): number[] => {\n assertNumber(length, sourceCodeInfo, { integer: true, nonNegative: true })\n return Array.from({ length }, () => 1)\n },\n arity: toFixedArity(1),\n },\n 'zeros': {\n evaluate: ([length], sourceCodeInfo): number[] => {\n assertNumber(length, sourceCodeInfo, { integer: true, nonNegative: true })\n return Array.from({ length }, () => 0)\n },\n arity: toFixedArity(1),\n },\n 'fill': {\n evaluate: ([length, value], sourceCodeInfo): number[] => {\n assertNumber(length, sourceCodeInfo, { integer: true, nonNegative: true })\n return Array.from({ length }, () => value) as number[]\n },\n arity: toFixedArity(2),\n },\n 'generate': {\n evaluate: ([length, generator], sourceCodeInfo, contextStack, { executeFunction }): number[] => {\n assertNumber(length, sourceCodeInfo, { integer: true, nonNegative: true })\n assertFunctionLike(generator, sourceCodeInfo)\n\n return Array.from({ length }, (_, i) => {\n const value = executeFunction(generator, [i], contextStack, sourceCodeInfo)\n assertNumber(value, sourceCodeInfo, { finite: true })\n return value\n })\n },\n arity: toFixedArity(2),\n },\n 'cumsum': {\n evaluate: ([vector], sourceCodeInfo): number[] => {\n assertVector(vector, sourceCodeInfo)\n\n return vector.reduce((acc, val) => {\n const last = acc[acc.length - 1] ?? 0\n acc.push(last + val)\n return acc\n }, [] as number[])\n },\n arity: toFixedArity(1),\n },\n 'cumprod': {\n evaluate: ([vector], sourceCodeInfo): number[] => {\n assertVector(vector, sourceCodeInfo)\n\n return vector.reduce((acc, val) => {\n const last = acc[acc.length - 1] ?? 1\n acc.push(last * val)\n return acc\n }, [] as number[])\n },\n arity: toFixedArity(1),\n },\n 'quartiles': {\n evaluate: ([vector], sourceCodeInfo): [number, number, number] => {\n assertVector(vector, sourceCodeInfo)\n if (vector.length < 4) {\n throw new LitsError('Quartiles require at least four values', sourceCodeInfo)\n }\n return quartiles(vector)\n },\n arity: toFixedArity(1),\n },\n 'percentile': {\n evaluate: ([vector, percentile], sourceCodeInfo): number => {\n assertNonEmptyVector(vector, sourceCodeInfo)\n assertNumber(percentile, sourceCodeInfo, { finite: true, nonNegative: true, lte: 100 })\n return calcPercentile(vector, percentile)\n },\n arity: toFixedArity(2),\n },\n 'quantile': {\n evaluate: ([vector, quantile], sourceCodeInfo): number => {\n assertVector(vector, sourceCodeInfo)\n assertNumber(quantile, sourceCodeInfo, { finite: true, nonNegative: true, lte: 1 })\n return calcPercentile(vector, quantile * 100)\n },\n arity: toFixedArity(2),\n },\n 'histogram': {\n evaluate: ([vector, bins], sourceCodeInfo): [number, number, number][] => {\n assertVector(vector, sourceCodeInfo)\n assertNumber(bins, sourceCodeInfo, { integer: true, positive: true })\n\n return calcHistogram(vector, bins)\n },\n arity: toFixedArity(2),\n },\n 'ecdf': {\n evaluate: ([vector, value], sourceCodeInfo): number => {\n assertNonEmptyVector(vector, sourceCodeInfo)\n assertNumber(value, sourceCodeInfo, { finite: true })\n\n const sorted = [...vector].sort((a, b) => a - b)\n const index = sorted.findIndex(val => val > value)\n\n return index === -1 ? 1 : index / sorted.length\n },\n arity: toFixedArity(2),\n },\n 'outliers?': {\n evaluate: ([vector], sourceCodeInfo): boolean => {\n assertVector(vector, sourceCodeInfo)\n return hasOutliers(vector)\n },\n arity: toFixedArity(1),\n },\n 'outliers': {\n evaluate: ([vector], sourceCodeInfo): number[] => {\n assertVector(vector, sourceCodeInfo)\n return outliers(vector)\n },\n arity: toFixedArity(1),\n },\n 'bincount': {\n evaluate: (params, sourceCodeInfo): number[] => {\n const vector = params[0]\n assertVector(vector, sourceCodeInfo)\n vector.forEach(val => assertNumber(val, sourceCodeInfo, { finite: true, integer: true, nonNegative: true }))\n\n const minSize = params[1] ?? 0\n assertNumber(minSize, sourceCodeInfo, { integer: true, nonNegative: true })\n\n const weights = params[2] ?? undefined\n if (weights !== undefined) {\n assertVector(weights, sourceCodeInfo)\n if (weights.length !== vector.length) {\n throw new LitsError('Weights vector must be the same length as the input vector', sourceCodeInfo)\n }\n weights.forEach(val => assertNumber(val, sourceCodeInfo, { finite: true }))\n }\n\n return bincount(vector, minSize, weights)\n },\n arity: { min: 1, max: 3 },\n },\n 'winsorize': {\n evaluate: ([vector, lowerQuantile, upperQuantile], sourceCodeInfo): number[] => {\n assertVector(vector, sourceCodeInfo)\n assertNumber(lowerQuantile, sourceCodeInfo, { finite: true, gte: 0, lte: 1 })\n upperQuantile ??= lowerQuantile > 0.5 ? 1 : (1 - lowerQuantile)\n assertNumber(upperQuantile, sourceCodeInfo, { finite: true, gte: lowerQuantile, lte: 1 })\n\n if (vector.length === 0)\n return []\n\n const sorted = [...vector].sort((a, b) => a - b)\n\n const lowerIndex = Math.max(0, Math.floor(lowerQuantile * vector.length))\n const upperIndex = Math.min(vector.length - 1, Math.max(0, Math.floor(upperQuantile * vector.length) - 1))\n\n const lowerBound = sorted[lowerIndex]!\n const upperBound = sorted[upperIndex]!\n\n return vector.map(val => Math.max(lowerBound, Math.min(val, upperBound)))\n },\n arity: { min: 2, max: 3 },\n },\n 'mse': {\n evaluate: ([vectorA, vectorB], sourceCodeInfo): number => {\n assertNonEmptyVector(vectorA, sourceCodeInfo)\n assertNonEmptyVector(vectorB, sourceCodeInfo)\n if (vectorA.length !== vectorB.length) {\n throw new LitsError('Vectors must be of the same length', sourceCodeInfo)\n }\n return vectorA.reduce((acc, val, i) => acc + (val - vectorB[i]!) ** 2, 0) / vectorA.length\n },\n arity: toFixedArity(2),\n },\n 'rmse': {\n evaluate: ([vectorA, vectorB], sourceCodeInfo): number => {\n assertNonEmptyVector(vectorA, sourceCodeInfo)\n assertNonEmptyVector(vectorB, sourceCodeInfo)\n if (vectorA.length !== vectorB.length) {\n throw new LitsError('Vectors must be of the same length', sourceCodeInfo)\n }\n return Math.sqrt(vectorA.reduce((acc, val, i) => acc + (val - vectorB[i]!) ** 2, 0) / vectorA.length)\n },\n arity: toFixedArity(2),\n },\n 'mae': {\n evaluate: ([vectorA, vectorB], sourceCodeInfo): number => {\n assertNonEmptyVector(vectorA, sourceCodeInfo)\n assertNonEmptyVector(vectorB, sourceCodeInfo)\n if (vectorA.length !== vectorB.length) {\n throw new LitsError('Vectors must be of the same length', sourceCodeInfo)\n }\n return vectorA.reduce((acc, val, i) => acc + Math.abs(val - vectorB[i]!), 0) / vectorA.length\n },\n arity: toFixedArity(2),\n },\n 'smape': {\n evaluate: ([vectorA, vectorB], sourceCodeInfo): number => {\n assertNonEmptyVector(vectorA, sourceCodeInfo)\n assertNonEmptyVector(vectorB, sourceCodeInfo)\n if (vectorA.length !== vectorB.length) {\n throw new LitsError('Vectors must be of the same length', sourceCodeInfo)\n }\n return vectorA.reduce((acc, val, i) => {\n const diff = Math.abs(val - vectorB[i]!)\n const denom = (Math.abs(val) + Math.abs(vectorB[i]!)) / 2\n return acc + (denom === 0 ? 0 : diff / denom)\n }, 0) / vectorA.length\n },\n arity: toFixedArity(2),\n },\n\n}\n\naddReductionFunctions(reductionFunctionNormalExpressions)\n\nfunction addReductionFunctions(sequences: BuiltinNormalExpressions) {\n for (const [key, value] of Object.entries(sequences)) {\n /* v8 ignore next 3 */\n if (vectorFunctions[key]) {\n throw new Error(`Duplicate normal expression key found: ${key}`)\n }\n vectorFunctions[key] = value\n }\n}\n\nfor (const [key, docs] of Object.entries(moduleDocs)) {\n if (vectorFunctions[key])\n vectorFunctions[key].docs = docs\n}\n\nexport const vectorModule: LitsModule = {\n name: 'vector',\n functions: vectorFunctions,\n}\n","/**\n * Calculates the mode (most frequent value(s)) of a dataset\n * @param values An array of values of any type\n * @returns An array containing the mode(s) of the dataset\n */\nexport function mode(values: number[]): number[] {\n // Create a frequency map\n const frequencyMap = new Map<number, number>()\n\n // Count occurrences of each value\n for (const value of values) {\n frequencyMap.set(value, (frequencyMap.get(value) || 0) + 1)\n }\n\n // Find the maximum frequency\n let maxFrequency = 0\n for (const frequency of frequencyMap.values()) {\n if (frequency > maxFrequency) {\n maxFrequency = frequency\n }\n }\n\n // If all values appear only once, there is no mode\n if (maxFrequency === 1) {\n return values\n }\n\n // Collect all values that appear with the maximum frequency\n const modes: number[] = []\n for (const [value, frequency] of frequencyMap.entries()) {\n if (frequency === maxFrequency) {\n modes.push(value)\n }\n }\n\n return modes\n}\n","/**\n * Creates a histogram from an array of numbers, returning bin ranges and counts.\n * Each bin is represented as a tuple of [minValue, maxValue, count].\n *\n * @param vector - Array of numeric values\n * @param bins - Number of bins to divide the data into\n * @returns Array of tuples, each containing [binStart, binEnd, count]\n */\nexport function calcHistogram(vector: number[], bins: number): [number, number, number][] {\n if (vector.length === 0) {\n // Return empty bins with zero counts if input is empty\n const result: [number, number, number][] = []\n for (let i = 0; i < bins; i++) {\n result.push([0, 0, 0])\n }\n return result\n }\n\n // Find min and max values\n const min = Math.min(...vector)\n const max = Math.max(...vector)\n\n // Handle the case where all values are the same\n if (min === max) {\n const result: [number, number, number][] = []\n // Create bins with the same min/max and zero counts\n for (let i = 0; i < bins; i++) {\n result.push([min, min, 0])\n }\n // Put all values in the first bin\n result[0]![2] = vector.length\n return result\n }\n\n // Calculate bin size\n const binSize = (max - min) / bins\n\n // Initialize histogram array with bin boundaries and zero counts\n const histogram: [number, number, number][] = []\n for (let i = 0; i < bins; i++) {\n const binStart = min + i * binSize\n const binEnd = i === bins - 1 ? max : min + (i + 1) * binSize\n histogram.push([binStart, binEnd, 0])\n }\n\n // Count values in each bin\n for (const value of vector) {\n if (value === max) {\n // Place maximum value in the last bin\n histogram[bins - 1]![2] += 1\n }\n else {\n const binIndex = Math.min(\n Math.floor((value - min) / binSize),\n bins - 1,\n )\n histogram[binIndex]![2] += 1\n }\n }\n\n return histogram\n}\n","/**\n * Counts occurrences of each integer value in an array of non-negative integers.\n *\n * @param array - Array of non-negative integers to count\n * @param minLength - Minimum length of the output array (default: 0)\n * @param weights - Optional array of weights (same length as input array)\n * @returns An array where index i contains the count of occurrences of i in the input array\n */\nexport function bincount(\n array: number[],\n minLength: number = 0,\n weights?: number[],\n): number[] {\n if (array.length === 0) {\n return Array.from({ length: minLength }, () => 0)\n }\n\n // Find the maximum value to determine output array size\n const maxValue = Math.max(...array)\n const outputLength = Math.max(maxValue + 1, minLength)\n const counts = Array.from({ length: outputLength }, () => 0)\n\n // Count occurrences (or sum weights if provided)\n for (let i = 0; i < array.length; i++) {\n const value = Math.floor(array[i]!)\n\n if (value < outputLength) {\n // If weights provided, add weight; otherwise add 1\n counts[value]! += weights ? weights[i]! : 1\n }\n }\n\n return counts\n}\n","import type { FunctionDocs } from '../../interface'\n\nexport const moduleDocs: Record<string, FunctionDocs> = {\n 'reflect': {\n category: 'linear-algebra',\n description: 'Reflects a vector across a given axis.',\n returns: {\n type: 'vector',\n },\n args: {\n a: {\n type: 'vector',\n description: 'Vector to reflect.',\n },\n b: {\n type: 'vector',\n description: 'Axis of reflection.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { reflect } = import(\"linear-algebra\");\\nreflect([1, 2], [0, 1])',\n 'let { reflect } = import(\"linear-algebra\");\\nreflect([1, 2, 3], [0, 0, 1])',\n ],\n seeAlso: ['linear-algebra.refract', 'linear-algebra.projection'],\n },\n 'refract': {\n category: 'linear-algebra',\n description: 'Refracts a vector across a given axis.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: 'Vector to refract.',\n },\n axis: {\n type: 'vector',\n description: 'Axis of refraction.',\n },\n eta: {\n type: 'number',\n description: 'Refraction index.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n 'axis',\n 'eta',\n ],\n },\n ],\n examples: [\n 'let { refract } = import(\"linear-algebra\");\\nrefract([1, 2], [0, 1], 1.5)',\n 'let { refract } = import(\"linear-algebra\");\\nrefract([1, 2, 3], [0, 0, 1], 1.5)',\n ],\n seeAlso: ['linear-algebra.reflect'],\n },\n 'lerp': {\n category: 'linear-algebra',\n description: 'Performs linear interpolation between two vectors.',\n returns: {\n type: 'vector',\n },\n args: {\n a: {\n type: 'vector',\n description: 'Start vector.',\n },\n b: {\n type: 'vector',\n description: 'End vector.',\n },\n t: {\n type: 'number',\n description: 'Interpolation factor (0 to 1).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n 't',\n ],\n },\n ],\n examples: [\n 'let { lerp } = import(\"linear-algebra\");\\nlerp([1, 2], [3, 4], 0.5)',\n 'let { lerp } = import(\"linear-algebra\");\\nlerp([1, 2], [3, 4], 2)',\n 'let { lerp } = import(\"linear-algebra\");\\nlerp([1, 2], [3, 4], -1)',\n 'let { lerp } = import(\"linear-algebra\");\\nlerp([1, 2, 3], [4, 5, 6], 0.25)',\n ],\n seeAlso: ['linear-algebra.projection'],\n },\n 'rotate2d': {\n category: 'linear-algebra',\n description: 'Rotates a 2D vector by a given angle in radians.',\n returns: {\n type: 'vector',\n },\n args: {\n a: {\n type: 'vector',\n description: 'Vector to rotate.',\n },\n b: {\n type: 'number',\n description: 'Angle in b.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { rotate2d } = import(\"linear-algebra\");\\nrotate2d([1, 0], PI / 2)',\n 'let { rotate2d } = import(\"linear-algebra\");\\nrotate2d([0, 1], PI)',\n ],\n seeAlso: ['linear-algebra.rotate3d', 'linear-algebra.angle'],\n },\n 'rotate3d': {\n category: 'linear-algebra',\n description: 'Rotates a 3D vector around a given axis by a given angle in radians.',\n returns: {\n type: 'vector',\n },\n args: {\n v: {\n type: 'vector',\n description: 'Vector to rotate.',\n },\n axis: {\n type: 'vector',\n description: 'Axis of rotation.',\n },\n radians: {\n type: 'number',\n description: 'Angle in radians.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'v',\n 'axis',\n 'radians',\n ],\n },\n ],\n examples: [\n 'let { rotate3d } = import(\"linear-algebra\");\\nrotate3d([1, 0, 0], [0, 1, 0], PI / 2)',\n 'let { rotate3d } = import(\"linear-algebra\");\\nrotate3d([0, 1, 0], [1, 0, 0], PI)',\n ],\n seeAlso: ['linear-algebra.rotate2d', 'linear-algebra.angle'],\n },\n 'dot': {\n category: 'linear-algebra',\n description: 'Calculates the dot product of two vectors. The result is a scalar.',\n returns: {\n type: 'number',\n },\n args: {\n a: {\n type: 'vector',\n description: 'First vector.',\n },\n b: {\n type: 'vector',\n description: 'Second vector.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { dot } = import(\"linear-algebra\");\\ndot([1, 2], [3, 4])',\n 'let { dot } = import(\"linear-algebra\");\\ndot([1, 2, 3], [4, 5, 6])',\n ],\n seeAlso: ['linear-algebra.cross', 'linear-algebra.cosine-similarity', 'linear-algebra.angle', 'linear-algebra.projection', 'linear-algebra.orthogonal?'],\n },\n 'cross': {\n category: 'linear-algebra',\n description: 'Calculates the cross product of two 3D vectors. The result is a vector perpendicular to both input vectors.',\n returns: {\n type: 'vector',\n },\n args: {\n a: {\n type: 'vector',\n description: 'First vector (3D).',\n },\n b: {\n type: 'vector',\n description: 'Second vector (3D).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { cross } = import(\"linear-algebra\");\\ncross([1, 2, 3], [4, 5, 6])',\n 'let { cross } = import(\"linear-algebra\");\\ncross([1, 0, 0], [0, 1, 0])',\n 'let { cross } = import(\"linear-algebra\");\\ncross([0, 0, 1], [1, 0, 0])',\n 'let { cross } = import(\"linear-algebra\");\\ncross([1, 2, 3], [0, 0, 0])',\n 'let { cross } = import(\"linear-algebra\");\\ncross([0, 0, 0], [1, 2, 3])',\n ],\n seeAlso: ['linear-algebra.dot'],\n },\n 'normalize-minmax': {\n category: 'linear-algebra',\n description: 'Normalizes the vector using min-max normalization. The result is a vector with values between 0 and 1.',\n returns: {\n type: 'number',\n },\n args: {\n v: {\n type: 'vector',\n description: 'Vector to normalize.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'v',\n ],\n },\n ],\n examples: [\n 'let { normalize-minmax } = import(\"linear-algebra\");\\nnormalize-minmax([1, 2, 3])',\n 'let { normalize-minmax } = import(\"linear-algebra\");\\nnormalize-minmax([1, 2, -3])',\n 'let { normalize-minmax } = import(\"linear-algebra\");\\nnormalize-minmax([1, 2, 3, 4])',\n 'let { normalize-minmax } = import(\"linear-algebra\");\\nnormalize-minmax([1, 2, -3, 4])',\n 'let { normalize-minmax } = import(\"linear-algebra\");\\nnormalize-minmax([1, 2, 3, 40, 50])',\n ],\n seeAlso: ['linear-algebra.normalize-zscore', 'linear-algebra.normalize-robust', 'linear-algebra.normalize-l1', 'linear-algebra.normalize-l2', 'linear-algebra.normalize-log'],\n },\n 'normalize-zscore': {\n category: 'linear-algebra',\n description: 'Normalizes the vector using z-score normalization. The result is a vector with mean 0 and standard deviation 1.',\n returns: {\n type: 'number',\n },\n args: {\n v: {\n type: 'vector',\n description: 'Vector to normalize.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'v',\n ],\n },\n ],\n examples: [\n 'let { normalize-zscore } = import(\"linear-algebra\");\\nnormalize-zscore([1, 2, 3])',\n 'let { normalize-zscore } = import(\"linear-algebra\");\\nnormalize-zscore([1, 2, -3])',\n 'let { normalize-zscore } = import(\"linear-algebra\");\\nnormalize-zscore([1, 2, 3, 4])',\n 'let { normalize-zscore } = import(\"linear-algebra\");\\nnormalize-zscore([1, 2, -3, 4])',\n 'let { normalize-zscore } = import(\"linear-algebra\");\\nnormalize-zscore([1, 2, 3, 40, 50])',\n ],\n seeAlso: ['linear-algebra.normalize-minmax', 'linear-algebra.normalize-robust', 'linear-algebra.normalize-l1', 'linear-algebra.normalize-l2', 'linear-algebra.normalize-log'],\n },\n 'normalize-robust': {\n category: 'linear-algebra',\n description: 'Normalizes the vector using robust normalization. The result is a vector with median 0 and median absolute deviation 1.',\n returns: {\n type: 'number',\n },\n args: {\n v: {\n type: 'vector',\n description: 'Vector to normalize.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'v',\n ],\n },\n ],\n examples: [\n 'let { normalize-robust } = import(\"linear-algebra\");\\nnormalize-robust([1, 2, 3])',\n 'let { normalize-robust } = import(\"linear-algebra\");\\nnormalize-robust([1, 2, -3])',\n 'let { normalize-robust } = import(\"linear-algebra\");\\nnormalize-robust([1, 2, 3, 4])',\n 'let { normalize-robust } = import(\"linear-algebra\");\\nnormalize-robust([1, 2, -3, 4])',\n 'let { normalize-robust } = import(\"linear-algebra\");\\nnormalize-robust([1, 2, 3, 40, 50])',\n ],\n seeAlso: ['linear-algebra.normalize-minmax', 'linear-algebra.normalize-zscore'],\n },\n 'normalize-l1': {\n category: 'linear-algebra',\n description: 'Normalizes the vector using L1 normalization. The result is a vector with L1 norm equal to 1.',\n returns: {\n type: 'number',\n },\n args: {\n v: {\n type: 'vector',\n description: 'Vector to normalize.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'v',\n ],\n },\n ],\n examples: [\n 'let { normalize-l1 } = import(\"linear-algebra\");\\nnormalize-l1([1, 2, 3])',\n 'let { normalize-l1 } = import(\"linear-algebra\");\\nnormalize-l1([1, 2, -3])',\n 'let { normalize-l1 } = import(\"linear-algebra\");\\nnormalize-l1([1, 2, 3, 4])',\n 'let { normalize-l1 } = import(\"linear-algebra\");\\nnormalize-l1([1, 2, -3, 4])',\n 'let { normalize-l1 } = import(\"linear-algebra\");\\nnormalize-l1([1, 2, 3, 40, 50])',\n ],\n seeAlso: ['linear-algebra.normalize-l2', 'linear-algebra.normalize-minmax', 'linear-algebra.manhattan-norm', 'linear-algebra.normalize-zscore'],\n },\n 'normalize-l2': {\n category: 'linear-algebra',\n description: 'Normalizes the vector using L2 normalization. The result is a vector with L2 norm equal to 1.',\n returns: {\n type: 'number',\n },\n args: {\n v: {\n type: 'vector',\n description: 'Vector to normalize.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'v',\n ],\n },\n ],\n examples: [\n 'let { normalize-l2 } = import(\"linear-algebra\");\\nnormalize-l2([1, 2, 3])',\n 'let { normalize-l2 } = import(\"linear-algebra\");\\nnormalize-l2([1, 2, 3])',\n 'let { normalize-l2 } = import(\"linear-algebra\");\\nnormalize-l2([1, 2, -3])',\n 'let { normalize-l2 } = import(\"linear-algebra\");\\nnormalize-l2([1, 2, 3, 4])',\n 'let { normalize-l2 } = import(\"linear-algebra\");\\nnormalize-l2([1, 2, -3, 4])',\n 'let { normalize-l2 } = import(\"linear-algebra\");\\nnormalize-l2([1, 2, 3, 40, 50])',\n ],\n seeAlso: ['linear-algebra.normalize-l1', 'linear-algebra.normalize-minmax', 'linear-algebra.euclidean-norm', 'linear-algebra.normalize-zscore'],\n },\n 'normalize-log': {\n category: 'linear-algebra',\n description: 'Normalizes the vector using natural log normalization. The result is a vector with log-transformed values.',\n returns: {\n type: 'number',\n },\n args: {\n v: {\n type: 'vector',\n description: 'Vector to normalize.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'v',\n ],\n },\n ],\n examples: [\n 'let { normalize-log } = import(\"linear-algebra\");\\nnormalize-log([1, 2, 3])',\n 'let { normalize-log } = import(\"linear-algebra\");\\nnormalize-log([1, 2, 3, 4])',\n 'let { normalize-log } = import(\"linear-algebra\");\\nnormalize-log([1, 2, 3, 40, 50])',\n ],\n seeAlso: ['linear-algebra.normalize-minmax', 'linear-algebra.normalize-zscore'],\n },\n 'angle': {\n category: 'linear-algebra',\n description: 'Calculates the **angle** between two vectors in radians.',\n returns: {\n type: 'number',\n },\n args: {\n a: {\n type: 'vector',\n },\n b: {\n type: 'vector',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { angle } = import(\"linear-algebra\");\\nangle([1, 0], [0, 1])',\n 'let { angle } = import(\"linear-algebra\");\\nangle([1, 0, 1], [0, 1, 0])',\n ],\n seeAlso: ['linear-algebra.dot', 'linear-algebra.collinear?', 'linear-algebra.orthogonal?', 'linear-algebra.rotate2d', 'linear-algebra.rotate3d', 'linear-algebra.parallel?', 'linear-algebra.cosine-similarity', 'linear-algebra.to-polar'],\n },\n 'projection': {\n category: 'linear-algebra',\n description: 'Calculates the **projection** of vector `a` onto vector `b`.',\n returns: {\n type: 'vector',\n },\n args: {\n a: {\n type: 'vector',\n },\n b: {\n type: 'vector',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { projection } = import(\"linear-algebra\");\\nprojection([1, 2], [3, 4])',\n 'let { projection } = import(\"linear-algebra\");\\nprojection([1, 2, 3], [4, 5, 6])',\n ],\n seeAlso: ['linear-algebra.dot', 'linear-algebra.reflect', 'linear-algebra.lerp'],\n },\n 'collinear?': {\n category: 'linear-algebra',\n description: 'Checks if two vectors are **collinear**.',\n returns: {\n type: 'boolean',\n },\n args: {\n a: {\n type: 'vector',\n },\n b: {\n type: 'vector',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { collinear? } = import(\"linear-algebra\");\\ncollinear?([1, 2], [2, 4])',\n 'let { collinear? } = import(\"linear-algebra\");\\ncollinear?([1, 2], [-2, -4])',\n 'let { collinear? } = import(\"linear-algebra\");\\ncollinear?([1, 2, 3], [2, 4, 6])',\n ],\n seeAlso: ['linear-algebra.parallel?', 'linear-algebra.orthogonal?', 'linear-algebra.angle'],\n },\n 'parallel?': {\n category: 'linear-algebra',\n description: 'Checks if two vectors are **parallel**.',\n returns: {\n type: 'boolean',\n },\n args: {\n a: {\n type: 'vector',\n },\n b: {\n type: 'vector',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { parallel? } = import(\"linear-algebra\");\\nparallel?([1, 2], [2, 4])',\n 'let { parallel? } = import(\"linear-algebra\");\\nparallel?([1, 2], [-2, -4])',\n 'let { parallel? } = import(\"linear-algebra\");\\nparallel?([1, 2, 3], [2, 4, 6])',\n 'let { parallel? } = import(\"linear-algebra\");\\nparallel?([1, 2], [3, 4])',\n ],\n seeAlso: ['linear-algebra.collinear?', 'linear-algebra.orthogonal?', 'linear-algebra.angle'],\n },\n 'orthogonal?': {\n category: 'linear-algebra',\n description: 'Checks if two vectors are **orthogonal**.',\n returns: {\n type: 'boolean',\n },\n args: {\n a: {\n type: 'vector',\n },\n b: {\n type: 'vector',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { orthogonal? } = import(\"linear-algebra\");\\northogonal?([1, 0], [0, 1])',\n 'let { orthogonal? } = import(\"linear-algebra\");\\northogonal?([1, 0, 1], [0, 1, 0])',\n 'let { orthogonal? } = import(\"linear-algebra\");\\northogonal?([1, 2], [2, -1])',\n ],\n seeAlso: ['linear-algebra.collinear?', 'linear-algebra.parallel?', 'linear-algebra.dot', 'matrix.orthogonal?', 'linear-algebra.angle'],\n },\n 'cosine-similarity': {\n category: 'linear-algebra',\n description: 'Calculates the **cosine similarity** between two vectors. The result is a value between -1 and 1.',\n returns: {\n type: 'number',\n },\n args: {\n a: {\n type: 'vector',\n },\n b: {\n type: 'vector',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { cosine-similarity } = import(\"linear-algebra\");\\ncosine-similarity([1, 2], [3, 4])',\n 'let { cosine-similarity } = import(\"linear-algebra\");\\ncosine-similarity([1, 2, 3], [4, 5, 6])',\n 'let { cosine-similarity } = import(\"linear-algebra\");\\ncosine-similarity([1, 0], [0, 1])',\n ],\n seeAlso: ['linear-algebra.dot', 'linear-algebra.angle', 'linear-algebra.euclidean-distance'],\n },\n 'euclidean-distance': {\n category: 'linear-algebra',\n description: 'Calculates the **Euclidean distance** between two vectors. The result is a non-negative number.',\n returns: {\n type: 'number',\n },\n args: {\n a: {\n type: 'vector',\n },\n b: {\n type: 'vector',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { euclidean-distance } = import(\"linear-algebra\");\\neuclidean-distance([1, 2], [3, 4])',\n 'let { euclidean-distance } = import(\"linear-algebra\");\\neuclidean-distance([1, 2, 3], [4, 5, 6])',\n 'let { euclidean-distance } = import(\"linear-algebra\");\\neuclidean-distance([1, 0], [0, 1])',\n ],\n seeAlso: ['linear-algebra.manhattan-distance', 'linear-algebra.chebyshev-distance', 'linear-algebra.minkowski-distance', 'linear-algebra.euclidean-norm', 'linear-algebra.cosine-similarity', 'linear-algebra.hamming-distance'],\n },\n 'euclidean-norm': {\n category: 'linear-algebra',\n description: 'Calculates the **Euclidean norm** (L2 norm) of a vector. The result is a non-negative number.',\n returns: {\n type: 'number',\n },\n args: {\n v: {\n type: 'vector',\n description: 'Vector to calculate the norm for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'v',\n ],\n },\n ],\n examples: [\n 'let { euclidean-norm } = import(\"linear-algebra\");\\neuclidean-norm([1, 2])',\n 'let { euclidean-norm } = import(\"linear-algebra\");\\neuclidean-norm([3, 4])',\n 'let { euclidean-norm } = import(\"linear-algebra\");\\neuclidean-norm([1, 2, 3])',\n ],\n seeAlso: ['linear-algebra.manhattan-norm', 'linear-algebra.chebyshev-norm', 'linear-algebra.minkowski-norm', 'linear-algebra.euclidean-distance', 'linear-algebra.normalize-l2', 'linear-algebra.hamming-norm'],\n },\n 'manhattan-distance': {\n category: 'linear-algebra',\n description: 'Calculates the **Manhattan distance** between two vectors. The result is a non-negative number.',\n returns: {\n type: 'number',\n },\n args: {\n a: {\n type: 'vector',\n },\n b: {\n type: 'vector',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { manhattan-distance } = import(\"linear-algebra\");\\nmanhattan-distance([1, 2], [3, 4])',\n 'let { manhattan-distance } = import(\"linear-algebra\");\\nmanhattan-distance([1, 2, 3], [4, 5, 6])',\n 'let { manhattan-distance } = import(\"linear-algebra\");\\nmanhattan-distance([1, 0], [0, 1])',\n ],\n seeAlso: ['linear-algebra.euclidean-distance', 'linear-algebra.chebyshev-distance', 'linear-algebra.minkowski-distance', 'linear-algebra.manhattan-norm', 'linear-algebra.hamming-distance'],\n },\n 'manhattan-norm': {\n category: 'linear-algebra',\n description: 'Calculates the **Manhattan norm** (L1 norm) of a vector. The result is a non-negative number.',\n returns: {\n type: 'number',\n },\n args: {\n v: {\n type: 'vector',\n description: 'Vector to calculate the norm for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'v',\n ],\n },\n ],\n examples: [\n 'let { manhattan-norm } = import(\"linear-algebra\");\\nmanhattan-norm([1, 2])',\n 'let { manhattan-norm } = import(\"linear-algebra\");\\nmanhattan-norm([3, 4])',\n 'let { manhattan-norm } = import(\"linear-algebra\");\\nmanhattan-norm([1, 2, 3])',\n ],\n seeAlso: ['linear-algebra.euclidean-norm', 'linear-algebra.chebyshev-norm', 'linear-algebra.minkowski-norm', 'linear-algebra.manhattan-distance', 'linear-algebra.normalize-l1', 'linear-algebra.hamming-norm'],\n },\n 'hamming-distance': {\n category: 'linear-algebra',\n description: 'Calculates the **Hamming distance** between two vectors. The result is a non-negative integer.',\n returns: {\n type: 'integer',\n },\n args: {\n a: {\n type: 'vector',\n },\n b: {\n type: 'vector',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { hamming-distance } = import(\"linear-algebra\");\\nhamming-distance([1, 2], [3, 4])',\n 'let { hamming-distance } = import(\"linear-algebra\");\\nhamming-distance([1, 2, 3], [4, 5, 6])',\n 'let { hamming-distance } = import(\"linear-algebra\");\\nhamming-distance([1, 0], [0, 1])',\n ],\n seeAlso: ['linear-algebra.euclidean-distance', 'linear-algebra.manhattan-distance', 'linear-algebra.hamming-norm'],\n },\n 'hamming-norm': {\n category: 'linear-algebra',\n description: 'Calculates the **Hamming norm** of a vector. The result is a non-negative integer.',\n returns: {\n type: 'integer',\n },\n args: {\n v: {\n type: 'vector',\n description: 'Vector to calculate the norm for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'v',\n ],\n },\n ],\n examples: [\n 'let { hamming-norm } = import(\"linear-algebra\");\\nhamming-norm([1, 2])',\n 'let { hamming-norm } = import(\"linear-algebra\");\\nhamming-norm([3, 4])',\n 'let { hamming-norm } = import(\"linear-algebra\");\\nhamming-norm([1, 2, 3])',\n ],\n seeAlso: ['linear-algebra.euclidean-norm', 'linear-algebra.manhattan-norm', 'linear-algebra.hamming-distance'],\n },\n 'chebyshev-distance': {\n category: 'linear-algebra',\n description: 'Calculates the **Chebyshev distance** between two vectors. The result is a non-negative number.',\n returns: {\n type: 'number',\n },\n args: {\n a: {\n type: 'vector',\n },\n b: {\n type: 'vector',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { chebyshev-distance } = import(\"linear-algebra\");\\nchebyshev-distance([1, 2], [3, 4])',\n 'let { chebyshev-distance } = import(\"linear-algebra\");\\nchebyshev-distance([1, 2, 3], [4, 5, 6])',\n 'let { chebyshev-distance } = import(\"linear-algebra\");\\nchebyshev-distance([1, 0], [0, 1])',\n ],\n seeAlso: ['linear-algebra.euclidean-distance', 'linear-algebra.manhattan-distance', 'linear-algebra.minkowski-distance', 'linear-algebra.chebyshev-norm'],\n },\n 'chebyshev-norm': {\n category: 'linear-algebra',\n description: 'Calculates the **Chebyshev norm** of a vector. The result is a non-negative number.',\n returns: {\n type: 'number',\n },\n args: {\n v: {\n type: 'vector',\n description: 'Vector to calculate the norm for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'v',\n ],\n },\n ],\n examples: [\n 'let { chebyshev-norm } = import(\"linear-algebra\");\\nchebyshev-norm([1, 2])',\n 'let { chebyshev-norm } = import(\"linear-algebra\");\\nchebyshev-norm([3, 4])',\n 'let { chebyshev-norm } = import(\"linear-algebra\");\\nchebyshev-norm([1, 2, 3])',\n ],\n seeAlso: ['linear-algebra.euclidean-norm', 'linear-algebra.manhattan-norm', 'linear-algebra.minkowski-norm', 'linear-algebra.chebyshev-distance'],\n },\n 'minkowski-distance': {\n category: 'linear-algebra',\n description: 'Calculates the **Minkowski distance** between two vectors. The result is a non-negative number.',\n returns: {\n type: 'number',\n },\n args: {\n a: {\n type: 'vector',\n },\n b: {\n type: 'vector',\n },\n p: {\n type: 'number',\n description: 'Order of the norm (p).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n 'p',\n ],\n },\n ],\n examples: [\n 'let { minkowski-distance } = import(\"linear-algebra\");\\nminkowski-distance([1, 2], [3, 4], 2)',\n 'let { minkowski-distance } = import(\"linear-algebra\");\\nminkowski-distance([1, 2, 3], [4, 5, 6], 3)',\n 'let { minkowski-distance } = import(\"linear-algebra\");\\nminkowski-distance([1, 0], [0, 1], 1)',\n ],\n seeAlso: ['linear-algebra.euclidean-distance', 'linear-algebra.manhattan-distance', 'linear-algebra.chebyshev-distance', 'linear-algebra.minkowski-norm'],\n },\n 'minkowski-norm': {\n category: 'linear-algebra',\n description: 'Calculates the **Minkowski norm** of a vector. The result is a non-negative number.',\n returns: {\n type: 'number',\n },\n args: {\n a: {\n type: 'vector',\n description: 'Vector to calculate the norm for.',\n },\n b: {\n type: 'number',\n description: 'Order of the norm (p).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { minkowski-norm } = import(\"linear-algebra\");\\nminkowski-norm([1, 2], 2)',\n 'let { minkowski-norm } = import(\"linear-algebra\");\\nminkowski-norm([3, 4], 3)',\n 'let { minkowski-norm } = import(\"linear-algebra\");\\nminkowski-norm([1, 2, 3], 4)',\n ],\n seeAlso: ['linear-algebra.euclidean-norm', 'linear-algebra.manhattan-norm', 'linear-algebra.chebyshev-norm', 'linear-algebra.minkowski-distance'],\n },\n 'cov': {\n category: 'linear-algebra',\n description: 'Calculates the **covariance** between two vectors. The result is a number.',\n returns: {\n type: 'number',\n },\n args: {\n a: {\n type: 'vector',\n },\n b: {\n type: 'vector',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { cov } = import(\"linear-algebra\");\\ncov([1, 2], [3, 4])',\n 'let { cov } = import(\"linear-algebra\");\\ncov([1, 2, 3], [4, 5, 6])',\n 'let { cov } = import(\"linear-algebra\");\\ncov([1, 0], [0, 1])',\n ],\n seeAlso: ['linear-algebra.corr', 'linear-algebra.pearson-corr', 'vector.variance'],\n },\n 'corr': {\n category: 'linear-algebra',\n description: 'Calculates the **correlation** between two vectors. The result is a number between -1 and 1.',\n returns: {\n type: 'number',\n },\n args: {\n a: {\n type: 'vector',\n },\n b: {\n type: 'vector',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { corr } = import(\"linear-algebra\");\\ncorr([1, 2], [3, 4])',\n 'let { corr } = import(\"linear-algebra\");\\ncorr([1, 2, 3], [4, 5, 6])',\n 'let { corr } = import(\"linear-algebra\");\\ncorr([1, 0], [0, 1])',\n ],\n seeAlso: ['linear-algebra.cov', 'linear-algebra.pearson-corr', 'linear-algebra.spearman-corr', 'linear-algebra.kendall-tau', 'linear-algebra.autocorrelation', 'linear-algebra.cross-correlation'],\n },\n 'spearman-corr': {\n category: 'linear-algebra',\n description: 'Calculates the **Spearman rank correlation** between two vectors. The result is a number between -1 and 1.',\n returns: {\n type: 'number',\n },\n args: {\n a: {\n type: 'vector',\n },\n b: {\n type: 'vector',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { spearman-corr } = import(\"linear-algebra\");\\nspearman-corr([1, 2], [3, 4])',\n 'let { spearman-corr } = import(\"linear-algebra\");\\nspearman-corr([1, 2, 3], [4, 5, 6])',\n 'let { spearman-corr } = import(\"linear-algebra\");\\nspearman-corr([1, 0], [0, 1])',\n ],\n seeAlso: ['linear-algebra.pearson-corr', 'linear-algebra.kendall-tau', 'linear-algebra.corr'],\n },\n 'pearson-corr': {\n category: 'linear-algebra',\n description: 'Calculates the **Pearson correlation** between two vectors. The result is a number between -1 and 1.',\n returns: {\n type: 'number',\n },\n args: {\n a: {\n type: 'vector',\n },\n b: {\n type: 'vector',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { pearson-corr } = import(\"linear-algebra\");\\npearson-corr([1, 2], [3, 4])',\n 'let { pearson-corr } = import(\"linear-algebra\");\\npearson-corr([1, 2, 3], [4, 5, 6])',\n 'let { pearson-corr } = import(\"linear-algebra\");\\npearson-corr([1, 0], [0, 1])',\n ],\n seeAlso: ['linear-algebra.spearman-corr', 'linear-algebra.kendall-tau', 'linear-algebra.corr', 'linear-algebra.cov'],\n },\n 'kendall-tau': {\n category: 'linear-algebra',\n description: 'Calculates the **Kendall Tau** rank correlation coefficient between two vectors. The result is a number between -1 and 1.',\n returns: {\n type: 'number',\n },\n args: {\n a: {\n type: 'vector',\n },\n b: {\n type: 'vector',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { kendall-tau } = import(\"linear-algebra\");\\nkendall-tau([1, 2], [3, 4])',\n 'let { kendall-tau } = import(\"linear-algebra\");\\nkendall-tau([1, 2, 3], [4, 5, 6])',\n 'let { kendall-tau } = import(\"linear-algebra\");\\nkendall-tau([1, 0], [0, 1])',\n ],\n seeAlso: ['linear-algebra.spearman-corr', 'linear-algebra.pearson-corr', 'linear-algebra.corr'],\n },\n 'autocorrelation': {\n category: 'linear-algebra',\n description: 'Calculates the **autocorrelation** of a vector. The result is a vector of autocorrelation coefficients.',\n returns: {\n type: 'vector',\n },\n args: {\n a: {\n type: 'vector',\n description: 'Vector to calculate the autocorrelation for.',\n },\n b: {\n type: 'integer',\n description: 'Lag value for the autocorrelation.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { autocorrelation } = import(\"linear-algebra\");\\nautocorrelation([1, 2, 3], -2)',\n 'let { autocorrelation } = import(\"linear-algebra\");\\nautocorrelation([1, 2, 3], -1)',\n 'let { autocorrelation } = import(\"linear-algebra\");\\nautocorrelation([1, 2, 3], 0)',\n 'let { autocorrelation } = import(\"linear-algebra\");\\nautocorrelation([1, 2, 3], 1)',\n 'let { autocorrelation } = import(\"linear-algebra\");\\nautocorrelation([1, 2, 3], 2)',\n ],\n seeAlso: ['linear-algebra.cross-correlation', 'linear-algebra.corr'],\n },\n 'cross-correlation': {\n category: 'linear-algebra',\n description: 'Calculates the **cross-correlation** between two vectors. The result is a vector of cross-correlation coefficients.',\n returns: {\n type: 'vector',\n },\n args: {\n a: {\n type: 'vector',\n },\n b: {\n type: 'vector',\n },\n lag: {\n type: 'integer',\n description: 'Lag value for the cross-correlation.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n 'lag',\n ],\n },\n ],\n examples: [\n 'let { cross-correlation } = import(\"linear-algebra\");\\ncross-correlation([1, 2, 3], [4, 5, 6], -2)',\n 'let { cross-correlation } = import(\"linear-algebra\");\\ncross-correlation([1, 2, 3], [4, 5, 6], -1)',\n 'let { cross-correlation } = import(\"linear-algebra\");\\ncross-correlation([1, 2, 3], [4, 5, 6], 0)',\n 'let { cross-correlation } = import(\"linear-algebra\");\\ncross-correlation([1, 2, 3], [4, 5, 6], 1)',\n 'let { cross-correlation } = import(\"linear-algebra\");\\ncross-correlation([1, 2, 3], [4, 5, 6], 2)',\n ],\n seeAlso: ['linear-algebra.autocorrelation', 'linear-algebra.corr'],\n },\n 'rref': {\n category: 'linear-algebra',\n description: 'Calculates the **Reduced Row Echelon Form** (RREF) of a matrix.',\n returns: {\n type: 'matrix',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'Matrix to calculate the RREF for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { rref } = import(\"linear-algebra\");\\nrref([[1, 2], [3, 4]])',\n 'let { rref } = import(\"linear-algebra\");\\nrref([[1, 2, 3], [4, 5, 6], [7, 8, 9]])',\n 'let { rref } = import(\"linear-algebra\");\\nrref([[1, 2, 3], [7, 8, 9], [4, 5, 7]])',\n ],\n seeAlso: ['linear-algebra.solve', 'matrix.rank'],\n },\n 'solve': {\n category: 'linear-algebra',\n description: 'Solves a system of linear equations represented by a matrix and a vector.',\n returns: {\n type: 'vector',\n },\n args: {\n a: {\n type: 'matrix',\n },\n b: {\n type: 'vector',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { solve } = import(\"linear-algebra\");\\nsolve([\\n [2, 1, -1, 1], \\n [4, 5, -3, 2], \\n [6, -2, 5, -3], \\n [8, 3, 2, 4]\\n], [5, 10, 2, 17])',\n 'let { solve } = import(\"linear-algebra\"); solve([[2, 0, 0], [3, 1, 0], [4, 5, 6]], [4, 5, 38])',\n 'let { solve } = import(\"linear-algebra\"); solve([[2, 3], [1, -1]], [8, 2])',\n ],\n seeAlso: ['linear-algebra.rref', 'matrix.inv'],\n },\n 'to-polar': {\n category: 'linear-algebra',\n description: 'Converts a 2D vector to polar coordinates.',\n returns: {\n type: 'vector',\n },\n args: {\n vector: {\n type: 'vector',\n description: '2D Vector to convert.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'vector',\n ],\n },\n ],\n examples: [\n 'let { to-polar } = import(\"linear-algebra\");\\nto-polar([1, 2])',\n 'let { to-polar } = import(\"linear-algebra\");\\nto-polar([3, 4])',\n ],\n seeAlso: ['linear-algebra.from-polar', 'linear-algebra.angle'],\n },\n 'from-polar': {\n category: 'linear-algebra',\n description: 'Converts polar coordinates to a 2D vector.',\n returns: {\n type: 'vector',\n },\n args: {\n polar: {\n type: 'vector',\n description: 'Polar coordinates to convert.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'polar',\n ],\n },\n ],\n examples: [\n 'let { from-polar } = import(\"linear-algebra\");\\nfrom-polar([1, PI / 4])',\n 'let { from-polar } = import(\"linear-algebra\");\\nfrom-polar([1, 0])',\n 'let { from-polar } = import(\"linear-algebra\");\\nfrom-polar([1, -PI / 2])',\n ],\n seeAlso: ['linear-algebra.to-polar'],\n },\n}\n","import { approxZero } from '../../../../utils'\n\n/**\n * Performs Gauss-Jordan elimination on a matrix, transforming it to reduced row echelon form\n *\n * @param matrix - The input matrix\n * @returns A tuple containing the reduced row echelon form matrix and the rank\n */\nexport function gaussJordanElimination(matrix: number[][]): [number[][], number] {\n // Create a copy of the matrix to avoid modifying the original\n const m = matrix.map(row => [...row])\n const rows = m.length\n const cols = m[0]!.length\n\n let rank = 0\n let rowsProcessed = 0\n\n // Row reduction to reduced row echelon form\n for (let col = 0; col < cols; col++) {\n // Find the pivot\n let pivotRow = -1\n\n for (let row = rowsProcessed; row < rows; row++) {\n if (!approxZero(m[row]![col]!)) {\n pivotRow = row\n break\n }\n }\n\n if (pivotRow === -1)\n continue // No pivot in this column\n\n // Increase rank\n rank += 1\n\n // Swap rows\n if (pivotRow !== rowsProcessed) {\n [m[pivotRow], m[rowsProcessed]] = [m[rowsProcessed]!, m[pivotRow]!]\n }\n\n // Get the pivot value\n const pivotValue = m[rowsProcessed]![col]!\n\n // Normalize the pivot row (always, for RREF)\n for (let j = col; j < cols; j++) {\n m[rowsProcessed]![j]! /= pivotValue\n }\n\n // Eliminate above and below (full Gauss-Jordan)\n for (let row = 0; row < rows; row++) {\n if (row !== rowsProcessed && !approxZero(m[row]![col]!)) {\n const factor = m[row]![col]!\n for (let j = col; j < cols; j++) {\n m[row]![j]! -= factor * m[rowsProcessed]![j]!\n }\n }\n }\n\n rowsProcessed++\n if (rowsProcessed === rows)\n break\n }\n\n return [m, rank]\n}\n","import { approxEqual, approxZero } from '../../../../utils'\n\nexport function areVectorsCollinear(vectorA: number[], vectorB: number[]): boolean {\n // Check if either vector is zero\n const isZeroVector = (vec: number[]): boolean =>\n vec.every(component => approxZero(component))\n\n if (isZeroVector(vectorA) || isZeroVector(vectorB)) {\n return true // Zero vector is technically collinear to all vectors\n }\n\n // Find the first non-zero component in vectorA\n let index = 0\n while (index < vectorA.length && approxZero(vectorA[index]!)) {\n index++\n }\n\n // Calculate the scale factor\n const ratio = vectorB[index]! / vectorA[index]!\n\n // Check if all other components maintain the same ratio\n for (let i = 0; i < vectorA.length; i++) {\n // Skip components where both vectors have (near) zero values\n if (approxZero(vectorA[i]!) && approxZero(vectorB[i]!))\n continue\n\n // If vectorA component is near zero but vectorB is not, vectors are not collinear\n if (approxZero(vectorA[i]!))\n return false\n\n // Check if the ratio is consistent\n if (!approxEqual(vectorB[i]! / vectorA[i]!, ratio)) {\n return false\n }\n }\n\n return true\n}\n\nexport function areVectorsParallel(vectorA: number[], vectorB: number[]): boolean {\n if (!areVectorsCollinear(vectorA, vectorB)) {\n return false\n }\n\n // Then verify they point in the same direction\n // Find first non-zero component in both vectors\n for (let i = 0; i < vectorA.length; i++) {\n if (!approxZero(vectorA[i]!) && !approxZero(vectorB[i]!)) {\n return Math.sign(vectorA[i]!) === Math.sign(vectorB[i]!)\n }\n }\n\n // If we get here, one of the vectors must be zero\n return true\n}\n","import { approxZero } from '../../../../utils'\n\nexport function isZeroVector(vector: number[]): boolean {\n return vector.every(component => approxZero(component))\n}\n","import { calcMean } from '../../vector/calcMean'\n\nexport function pearsonCorr(vectorA: number[], vectorB: number[]): number {\n const meanA = calcMean(vectorA)\n const meanB = calcMean(vectorB)\n\n let sumNumerator = 0\n let sumSquareA = 0\n let sumSquareB = 0\n\n for (let i = 0; i < vectorA.length; i++) {\n const diffA = vectorA[i]! - meanA\n const diffB = vectorB[i]! - meanB\n\n sumNumerator += diffA * diffB\n sumSquareA += diffA * diffA\n sumSquareB += diffB * diffB\n }\n\n // Check if either vector has zero variance\n if (sumSquareA === 0 || sumSquareB === 0) {\n throw new Error('Cannot calculate Pearson correlation coefficient: one of the vectors has zero variance.')\n }\n\n return sumNumerator / (Math.sqrt(sumSquareA) * Math.sqrt(sumSquareB))\n}\n","export function calcFractionalRanks(vector: number[]): number[] {\n // Create array of indices and sort by values\n const indices = [...vector.keys()].sort((a, b) => vector[a]! - vector[b]!)\n\n // Create ranks array (same size as input vector)\n const ranks: number[] = Array.from<number>({ length: vector.length }).fill(0)\n\n // Assign ranks, handling ties properly\n let currentRank = 1\n let i = 0\n while (i < indices.length) {\n const value = vector[indices[i]!]\n let j = i\n\n // Find all indices with the same value\n while (j < indices.length && vector[indices[j]!] === value) {\n j++\n }\n\n // Calculate average rank for ties\n const averageRank = currentRank + (j - i - 1) / 2\n\n // Assign average rank to all tied elements\n for (let k = i; k < j; k++) {\n ranks[indices[k]!] = averageRank\n }\n\n // Update current rank and index\n currentRank += j - i\n i = j\n }\n\n return ranks\n}\n","import { calcMean } from '../../vector/calcMean'\n\n/**\n * Calculate covariance between two segments\n */\nexport function calcCovariance(segmentA: number[], segmentB: number[]): number {\n const meanA = calcMean(segmentA)\n const meanB = calcMean(segmentB)\n\n let sum = 0\n for (let i = 0; i < segmentA.length; i++) {\n sum += (segmentA[i]! - meanA) * (segmentB[i]! - meanB)\n }\n\n return sum / segmentA.length\n}\n","import { LitsError } from '../../../../errors'\nimport type { SourceCodeInfo } from '../../../../tokenizer/token'\nimport { approxZero } from '../../../../utils'\n\nexport function getUnit<T extends number[]>(\n value: T,\n sourceCodeInfo: SourceCodeInfo | undefined,\n): T {\n if (value.length === 0) {\n return value\n }\n const length = Math.sqrt(value.reduce((acc, item) => acc + item ** 2, 0))\n if (approxZero(length)) {\n throw new LitsError('The vector must not be zero', sourceCodeInfo)\n }\n return value.map(item => item / length) as T\n}\n","export function dot(\n vector1: number[],\n vector2: number[],\n): number {\n return vector1.reduce((acc, item, index) => acc + item * vector2[index]!, 0)\n}\n","export function subtract<T extends number[]>(\n vector1: T,\n vector2: T,\n): T {\n return vector1.map((item, index) => item - vector2[index]!) as T\n}\n","export function scale<T extends number[]>(\n vector: T,\n scalar: number,\n): T {\n return vector.map(item => item * scalar) as T\n}\n","import { LitsError } from '../../../errors'\nimport { assert2dVector, assert3dVector, assertMatrix, assertNonEmptyVector, assertSquareMatrix, assertVector } from '../../../typeGuards/annotatedArrays'\nimport { assertNumber } from '../../../typeGuards/number'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\nimport type { LitsModule } from '../interface'\nimport { calcMean } from '../vector/calcMean'\nimport { calcMedad } from '../vector/calcMedad'\nimport { calcMedian } from '../vector/calcMedian'\nimport { calcStdDev } from '../vector/calcStdDev'\nimport { toFixedArity } from '../../../utils/arity'\nimport { moduleDocs } from './docs'\nimport { gaussJordanElimination } from './helpers/gaussJordanElimination'\nimport { solve } from './helpers/solve'\nimport { areVectorsCollinear, areVectorsParallel } from './helpers/collinear'\nimport { isZeroVector } from './helpers/isZeroVector'\nimport { pearsonCorr } from './helpers/pearsonCorr'\nimport { calcFractionalRanks } from './helpers/calcFractionalRanks'\nimport { kendallTau } from './helpers/kendallTau'\nimport { calcCovariance } from './helpers/covariance'\nimport { calcCorrelation, extractOverlappingSegments } from './helpers/corrleation'\nimport { getUnit } from './helpers/getUnit'\nimport { dot } from './helpers/dot'\nimport { subtract } from './helpers/subtract'\nimport { scale } from './helpers/scale'\nimport { length } from './helpers/length'\n\nexport const linearAlgebraNormalExpression: BuiltinNormalExpressions = {\n 'rotate2d': {\n evaluate: ([vector, radians], sourceCodeInfo): number[] => {\n assert2dVector(vector, sourceCodeInfo)\n if (isZeroVector(vector)) {\n return vector\n }\n assertNumber(radians, sourceCodeInfo, { finite: true })\n const cosTheta = Math.cos(radians)\n const sinTheta = Math.sin(radians)\n return [\n vector[0] * cosTheta - vector[1] * sinTheta,\n vector[0] * sinTheta + vector[1] * cosTheta,\n ]\n },\n arity: toFixedArity(2),\n },\n 'rotate3d': {\n evaluate: ([vector, axis, radians], sourceCodeInfo): number[] => {\n assert3dVector(vector, sourceCodeInfo)\n if (isZeroVector(vector)) {\n return vector\n }\n assertNumber(radians, sourceCodeInfo, { finite: true })\n assert3dVector(axis, sourceCodeInfo)\n if (isZeroVector(axis)) {\n throw new LitsError('Rotation axis must not be zero', sourceCodeInfo)\n }\n const cosTheta = Math.cos(radians)\n const sinTheta = Math.sin(radians)\n const [u, v, w] = getUnit(axis, sourceCodeInfo)\n const dotProduct = vector[0] * u + vector[1] * v + vector[2] * w\n return [\n dotProduct * u * (1 - cosTheta) + vector[0] * cosTheta + (-w * vector[1] + v * vector[2]) * sinTheta,\n dotProduct * v * (1 - cosTheta) + vector[1] * cosTheta + (w * vector[0] - u * vector[2]) * sinTheta,\n dotProduct * w * (1 - cosTheta) + vector[2] * cosTheta + (-v * vector[0] + u * vector[1]) * sinTheta,\n ]\n },\n arity: toFixedArity(3),\n },\n 'reflect': {\n evaluate: ([vector, normal], sourceCodeInfo): number[] => {\n assertVector(vector, sourceCodeInfo)\n assertVector(normal, sourceCodeInfo)\n if (vector.length !== normal.length) {\n throw new LitsError('Vectors must be of the same length', sourceCodeInfo)\n }\n if (isZeroVector(normal)) {\n throw new LitsError('Reflection normal must not be zero', sourceCodeInfo)\n }\n if (isZeroVector(vector)) {\n return vector\n }\n const unitNormal = getUnit(normal, sourceCodeInfo)\n const doubleDot = 2 * dot(vector, unitNormal)\n return subtract(vector, scale(unitNormal, doubleDot))\n },\n arity: toFixedArity(2),\n },\n 'refract': {\n evaluate: ([vector, normal, eta], sourceCodeInfo): number[] => {\n assertVector(vector, sourceCodeInfo)\n assertVector(normal, sourceCodeInfo)\n assertNumber(eta, sourceCodeInfo, { finite: true, positive: true })\n if (vector.length !== normal.length) {\n throw new LitsError('Vectors must be of the same length', sourceCodeInfo)\n }\n if (isZeroVector(normal)) {\n throw new LitsError('Refraction normal must not be zero', sourceCodeInfo)\n }\n if (isZeroVector(vector)) {\n return vector\n }\n // Make sure vectors are normalized\n const normalizedV = getUnit(vector, sourceCodeInfo)\n const normalizedNormal = getUnit(normal, sourceCodeInfo)\n\n // Calculate dot product between incident vector and normal\n const dotProduct = dot(normalizedV, normalizedNormal)\n\n // Calculate discriminant\n const discriminant = 1 - eta * eta * (1 - dotProduct * dotProduct)\n\n // Check for total internal reflection\n if (discriminant < 0) {\n return vector // Total internal reflection occurs\n }\n\n // Calculate the refracted vector\n const scaledIncident = scale(normalizedV, eta)\n const scaledNormal = scale(\n normalizedNormal,\n eta * dotProduct + Math.sqrt(discriminant),\n )\n\n return subtract(scaledIncident, scaledNormal)\n },\n arity: toFixedArity(3),\n },\n 'lerp': {\n evaluate: ([vectorA, vectorB, t], sourceCodeInfo): number[] => {\n assertVector(vectorA, sourceCodeInfo)\n assertVector(vectorB, sourceCodeInfo)\n assertNumber(t, sourceCodeInfo, { finite: true })\n if (vectorA.length !== vectorB.length) {\n throw new LitsError('Vectors must be of the same length', sourceCodeInfo)\n }\n return vectorA.map((val, i) => val + (vectorB[i]! - val) * t)\n },\n arity: toFixedArity(3),\n },\n 'dot': {\n evaluate: ([vectorA, vectorB], sourceCodeInfo): number => {\n assertVector(vectorA, sourceCodeInfo)\n assertVector(vectorB, sourceCodeInfo)\n\n if (vectorA.length !== vectorB.length) {\n throw new LitsError('Vectors must be of the same length', sourceCodeInfo)\n }\n\n return dot(vectorA, vectorB)\n },\n arity: toFixedArity(2),\n },\n 'cross': {\n evaluate: ([vectorA, vectorB], sourceCodeInfo): number[] => {\n assertVector(vectorA, sourceCodeInfo)\n assertVector(vectorB, sourceCodeInfo)\n\n if (vectorA.length !== 3 || vectorB.length !== 3) {\n throw new LitsError('Cross product is only defined for 3D vectors', sourceCodeInfo)\n }\n\n return [\n vectorA[1]! * vectorB[2]! - vectorA[2]! * vectorB[1]!,\n vectorA[2]! * vectorB[0]! - vectorA[0]! * vectorB[2]!,\n vectorA[0]! * vectorB[1]! - vectorA[1]! * vectorB[0]!,\n ] as number[]\n },\n arity: toFixedArity(2),\n },\n 'normalize-minmax': {\n evaluate: ([vector], sourceCodeInfo): number[] => {\n assertVector(vector, sourceCodeInfo)\n\n if (vector.length === 0) {\n return []\n }\n\n const min = vector.reduce((acc, val) => (val < acc ? val : acc), vector[0]!)\n const max = vector.reduce((acc, val) => (val > acc ? val : acc), vector[0]!)\n\n if (min === max) {\n return vector.map(() => 0)\n }\n\n return vector.map(val => (val - min) / (max - min))\n },\n arity: toFixedArity(1),\n },\n 'normalize-robust': {\n evaluate: ([vector], sourceCodeInfo): number[] => {\n assertVector(vector, sourceCodeInfo)\n\n if (vector.length === 0) {\n return []\n }\n\n const median = calcMedian(vector)\n const medad = calcMedad(vector)\n\n if (medad === 0) {\n return vector.map(val => val - median)\n }\n return vector.map(val => (val - median) / medad)\n },\n arity: toFixedArity(1),\n },\n 'normalize-zscore': {\n evaluate: ([vector], sourceCodeInfo): number[] => {\n assertVector(vector, sourceCodeInfo)\n\n const mean = calcMean(vector)\n const stdDev = calcStdDev(vector)\n\n if (stdDev === 0) {\n return vector.map(() => 0)\n }\n\n return vector.map(val => (val - mean) / stdDev)\n },\n arity: toFixedArity(1),\n },\n 'normalize-l1': {\n evaluate: ([vector], sourceCodeInfo): number[] => {\n assertVector(vector, sourceCodeInfo)\n if (vector.length === 0) {\n return []\n }\n const norm = vector.reduce((acc, val) => acc + Math.abs(val), 0)\n\n if (norm === 0) {\n return vector.map(() => 0)\n }\n\n return vector.map(val => val / norm)\n },\n arity: toFixedArity(1),\n },\n 'normalize-l2': {\n evaluate: ([vector], sourceCodeInfo): number[] => {\n assertVector(vector, sourceCodeInfo)\n return getUnit(vector, sourceCodeInfo)\n },\n arity: toFixedArity(1),\n },\n 'normalize-log': {\n evaluate: ([vector], sourceCodeInfo): number[] => {\n assertVector(vector, sourceCodeInfo)\n\n if (vector.length === 0) {\n return []\n }\n\n const min = Math.min(...vector)\n\n if (min <= 0) {\n throw new LitsError('Log normalization requires all values to be positive', sourceCodeInfo)\n }\n\n return vector.map(val => Math.log(val / min))\n },\n arity: toFixedArity(1),\n },\n 'angle': {\n evaluate: ([vectorA, vectorB], sourceCodeInfo): number => {\n assertNonEmptyVector(vectorA, sourceCodeInfo)\n assertNonEmptyVector(vectorB, sourceCodeInfo)\n if (isZeroVector(vectorA) || isZeroVector(vectorB)) {\n throw new LitsError('Cannot calculate angle with zero-length vector', sourceCodeInfo)\n }\n\n if (vectorA.length !== vectorB.length) {\n throw new LitsError('Vectors must be of the same length', sourceCodeInfo)\n }\n\n const dotProduct = vectorA.reduce((acc, val, i) => acc + val * vectorB[i]!, 0)\n const magnitudeA = Math.sqrt(vectorA.reduce((acc, val) => acc + val * val, 0))\n const magnitudeB = Math.sqrt(vectorB.reduce((acc, val) => acc + val * val, 0))\n\n return Math.acos(dotProduct / (magnitudeA * magnitudeB))\n },\n arity: toFixedArity(2),\n },\n 'projection': {\n evaluate: ([vectorA, vectorB], sourceCodeInfo): number[] => {\n assertNonEmptyVector(vectorA, sourceCodeInfo)\n assertNonEmptyVector(vectorB, sourceCodeInfo)\n if (isZeroVector(vectorB)) {\n throw new LitsError('Cannot project onto zero-length vector', sourceCodeInfo)\n }\n\n if (vectorA.length !== vectorB.length) {\n throw new LitsError('Vectors must be of the same length', sourceCodeInfo)\n }\n\n const dotProduct = vectorA.reduce((acc, val, i) => acc + val * vectorB[i]!, 0)\n const magnitudeB = Math.sqrt(vectorB.reduce((acc, val) => acc + val * val, 0))\n\n return vectorB.map(val => (dotProduct / (magnitudeB ** 2)) * val)\n },\n arity: toFixedArity(2),\n },\n 'orthogonal?': {\n evaluate: ([vectorA, vectorB], sourceCodeInfo): boolean => {\n assertNonEmptyVector(vectorA, sourceCodeInfo)\n assertNonEmptyVector(vectorB, sourceCodeInfo)\n\n if (vectorA.length !== vectorB.length) {\n throw new LitsError('Vectors must be of the same length', sourceCodeInfo)\n }\n\n const dotProduct = vectorA.reduce((acc, val, i) => acc + val * vectorB[i]!, 0)\n return dotProduct === 0\n },\n arity: toFixedArity(2),\n },\n 'parallel?': {\n evaluate: ([vectorA, vectorB], sourceCodeInfo): boolean => {\n assertNonEmptyVector(vectorA, sourceCodeInfo)\n assertNonEmptyVector(vectorB, sourceCodeInfo)\n\n if (vectorA.length !== vectorB.length) {\n throw new LitsError('Vectors must be of the same length', sourceCodeInfo)\n }\n\n return areVectorsParallel(vectorA, vectorB)\n },\n arity: toFixedArity(2),\n },\n 'collinear?': {\n evaluate: ([vectorA, vectorB], sourceCodeInfo): boolean => {\n assertNonEmptyVector(vectorA, sourceCodeInfo)\n assertNonEmptyVector(vectorB, sourceCodeInfo)\n\n if (vectorA.length !== vectorB.length) {\n throw new LitsError('Vectors must be of the same length', sourceCodeInfo)\n }\n\n return areVectorsCollinear(vectorA, vectorB)\n },\n arity: toFixedArity(2),\n },\n 'cosine-similarity': {\n evaluate: ([vectorA, vectorB], sourceCodeInfo): number => {\n assertNonEmptyVector(vectorA, sourceCodeInfo)\n assertNonEmptyVector(vectorB, sourceCodeInfo)\n if (isZeroVector(vectorA) || isZeroVector(vectorB)) {\n throw new LitsError('Cannot calculate cosine similarity with zero-length vector', sourceCodeInfo)\n }\n\n if (vectorA.length !== vectorB.length) {\n throw new LitsError('Vectors must be of the same length', sourceCodeInfo)\n }\n\n const dotProduct = vectorA.reduce((acc, val, i) => acc + val * vectorB[i]!, 0)\n const magnitudeA = Math.sqrt(vectorA.reduce((acc, val) => acc + val * val, 0))\n const magnitudeB = Math.sqrt(vectorB.reduce((acc, val) => acc + val * val, 0))\n\n return dotProduct / (magnitudeA * magnitudeB)\n },\n arity: toFixedArity(2),\n },\n 'euclidean-distance': {\n evaluate: ([vectorA, vectorB], sourceCodeInfo): number => {\n assertNonEmptyVector(vectorA, sourceCodeInfo)\n assertNonEmptyVector(vectorB, sourceCodeInfo)\n\n if (vectorA.length !== vectorB.length) {\n throw new LitsError('Vectors must be of the same length', sourceCodeInfo)\n }\n\n return Math.sqrt(vectorA.reduce((acc, val, i) => acc + (val - vectorB[i]!) ** 2, 0))\n },\n arity: toFixedArity(2),\n },\n 'euclidean-norm': {\n evaluate: ([vector], sourceCodeInfo): number => {\n assertNonEmptyVector(vector, sourceCodeInfo)\n\n return length(vector)\n },\n arity: toFixedArity(1),\n },\n 'manhattan-distance': {\n evaluate: ([vectorA, vectorB], sourceCodeInfo): number => {\n assertNonEmptyVector(vectorA, sourceCodeInfo)\n assertNonEmptyVector(vectorB, sourceCodeInfo)\n\n if (vectorA.length !== vectorB.length) {\n throw new LitsError('Vectors must be of the same length', sourceCodeInfo)\n }\n\n return vectorA.reduce((acc, val, i) => acc + Math.abs(val - vectorB[i]!), 0)\n },\n arity: toFixedArity(2),\n },\n 'manhattan-norm': {\n evaluate: ([vector], sourceCodeInfo): number => {\n assertNonEmptyVector(vector, sourceCodeInfo)\n\n return vector.reduce((acc, val) => acc + Math.abs(val), 0)\n },\n arity: toFixedArity(1),\n },\n 'hamming-distance': {\n evaluate: ([vectorA, vectorB], sourceCodeInfo): number => {\n assertNonEmptyVector(vectorA, sourceCodeInfo)\n assertNonEmptyVector(vectorB, sourceCodeInfo)\n\n if (vectorA.length !== vectorB.length) {\n throw new LitsError('Vectors must be of the same length', sourceCodeInfo)\n }\n\n return vectorA.reduce((acc, val, i) => acc + (val !== vectorB[i]! ? 1 : 0), 0)\n },\n arity: toFixedArity(2),\n },\n 'hamming-norm': {\n evaluate: ([vector], sourceCodeInfo): number => {\n assertNonEmptyVector(vector, sourceCodeInfo)\n return vector.reduce((acc, val) => acc + (val !== 0 ? 1 : 0), 0)\n },\n arity: toFixedArity(1),\n },\n 'chebyshev-distance': {\n evaluate: ([vectorA, vectorB], sourceCodeInfo): number => {\n assertNonEmptyVector(vectorA, sourceCodeInfo)\n assertNonEmptyVector(vectorB, sourceCodeInfo)\n\n if (vectorA.length !== vectorB.length) {\n throw new LitsError('Vectors must be of the same length', sourceCodeInfo)\n }\n\n return Math.max(...vectorA.map((val, i) => Math.abs(val - vectorB[i]!)))\n },\n arity: toFixedArity(2),\n },\n 'chebyshev-norm': {\n evaluate: ([vector], sourceCodeInfo): number => {\n assertNonEmptyVector(vector, sourceCodeInfo)\n return Math.max(...vector.map(val => Math.abs(val)))\n },\n arity: toFixedArity(1),\n },\n 'minkowski-distance': {\n evaluate: ([vectorA, vectorB, p], sourceCodeInfo): number => {\n assertNonEmptyVector(vectorA, sourceCodeInfo)\n assertNonEmptyVector(vectorB, sourceCodeInfo)\n assertNumber(p, sourceCodeInfo, { finite: true, positive: true })\n\n if (vectorA.length !== vectorB.length) {\n throw new LitsError('Vectors must be of the same length', sourceCodeInfo)\n }\n\n return vectorA.reduce((acc, val, i) => acc + Math.abs(val - vectorB[i]!) ** p, 0) ** (1 / p)\n },\n arity: toFixedArity(3),\n },\n 'minkowski-norm': {\n evaluate: ([vector, p], sourceCodeInfo): number => {\n assertNonEmptyVector(vector, sourceCodeInfo)\n assertNumber(p, sourceCodeInfo, { finite: true, positive: true })\n return vector.reduce((acc, val) => acc + Math.abs(val) ** p, 0) ** (1 / p)\n },\n arity: toFixedArity(2),\n },\n 'cov': {\n evaluate: ([vectorA, vectorB], sourceCodeInfo): number => {\n assertNonEmptyVector(vectorA, sourceCodeInfo)\n assertNonEmptyVector(vectorB, sourceCodeInfo)\n\n if (vectorA.length !== vectorB.length) {\n throw new LitsError('Vectors must be of the same length', sourceCodeInfo)\n }\n if (vectorA.length === 1) {\n return 0\n }\n\n return calcCovariance(vectorA, vectorB)\n },\n arity: toFixedArity(2),\n },\n 'corr': {\n evaluate: ([vectorA, vectorB], sourceCodeInfo): number => {\n assertVector(vectorA, sourceCodeInfo)\n assertVector(vectorB, sourceCodeInfo)\n\n if (vectorA.length <= 1) {\n throw new LitsError('Vectors must have at least 2 elements for corr', sourceCodeInfo)\n }\n\n if (vectorA.length !== vectorB.length) {\n throw new LitsError('Vectors must be of the same length', sourceCodeInfo)\n }\n\n const meanA = calcMean(vectorA)\n const meanB = calcMean(vectorB)\n\n const numerator = vectorA.reduce((acc, val, i) => acc + (val - meanA) * (vectorB[i]! - meanB), 0)\n const denominator = Math.sqrt(\n vectorA.reduce((acc, val) => acc + (val - meanA) ** 2, 0) * vectorB.reduce((acc, val) => acc + (val - meanB) ** 2, 0),\n )\n\n return numerator / denominator\n },\n arity: toFixedArity(2),\n },\n 'spearman-corr': {\n evaluate: ([vectorA, vectorB], sourceCodeInfo): number => {\n assertVector(vectorA, sourceCodeInfo)\n assertVector(vectorB, sourceCodeInfo)\n\n if (vectorA.length <= 1) {\n throw new LitsError('Vectors must have at least 2 elements for corr', sourceCodeInfo)\n }\n\n if (vectorA.length !== vectorB.length) {\n throw new LitsError('Vectors must be of the same length', sourceCodeInfo)\n }\n\n const ranksA = calcFractionalRanks(vectorA)\n const ranksB = calcFractionalRanks(vectorB)\n\n try {\n return pearsonCorr(ranksA, ranksB)\n }\n catch (error) {\n throw new LitsError(error, sourceCodeInfo)\n }\n },\n arity: toFixedArity(2),\n },\n 'pearson-corr': {\n evaluate: ([vectorA, vectorB], sourceCodeInfo): number => {\n assertVector(vectorA, sourceCodeInfo)\n assertVector(vectorB, sourceCodeInfo)\n\n if (vectorA.length <= 1) {\n throw new LitsError('Vectors must have at least 2 elements for pearson-corr', sourceCodeInfo)\n }\n\n if (vectorA.length !== vectorB.length) {\n throw new LitsError('Vectors must be of the same length', sourceCodeInfo)\n }\n\n try {\n return pearsonCorr(vectorA, vectorB)\n }\n catch (error) {\n throw new LitsError(error, sourceCodeInfo)\n }\n },\n arity: toFixedArity(2),\n },\n 'kendall-tau': {\n evaluate: ([vectorA, vectorB], sourceCodeInfo): number => {\n assertVector(vectorA, sourceCodeInfo)\n assertVector(vectorB, sourceCodeInfo)\n\n if (vectorA.length < 2) {\n throw new LitsError('Vectors must have at least 2 elements for kendall-tau', sourceCodeInfo)\n }\n\n if (vectorA.length !== vectorB.length) {\n throw new LitsError('Vectors must be of the same length', sourceCodeInfo)\n }\n\n try {\n return kendallTau(vectorA, vectorB)\n }\n catch (error) {\n throw new LitsError(error, sourceCodeInfo)\n }\n },\n arity: toFixedArity(2),\n },\n 'autocorrelation': {\n evaluate: ([vector, lag], sourceCodeInfo): number => {\n assertVector(vector, sourceCodeInfo)\n if (vector.length < 2) {\n throw new LitsError('Vector must have at least 2 elements for autocorrelation', sourceCodeInfo)\n }\n\n assertNumber(lag, sourceCodeInfo, {\n integer: true,\n lt: vector.length,\n gt: -vector.length,\n })\n\n // For lag 0, return 1 (a series is perfectly correlated with itself)\n if (lag === 0) {\n return 1\n }\n const absLag = Math.abs(lag)\n const mean = calcMean(vector)\n\n // Calculate the numerator (sum of products of deviations)\n let numerator = 0\n const n = vector.length\n\n // If lag is positive, correlate current with past values\n // If lag is negative, correlate current with future values (same calculation, different interpretation)\n for (let i = 0; i < n - absLag; i++) {\n const currentIndex = lag < 0 ? i + absLag : i\n const laggedIndex = lag < 0 ? i : i + absLag\n\n numerator += (vector[currentIndex]! - mean) * (vector[laggedIndex]! - mean)\n }\n\n // Calculate the denominator (sum of squared deviations)\n let denominator = 0\n for (let i = 0; i < n; i++) {\n denominator += (vector[i]! - mean) ** 2\n }\n\n // Handle edge case of zero variance\n if (denominator === 0) {\n return 0 // Conventional definition\n }\n\n // Return the autocorrelation coefficient\n return numerator / denominator\n },\n arity: toFixedArity(2),\n },\n\n 'cross-correlation': {\n evaluate: ([vectorA, vectorB, lag], sourceCodeInfo): number => {\n assertVector(vectorA, sourceCodeInfo)\n assertVector(vectorB, sourceCodeInfo)\n\n if (vectorA.length < 2) {\n throw new LitsError('Vectors must have at least 2 elements', sourceCodeInfo)\n }\n\n if (vectorA.length !== vectorB.length) {\n throw new LitsError('Vectors must be of the same length', sourceCodeInfo)\n }\n\n assertNumber(lag, sourceCodeInfo, {\n integer: true,\n lt: vectorA.length,\n gt: -vectorA.length,\n })\n\n // For lag 0 between identical vectors, return 1\n if (lag === 0\n && vectorA.length === vectorB.length\n && vectorA.every((v, i) => v === vectorB[i])) {\n return 1\n }\n\n const [segmentA, segmentB] = extractOverlappingSegments(vectorA, vectorB, lag)\n return calcCorrelation(segmentA, segmentB)\n },\n arity: toFixedArity(3),\n },\n 'rref': {\n evaluate: ([matrix], sourceCodeInfo): number[][] => {\n assertMatrix(matrix, sourceCodeInfo)\n\n // Reduced Row Echelon Form (RREF)\n const [rref] = gaussJordanElimination(matrix)\n return rref\n },\n arity: toFixedArity(1),\n },\n 'solve': {\n evaluate: ([matrix, vector], sourceCodeInfo): number[] | null => {\n assertSquareMatrix(matrix, sourceCodeInfo)\n assertVector(vector, sourceCodeInfo)\n if (matrix.length !== vector.length) {\n throw new LitsError(`The number of rows in the matrix must be equal to the length of the vector, but got ${matrix.length} and ${vector.length}`, sourceCodeInfo)\n }\n return solve(matrix, vector)\n },\n arity: toFixedArity(2),\n },\n 'to-polar': {\n evaluate: ([vector], sourceCodeInfo): number[] => {\n assert2dVector(vector, sourceCodeInfo)\n if (isZeroVector(vector)) {\n return [0, 0]\n }\n const r = Math.sqrt(vector[0] ** 2 + vector[1] ** 2)\n const theta = Math.atan2(vector[1], vector[0])\n return [r, theta]\n },\n arity: toFixedArity(1),\n },\n 'from-polar': {\n evaluate: ([polar], sourceCodeInfo): number[] => {\n assert2dVector(polar, sourceCodeInfo)\n const [r, theta] = polar\n if (r === 0) {\n return [0, 0]\n }\n return [r * Math.cos(theta), r * Math.sin(theta)]\n },\n arity: toFixedArity(1),\n },\n}\n\nfor (const [key, docs] of Object.entries(moduleDocs)) {\n if (linearAlgebraNormalExpression[key])\n linearAlgebraNormalExpression[key].docs = docs\n}\n\nexport const linearAlgebraModule: LitsModule = {\n name: 'linear-algebra',\n functions: linearAlgebraNormalExpression,\n}\n","export function length(vector: number[]): number {\n return Math.sqrt(vector.reduce((acc, item) => acc + item ** 2, 0))\n}\n","/**\n * Calculates Kendall's Tau-b rank correlation coefficient between two vectors\n * This implementation handles ties and uses an epsilon value for floating-point comparisons\n *\n * @param vectorA - First vector of numbers\n * @param vectorB - Second vector of numbers\n * @param epsilon - Threshold for considering two values as equal (default: 1e-10)\n * @returns The Kendall's Tau-b correlation coefficient\n */\nexport function kendallTau(vectorA: number[], vectorB: number[], epsilon: number = 1e-10): number {\n let concordant = 0\n let discordant = 0\n let tiesInA = 0\n let tiesInB = 0\n\n // Compare all pairs\n for (let i = 0; i < vectorA.length; i++) {\n for (let j = i + 1; j < vectorA.length; j++) {\n // Calculate differences\n const diffA = vectorA[i]! - vectorA[j]!\n const diffB = vectorB[i]! - vectorB[j]!\n\n // Check for ties using epsilon\n const isTieA = Math.abs(diffA) < epsilon\n const isTieB = Math.abs(diffB) < epsilon\n\n if (isTieA && isTieB) {\n // Tied in both vectors\n continue\n }\n else if (isTieA) {\n // Tied in vector A only\n tiesInA += 1\n }\n else if (isTieB) {\n // Tied in vector B only\n tiesInB += 1\n }\n else if (diffA * diffB > 0) {\n // Concordant pair\n concordant += 1\n }\n else {\n // Discordant pair\n discordant += 1\n }\n }\n }\n\n const n1 = concordant + discordant + tiesInA\n const n2 = concordant + discordant + tiesInB\n\n // Handle edge cases to avoid division by zero\n if (n1 === 0 || n2 === 0) {\n throw new Error('Not enough data to calculate Kendall\\'s Tau')\n }\n\n // Kendall's Tau-b formula\n return (concordant - discordant) / Math.sqrt(n1 * n2)\n}\n","import { calcMean } from '../../vector/calcMean'\nimport { calcStdDev } from '../../vector/calcStdDev'\nimport { calcCovariance } from './covariance'\n\n/**\n * Calculate Pearson correlation between two segments\n */\nexport function calcCorrelation(segmentA: number[], segmentB: number[]): number {\n const meanA = calcMean(segmentA)\n const meanB = calcMean(segmentB)\n\n const stdA = calcStdDev(segmentA, meanA)\n const stdB = calcStdDev(segmentB, meanB)\n\n // Handle zero variance\n if (stdA === 0 || stdB === 0) {\n // If both have zero variance and are the same constant, they're perfectly correlated\n if (stdA === 0 && stdB === 0 && meanA === meanB) {\n return 1\n }\n // Otherwise, no meaningful correlation can be established\n return 0\n }\n\n const covariance = calcCovariance(segmentA, segmentB)\n return covariance / (stdA * stdB)\n}\n\n/**\n * Extract overlapping segments from two vectors based on lag\n */\nexport function extractOverlappingSegments(\n vectorA: number[],\n vectorB: number[],\n lag: number,\n): [number[], number[]] {\n const absLag = Math.abs(lag)\n const overlapLength = vectorA.length - absLag\n\n let segmentA = []\n let segmentB = []\n\n if (lag >= 0) {\n segmentA = vectorA.slice(0, overlapLength)\n segmentB = vectorB.slice(lag, lag + overlapLength)\n }\n else {\n segmentA = vectorA.slice(absLag)\n segmentB = vectorB.slice(0, overlapLength)\n }\n\n return [segmentA, segmentB]\n}\n","import { approxZero } from '../../../../utils'\nimport { gaussJordanElimination } from './gaussJordanElimination'\n\n/**\n * Solves a system of linear equations Ax = b\n *\n * @param A - The coefficient matrix\n * @param b - The constant vector\n * @returns The solution vector x, or null if no unique solution exists\n */\nexport function solve(A: number[][], b: number[]): number[] | null {\n const n = A.length\n\n // Create augmented matrix [A|b]\n const augmented = A.map((row, i) => [...row, b[i]!])\n\n // Convert to row echelon form using your existing function\n const [echelon] = gaussJordanElimination(augmented)\n\n // Check if the system has a unique solution\n for (let i = 0; i < n; i += 1) {\n if (approxZero(echelon[i]![i]!)) {\n return null // No unique solution\n }\n }\n\n // Back substitution\n const x = Array.from({ length: n }, () => 0)\n for (let i = n - 1; i >= 0; i--) {\n let sum = 0\n for (let j = i + 1; j < n; j++) {\n sum += echelon[i]![j]! * x[j]!\n }\n x[i] = (echelon[i]![n]! - sum) / echelon[i]![i]!\n }\n\n return x\n}\n","import type { FunctionDocs } from '../../interface'\n\nexport const moduleDocs: Record<string, FunctionDocs> = {\n 'mul': {\n category: 'matrix',\n description: 'Multiplies two `matrices` using standard `matrix` multiplication based on **dot products** of rows and columns.',\n returns: {\n type: 'matrix',\n },\n args: {\n a: {\n type: 'matrix',\n },\n b: {\n type: 'matrix',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { mul } = import(\"matrix\");\\nmul([[1, 2], [3, 4]], [[5, 6], [7, 8]])',\n 'let { mul } = import(\"matrix\");\\nmul([[1, 2, 3], [4, 5, 6]], [[7, 8], [9, 10], [11, 12]])',\n ],\n seeAlso: ['matrix.det', 'matrix.inv'],\n },\n 'det': {\n category: 'matrix',\n description: 'Calculates the **determinant** of a square matrix.',\n returns: {\n type: 'number',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to calculate the determinant of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { det } = import(\"matrix\");\\ndet([[1, 2], [3, 4]])',\n 'let { det } = import(\"matrix\");\\ndet([[1, 2, 3], [4, 5, 6], [7, 8, 9]])',\n ],\n seeAlso: ['matrix.inv', 'matrix.cofactor', 'matrix.adj', 'matrix.trace', 'matrix.rank', 'matrix.invertible?', 'matrix.mul', 'matrix.minor'],\n },\n 'inv': {\n category: 'matrix',\n description: 'Calculates the **inverse** of a square matrix.',\n returns: {\n type: 'matrix',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to calculate the inverse of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { inv } = import(\"matrix\");\\ninv([[1, 2], [3, 4]])',\n 'let { inv } = import(\"matrix\");\\ninv([[1, 2, 3], [4, 5, 7], [7, 8, 10]])',\n ],\n seeAlso: ['matrix.det', 'matrix.adj', 'matrix.invertible?', 'linear-algebra.solve', 'matrix.mul', 'matrix.orthogonal?'],\n },\n 'adj': {\n category: 'matrix',\n description: 'Calculates the **adjugate** of a square matrix.',\n returns: {\n type: 'matrix',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to calculate the adjugate of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { adj } = import(\"matrix\");\\nadj([[1, 2], [3, 4]])',\n 'let { adj } = import(\"matrix\");\\nadj([[1, 2, 3], [4, 5, 6], [7, 8, 9]])',\n 'let { adj } = import(\"matrix\");\\nadj([[1, 2, 3], [7, 8, 9], [4, 5, 6]])',\n ],\n seeAlso: ['matrix.cofactor', 'matrix.det', 'matrix.inv'],\n },\n 'cofactor': {\n category: 'matrix',\n description: 'Calculates the **cofactor** of a square matrix.',\n returns: {\n type: 'matrix',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to calculate the cofactor of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { cofactor } = import(\"matrix\");\\ncofactor([[1, 2], [3, 4]])',\n 'let { cofactor } = import(\"matrix\");\\ncofactor([[1, 2, 3], [4, 5, 6], [7, 8, 9]])',\n 'let { cofactor } = import(\"matrix\");\\ncofactor([[1, 2, 3], [7, 8, 9], [4, 5, 6]])',\n ],\n seeAlso: ['matrix.adj', 'matrix.minor', 'matrix.det'],\n },\n 'minor': {\n category: 'matrix',\n description: 'Calculates the **minor** of a square matrix.',\n returns: {\n type: 'matrix',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to calculate the minor of.',\n },\n row: {\n type: 'integer',\n description: 'The row index of the element to calculate the minor for.',\n },\n col: {\n type: 'integer',\n description: 'The column index of the element to calculate the minor for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n 'row',\n 'col',\n ],\n },\n ],\n examples: [\n 'let { minor } = import(\"matrix\");\\nminor([[1, 2], [3, 4]], 0, 1)',\n 'let { minor } = import(\"matrix\");\\nminor([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 1, 1)',\n ],\n seeAlso: ['matrix.cofactor', 'matrix.det'],\n },\n 'trace': {\n category: 'matrix',\n description: 'Calculates the **trace** of a square matrix.',\n returns: {\n type: 'number',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to calculate the trace of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { trace } = import(\"matrix\");\\ntrace([[1, 2], [3, 4]])',\n 'let { trace } = import(\"matrix\");\\ntrace([[1, 2, 3], [4, 5, 6], [7, 8, 9]])',\n ],\n seeAlso: ['matrix.det', 'matrix.diagonal?'],\n },\n 'symmetric?': {\n category: 'matrix',\n description: 'Checks if a `matrix` is **symmetric**.',\n returns: {\n type: 'boolean',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to check for symmetry.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { symmetric? } = import(\"matrix\");\\nsymmetric?([[1, 2], [2, 1]])',\n 'let { symmetric? } = import(\"matrix\");\\nsymmetric?([[1, 2, 3], [2, 1, 4], [3, 4, 1]])',\n ],\n seeAlso: ['matrix.orthogonal?', 'matrix.diagonal?', 'matrix.square?', 'matrix.hilbert'],\n },\n 'triangular?': {\n category: 'matrix',\n description: 'Checks if a `matrix` is **triangular**.',\n returns: {\n type: 'boolean',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to check for triangularity.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { triangular? } = import(\"matrix\");\\ntriangular?([[2, 0], [0, 1]])',\n 'let { triangular? } = import(\"matrix\");\\ntriangular?([[1, 2, 3], [0, 4, 5], [0, 0, 6]])',\n ],\n seeAlso: ['matrix.upper-triangular?', 'matrix.lower-triangular?', 'matrix.diagonal?', 'matrix.banded?'],\n },\n 'upper-triangular?': {\n category: 'matrix',\n description: 'Checks if a `matrix` is **upper triangular**.',\n returns: {\n type: 'boolean',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to check for upper triangularity.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { upper-triangular? } = import(\"matrix\");\\nupper-triangular?([[1, 2], [0, 3]])',\n 'let { upper-triangular? } = import(\"matrix\");\\nupper-triangular?([[1, 2, 3], [0, 4, 5], [0, 0, 6]])',\n ],\n seeAlso: ['matrix.lower-triangular?', 'matrix.triangular?', 'matrix.diagonal?'],\n },\n 'lower-triangular?': {\n category: 'matrix',\n description: 'Checks if a `matrix` is **lower triangular**.',\n returns: {\n type: 'boolean',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to check for lower triangularity.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { lower-triangular? } = import(\"matrix\");\\nlower-triangular?([[1, 0], [2, 3]])',\n 'let { lower-triangular? } = import(\"matrix\");\\nlower-triangular?([[1, 0, 0], [2, 3, 0], [4, 5, 6]])',\n ],\n seeAlso: ['matrix.upper-triangular?', 'matrix.triangular?', 'matrix.diagonal?'],\n },\n 'diagonal?': {\n category: 'matrix',\n description: 'Checks if a `matrix` is **diagonal**.',\n returns: {\n type: 'boolean',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to check for diagonal property.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { diagonal? } = import(\"matrix\");\\ndiagonal?([[1, 0], [0, 2]])',\n 'let { diagonal? } = import(\"matrix\");\\ndiagonal?([[1, 0, 0], [0, 2, 0], [0, 0, 3]])',\n 'let { diagonal? } = import(\"matrix\");\\ndiagonal?([[1, 0, 0], [2, 2, 2], [0, 0, 3]])',\n ],\n seeAlso: ['matrix.identity?', 'matrix.symmetric?', 'matrix.triangular?', 'matrix.trace', 'matrix.upper-triangular?', 'matrix.lower-triangular?', 'matrix.band', 'matrix.banded?'],\n },\n 'square?': {\n category: 'matrix',\n description: 'Checks if a `matrix` is **square**.',\n returns: {\n type: 'boolean',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to check for square property.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { square? } = import(\"matrix\");\\nsquare?([[1, 2], [3, 4]])',\n 'let { square? } = import(\"matrix\");\\nsquare?([[1, 2, 3], [4, 5, 6], [7, 8, 9]])',\n 'let { square? } = import(\"matrix\");\\nsquare?([[1, 2, 3], [4, 5, 6]])',\n ],\n seeAlso: ['matrix.symmetric?', 'matrix.identity?', 'matrix.invertible?'],\n },\n 'orthogonal?': {\n category: 'matrix',\n description: 'Checks if a `matrix` is **orthogonal**.',\n returns: {\n type: 'boolean',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to check for **orthogonality**.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { orthogonal? } = import(\"matrix\");\\northogonal?([[1, 0], [0, 1]])',\n 'let { orthogonal? } = import(\"matrix\");\\northogonal?([[1, 0], [0, -1]])',\n 'let { orthogonal? } = import(\"matrix\");\\northogonal?([[1, 2], [3, 4]])',\n ],\n seeAlso: ['matrix.symmetric?', 'matrix.inv', 'matrix.identity?', 'linear-algebra.orthogonal?'],\n },\n 'identity?': {\n category: 'matrix',\n description: 'Checks if a `matrix` is an **identity matrix**.',\n returns: {\n type: 'boolean',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to check for identity property.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { identity? } = import(\"matrix\");\\nidentity?([[1, 0], [0, 1]])',\n 'let { identity? } = import(\"matrix\");\\nidentity?([[1, 0, 0], [0, 1, 0], [0, 0, 1]])',\n 'let { identity? } = import(\"matrix\");\\nidentity?([[1, 0, 0], [0, 1, 0], [0, 0, 0]])',\n ],\n seeAlso: ['matrix.diagonal?', 'matrix.square?', 'matrix.orthogonal?'],\n },\n 'invertible?': {\n category: 'matrix',\n description: 'Checks if a `matrix` is **invertible**.',\n returns: {\n type: 'boolean',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to check for invertibility.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { invertible? } = import(\"matrix\");\\ninvertible?([[1, 2], [3, 4]])',\n 'let { invertible? } = import(\"matrix\");\\ninvertible?([[1, 2, 3], [4, 5, 6], [7, 8, 9]])',\n 'let { invertible? } = import(\"matrix\");\\ninvertible?([[1, 2], [2, 4]])',\n ],\n seeAlso: ['matrix.det', 'matrix.inv', 'matrix.rank', 'matrix.square?'],\n },\n 'hilbert': {\n category: 'matrix',\n description: 'Generates a **Hilbert matrix** of size `n`.',\n returns: {\n type: 'matrix',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The size of the Hilbert matrix.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { hilbert } = import(\"matrix\");\\nhilbert(3)',\n 'let { hilbert } = import(\"matrix\");\\nhilbert(4)',\n ],\n seeAlso: ['matrix.vandermonde', 'matrix.symmetric?'],\n },\n 'vandermonde': {\n category: 'matrix',\n description: 'Generates a **Vandermonde matrix** from a vector.',\n returns: {\n type: 'matrix',\n },\n args: {\n v: {\n type: 'vector',\n description: 'The vector to generate the Vandermonde matrix from.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'v',\n ],\n },\n ],\n examples: [\n 'let { vandermonde } = import(\"matrix\");\\nvandermonde([1, 2, 3])',\n 'let { vandermonde } = import(\"matrix\");\\nvandermonde([1, 0, 1])',\n ],\n seeAlso: ['matrix.hilbert', 'matrix.band'],\n },\n 'band': {\n category: 'matrix',\n description: 'Generates a **banded matrix** of size `n` with lower band index `lband` and upper band index `uband`.',\n returns: {\n type: 'matrix',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The size of the banded matrix.',\n },\n lband: {\n type: 'integer',\n description: 'The lower band index.',\n },\n uband: {\n type: 'integer',\n description: 'The upper band index.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n 'lband',\n 'uband',\n ],\n },\n ],\n examples: [\n 'let { band } = import(\"matrix\");\\nband(3, 1, 1)',\n 'let { band } = import(\"matrix\");\\nband(4, 1, 2)',\n ],\n seeAlso: ['matrix.banded?', 'matrix.diagonal?', 'matrix.vandermonde'],\n },\n 'banded?': {\n category: 'matrix',\n description: 'Checks if a `matrix` is **banded** with lower band index `lband` and upper band index `uband`.',\n returns: {\n type: 'boolean',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to check for **banded** property.',\n },\n lband: {\n type: 'integer',\n description: 'The lower band index.',\n },\n uband: {\n type: 'integer',\n description: 'The upper band index.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n 'lband',\n 'uband',\n ],\n },\n ],\n examples: [\n 'let { banded? } = import(\"matrix\");\\nbanded?([\\n [1, 1, 1, 0],\\n [1, 1, 1, 1],\\n [1, 1, 1, 1],\\n [0, 1, 1, 1],\\n], 2, 2)',\n 'let { banded? } = import(\"matrix\");\\nbanded?([\\n [1, 1, 1, 0],\\n [1, 1, 1, 1],\\n [1, 1, 1, 1],\\n [0, 1, 1, 1],\\n], 1, 1)',\n ],\n seeAlso: ['matrix.band', 'matrix.triangular?', 'matrix.diagonal?'],\n },\n 'rank': {\n category: 'matrix',\n description: 'Calculates the **rank** of a matrix using **Gaussian elimination**.',\n returns: {\n type: 'number',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to calculate the rank of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { rank } = import(\"matrix\");\\nrank([[1, 0, 0], [0, 1, 0], [0, 0, 1]])',\n 'let { rank } = import(\"matrix\");\\nrank([[1, 2, 3], [4, 5, 6], [7, 8, 9]])',\n 'let { rank } = import(\"matrix\");\\nrank([[2, 4, 6], [3, 6, 9], [4, 8, 12]])',\n ],\n seeAlso: ['matrix.det', 'matrix.invertible?', 'linear-algebra.rref'],\n },\n 'frobenius-norm': {\n category: 'matrix',\n description: 'Calculates the **Frobenius norm** of a matrix.',\n returns: {\n type: 'number',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to calculate the Frobenius norm of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { frobenius-norm } = import(\"matrix\");\\nfrobenius-norm([[1, 2], [3, 4]])',\n 'let { frobenius-norm } = import(\"matrix\");\\nfrobenius-norm([[1, 2, 3], [4, 5, 6], [7, 8, 9]])',\n ],\n seeAlso: ['matrix.one-norm', 'matrix.inf-norm', 'matrix.max-norm'],\n },\n 'one-norm': {\n category: 'matrix',\n description: 'Calculates the **one-norm** (column norm) of a matrix.',\n returns: {\n type: 'number',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to calculate the one-norm of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { one-norm } = import(\"matrix\");\\none-norm([[1, 2], [3, 4]])',\n 'let { one-norm } = import(\"matrix\");\\none-norm([[1, 2, 3], [4, 5, 6], [7, 8, 9]])',\n ],\n seeAlso: ['matrix.frobenius-norm', 'matrix.inf-norm', 'matrix.max-norm'],\n },\n 'inf-norm': {\n category: 'matrix',\n description: 'Calculates the **infinity norm** of a matrix.',\n returns: {\n type: 'number',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to calculate the infinity norm of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { inf-norm } = import(\"matrix\");\\ninf-norm([[1, 2], [3, 4]])',\n 'let { inf-norm } = import(\"matrix\");\\ninf-norm([[1, 2, 3], [4, 5, 6], [7, 8, 9]])',\n ],\n seeAlso: ['matrix.frobenius-norm', 'matrix.one-norm', 'matrix.max-norm'],\n },\n 'max-norm': {\n category: 'matrix',\n description: 'Calculates the **max norm** of a matrix.',\n returns: {\n type: 'number',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to calculate the max norm of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { max-norm } = import(\"matrix\");\\nmax-norm([[1, 2], [3, 4]])',\n 'let { max-norm } = import(\"matrix\");\\nmax-norm([[1, 2, 3], [4, 5, 6], [7, 8, 9]])',\n ],\n seeAlso: ['matrix.frobenius-norm', 'matrix.one-norm', 'matrix.inf-norm'],\n },\n}\n","import { approxZero } from '../../../../utils'\n\n/**\n * Calculates the determinant of a matrix using Gaussian Elimination\n * @param matrix A square matrix represented as a 2D array\n * @returns The determinant of the matrix\n */\nexport function determinant(matrix: number[][]): number {\n // First, make a deep copy of the matrix to avoid modifying the original\n const n = matrix.length\n const A: number[][] = []\n\n for (let i = 0; i < n; i++) {\n A[i] = [...matrix[i]!]\n }\n\n // Handle special cases for small matrices\n if (n === 1) {\n return A[0]![0]!\n }\n\n if (n === 2) {\n return A[0]![0]! * A[1]![1]! - A[0]![1]! * A[1]![0]!\n }\n\n // For larger matrices, use Gaussian elimination\n let sign = 1 // Track sign changes from row swaps\n\n // Perform Gaussian elimination to get an upper triangular matrix\n for (let i = 0; i < n - 1; i += 1) {\n // Find pivot (maximum element in current column)\n let maxRow = i\n\n for (let j = i + 1; j < n; j += 1) {\n if (Math.abs(A[j]![i]!) > Math.abs(A[maxRow]![i]!)) {\n maxRow = j\n }\n }\n\n // If the pivot is zero, the determinant is zero\n if (approxZero(A[maxRow]![i]!)) {\n return 0\n }\n\n // Swap rows if necessary\n if (maxRow !== i) {\n [A[i], A[maxRow]] = [A[maxRow]!, A[i]!] // ES6 array destructuring for swap\n sign = -sign // Each row swap changes the sign\n }\n\n // Eliminate entries below the pivot\n for (let j = i + 1; j < n; j += 1) {\n const factor = A[j]![i]! / A[i]![i]!\n\n // Subtract (factor * pivot row) from current row\n for (let k = i; k < n; k++) {\n A[j]![k]! -= factor * A[i]![k]!\n }\n }\n }\n\n // Calculate determinant as the product of diagonal elements\n let det = sign\n for (let i = 0; i < n; i++) {\n det *= A[i]![i]!\n }\n\n return det\n}\n","export function minor(matrix: number[][], row: number, col: number): number[][] {\n const n = matrix.length\n const result: number[][] = []\n\n for (let i = 0; i < n; i++) {\n if (i !== row) {\n const minorRow: number[] = []\n for (let j = 0; j < n; j++) {\n if (j !== col) {\n minorRow.push(matrix[i]![j]!)\n }\n }\n result.push(minorRow)\n }\n }\n\n return result\n}\n","import { determinant } from './determinant'\nimport { minor } from './minor'\n\nexport function adjugate(matrix: number[][]): number[][] {\n const n = matrix.length\n const adj: number[][] = []\n for (let i = 0; i < n; i++) {\n adj[i] = []\n for (let j = 0; j < n; j++) {\n const min = minor(matrix, j, i)\n const sign = (-1) ** (i + j)\n const cofactor = sign * determinant(min)\n adj[i]![j] = cofactor\n }\n }\n return adj\n}\n","export function isSquare(matrix: number[][]): boolean {\n return matrix.length === matrix[0]!.length\n}\n","import { approxEqual, approxZero } from '../../../../utils'\nimport { isSquare } from './isSquare'\n\nexport function isIdentity(matrix: number[][]): boolean {\n if (!isSquare(matrix)) {\n return false\n }\n const n = matrix.length\n\n for (let i = 0; i < n; i++) {\n for (let j = 0; j < n; j++) {\n if (i === j) {\n if (!approxEqual(matrix[i]![j]!, 1)) {\n return false\n }\n }\n else {\n if (!approxZero(matrix[i]![j]!)) {\n return false\n }\n }\n }\n }\n\n return true\n}\n","/**\n * Performs cache-optimized matrix multiplication.\n * @param A The first input matrix (m x n)\n * @param B The second input matrix (n x p)\n * @returns The result matrix C (m x p) where C = A × B\n */\nexport function matrixMultiply(A: number[][], B: number[][]): number[][] {\n // Check if matrices can be multiplied\n if (A.length === 0 || B.length === 0 || A[0]!.length !== B.length) {\n throw new Error('Matrix dimensions do not match for multiplication')\n }\n\n const m = A.length // Number of rows in A\n const n = A[0]!.length // Number of columns in A / Number of rows in B\n const p = B[0]!.length // Number of columns in B\n\n // Initialize result matrix C with zeros\n const C: number[][] = (Array(m).fill(0) as number[]).map(() => Array(p).fill(0) as number[])\n\n // Perform multiplication with cache-optimized loop order (i-k-j)\n for (let i = 0; i < m; i++) {\n for (let k = 0; k < n; k++) {\n const aik = A[i]![k]! // Cache this value to avoid repeated lookups\n for (let j = 0; j < p; j++) {\n C[i]![j]! += aik * B[k]![j]!\n }\n }\n }\n\n return C\n}\n","import { LitsError } from '../../../errors'\nimport { assertMatrix, assertSquareMatrix, assertVector, isSquareMatrix } from '../../../typeGuards/annotatedArrays'\nimport { assertNumber } from '../../../typeGuards/number'\nimport { approxZero } from '../../../utils'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\nimport type { LitsModule } from '../interface'\nimport { gaussJordanElimination } from '../linear-algebra/helpers/gaussJordanElimination'\nimport { moduleDocs } from './docs'\nimport { adjugate } from './helpers/adjugate'\nimport { band } from './helpers/band'\nimport { cofactor } from './helpers/cofactor'\nimport { determinant } from './helpers/determinant'\nimport { inverse } from './helpers/inverse'\nimport { isBanded } from './helpers/isBanded'\nimport { isDiagonal } from './helpers/isDiagonal'\nimport { isIdentity } from './helpers/isIdentity'\nimport { isOrthogonal } from './helpers/isOrthogonal'\nimport { isSquare } from './helpers/isSquare'\nimport { isSymetric } from './helpers/isSymetric'\nimport { isTriangular, isTriangularLower, isTriangularUpper } from './helpers/isTriangular'\nimport { matrixMultiply } from './helpers/matrixMultiply'\nimport { minor } from './helpers/minor'\nimport { norm1 } from './helpers/norm1'\nimport { trace } from './helpers/trace'\n\nexport const matrixNormalExpression: BuiltinNormalExpressions = {\n 'mul': {\n evaluate: ([matrix1, matrix2], sourceCodeInfo): number[][] => {\n assertMatrix(matrix1, sourceCodeInfo)\n assertMatrix(matrix2, sourceCodeInfo)\n try {\n return matrixMultiply(matrix1, matrix2)\n }\n catch (error) {\n throw new LitsError(`The number of columns in the first matrix must be equal to the number of rows in the second matrix, but got ${matrix1[0]!.length} and ${matrix2.length}`, sourceCodeInfo)\n }\n },\n arity: toFixedArity(2),\n },\n 'det': {\n evaluate: ([matrix], sourceCodeInfo): number => {\n assertSquareMatrix(matrix, sourceCodeInfo)\n return determinant(matrix)\n },\n arity: toFixedArity(1),\n },\n 'inv': {\n evaluate: ([matrix], sourceCodeInfo): number[][] => {\n assertSquareMatrix(matrix, sourceCodeInfo)\n const result = inverse(matrix)\n if (result === null) {\n throw new LitsError('The matrix must be invertible', sourceCodeInfo)\n }\n return result\n },\n arity: toFixedArity(1),\n },\n 'adj': {\n evaluate: ([matrix], sourceCodeInfo): number[][] => {\n assertSquareMatrix(matrix, sourceCodeInfo)\n return adjugate(matrix)\n },\n arity: toFixedArity(1),\n },\n 'cofactor': {\n evaluate: ([matrix], sourceCodeInfo): number[][] => {\n assertSquareMatrix(matrix, sourceCodeInfo)\n return cofactor(matrix)\n },\n arity: toFixedArity(1),\n },\n 'minor': {\n evaluate: ([matrix, row, col], sourceCodeInfo): number[][] => {\n assertMatrix(matrix, sourceCodeInfo)\n assertNumber(row, sourceCodeInfo, { integer: true, nonNegative: true, lte: matrix.length })\n assertNumber(col, sourceCodeInfo, { integer: true, nonNegative: true, lte: matrix[0]!.length })\n\n return minor(matrix, row, col)\n },\n arity: toFixedArity(3),\n },\n 'trace': {\n evaluate: ([matrix], sourceCodeInfo): number => {\n assertSquareMatrix(matrix, sourceCodeInfo)\n return trace(matrix)\n },\n arity: toFixedArity(1),\n },\n 'symmetric?': {\n evaluate: ([matrix], sourceCodeInfo): boolean => {\n assertMatrix(matrix, sourceCodeInfo)\n return isSymetric(matrix)\n },\n arity: toFixedArity(1),\n },\n 'triangular?': {\n evaluate: ([matrix], sourceCodeInfo): boolean => {\n assertMatrix(matrix, sourceCodeInfo)\n return isTriangular(matrix)\n },\n arity: toFixedArity(1),\n },\n 'upper-triangular?': {\n evaluate: ([matrix], sourceCodeInfo): boolean => {\n assertMatrix(matrix, sourceCodeInfo)\n return isTriangularUpper(matrix)\n },\n arity: toFixedArity(1),\n },\n 'lower-triangular?': {\n evaluate: ([matrix], sourceCodeInfo): boolean => {\n assertMatrix(matrix, sourceCodeInfo)\n return isTriangularLower(matrix)\n },\n arity: toFixedArity(1),\n },\n 'diagonal?': {\n evaluate: ([matrix], sourceCodeInfo): boolean => {\n assertMatrix(matrix, sourceCodeInfo)\n return isDiagonal(matrix)\n },\n arity: toFixedArity(1),\n },\n 'square?': {\n evaluate: ([matrix], sourceCodeInfo): boolean => {\n assertMatrix(matrix, sourceCodeInfo)\n return isSquare(matrix)\n },\n arity: toFixedArity(1),\n },\n 'orthogonal?': {\n evaluate: ([matrix], sourceCodeInfo): boolean => {\n assertMatrix(matrix, sourceCodeInfo)\n return isOrthogonal(matrix)\n },\n arity: toFixedArity(1),\n },\n 'identity?': {\n evaluate: ([matrix], sourceCodeInfo): boolean => {\n assertMatrix(matrix, sourceCodeInfo)\n return isIdentity(matrix)\n },\n arity: toFixedArity(1),\n },\n 'invertible?': {\n evaluate: ([matrix], sourceCodeInfo): boolean => {\n assertMatrix(matrix, sourceCodeInfo)\n if (!isSquareMatrix(matrix)) {\n return false\n }\n return !approxZero(determinant(matrix))\n },\n arity: toFixedArity(1),\n },\n 'hilbert': {\n evaluate: ([size], sourceCodeInfo): number[][] => {\n assertNumber(size, sourceCodeInfo, { integer: true, positive: true })\n const result: number[][] = []\n for (let i = 0; i < size; i += 1) {\n const row: number[] = []\n for (let j = 0; j < size; j += 1) {\n row.push(1 / (i + j + 1))\n }\n result.push(row)\n }\n return result\n },\n arity: toFixedArity(1),\n },\n 'vandermonde': {\n evaluate: ([vector], sourceCodeInfo): number[][] => {\n assertVector(vector, sourceCodeInfo)\n const result: number[][] = []\n for (let i = 0; i < vector.length; i += 1) {\n const row: number[] = []\n for (let j = 0; j < vector.length; j += 1) {\n row.push((vector[i]!) ** j)\n }\n result.push(row)\n }\n return result\n },\n arity: toFixedArity(1),\n },\n 'band': {\n evaluate: ([n, lband, uband], sourceCodeInfo): number[][] => {\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n assertNumber(lband, sourceCodeInfo, { integer: true, nonNegative: true, lt: n })\n assertNumber(uband, sourceCodeInfo, { integer: true, nonNegative: true, lte: n })\n return band(n, lband, uband)\n },\n arity: toFixedArity(3),\n },\n 'banded?': {\n evaluate: ([matrix, lband, uband], sourceCodeInfo): boolean => {\n assertMatrix(matrix, sourceCodeInfo)\n const maxBand = Math.max(matrix.length, matrix[0]!.length)\n assertNumber(lband, sourceCodeInfo, { integer: true, nonNegative: true, lt: maxBand })\n assertNumber(uband, sourceCodeInfo, { integer: true, nonNegative: true, lt: maxBand })\n return isBanded(matrix, lband, uband)\n },\n arity: toFixedArity(3),\n },\n 'rank': {\n evaluate: ([matrix], sourceCodeInfo): number => {\n assertMatrix(matrix, sourceCodeInfo)\n const [, result] = gaussJordanElimination(matrix)\n return result\n },\n arity: toFixedArity(1),\n },\n // Frobenius norm\n 'frobenius-norm': {\n evaluate: ([matrix], sourceCodeInfo): number => {\n assertMatrix(matrix, sourceCodeInfo)\n return Math.sqrt(matrix.reduce((sum, row) => sum + row.reduce((rowSum, cell) => rowSum + cell * cell, 0), 0))\n },\n arity: toFixedArity(1),\n },\n // one-norm (column norm)\n 'one-norm': {\n evaluate: ([matrix], sourceCodeInfo): number => {\n assertMatrix(matrix, sourceCodeInfo)\n return norm1(matrix)\n },\n arity: toFixedArity(1),\n },\n // Infinity norm\n 'inf-norm': {\n evaluate: ([matrix], sourceCodeInfo): number => {\n assertMatrix(matrix, sourceCodeInfo)\n return matrix.reduce((max, row) => Math.max(max, row.reduce((sum, cell) => sum + Math.abs(cell), 0)), 0)\n },\n arity: toFixedArity(1),\n },\n // Max norm\n 'max-norm': {\n evaluate: ([matrix], sourceCodeInfo): number => {\n assertMatrix(matrix, sourceCodeInfo)\n return matrix.reduce((maxVal, row) => {\n const rowMax = row.reduce((max, val) => Math.max(max, Math.abs(val)), 0)\n return Math.max(maxVal, rowMax)\n }, 0)\n },\n arity: toFixedArity(1),\n },\n}\n\nfor (const [key, docs] of Object.entries(moduleDocs)) {\n if (matrixNormalExpression[key])\n matrixNormalExpression[key].docs = docs\n}\n\nexport const matrixModule: LitsModule = {\n name: 'matrix',\n functions: matrixNormalExpression,\n}\n","/**\n * Calculate the inverse of a matrix using the adjugate method\n * @param matrix The input matrix\n * @returns The inverse matrix or null if the matrix is not invertible\n */\n\nimport { approxZero } from '../../../../utils'\nimport { adjugate } from './adjugate'\nimport { determinant } from './determinant'\n\nexport function inverse(matrix: number[][]): number[][] | null {\n const n = matrix.length\n\n // Special case for 1x1 matrix - handle it directly\n if (n === 1) {\n const element = matrix[0]![0]!\n if (approxZero(element)) {\n return null // Not invertible\n }\n return [[1 / element]]\n }\n\n // Calculate determinant\n const det = determinant(matrix)\n\n // Check if matrix is invertible\n if (approxZero(det)) {\n return null // Matrix is not invertible\n }\n\n // Get the adjugate matrix\n const adj = adjugate(matrix)\n\n // Calculate the inverse: inverse = adjugate / determinant\n const inverseMatrix: number[][] = []\n for (let i = 0; i < n; i++) {\n inverseMatrix[i] = []\n for (let j = 0; j < n; j++) {\n inverseMatrix[i]![j] = adj[i]![j]! / det\n }\n }\n\n return inverseMatrix\n}\n","import { determinant } from './determinant'\nimport { minor } from './minor'\n\nexport function cofactor(matrix: number[][]): number[][] {\n const n = matrix.length\n const cofactors: number[][] = []\n\n // Create a new matrix to store cofactors\n for (let i = 0; i < n; i++) {\n cofactors[i] = []\n for (let j = 0; j < n; j++) {\n // Get the minor by removing row i and column j\n const min = minor(matrix, i, j)\n const sign = (-1) ** (i + j)\n cofactors[i]![j] = sign * determinant(min)\n }\n }\n\n return cofactors\n}\n","/**\n * Calculates the trace of a square matrix.\n * The trace is defined as the sum of the elements on the main diagonal.\n *\n * @param matrix - A 2D array representing a square matrix.\n * @returns The trace of the matrix.\n */\nexport function trace(matrix: number[][]): number {\n return matrix.reduce((sum, row, i) => sum + row[i]!, 0)\n}\n","import { isSquare } from './isSquare'\n\n/**\n * Checks if a given matrix is symmetric.\n * A matrix is symmetric if it is square and its transpose is equal to itself.\n *\n * @param matrix - A 2D array representing the matrix.\n * @returns `true` if the matrix is symmetric, otherwise `false`.\n */\nexport function isSymetric(matrix: number[][]): boolean {\n const rows = matrix.length\n\n // Check if the matrix is square\n if (!isSquare(matrix)) {\n return false\n }\n\n // Check symmetry\n for (let i = 0; i < rows; i += 1) {\n for (let j = 0; j < i; j += 1) {\n if (matrix[i]![j]! !== matrix[j]![i]!) {\n return false\n }\n }\n }\n\n return true\n}\n","import { isSquare } from './isSquare'\n\n/**\n * Determines whether a given matrix is triangular.\n *\n * A triangular matrix is a square matrix where all elements\n * below or above the main diagonal are zero. This function\n * checks if the matrix is square and symmetric.\n *\n * @param matrix - A two-dimensional array of numbers representing the matrix.\n * @returns `true` if the matrix is triangular, otherwise `false`.\n */\nexport function isTriangular(matrix: number[][]): boolean {\n if (!isSquare(matrix)) {\n return false\n }\n\n const rows = matrix.length\n\n let isUpperTriangular = true\n let isLowerTriangular = true\n\n for (let i = 0; i < rows; i++) {\n for (let j = 0; j < rows; j++) {\n if (i > j && matrix[i]![j] !== 0) {\n isUpperTriangular = false\n if (!isLowerTriangular) {\n return false\n }\n }\n if (i < j && matrix[i]![j] !== 0) {\n isLowerTriangular = false\n }\n }\n }\n\n return isUpperTriangular || isLowerTriangular\n}\n\nexport function isTriangularUpper(matrix: number[][]): boolean {\n if (!isSquare(matrix)) {\n return false\n }\n const rows = matrix.length\n\n for (let i = 0; i < rows; i++) {\n for (let j = 0; j < i; j++) {\n if (matrix[i]![j] !== 0) {\n return false\n }\n }\n }\n\n return true\n}\n\nexport function isTriangularLower(matrix: number[][]): boolean {\n if (!isSquare(matrix)) {\n return false\n }\n const rows = matrix.length\n\n // Check if the matrix is square\n if (!matrix.every(row => row.length === rows)) {\n return false\n }\n\n for (let i = 0; i < rows; i++) {\n for (let j = i + 1; j < rows; j++) {\n if (matrix[i]![j] !== 0) {\n return false\n }\n }\n }\n\n return true\n}\n","import { isSquare } from './isSquare'\n\n/**\n * Checks if a given matrix is diagonal.\n *\n * A matrix is considered diagonal if it is square (i.e., the number of rows equals the number of columns)\n * and all elements outside the main diagonal are zero.\n *\n * @param matrix - A two-dimensional array of numbers representing the matrix to check.\n * @returns `true` if the matrix is diagonal, otherwise `false`.\n */\nexport function isDiagonal(matrix: number[][]): boolean {\n if (!isSquare(matrix)) {\n return false\n }\n const rows = matrix.length\n\n for (let i = 0; i < rows; i += 1) {\n for (let j = 0; j < rows; j += 1) {\n if (i !== j && matrix[i]![j] !== 0) {\n return false\n }\n }\n }\n\n return true\n}\n","import { transpose } from '../../../modules/grid/transpose'\nimport { matrixMultiply } from './matrixMultiply'\nimport { isIdentity } from './isIdentity'\nimport { isSquare } from './isSquare'\n\nexport function isOrthogonal(matrix: number[][]): boolean {\n if (!isSquare(matrix)) {\n return false\n }\n\n // Calculate matrix transpose\n const transposed = transpose(matrix)\n\n // Check if matrix * transpose = Identity\n const product = matrixMultiply(matrix, transposed)\n\n // Check if the product is an identity matrix\n return isIdentity(product)\n}\n","/**\n * Creates a band matrix with specified lower and upper bandwidths\n *\n * @param n Size of the square matrix\n * @param lband Lower bandwidth (number of non-zero diagonals below main diagonal)\n * @param uband Upper bandwidth (number of non-zero diagonals above main diagonal)\n * @returns A 2D array representing the band matrix with 1s in the band and 0s elsewhere\n */\nexport function band(n: number, lband: number, uband: number): number[][] {\n // Create an n×n matrix filled with zeros\n const matrix: number[][] = Array.from({ length: n }, () => Array.from({ length: n }, () => 0))\n\n // Fill the band with 1s\n for (let i = 0; i < n; i++) {\n for (let j = Math.max(0, i - lband); j <= Math.min(n - 1, i + uband); j++) {\n matrix[i]![j] = 1\n }\n }\n\n return matrix\n}\n","/**\n * Checks if a matrix is banded with the given lower and upper bandwidth.\n * A matrix is banded if all non-zero elements are within 'lower' diagonals\n * below the main diagonal and 'upper' diagonals above the main diagonal.\n *\n * @param matrix - The matrix to check, represented as a 2D array of numbers\n * @param lower - Number of non-zero diagonals below the main diagonal\n * @param upper - Number of non-zero diagonals above the main diagonal\n * @returns true if the matrix is banded with the given parameters, false otherwise\n */\nexport function isBanded(matrix: number[][], lower: number, upper: number): boolean {\n const rows = matrix.length\n const cols = matrix[0]!.length\n\n // Check each element in the matrix\n for (let i = 0; i < rows; i++) {\n for (let j = 0; j < cols; j++) {\n // If we find a non-zero element outside the band, return false\n if (matrix[i]![j] !== 0 && (i - j > lower || j - i > upper)) {\n return false\n }\n }\n }\n\n // All elements outside the band are zero\n return true\n}\n","// Assuming a matrix is represented as a 2D array\nexport function norm1(matrix: number[][]): number {\n const numRows = matrix.length\n const numCols = matrix[0]!.length\n\n let maxColSum = 0\n\n // Iterate through each column\n for (let j = 0; j < numCols; j += 1) {\n let colSum = 0\n\n // Sum the absolute values of all elements in this column\n for (let i = 0; i < numRows; i += 1) {\n colSum += Math.abs(matrix[i]![j]!)\n }\n\n // Update the maximum column sum if necessary\n maxColSum = Math.max(maxColSum, colSum)\n }\n\n return maxColSum\n}\n","import type { FunctionDocs } from '../../interface'\n\nexport const moduleDocs: Record<string, FunctionDocs> = {\n 'abundant-seq': {\n category: 'number-theory',\n description: 'Generates the abundant numbers up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { abundant-seq } = import(\"number-theory\");\\nabundant-seq(1)',\n 'let { abundant-seq } = import(\"number-theory\");\\nabundant-seq(5)',\n ],\n seeAlso: ['number-theory.abundant-nth', 'number-theory.abundant-take-while', 'number-theory.abundant?', 'number-theory.deficient-seq', 'number-theory.perfect-seq'],\n },\n 'abundant-take-while': {\n category: 'number-theory',\n description: 'Generates the abundant numbers while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { abundant-take-while } = import(\"number-theory\");\\nabundant-take-while(-> $ < 100)',\n ],\n seeAlso: ['number-theory.abundant-seq', 'number-theory.abundant-nth', 'number-theory.abundant?'],\n },\n 'abundant-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the abundant numbers.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the number in the sequence.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { abundant-nth } = import(\"number-theory\");\\nabundant-nth(1)',\n 'let { abundant-nth } = import(\"number-theory\");\\nabundant-nth(5)',\n ],\n seeAlso: ['number-theory.abundant-seq', 'number-theory.abundant-take-while', 'number-theory.abundant?'],\n },\n 'abundant?': {\n category: 'number-theory',\n description: 'Checks if a number is abundant.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { abundant? } = import(\"number-theory\");\\nabundant?(12)',\n 'let { abundant? } = import(\"number-theory\");\\nabundant?(15)',\n ],\n seeAlso: ['number-theory.abundant-seq', 'number-theory.abundant-nth', 'number-theory.deficient?', 'number-theory.perfect?', 'number-theory.sigma', 'number-theory.divisors', 'number-theory.abundant-take-while'],\n },\n 'arithmetic-seq': {\n category: 'number-theory',\n description: 'Generates the arithmetic sequence for a given $start, $step, and $length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n start: {\n type: 'number',\n description: 'The starting term of the sequence.',\n },\n step: {\n type: 'number',\n description: 'The common difference of the sequence.',\n },\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n 'step',\n 'length',\n ],\n },\n ],\n examples: [\n 'let { arithmetic-seq } = import(\"number-theory\");\\narithmetic-seq(3, 2, 2)',\n 'let { arithmetic-seq } = import(\"number-theory\");\\narithmetic-seq(2, 3, 2)',\n 'let { arithmetic-seq } = import(\"number-theory\");\\narithmetic-seq(1, 2, 2)',\n 'let { arithmetic-seq } = import(\"number-theory\");\\narithmetic-seq(1, 1.5, 12)',\n ],\n seeAlso: ['number-theory.arithmetic-nth', 'number-theory.arithmetic-take-while', 'number-theory.arithmetic?', 'number-theory.geometric-seq'],\n },\n 'arithmetic-take-while': {\n category: 'number-theory',\n description: 'Generates the arithmetic sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n start: {\n type: 'number',\n description: 'The starting term of the sequence.',\n },\n step: {\n type: 'number',\n description: 'The common difference of the sequence.',\n },\n takeWhile: {\n type: 'function',\n description: 'A function that takes a number and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n 'step',\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { arithmetic-take-while } = import(\"number-theory\");\\narithmetic-take-while(1, 0.25, -> $ < 3)',\n ],\n seeAlso: ['number-theory.arithmetic-seq', 'number-theory.arithmetic-nth', 'number-theory.arithmetic?'],\n },\n 'arithmetic-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the arithmetic sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n start: {\n type: 'number',\n description: 'The starting term of the sequence.',\n },\n step: {\n type: 'number',\n description: 'The common difference of the sequence.',\n },\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n 'step',\n 'n',\n ],\n },\n ],\n examples: [\n 'let { arithmetic-nth } = import(\"number-theory\");\\narithmetic-nth(3, 2, 2)',\n 'let { arithmetic-nth } = import(\"number-theory\");\\narithmetic-nth(2, 3, 2)',\n 'let { arithmetic-nth } = import(\"number-theory\");\\narithmetic-nth(1, 2, 2)',\n 'let { arithmetic-nth } = import(\"number-theory\");\\narithmetic-nth(1, 1.5, 12)',\n ],\n seeAlso: ['number-theory.arithmetic-seq', 'number-theory.arithmetic-take-while', 'number-theory.arithmetic?'],\n },\n 'arithmetic?': {\n category: 'number-theory',\n description: 'Checks if a number is part of the arithmetic sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n start: {\n type: 'number',\n description: 'The starting term of the sequence.',\n },\n step: {\n type: 'number',\n description: 'The common difference of the sequence.',\n },\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n 'step',\n 'n',\n ],\n },\n ],\n examples: [\n 'let { arithmetic? } = import(\"number-theory\");\\narithmetic?(3, 2, 2)',\n 'let { arithmetic? } = import(\"number-theory\");\\narithmetic?(2, 3, 2)',\n 'let { arithmetic? } = import(\"number-theory\");\\narithmetic?(1, 2, 2)',\n 'let { arithmetic? } = import(\"number-theory\");\\narithmetic?(1, 1.5, 12)',\n ],\n seeAlso: ['number-theory.arithmetic-seq', 'number-theory.arithmetic-nth', 'number-theory.geometric?', 'number-theory.arithmetic-take-while'],\n },\n 'bell-seq': {\n category: 'number-theory',\n description: 'Generates the Bell sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate. If not provided, the default is 22 (the maximum length of the pre-calculated bell numbers).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { bell-seq } = import(\"number-theory\");\\nbell-seq(5)',\n 'let { bell-seq } = import(\"number-theory\");\\nbell-seq(10)',\n 'let { bell-seq } = import(\"number-theory\");\\nbell-seq()',\n ],\n seeAlso: ['number-theory.bell-nth', 'number-theory.bell-take-while', 'number-theory.bell?', 'number-theory.catalan-seq', 'number-theory.stirling-second', 'number-theory.stirling-first'],\n },\n 'bell-take-while': {\n category: 'number-theory',\n description: 'Generates the Bell sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { bell-take-while } = import(\"number-theory\");\\nbell-take-while(-> $ < 1000)',\n ],\n seeAlso: ['number-theory.bell-seq', 'number-theory.bell-nth', 'number-theory.bell?'],\n },\n 'bell-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Bell sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { bell-nth } = import(\"number-theory\");\\nbell-nth(5)',\n 'let { bell-nth } = import(\"number-theory\");\\nbell-nth(10)',\n ],\n seeAlso: ['number-theory.bell-seq', 'number-theory.bell-take-while', 'number-theory.bell?'],\n },\n 'bell?': {\n category: 'number-theory',\n description: 'Checks if a number is in the Bell sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { bell? } = import(\"number-theory\");\\nbell?(1)',\n 'let { bell? } = import(\"number-theory\");\\nbell?(27644437)',\n 'let { bell? } = import(\"number-theory\");\\nbell?(27644436)',\n ],\n seeAlso: ['number-theory.bell-seq', 'number-theory.bell-nth', 'number-theory.catalan?', 'number-theory.bell-take-while'],\n },\n 'bernoulli-seq': {\n category: 'number-theory',\n description: 'Generates the Bernoulli sequence up to a specified length.',\n returns: {\n type: 'number',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { bernoulli-seq } = import(\"number-theory\");\\nbernoulli-seq(5)',\n 'let { bernoulli-seq } = import(\"number-theory\");\\nbernoulli-seq(10)',\n ],\n seeAlso: ['number-theory.bernoulli-nth', 'number-theory.bernoulli-take-while'],\n },\n 'bernoulli-take-while': {\n category: 'number-theory',\n description: 'Generates the Bernoulli sequence while a condition is met.',\n returns: {\n type: 'number',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { bernoulli-take-while } = import(\"number-theory\");\\nbernoulli-take-while(-> abs($) < 100)',\n ],\n seeAlso: ['number-theory.bernoulli-seq', 'number-theory.bernoulli-nth'],\n },\n 'bernoulli-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Bernoulli sequence.',\n returns: {\n type: 'number',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { bernoulli-nth } = import(\"number-theory\");\\nbernoulli-nth(5)',\n 'let { bernoulli-nth } = import(\"number-theory\");\\nbernoulli-nth(10)',\n 'let { bernoulli-nth } = import(\"number-theory\");\\nbernoulli-nth(23)',\n ],\n seeAlso: ['number-theory.bernoulli-seq', 'number-theory.bernoulli-take-while'],\n },\n 'catalan-seq': {\n category: 'number-theory',\n description: 'Generates the Catalan sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate. If not provided, the default is 30 (the maximum length of the pre-calculated catalan numbers).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { catalan-seq } = import(\"number-theory\");\\ncatalan-seq(5)',\n 'let { catalan-seq } = import(\"number-theory\");\\ncatalan-seq(10)',\n 'let { catalan-seq } = import(\"number-theory\");\\ncatalan-seq()',\n ],\n seeAlso: ['number-theory.catalan-nth', 'number-theory.catalan-take-while', 'number-theory.catalan?', 'number-theory.bell-seq'],\n },\n 'catalan-take-while': {\n category: 'number-theory',\n description: 'Generates the Catalan sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { catalan-take-while } = import(\"number-theory\");\\ncatalan-take-while(-> $ < 1000)',\n ],\n seeAlso: ['number-theory.catalan-seq', 'number-theory.catalan-nth', 'number-theory.catalan?'],\n },\n 'catalan-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Catalan sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { catalan-nth } = import(\"number-theory\");\\ncatalan-nth(5)',\n 'let { catalan-nth } = import(\"number-theory\");\\ncatalan-nth(10)',\n ],\n seeAlso: ['number-theory.catalan-seq', 'number-theory.catalan-take-while', 'number-theory.catalan?'],\n },\n 'catalan?': {\n category: 'number-theory',\n description: 'Determines if a number is in the Catalan sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { catalan? } = import(\"number-theory\");\\ncatalan?(5)',\n 'let { catalan? } = import(\"number-theory\");\\ncatalan?(10)',\n ],\n seeAlso: ['number-theory.catalan-seq', 'number-theory.catalan-nth', 'number-theory.bell?', 'number-theory.catalan-take-while'],\n },\n 'collatz-seq': {\n category: 'number-theory',\n description: 'Generates the collatz sequence starting from a given integer.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n start: {\n type: 'integer',\n description: 'The starting integer for the collatz sequence.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n ],\n },\n ],\n examples: [\n 'let { collatz-seq } = import(\"number-theory\");\\ncollatz-seq(3)',\n 'let { collatz-seq } = import(\"number-theory\");\\ncollatz-seq(11)',\n ],\n seeAlso: ['number-theory.juggler-seq'],\n },\n 'composite-seq': {\n category: 'number-theory',\n description: 'Generates the composite sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { composite-seq } = import(\"number-theory\");\\ncomposite-seq(1)',\n 'let { composite-seq } = import(\"number-theory\");\\ncomposite-seq(2)',\n 'let { composite-seq } = import(\"number-theory\");\\ncomposite-seq(10)',\n ],\n seeAlso: ['number-theory.composite-nth', 'number-theory.composite-take-while', 'number-theory.composite?', 'number-theory.prime-seq'],\n },\n 'composite-take-while': {\n category: 'number-theory',\n description: 'Generates the composite sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { composite-take-while } = import(\"number-theory\");\\ncomposite-take-while(-> $ < 50)',\n ],\n seeAlso: ['number-theory.composite-seq', 'number-theory.composite-nth', 'number-theory.composite?'],\n },\n 'composite-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the composite sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the composite number to retrieve.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { composite-nth } = import(\"number-theory\");\\ncomposite-nth(1)',\n 'let { composite-nth } = import(\"number-theory\");\\ncomposite-nth(2)',\n 'let { composite-nth } = import(\"number-theory\");\\ncomposite-nth(10)',\n ],\n seeAlso: ['number-theory.composite-seq', 'number-theory.composite-take-while', 'number-theory.composite?'],\n },\n 'composite?': {\n category: 'number-theory',\n description: 'Determines if a number is composite.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { composite? } = import(\"number-theory\");\\ncomposite?(4)',\n 'let { composite? } = import(\"number-theory\");\\ncomposite?(5)',\n 'let { composite? } = import(\"number-theory\");\\ncomposite?(11)',\n ],\n seeAlso: ['number-theory.composite-seq', 'number-theory.composite-nth', 'number-theory.prime?', 'number-theory.prime-factors', 'number-theory.composite-take-while'],\n },\n 'deficient-seq': {\n category: 'number-theory',\n description: 'Generates the deficient numbers up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { deficient-seq } = import(\"number-theory\");\\ndeficient-seq(1)',\n 'let { deficient-seq } = import(\"number-theory\");\\ndeficient-seq(5)',\n ],\n seeAlso: ['number-theory.deficient-nth', 'number-theory.deficient-take-while', 'number-theory.deficient?', 'number-theory.abundant-seq', 'number-theory.perfect-seq'],\n },\n 'deficient-take-while': {\n category: 'number-theory',\n description: 'Generates the deficient numbers while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { deficient-take-while } = import(\"number-theory\");\\ndeficient-take-while(-> $ < 100)',\n ],\n seeAlso: ['number-theory.deficient-seq', 'number-theory.deficient-nth', 'number-theory.deficient?'],\n },\n 'deficient-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the deficient numbers.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the number in the sequence.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { deficient-nth } = import(\"number-theory\");\\ndeficient-nth(5)',\n 'let { deficient-nth } = import(\"number-theory\");\\ndeficient-nth(12)',\n ],\n seeAlso: ['number-theory.deficient-seq', 'number-theory.deficient-take-while', 'number-theory.deficient?'],\n },\n 'deficient?': {\n category: 'number-theory',\n description: 'Checks if a number is deficient.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { deficient? } = import(\"number-theory\");\\ndeficient?(12)',\n 'let { deficient? } = import(\"number-theory\");\\ndeficient?(15)',\n ],\n seeAlso: ['number-theory.deficient-seq', 'number-theory.deficient-nth', 'number-theory.abundant?', 'number-theory.perfect?', 'number-theory.sigma', 'number-theory.divisors', 'number-theory.deficient-take-while'],\n },\n 'factorial-seq': {\n category: 'number-theory',\n description: 'Generates the factorial sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate. If not provided, the default is 19 (the maximum length of the pre-calculated factorial numbers).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { factorial-seq } = import(\"number-theory\");\\nfactorial-seq(1)',\n 'let { factorial-seq } = import(\"number-theory\");\\nfactorial-seq(2)',\n 'let { factorial-seq } = import(\"number-theory\");\\nfactorial-seq(3)',\n 'let { factorial-seq } = import(\"number-theory\");\\nfactorial-seq(4)',\n 'let { factorial-seq } = import(\"number-theory\");\\nfactorial-seq(5)',\n 'let { factorial-seq } = import(\"number-theory\");\\nfactorial-seq(10)',\n ],\n seeAlso: ['number-theory.factorial-nth', 'number-theory.factorial-take-while', 'number-theory.factorial?', 'number-theory.factorial'],\n },\n 'factorial-take-while': {\n category: 'number-theory',\n description: 'Generates the factorial sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { factorial-take-while } = import(\"number-theory\");\\nfactorial-take-while(-> $ < 1000)',\n ],\n seeAlso: ['number-theory.factorial-seq', 'number-theory.factorial-nth', 'number-theory.factorial?'],\n },\n 'factorial-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the factorial sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { factorial-nth } = import(\"number-theory\");\\nfactorial-nth(1)',\n 'let { factorial-nth } = import(\"number-theory\");\\nfactorial-nth(2)',\n 'let { factorial-nth } = import(\"number-theory\");\\nfactorial-nth(3)',\n 'let { factorial-nth } = import(\"number-theory\");\\nfactorial-nth(4)',\n 'let { factorial-nth } = import(\"number-theory\");\\nfactorial-nth(5)',\n 'let { factorial-nth } = import(\"number-theory\");\\nfactorial-nth(10)',\n ],\n seeAlso: ['number-theory.factorial-seq', 'number-theory.factorial-take-while', 'number-theory.factorial?', 'number-theory.factorial'],\n },\n 'factorial?': {\n category: 'number-theory',\n description: 'Checks if a number is in the factorial sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { factorial? } = import(\"number-theory\");\\nfactorial?(1)',\n 'let { factorial? } = import(\"number-theory\");\\nfactorial?(2)',\n 'let { factorial? } = import(\"number-theory\");\\nfactorial?(3)',\n 'let { factorial? } = import(\"number-theory\");\\nfactorial?(4)',\n 'let { factorial? } = import(\"number-theory\");\\nfactorial?(5)',\n 'let { factorial? } = import(\"number-theory\");\\nfactorial?(6)',\n 'let { factorial? } = import(\"number-theory\");\\nfactorial?(7)',\n 'let { factorial? } = import(\"number-theory\");\\nfactorial?(8)',\n 'let { factorial? } = import(\"number-theory\");\\nfactorial?(9)',\n 'let { factorial? } = import(\"number-theory\");\\nfactorial?(3628800)',\n ],\n seeAlso: ['number-theory.factorial-seq', 'number-theory.factorial-nth', 'number-theory.factorial', 'number-theory.factorial-take-while'],\n },\n 'fibonacci-seq': {\n category: 'number-theory',\n description: 'Generates the fibonacci sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate. If not provided, the default is 79 (the maximum length of the pre-calculated Fibonacci numbers).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { fibonacci-seq } = import(\"number-theory\");\\nfibonacci-seq(1)',\n 'let { fibonacci-seq } = import(\"number-theory\");\\nfibonacci-seq(2)',\n 'let { fibonacci-seq } = import(\"number-theory\");\\nfibonacci-seq()',\n ],\n seeAlso: ['number-theory.fibonacci-nth', 'number-theory.fibonacci-take-while', 'number-theory.fibonacci?', 'number-theory.lucas-seq', 'number-theory.tribonacci-seq', 'number-theory.pell-seq', 'number-theory.padovan-seq'],\n },\n 'fibonacci-take-while': {\n category: 'number-theory',\n description: 'Generates the fibonacci sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { fibonacci-take-while } = import(\"number-theory\");\\nfibonacci-take-while(-> $ < 100)',\n ],\n seeAlso: ['number-theory.fibonacci-seq', 'number-theory.fibonacci-nth', 'number-theory.fibonacci?'],\n },\n 'fibonacci-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the fibonacci sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { fibonacci-nth } = import(\"number-theory\");\\nfibonacci-nth(5)',\n 'let { fibonacci-nth } = import(\"number-theory\");\\nfibonacci-nth(50)',\n ],\n seeAlso: ['number-theory.fibonacci-seq', 'number-theory.fibonacci-take-while', 'number-theory.fibonacci?'],\n },\n 'fibonacci?': {\n category: 'number-theory',\n description: 'Determines if a number is in the fibonacci sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { fibonacci? } = import(\"number-theory\");\\nfibonacci?(0)',\n 'let { fibonacci? } = import(\"number-theory\");\\nfibonacci?(1)',\n 'let { fibonacci? } = import(\"number-theory\");\\nfibonacci?(2)',\n 'let { fibonacci? } = import(\"number-theory\");\\nfibonacci?(3)',\n 'let { fibonacci? } = import(\"number-theory\");\\nfibonacci?(4)',\n 'let { fibonacci? } = import(\"number-theory\");\\nfibonacci?(5)',\n 'let { fibonacci? } = import(\"number-theory\");\\nfibonacci?(6)',\n 'let { fibonacci? } = import(\"number-theory\");\\nfibonacci?(7)',\n 'let { fibonacci? } = import(\"number-theory\");\\nfibonacci?(8)',\n 'let { fibonacci? } = import(\"number-theory\");\\nfibonacci?(9)',\n ],\n seeAlso: ['number-theory.fibonacci-seq', 'number-theory.fibonacci-nth', 'number-theory.lucas?', 'number-theory.fibonacci-take-while', 'number-theory.tribonacci?', 'number-theory.padovan?', 'number-theory.pell?'],\n },\n 'geometric-seq': {\n category: 'number-theory',\n description: 'Generates the geometric sequence for a given $start, $ratio, and $length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n start: {\n type: 'number',\n description: 'The starting term of the sequence.',\n },\n ratio: {\n type: 'number',\n description: 'The common ratio of the sequence.',\n },\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n 'ratio',\n 'length',\n ],\n },\n ],\n examples: [\n 'let { geometric-seq } = import(\"number-theory\");\\ngeometric-seq(3, 2, 2)',\n 'let { geometric-seq } = import(\"number-theory\");\\ngeometric-seq(2, 3, 2)',\n 'let { geometric-seq } = import(\"number-theory\");\\ngeometric-seq(1, 2, 2)',\n 'let { geometric-seq } = import(\"number-theory\");\\ngeometric-seq(1, 1.5, 12)',\n ],\n seeAlso: ['number-theory.geometric-nth', 'number-theory.geometric-take-while', 'number-theory.geometric?', 'number-theory.arithmetic-seq'],\n },\n 'geometric-take-while': {\n category: 'number-theory',\n description: 'Generates the geometric sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n start: {\n type: 'number',\n description: 'The starting term of the sequence.',\n },\n ratio: {\n type: 'number',\n description: 'The common ratio of the sequence.',\n },\n takeWhile: {\n type: 'function',\n description: 'A function that takes a number and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n 'ratio',\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { geometric-take-while } = import(\"number-theory\");\\ngeometric-take-while(1, 1.5, -> $ < 10)',\n ],\n seeAlso: ['number-theory.geometric-seq', 'number-theory.geometric-nth', 'number-theory.geometric?'],\n },\n 'geometric-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the geometric sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n start: {\n type: 'number',\n description: 'The starting term of the sequence.',\n },\n ratio: {\n type: 'number',\n description: 'The common ratio of the sequence.',\n },\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n 'ratio',\n 'n',\n ],\n },\n ],\n examples: [\n 'let { geometric-nth } = import(\"number-theory\");\\ngeometric-nth(3, 2, 2)',\n 'let { geometric-nth } = import(\"number-theory\");\\ngeometric-nth(2, 3, 2)',\n 'let { geometric-nth } = import(\"number-theory\");\\ngeometric-nth(1, 2, 2)',\n 'let { geometric-nth } = import(\"number-theory\");\\ngeometric-nth(1, 1.5, 4)',\n ],\n seeAlso: ['number-theory.geometric-seq', 'number-theory.geometric-take-while', 'number-theory.geometric?'],\n },\n 'geometric?': {\n category: 'number-theory',\n description: 'Checks if a number is in the geometric sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n start: {\n type: 'number',\n description: 'The starting term of the sequence.',\n },\n ratio: {\n type: 'number',\n description: 'The common ratio of the sequence.',\n },\n n: {\n type: 'number',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n 'ratio',\n 'n',\n ],\n },\n ],\n examples: [\n 'let { geometric? } = import(\"number-theory\");\\ngeometric?(1, 2, 1)',\n 'let { geometric? } = import(\"number-theory\");\\ngeometric?(2, 3, 2)',\n 'let { geometric? } = import(\"number-theory\");\\ngeometric?(3, 2, 2)',\n 'let { geometric? } = import(\"number-theory\");\\ngeometric?(1, 1.5, 2.25)',\n 'let { geometric? } = import(\"number-theory\");\\ngeometric?(1, 1.5, -4)',\n ],\n seeAlso: ['number-theory.geometric-seq', 'number-theory.geometric-nth', 'number-theory.arithmetic?', 'number-theory.geometric-take-while'],\n },\n 'golomb-seq': {\n category: 'number-theory',\n description: 'Generates the Golomb sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { golomb-seq } = import(\"number-theory\");\\ngolomb-seq(5)',\n 'let { golomb-seq } = import(\"number-theory\");\\ngolomb-seq(20)',\n ],\n seeAlso: ['number-theory.golomb-nth', 'number-theory.golomb-take-while', 'number-theory.golomb?', 'number-theory.recaman-seq'],\n },\n 'golomb-take-while': {\n category: 'number-theory',\n description: 'Generates the Golomb sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { golomb-take-while } = import(\"number-theory\");\\ngolomb-take-while(-> $ <= 10)',\n ],\n seeAlso: ['number-theory.golomb-seq', 'number-theory.golomb-nth', 'number-theory.golomb?'],\n },\n 'golomb-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Golomb sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { golomb-nth } = import(\"number-theory\");\\ngolomb-nth(5)',\n 'let { golomb-nth } = import(\"number-theory\");\\ngolomb-nth(1000)',\n ],\n seeAlso: ['number-theory.golomb-seq', 'number-theory.golomb-take-while', 'number-theory.golomb?'],\n },\n 'golomb?': {\n category: 'number-theory',\n description: 'Checks if a number is in the Golomb sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { golomb? } = import(\"number-theory\");\\ngolomb?(1)',\n 'let { golomb? } = import(\"number-theory\");\\ngolomb?(2)',\n 'let { golomb? } = import(\"number-theory\");\\ngolomb?(3345)',\n 'let { golomb? } = import(\"number-theory\");\\ngolomb?(67867864)',\n ],\n seeAlso: ['number-theory.golomb-seq', 'number-theory.golomb-nth', 'number-theory.golomb-take-while'],\n },\n 'happy-seq': {\n category: 'number-theory',\n description: 'Generates the happy sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate. If not provided, the default is 20 (the maximum length of the pre-calculated happy numbers).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { happy-seq } = import(\"number-theory\");\\nhappy-seq(1)',\n 'let { happy-seq } = import(\"number-theory\");\\nhappy-seq(2)',\n 'let { happy-seq } = import(\"number-theory\");\\nhappy-seq(20)',\n ],\n seeAlso: ['number-theory.happy-nth', 'number-theory.happy-take-while', 'number-theory.happy?', 'number-theory.lucky-seq'],\n },\n 'happy-take-while': {\n category: 'number-theory',\n description: 'Generates the happy sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { happy-take-while } = import(\"number-theory\");\\nhappy-take-while(-> $ < 100)',\n ],\n seeAlso: ['number-theory.happy-seq', 'number-theory.happy-nth', 'number-theory.happy?'],\n },\n 'happy-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the happy sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the happy number to return.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { happy-nth } = import(\"number-theory\");\\nhappy-nth(1)',\n 'let { happy-nth } = import(\"number-theory\");\\nhappy-nth(2)',\n 'let { happy-nth } = import(\"number-theory\");\\nhappy-nth(20)',\n ],\n seeAlso: ['number-theory.happy-seq', 'number-theory.happy-take-while', 'number-theory.happy?'],\n },\n 'happy?': {\n category: 'number-theory',\n description: 'Determines if a number is a happy number.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { happy? } = import(\"number-theory\");\\nhappy?(1)',\n 'let { happy? } = import(\"number-theory\");\\nhappy?(2)',\n 'let { happy? } = import(\"number-theory\");\\nhappy?(100)',\n ],\n seeAlso: ['number-theory.happy-seq', 'number-theory.happy-nth', 'number-theory.happy-take-while'],\n },\n 'juggler-seq': {\n category: 'number-theory',\n description: 'Generates the Juggler sequence starting from a given integer.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n start: {\n type: 'integer',\n description: 'The starting integer for the Juggler sequence.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n ],\n },\n ],\n examples: [\n 'let { juggler-seq } = import(\"number-theory\");\\njuggler-seq(3)',\n 'let { juggler-seq } = import(\"number-theory\");\\njuggler-seq(5)',\n ],\n seeAlso: ['number-theory.collatz-seq'],\n },\n 'look-and-say-seq': {\n category: 'number-theory',\n description: 'Generates the Look-and-Say sequence up to a specified length.',\n returns: {\n type: 'string',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { look-and-say-seq } = import(\"number-theory\");\\nlook-and-say-seq(5)',\n ],\n seeAlso: ['number-theory.look-and-say-nth', 'number-theory.look-and-say-take-while', 'number-theory.look-and-say?'],\n },\n 'look-and-say-take-while': {\n category: 'number-theory',\n description: 'Generates the Look-and-Say sequence while a condition is met.',\n returns: {\n type: 'string',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes a string and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { look-and-say-take-while } = import(\"number-theory\");\\nlook-and-say-take-while((term, index) -> count(term) < 10)',\n 'let { look-and-say-take-while } = import(\"number-theory\");\\nlook-and-say-take-while(-> $2 <= 10)',\n ],\n seeAlso: ['number-theory.look-and-say-seq', 'number-theory.look-and-say-nth', 'number-theory.look-and-say?'],\n },\n 'look-and-say-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Look-and-Say sequence.',\n returns: {\n type: 'string',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term in the sequence.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { look-and-say-nth } = import(\"number-theory\");\\nlook-and-say-nth(5)',\n ],\n seeAlso: ['number-theory.look-and-say-seq', 'number-theory.look-and-say-take-while', 'number-theory.look-and-say?'],\n },\n 'look-and-say?': {\n category: 'number-theory',\n description: 'Checks if a string is a valid Look-and-Say term.',\n returns: {\n type: 'boolean',\n },\n args: {\n term: {\n type: 'string',\n description: 'The term to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'term',\n ],\n },\n ],\n examples: [\n 'let { look-and-say? } = import(\"number-theory\");\\nlook-and-say?(\"111221\")',\n 'let { look-and-say? } = import(\"number-theory\");\\nlook-and-say?(\"123\")',\n ],\n seeAlso: ['number-theory.look-and-say-seq', 'number-theory.look-and-say-nth', 'number-theory.look-and-say-take-while'],\n },\n 'lucas-seq': {\n category: 'number-theory',\n description: 'Generates the lucas sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate. If not provided, the default is 77 (the maximum length of the pre-calculated Lucas numbers).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { lucas-seq } = import(\"number-theory\");\\nlucas-seq(1)',\n 'let { lucas-seq } = import(\"number-theory\");\\nlucas-seq(2)',\n 'let { lucas-seq } = import(\"number-theory\");\\nlucas-seq()',\n ],\n seeAlso: ['number-theory.lucas-nth', 'number-theory.lucas-take-while', 'number-theory.lucas?', 'number-theory.fibonacci-seq'],\n },\n 'lucas-take-while': {\n category: 'number-theory',\n description: 'Generates the lucas sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { lucas-take-while } = import(\"number-theory\");\\nlucas-take-while(-> $ < 100)',\n ],\n seeAlso: ['number-theory.lucas-seq', 'number-theory.lucas-nth', 'number-theory.lucas?'],\n },\n 'lucas-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the lucas sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { lucas-nth } = import(\"number-theory\");\\nlucas-nth(1)',\n 'let { lucas-nth } = import(\"number-theory\");\\nlucas-nth(2)',\n 'let { lucas-nth } = import(\"number-theory\");\\nlucas-nth(10)',\n ],\n seeAlso: ['number-theory.lucas-seq', 'number-theory.lucas-take-while', 'number-theory.lucas?'],\n },\n 'lucas?': {\n category: 'number-theory',\n description: 'Determines if a number is in the lucas sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { lucas? } = import(\"number-theory\");\\nlucas?(1)',\n 'let { lucas? } = import(\"number-theory\");\\nlucas?(2)',\n 'let { lucas? } = import(\"number-theory\");\\nlucas?(10)',\n ],\n seeAlso: ['number-theory.lucas-seq', 'number-theory.lucas-nth', 'number-theory.fibonacci?', 'number-theory.lucas-take-while'],\n },\n 'lucky-seq': {\n category: 'number-theory',\n description: 'Generates the lucky sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { lucky-seq } = import(\"number-theory\");\\nlucky-seq(1)',\n 'let { lucky-seq } = import(\"number-theory\");\\nlucky-seq(2)',\n 'let { lucky-seq } = import(\"number-theory\");\\nlucky-seq(20)',\n ],\n seeAlso: ['number-theory.lucky-nth', 'number-theory.lucky-take-while', 'number-theory.lucky?', 'number-theory.happy-seq', 'number-theory.prime-seq'],\n },\n 'lucky-take-while': {\n category: 'number-theory',\n description: 'Generates the lucky sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { lucky-take-while } = import(\"number-theory\");\\nlucky-take-while(-> $ < 100)',\n ],\n seeAlso: ['number-theory.lucky-seq', 'number-theory.lucky-nth', 'number-theory.lucky?'],\n },\n 'lucky-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the lucky sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The position in the sequence.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { lucky-nth } = import(\"number-theory\");\\nlucky-nth(1)',\n 'let { lucky-nth } = import(\"number-theory\");\\nlucky-nth(2)',\n 'let { lucky-nth } = import(\"number-theory\");\\nlucky-nth(20)',\n ],\n seeAlso: ['number-theory.lucky-seq', 'number-theory.lucky-take-while', 'number-theory.lucky?'],\n },\n 'lucky?': {\n category: 'number-theory',\n description: 'Checks if a number is a lucky number.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { lucky? } = import(\"number-theory\");\\nlucky?(4)',\n 'let { lucky? } = import(\"number-theory\");\\nlucky?(7)',\n 'let { lucky? } = import(\"number-theory\");\\nlucky?(33)',\n ],\n seeAlso: ['number-theory.lucky-seq', 'number-theory.lucky-nth', 'number-theory.prime?', 'number-theory.lucky-take-while'],\n },\n 'mersenne-seq': {\n category: 'number-theory',\n description: 'Generates the Mersenne sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate. If not provided, the default is 9 (the maximum length of the pre-calculated mersenne numbers).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { mersenne-seq } = import(\"number-theory\");\\nmersenne-seq(1)',\n 'let { mersenne-seq } = import(\"number-theory\");\\nmersenne-seq(5)',\n 'let { mersenne-seq } = import(\"number-theory\");\\nmersenne-seq()',\n ],\n seeAlso: ['number-theory.mersenne-nth', 'number-theory.mersenne-take-while', 'number-theory.mersenne?', 'number-theory.prime-seq'],\n },\n 'mersenne-take-while': {\n category: 'number-theory',\n description: 'Generates the Mersenne sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { mersenne-take-while } = import(\"number-theory\");\\nmersenne-take-while(-> $ < 1000)',\n ],\n seeAlso: ['number-theory.mersenne-seq', 'number-theory.mersenne-nth', 'number-theory.mersenne?'],\n },\n 'mersenne-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Mersenne sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { mersenne-nth } = import(\"number-theory\");\\nmersenne-nth(1)',\n 'let { mersenne-nth } = import(\"number-theory\");\\nmersenne-nth(5)',\n ],\n seeAlso: ['number-theory.mersenne-seq', 'number-theory.mersenne-take-while', 'number-theory.mersenne?'],\n },\n 'mersenne?': {\n category: 'number-theory',\n description: 'Checks if a number is in the Mersenne sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { mersenne? } = import(\"number-theory\");\\nmersenne?(3)',\n 'let { mersenne? } = import(\"number-theory\");\\nmersenne?(4)',\n 'let { mersenne? } = import(\"number-theory\");\\nmersenne?(7)',\n ],\n seeAlso: ['number-theory.mersenne-seq', 'number-theory.mersenne-nth', 'number-theory.prime?', 'number-theory.mersenne-take-while'],\n },\n 'padovan-seq': {\n category: 'number-theory',\n description: 'Generates the Padovan sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { padovan-seq } = import(\"number-theory\");\\npadovan-seq(5)',\n 'let { padovan-seq } = import(\"number-theory\");\\npadovan-seq(10)',\n 'let { padovan-seq } = import(\"number-theory\");\\npadovan-seq(20)',\n ],\n seeAlso: ['number-theory.padovan-nth', 'number-theory.padovan-take-while', 'number-theory.padovan?', 'number-theory.fibonacci-seq'],\n },\n 'padovan-take-while': {\n category: 'number-theory',\n description: 'Generates the Padovan sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { padovan-take-while } = import(\"number-theory\");\\npadovan-take-while(-> $ < 1000)',\n ],\n seeAlso: ['number-theory.padovan-seq', 'number-theory.padovan-nth', 'number-theory.padovan?'],\n },\n 'padovan-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Padovan sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { padovan-nth } = import(\"number-theory\");\\npadovan-nth(5)',\n 'let { padovan-nth } = import(\"number-theory\");\\npadovan-nth(10)',\n 'let { padovan-nth } = import(\"number-theory\");\\npadovan-nth(20)',\n ],\n seeAlso: ['number-theory.padovan-seq', 'number-theory.padovan-take-while', 'number-theory.padovan?'],\n },\n 'padovan?': {\n category: 'number-theory',\n description: 'Checks if a number is in the Padovan sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { padovan? } = import(\"number-theory\");\\npadovan?(1)',\n 'let { padovan? } = import(\"number-theory\");\\npadovan?(265)',\n 'let { padovan? } = import(\"number-theory\");\\npadovan?(6)',\n ],\n seeAlso: ['number-theory.padovan-seq', 'number-theory.padovan-nth', 'number-theory.fibonacci?', 'number-theory.padovan-take-while'],\n },\n 'partition-seq': {\n category: 'number-theory',\n description: 'Generates the partition numbers up to a specified length. If no length is provided, it defaults to 299 (the maximum length of the pre-calculated partition numbers).',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { partition-seq } = import(\"number-theory\");\\npartition-seq(1)',\n 'let { partition-seq } = import(\"number-theory\");\\npartition-seq(10)',\n 'let { partition-seq } = import(\"number-theory\");\\npartition-seq()',\n ],\n seeAlso: ['number-theory.partition-nth', 'number-theory.partition-take-while', 'number-theory.partition?', 'number-theory.partitions', 'number-theory.count-partitions'],\n },\n 'partition-take-while': {\n category: 'number-theory',\n description: 'Generates the partition numbers while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { partition-take-while } = import(\"number-theory\");\\npartition-take-while(-> $ < 1000)',\n ],\n seeAlso: ['number-theory.partition-seq', 'number-theory.partition-nth', 'number-theory.partition?'],\n },\n 'partition-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the partition numbers.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the partition number to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { partition-nth } = import(\"number-theory\");\\npartition-nth(1)',\n 'let { partition-nth } = import(\"number-theory\");\\npartition-nth(5)',\n ],\n seeAlso: ['number-theory.partition-seq', 'number-theory.partition-take-while', 'number-theory.partition?'],\n },\n 'partition?': {\n category: 'number-theory',\n description: 'Checks if a number is in the partition numbers.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { partition? } = import(\"number-theory\");\\npartition?(0)',\n 'let { partition? } = import(\"number-theory\");\\npartition?(1)',\n 'let { partition? } = import(\"number-theory\");\\npartition?(2)',\n 'let { partition? } = import(\"number-theory\");\\npartition?(3)',\n 'let { partition? } = import(\"number-theory\");\\npartition?(4)',\n 'let { partition? } = import(\"number-theory\");\\npartition?(5)',\n ],\n seeAlso: ['number-theory.partition-seq', 'number-theory.partition-nth', 'number-theory.partitions', 'number-theory.partition-take-while'],\n },\n 'pell-seq': {\n category: 'number-theory',\n description: 'Generates the Pell sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate. If not provided, the default is 42 (the maximum length of the pre-calculated Pell numbers).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { pell-seq } = import(\"number-theory\");\\npell-seq(5)',\n 'let { pell-seq } = import(\"number-theory\");\\npell-seq(10)',\n 'let { pell-seq } = import(\"number-theory\");\\npell-seq()',\n ],\n seeAlso: ['number-theory.pell-nth', 'number-theory.pell-take-while', 'number-theory.pell?', 'number-theory.fibonacci-seq'],\n },\n 'pell-take-while': {\n category: 'number-theory',\n description: 'Generates the Pell sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { pell-take-while } = import(\"number-theory\");\\npell-take-while(-> $ < 1000)',\n ],\n seeAlso: ['number-theory.pell-seq', 'number-theory.pell-nth', 'number-theory.pell?'],\n },\n 'pell-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Pell sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { pell-nth } = import(\"number-theory\");\\npell-nth(5)',\n 'let { pell-nth } = import(\"number-theory\");\\npell-nth(10)',\n 'let { pell-nth } = import(\"number-theory\");\\npell-nth(20)',\n ],\n seeAlso: ['number-theory.pell-seq', 'number-theory.pell-take-while', 'number-theory.pell?'],\n },\n 'pell?': {\n category: 'number-theory',\n description: 'Checks if a number is a Pell number.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { pell? } = import(\"number-theory\");\\npell?(1)',\n 'let { pell? } = import(\"number-theory\");\\npell?(470832)',\n 'let { pell? } = import(\"number-theory\");\\npell?(10)',\n ],\n seeAlso: ['number-theory.pell-seq', 'number-theory.pell-nth', 'number-theory.fibonacci?', 'number-theory.pell-take-while'],\n },\n 'perfect-seq': {\n category: 'number-theory',\n description: 'Generates the perfect numbers up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate. If no length is provided, it defaults to 7 (the maximum length of the pre-calculated perfect numbers).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { perfect-seq } = import(\"number-theory\");\\nperfect-seq(1)',\n 'let { perfect-seq } = import(\"number-theory\");\\nperfect-seq(5)',\n 'let { perfect-seq } = import(\"number-theory\");\\nperfect-seq()',\n ],\n seeAlso: ['number-theory.perfect-nth', 'number-theory.perfect-take-while', 'number-theory.perfect?', 'number-theory.abundant-seq', 'number-theory.deficient-seq', 'number-theory.amicable?'],\n },\n 'perfect-take-while': {\n category: 'number-theory',\n description: 'Generates the perfect numbers while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { perfect-take-while } = import(\"number-theory\");\\nperfect-take-while(-> $ < 1000)',\n ],\n seeAlso: ['number-theory.perfect-seq', 'number-theory.perfect-nth', 'number-theory.perfect?'],\n },\n 'perfect-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the perfect numbers.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the perfect number to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { perfect-nth } = import(\"number-theory\");\\nperfect-nth(1)',\n 'let { perfect-nth } = import(\"number-theory\");\\nperfect-nth(5)',\n ],\n seeAlso: ['number-theory.perfect-seq', 'number-theory.perfect-take-while', 'number-theory.perfect?'],\n },\n 'perfect?': {\n category: 'number-theory',\n description: 'Checks if a number is in the perfect numbers.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { perfect? } = import(\"number-theory\");\\nperfect?(0)',\n 'let { perfect? } = import(\"number-theory\");\\nperfect?(1)',\n 'let { perfect? } = import(\"number-theory\");\\nperfect?(2)',\n 'let { perfect? } = import(\"number-theory\");\\nperfect?(3)',\n 'let { perfect? } = import(\"number-theory\");\\nperfect?(4)',\n 'let { perfect? } = import(\"number-theory\");\\nperfect?(5)',\n 'let { perfect? } = import(\"number-theory\");\\nperfect?(6)',\n 'let { perfect? } = import(\"number-theory\");\\nperfect?(7)',\n 'let { perfect? } = import(\"number-theory\");\\nperfect?(8)',\n 'let { perfect? } = import(\"number-theory\");\\nperfect?(9)',\n ],\n seeAlso: ['number-theory.perfect-seq', 'number-theory.perfect-nth', 'number-theory.abundant?', 'number-theory.deficient?', 'number-theory.sigma', 'number-theory.perfect-take-while', 'number-theory.amicable?', 'number-theory.proper-divisors'],\n },\n 'perfect-square-seq': {\n category: 'number-theory',\n description: 'Generates the perfect square numbers up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { perfect-square-seq } = import(\"number-theory\");\\nperfect-square-seq(5)',\n 'let { perfect-square-seq } = import(\"number-theory\");\\nperfect-square-seq(20)',\n ],\n seeAlso: ['number-theory.perfect-square-nth', 'number-theory.perfect-square-take-while', 'number-theory.perfect-square?', 'number-theory.perfect-cube-seq', 'number-theory.perfect-power-seq', 'number-theory.polygonal-seq'],\n },\n 'perfect-square-take-while': {\n category: 'number-theory',\n description: 'Generates the perfect square numbers while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { perfect-square-take-while } = import(\"number-theory\");\\nperfect-square-take-while(-> $ <= 100)',\n ],\n seeAlso: ['number-theory.perfect-square-seq', 'number-theory.perfect-square-nth', 'number-theory.perfect-square?'],\n },\n 'perfect-square-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the perfect square numbers.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { perfect-square-nth } = import(\"number-theory\");\\nperfect-square-nth(1)',\n 'let { perfect-square-nth } = import(\"number-theory\");\\nperfect-square-nth(5)',\n ],\n seeAlso: ['number-theory.perfect-square-seq', 'number-theory.perfect-square-take-while', 'number-theory.perfect-square?'],\n },\n 'perfect-square?': {\n category: 'number-theory',\n description: 'Checks if a number is a perfect square.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { perfect-square? } = import(\"number-theory\");\\nperfect-square?(16)',\n 'let { perfect-square? } = import(\"number-theory\");\\nperfect-square?(20)',\n ],\n seeAlso: ['number-theory.perfect-square-seq', 'number-theory.perfect-square-nth', 'number-theory.perfect-cube?', 'number-theory.perfect-power?', 'number-theory.perfect-square-take-while', 'number-theory.perfect-power', 'number-theory.polygonal?'],\n },\n 'perfect-cube-seq': {\n category: 'number-theory',\n description: 'Generates the perfect cube numbers up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { perfect-cube-seq } = import(\"number-theory\");\\nperfect-cube-seq(5)',\n 'let { perfect-cube-seq } = import(\"number-theory\");\\nperfect-cube-seq(20)',\n ],\n seeAlso: ['number-theory.perfect-cube-nth', 'number-theory.perfect-cube-take-while', 'number-theory.perfect-cube?', 'number-theory.perfect-square-seq', 'number-theory.perfect-power-seq'],\n },\n 'perfect-cube-take-while': {\n category: 'number-theory',\n description: 'Generates the perfect cube numbers while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { perfect-cube-take-while } = import(\"number-theory\");\\nperfect-cube-take-while(-> $ <= 100)',\n ],\n seeAlso: ['number-theory.perfect-cube-seq', 'number-theory.perfect-cube-nth', 'number-theory.perfect-cube?'],\n },\n 'perfect-cube-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the perfect cube numbers.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { perfect-cube-nth } = import(\"number-theory\");\\nperfect-cube-nth(1)',\n 'let { perfect-cube-nth } = import(\"number-theory\");\\nperfect-cube-nth(5)',\n ],\n seeAlso: ['number-theory.perfect-cube-seq', 'number-theory.perfect-cube-take-while', 'number-theory.perfect-cube?'],\n },\n 'perfect-cube?': {\n category: 'number-theory',\n description: 'Checks if a number is in the perfect cube numbers.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { perfect-cube? } = import(\"number-theory\");\\nperfect-cube?(7)',\n 'let { perfect-cube? } = import(\"number-theory\");\\nperfect-cube?(8)',\n 'let { perfect-cube? } = import(\"number-theory\");\\nperfect-cube?(9)',\n ],\n seeAlso: ['number-theory.perfect-cube-seq', 'number-theory.perfect-cube-nth', 'number-theory.perfect-square?', 'number-theory.perfect-power?', 'number-theory.perfect-cube-take-while', 'number-theory.perfect-power'],\n },\n 'perfect-power-seq': {\n category: 'number-theory',\n description: 'Generates the perfect power numbers up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { perfect-power-seq } = import(\"number-theory\");\\nperfect-power-seq(5)',\n 'let { perfect-power-seq } = import(\"number-theory\");\\nperfect-power-seq(20)',\n ],\n seeAlso: ['number-theory.perfect-power-nth', 'number-theory.perfect-power-take-while', 'number-theory.perfect-power?', 'number-theory.perfect-power', 'number-theory.perfect-square-seq', 'number-theory.perfect-cube-seq'],\n },\n 'perfect-power-take-while': {\n category: 'number-theory',\n description: 'Generates the perfect power numbers while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { perfect-power-take-while } = import(\"number-theory\");\\nperfect-power-take-while(-> $ <= 100)',\n ],\n seeAlso: ['number-theory.perfect-power-seq', 'number-theory.perfect-power-nth', 'number-theory.perfect-power?'],\n },\n 'perfect-power-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the perfect power numbers.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { perfect-power-nth } = import(\"number-theory\");\\nperfect-power-nth(3)',\n 'let { perfect-power-nth } = import(\"number-theory\");\\nperfect-power-nth(15)',\n ],\n seeAlso: ['number-theory.perfect-power-seq', 'number-theory.perfect-power-take-while', 'number-theory.perfect-power?'],\n },\n 'perfect-power?': {\n category: 'number-theory',\n description: 'Checks if a number is in the perfect power numbers.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { perfect-power? } = import(\"number-theory\");\\nperfect-power?(7)',\n 'let { perfect-power? } = import(\"number-theory\");\\nperfect-power?(8)',\n 'let { perfect-power? } = import(\"number-theory\");\\nperfect-power?(9)',\n 'let { perfect-power? } = import(\"number-theory\");\\nperfect-power?(10)',\n ],\n seeAlso: ['number-theory.perfect-power-seq', 'number-theory.perfect-power-nth', 'number-theory.perfect-power', 'number-theory.perfect-square?', 'number-theory.perfect-cube?', 'number-theory.perfect-power-take-while'],\n },\n 'polygonal-seq': {\n category: 'number-theory',\n description: 'Generates the polygonal sequence for a given number of sides and length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n sides: {\n type: 'integer',\n description: 'The number of sides of the polygon.',\n },\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'sides',\n 'length',\n ],\n },\n ],\n examples: [\n 'let { polygonal-seq } = import(\"number-theory\");\\npolygonal-seq(3, 2)',\n 'let { polygonal-seq } = import(\"number-theory\");\\npolygonal-seq(4, 2)',\n 'let { polygonal-seq } = import(\"number-theory\");\\npolygonal-seq(5, 3)',\n 'let { polygonal-seq } = import(\"number-theory\");\\npolygonal-seq(6, 5)',\n 'let { polygonal-seq } = import(\"number-theory\");\\npolygonal-seq(100, 10)',\n ],\n seeAlso: ['number-theory.polygonal-nth', 'number-theory.polygonal-take-while', 'number-theory.polygonal?', 'number-theory.perfect-square-seq'],\n },\n 'polygonal-take-while': {\n category: 'number-theory',\n description: 'Generates the polygonal sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n sides: {\n type: 'integer',\n description: 'The number of sides of the polygon.',\n },\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n a: {\n type: 'integer',\n },\n b: {\n type: 'function',\n },\n },\n variants: [\n {\n argumentNames: [\n 'sides',\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { polygonal-take-while } = import(\"number-theory\");\\npolygonal-take-while(15, -> $ < 1000)',\n ],\n seeAlso: ['number-theory.polygonal-seq', 'number-theory.polygonal-nth', 'number-theory.polygonal?'],\n },\n 'polygonal-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the polygonal sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n sides: {\n type: 'integer',\n description: 'The number of sides of the polygon.',\n },\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'sides',\n 'n',\n ],\n },\n ],\n examples: [\n 'let { polygonal-nth } = import(\"number-theory\");\\npolygonal-nth(3, 9)',\n 'let { polygonal-nth } = import(\"number-theory\");\\npolygonal-nth(4, 5)',\n 'let { polygonal-nth } = import(\"number-theory\");\\npolygonal-nth(5, 5)',\n ],\n seeAlso: ['number-theory.polygonal-seq', 'number-theory.polygonal-take-while', 'number-theory.polygonal?'],\n },\n 'polygonal?': {\n category: 'number-theory',\n description: 'Checks if a number is in the polygonal sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n sides: {\n type: 'integer',\n description: 'The number of sides of the polygon.',\n },\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'sides',\n 'n',\n ],\n },\n ],\n examples: [\n 'let { polygonal? } = import(\"number-theory\");\\npolygonal?(3, 10)',\n 'let { polygonal? } = import(\"number-theory\");\\npolygonal?(3, 9)',\n 'let { polygonal? } = import(\"number-theory\");\\npolygonal?(4, 10000)',\n 'let { polygonal? } = import(\"number-theory\");\\npolygonal?(4, 1000)',\n 'let { polygonal? } = import(\"number-theory\");\\npolygonal?(6, 45)',\n ],\n seeAlso: ['number-theory.polygonal-seq', 'number-theory.polygonal-nth', 'number-theory.perfect-square?', 'number-theory.polygonal-take-while'],\n },\n 'prime-seq': {\n category: 'number-theory',\n description: 'Generates the prime sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { prime-seq } = import(\"number-theory\");\\nprime-seq(1)',\n 'let { prime-seq } = import(\"number-theory\");\\nprime-seq(2)',\n 'let { prime-seq } = import(\"number-theory\");\\nprime-seq(10)',\n ],\n seeAlso: ['number-theory.prime-nth', 'number-theory.prime-take-while', 'number-theory.prime?', 'number-theory.composite-seq', 'number-theory.mersenne-seq', 'number-theory.lucky-seq'],\n },\n 'prime-take-while': {\n category: 'number-theory',\n description: 'Generates the prime sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { prime-take-while } = import(\"number-theory\");\\nprime-take-while(-> $ < 50)',\n ],\n seeAlso: ['number-theory.prime-seq', 'number-theory.prime-nth', 'number-theory.prime?'],\n },\n 'prime-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the prime sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { prime-nth } = import(\"number-theory\");\\nprime-nth(1)',\n 'let { prime-nth } = import(\"number-theory\");\\nprime-nth(2)',\n 'let { prime-nth } = import(\"number-theory\");\\nprime-nth(10)',\n ],\n seeAlso: ['number-theory.prime-seq', 'number-theory.prime-take-while', 'number-theory.prime?'],\n },\n 'prime?': {\n category: 'number-theory',\n description: 'Determines if a number is prime.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { prime? } = import(\"number-theory\");\\nprime?(1)',\n 'let { prime? } = import(\"number-theory\");\\nprime?(2)',\n 'let { prime? } = import(\"number-theory\");\\nprime?(3)',\n 'let { prime? } = import(\"number-theory\");\\nprime?(4)',\n 'let { prime? } = import(\"number-theory\");\\nprime?(997)',\n 'let { prime? } = import(\"number-theory\");\\nprime?(1001)',\n ],\n seeAlso: ['number-theory.prime-seq', 'number-theory.prime-nth', 'number-theory.composite?', 'number-theory.prime-factors', 'number-theory.mersenne?', 'number-theory.prime-take-while', 'number-theory.lucky?'],\n },\n 'recaman-seq': {\n category: 'number-theory',\n description: 'Generates the Recaman sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { recaman-seq } = import(\"number-theory\");\\nrecaman-seq(5)',\n 'let { recaman-seq } = import(\"number-theory\");\\nrecaman-seq(10)',\n 'let { recaman-seq } = import(\"number-theory\");\\nrecaman-seq(20)',\n ],\n seeAlso: ['number-theory.recaman-nth', 'number-theory.recaman-take-while', 'number-theory.recaman?', 'number-theory.golomb-seq'],\n },\n 'recaman-take-while': {\n category: 'number-theory',\n description: 'Generates the Recaman sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { recaman-take-while } = import(\"number-theory\");\\nrecaman-take-while(-> $ < 10)',\n ],\n seeAlso: ['number-theory.recaman-seq', 'number-theory.recaman-nth', 'number-theory.recaman?'],\n },\n 'recaman-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Recaman sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { recaman-nth } = import(\"number-theory\");\\nrecaman-nth(5)',\n 'let { recaman-nth } = import(\"number-theory\");\\nrecaman-nth(10)',\n 'let { recaman-nth } = import(\"number-theory\");\\nrecaman-nth(20)',\n ],\n seeAlso: ['number-theory.recaman-seq', 'number-theory.recaman-take-while', 'number-theory.recaman?'],\n },\n 'recaman?': {\n category: 'number-theory',\n description: 'Checks if a number is in the Recaman sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { recaman? } = import(\"number-theory\");\\nrecaman?(5)',\n 'let { recaman? } = import(\"number-theory\");\\nrecaman?(10)',\n 'let { recaman? } = import(\"number-theory\");\\nrecaman?(20)',\n ],\n seeAlso: ['number-theory.recaman-seq', 'number-theory.recaman-nth', 'number-theory.recaman-take-while'],\n },\n 'sylvester-seq': {\n category: 'number-theory',\n description: 'Generates the Sylvester sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate. If not provided, the default is 6 (the maximum length of the pre-calculated Sylvester numbers).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { sylvester-seq } = import(\"number-theory\");\\nsylvester-seq(5)',\n 'let { sylvester-seq } = import(\"number-theory\");\\nsylvester-seq()',\n 'let { sylvester-seq } = import(\"number-theory\");\\nsylvester-seq()',\n ],\n seeAlso: ['number-theory.sylvester-nth', 'number-theory.sylvester-take-while', 'number-theory.sylvester?'],\n },\n 'sylvester-take-while': {\n category: 'number-theory',\n description: 'Generates the Sylvester sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { sylvester-take-while } = import(\"number-theory\");\\nsylvester-take-while(-> $ < 100000)',\n ],\n seeAlso: ['number-theory.sylvester-seq', 'number-theory.sylvester-nth', 'number-theory.sylvester?'],\n },\n 'sylvester-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Sylvester sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { sylvester-nth } = import(\"number-theory\");\\nsylvester-nth(1)',\n 'let { sylvester-nth } = import(\"number-theory\");\\nsylvester-nth(5)',\n ],\n seeAlso: ['number-theory.sylvester-seq', 'number-theory.sylvester-take-while', 'number-theory.sylvester?'],\n },\n 'sylvester?': {\n category: 'number-theory',\n description: 'Checks if a number is in the Sylvester sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { sylvester? } = import(\"number-theory\");\\nsylvester?(2)',\n 'let { sylvester? } = import(\"number-theory\");\\nsylvester?(3)',\n 'let { sylvester? } = import(\"number-theory\");\\nsylvester?(6)',\n ],\n seeAlso: ['number-theory.sylvester-seq', 'number-theory.sylvester-nth', 'number-theory.sylvester-take-while'],\n },\n 'thue-morse-seq': {\n category: 'number-theory',\n description: 'Generates the Thue-Morse sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { thue-morse-seq } = import(\"number-theory\");\\nthue-morse-seq(5)',\n 'let { thue-morse-seq } = import(\"number-theory\");\\nthue-morse-seq(10)',\n 'let { thue-morse-seq } = import(\"number-theory\");\\nthue-morse-seq(20)',\n ],\n seeAlso: ['number-theory.thue-morse-nth', 'number-theory.thue-morse-take-while', 'number-theory.thue-morse?'],\n },\n 'thue-morse-take-while': {\n category: 'number-theory',\n description: 'Generates the Thue-Morse sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { thue-morse-take-while } = import(\"number-theory\");\\nthue-morse-take-while(-> $2 < 10)',\n ],\n seeAlso: ['number-theory.thue-morse-seq', 'number-theory.thue-morse-nth', 'number-theory.thue-morse?'],\n },\n 'thue-morse-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Thue-Morse sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term in the sequence.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { thue-morse-nth } = import(\"number-theory\");\\nthue-morse-nth(5)',\n 'let { thue-morse-nth } = import(\"number-theory\");\\nthue-morse-nth(10)',\n 'let { thue-morse-nth } = import(\"number-theory\");\\nthue-morse-nth(20)',\n ],\n seeAlso: ['number-theory.thue-morse-seq', 'number-theory.thue-morse-take-while', 'number-theory.thue-morse?'],\n },\n 'thue-morse?': {\n category: 'number-theory',\n description: 'Checks if a number is part of the Thue-Morse sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { thue-morse? } = import(\"number-theory\");\\nthue-morse?(1)',\n 'let { thue-morse? } = import(\"number-theory\");\\nthue-morse?(2)',\n ],\n seeAlso: ['number-theory.thue-morse-seq', 'number-theory.thue-morse-nth', 'number-theory.thue-morse-take-while'],\n },\n 'tribonacci-seq': {\n category: 'number-theory',\n description: 'Generates the tribonacci sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { tribonacci-seq } = import(\"number-theory\");\\ntribonacci-seq(1)',\n 'let { tribonacci-seq } = import(\"number-theory\");\\ntribonacci-seq(2)',\n 'let { tribonacci-seq } = import(\"number-theory\");\\ntribonacci-seq(10)',\n ],\n seeAlso: ['number-theory.tribonacci-nth', 'number-theory.tribonacci-take-while', 'number-theory.tribonacci?', 'number-theory.fibonacci-seq'],\n },\n 'tribonacci-take-while': {\n category: 'number-theory',\n description: 'Generates the tribonacci sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { tribonacci-take-while } = import(\"number-theory\");\\ntribonacci-take-while(-> $ < 100)',\n ],\n seeAlso: ['number-theory.tribonacci-seq', 'number-theory.tribonacci-nth', 'number-theory.tribonacci?'],\n },\n 'tribonacci-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the tribonacci sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { tribonacci-nth } = import(\"number-theory\");\\ntribonacci-nth(1)',\n 'let { tribonacci-nth } = import(\"number-theory\");\\ntribonacci-nth(2)',\n 'let { tribonacci-nth } = import(\"number-theory\");\\ntribonacci-nth(10)',\n ],\n seeAlso: ['number-theory.tribonacci-seq', 'number-theory.tribonacci-take-while', 'number-theory.tribonacci?'],\n },\n 'tribonacci?': {\n category: 'number-theory',\n description: 'Determines if a number is in the tribonacci sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(0)',\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(1)',\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(2)',\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(3)',\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(4)',\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(5)',\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(6)',\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(7)',\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(8)',\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(9)',\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(10)',\n ],\n seeAlso: ['number-theory.tribonacci-seq', 'number-theory.tribonacci-nth', 'number-theory.fibonacci?', 'number-theory.tribonacci-take-while'],\n },\n 'count-combinations': {\n category: 'number-theory',\n description: 'Calculates the number of combinations of n items taken k at a time.',\n returns: {\n type: 'integer',\n },\n args: {\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { count-combinations } = import(\"number-theory\");\\ncount-combinations(5, 3)',\n 'let { count-combinations } = import(\"number-theory\");\\ncount-combinations(10, 2)',\n ],\n seeAlso: ['number-theory.combinations', 'number-theory.count-permutations', 'number-theory.factorial', 'number-theory.multinomial', 'number-theory.stirling-second', 'number-theory.count-partitions', 'number-theory.count-power-set'],\n },\n 'combinations': {\n category: 'number-theory',\n description: 'Generates all possible combinations of a specified size from a collection.',\n returns: {\n type: 'array',\n array: true,\n },\n args: {\n set: {\n type: 'array',\n array: true,\n description: 'The input collection to generate combinations from.',\n },\n n: {\n type: 'integer',\n description: 'The size of each combination.',\n },\n a: {\n type: 'array',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'set',\n 'n',\n ],\n },\n ],\n examples: [\n 'let { combinations } = import(\"number-theory\");\\ncombinations([1, 2, 3], 2)',\n 'let { combinations } = import(\"number-theory\");\\ncombinations([\"a\", \"b\", \"c\"], 2)',\n 'let { combinations } = import(\"number-theory\");\\ncombinations([1, 2, 3], 0)',\n 'let { combinations } = import(\"number-theory\");\\ncombinations([1, 2, 3], 1)',\n 'let { combinations } = import(\"number-theory\");\\ncombinations([1, 2, 3], 3)',\n ],\n seeAlso: ['number-theory.count-combinations', 'number-theory.permutations', 'number-theory.power-set', 'number-theory.cartesian-product', 'number-theory.partitions'],\n },\n 'count-derangements': {\n category: 'number-theory',\n description: 'Calculates the number of derangements (permutations where no element appears in its original position) of n items.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The total number of items.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { count-derangements } = import(\"number-theory\");\\ncount-derangements(4)',\n 'let { count-derangements } = import(\"number-theory\");\\ncount-derangements(5)',\n ],\n seeAlso: ['number-theory.derangements', 'number-theory.count-permutations', 'number-theory.factorial'],\n },\n 'derangements': {\n category: 'number-theory',\n description: 'Generates all derangements (permutations where no element appears in its original position) of a set.',\n returns: {\n type: 'array',\n array: true,\n },\n args: {\n set: {\n type: 'array',\n array: true,\n description: 'The input collection to generate derangements from.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'set',\n ],\n },\n ],\n examples: [\n 'let { derangements } = import(\"number-theory\");\\nderangements([1, 2, 3, 4])',\n 'let { derangements } = import(\"number-theory\");\\nderangements([\"a\", \"b\", \"c\"])',\n ],\n seeAlso: ['number-theory.count-derangements', 'number-theory.permutations'],\n },\n 'divisors': {\n category: 'number-theory',\n description: 'Returns the divisors of a number.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to find divisors for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { divisors } = import(\"number-theory\");\\ndivisors(12)',\n 'let { divisors } = import(\"number-theory\");\\ndivisors(100)',\n 'let { divisors } = import(\"number-theory\");\\ndivisors(37)',\n ],\n seeAlso: ['number-theory.count-divisors', 'number-theory.proper-divisors', 'number-theory.sigma', 'number-theory.prime-factors', 'number-theory.divisible-by?', 'number-theory.lcm', 'number-theory.abundant?', 'number-theory.deficient?', 'number-theory.count-proper-divisors'],\n },\n 'count-divisors': {\n category: 'number-theory',\n description: 'Returns the number of divisors of a number.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to count divisors for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { count-divisors } = import(\"number-theory\");\\ncount-divisors(12)',\n 'let { count-divisors } = import(\"number-theory\");\\ncount-divisors(100)',\n 'let { count-divisors } = import(\"number-theory\");\\ncount-divisors(37)',\n ],\n seeAlso: ['number-theory.divisors', 'number-theory.count-proper-divisors', 'number-theory.sigma'],\n },\n 'proper-divisors': {\n category: 'number-theory',\n description: 'Returns the proper divisors of a number.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to find proper divisors for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { proper-divisors } = import(\"number-theory\");\\nproper-divisors(12)',\n 'let { proper-divisors } = import(\"number-theory\");\\nproper-divisors(100)',\n 'let { proper-divisors } = import(\"number-theory\");\\nproper-divisors(37)',\n ],\n seeAlso: ['number-theory.count-proper-divisors', 'number-theory.divisors', 'number-theory.amicable?', 'number-theory.perfect?'],\n },\n 'count-proper-divisors': {\n category: 'number-theory',\n description: 'Returns the number of proper divisors of a number.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to count proper divisors for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { count-proper-divisors } = import(\"number-theory\");\\ncount-proper-divisors(12)',\n 'let { count-proper-divisors } = import(\"number-theory\");\\ncount-proper-divisors(100)',\n 'let { count-proper-divisors } = import(\"number-theory\");\\ncount-proper-divisors(37)',\n ],\n seeAlso: ['number-theory.proper-divisors', 'number-theory.count-divisors', 'number-theory.divisors'],\n },\n 'factorial': {\n category: 'number-theory',\n description: 'Calculates the factorial of a number.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to calculate the factorial for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { factorial } = import(\"number-theory\");\\nfactorial(5)',\n 'let { factorial } = import(\"number-theory\");\\nfactorial(0)',\n 'let { factorial } = import(\"number-theory\");\\nfactorial(10)',\n 'let { factorial } = import(\"number-theory\");\\nfactorial(20)',\n ],\n seeAlso: ['number-theory.factorial-seq', 'number-theory.factorial-nth', 'number-theory.factorial?', 'number-theory.count-combinations', 'number-theory.count-permutations', 'number-theory.multinomial', 'number-theory.count-derangements'],\n },\n 'partitions': {\n category: 'number-theory',\n description: 'Generates all partitions of a number.',\n returns: {\n type: 'array',\n array: true,\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to partition.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { partitions } = import(\"number-theory\");\\npartitions(4)',\n 'let { partitions } = import(\"number-theory\");\\npartitions(8)',\n ],\n seeAlso: ['number-theory.count-partitions', 'number-theory.partition-seq', 'number-theory.combinations', 'number-theory.partition?'],\n },\n 'count-partitions': {\n category: 'number-theory',\n description: 'Returns the number of partitions of a number.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to count partitions for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { count-partitions } = import(\"number-theory\");\\ncount-partitions(4)',\n 'let { count-partitions } = import(\"number-theory\");\\ncount-partitions(8)',\n 'let { count-partitions } = import(\"number-theory\");\\ncount-partitions(15)',\n ],\n seeAlso: ['number-theory.partitions', 'number-theory.partition-seq', 'number-theory.count-combinations'],\n },\n 'permutations': {\n category: 'number-theory',\n description: 'Generates all permutations of a collection.',\n returns: {\n type: 'array',\n array: true,\n },\n args: {\n set: {\n type: 'array',\n array: true,\n description: 'The input collection to generate permutations from.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'set',\n ],\n },\n ],\n examples: [\n 'let { permutations } = import(\"number-theory\");\\npermutations([1, 2, 3])',\n 'let { permutations } = import(\"number-theory\");\\npermutations([\"a\", \"b\", \"c\"])',\n 'let { permutations } = import(\"number-theory\");\\npermutations([1, 2, 3, 4])',\n 'let { permutations } = import(\"number-theory\");\\npermutations([1, 2])',\n 'let { permutations } = import(\"number-theory\");\\npermutations([1])',\n 'let { permutations } = import(\"number-theory\");\\npermutations([])',\n ],\n seeAlso: ['number-theory.count-permutations', 'number-theory.combinations', 'number-theory.derangements', 'number-theory.cartesian-product'],\n },\n 'count-permutations': {\n category: 'number-theory',\n description: 'Returns the number of permutations of n items taken k at a time.',\n returns: {\n type: 'integer',\n },\n args: {\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { count-permutations } = import(\"number-theory\");\\ncount-permutations(5, 3)',\n 'let { count-permutations } = import(\"number-theory\");\\ncount-permutations(10, 2)',\n 'let { count-permutations } = import(\"number-theory\");\\ncount-permutations(10, 10)',\n 'let { count-permutations } = import(\"number-theory\");\\ncount-permutations(10, 0)',\n 'let { count-permutations } = import(\"number-theory\");\\ncount-permutations(10, 1)',\n ],\n seeAlso: ['number-theory.permutations', 'number-theory.count-combinations', 'number-theory.factorial', 'number-theory.multinomial', 'number-theory.stirling-first', 'number-theory.count-derangements'],\n },\n 'power-set': {\n category: 'number-theory',\n description: 'Generates the power set of a collection.',\n returns: {\n type: 'array',\n array: true,\n },\n args: {\n set: {\n type: 'any',\n array: true,\n description: 'The input collection to generate the power set from.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'set',\n ],\n },\n ],\n examples: [\n 'let { power-set } = import(\"number-theory\");\\npower-set([\"a\", \"b\", \"c\"])',\n 'let { power-set } = import(\"number-theory\");\\npower-set([1, 2])',\n 'let { power-set } = import(\"number-theory\");\\npower-set([1])',\n 'let { power-set } = import(\"number-theory\");\\npower-set([])',\n ],\n seeAlso: ['number-theory.count-power-set', 'number-theory.combinations', 'number-theory.cartesian-product'],\n },\n 'count-power-set': {\n category: 'number-theory',\n description: 'Returns the number of subsets of a set.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The size of the set.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { count-power-set } = import(\"number-theory\");\\ncount-power-set(3)',\n 'let { count-power-set } = import(\"number-theory\");\\ncount-power-set(5)',\n 'let { count-power-set } = import(\"number-theory\");\\ncount-power-set(10)',\n ],\n seeAlso: ['number-theory.power-set', 'number-theory.count-combinations'],\n },\n 'prime-factors': {\n category: 'number-theory',\n description: 'Returns the prime factors of a number.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to factor.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { prime-factors } = import(\"number-theory\");\\nprime-factors(12)',\n 'let { prime-factors } = import(\"number-theory\");\\nprime-factors(100)',\n 'let { prime-factors } = import(\"number-theory\");\\nprime-factors(37)',\n ],\n seeAlso: ['number-theory.count-prime-factors', 'number-theory.distinct-prime-factors', 'number-theory.prime?', 'number-theory.divisors', 'number-theory.euler-totient', 'number-theory.mobius', 'number-theory.composite?', 'number-theory.count-distinct-prime-factors'],\n },\n 'count-prime-factors': {\n category: 'number-theory',\n description: 'Returns the number of prime factors of a number.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to count prime factors for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { count-prime-factors } = import(\"number-theory\");\\ncount-prime-factors(12)',\n 'let { count-prime-factors } = import(\"number-theory\");\\ncount-prime-factors(100)',\n 'let { count-prime-factors } = import(\"number-theory\");\\ncount-prime-factors(37)',\n ],\n seeAlso: ['number-theory.prime-factors', 'number-theory.distinct-prime-factors', 'number-theory.count-distinct-prime-factors'],\n },\n 'distinct-prime-factors': {\n category: 'number-theory',\n description: 'Returns the distinct prime factors of a number.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to find distinct prime factors for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { distinct-prime-factors } = import(\"number-theory\");\\ndistinct-prime-factors(12)',\n 'let { distinct-prime-factors } = import(\"number-theory\");\\ndistinct-prime-factors(100)',\n 'let { distinct-prime-factors } = import(\"number-theory\");\\ndistinct-prime-factors(37)',\n ],\n seeAlso: ['number-theory.prime-factors', 'number-theory.count-distinct-prime-factors', 'number-theory.count-prime-factors'],\n },\n 'count-distinct-prime-factors': {\n category: 'number-theory',\n description: 'Returns the number of distinct prime factors of a number.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to count distinct prime factors for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { count-distinct-prime-factors } = import(\"number-theory\");\\ncount-distinct-prime-factors(12)',\n 'let { count-distinct-prime-factors } = import(\"number-theory\");\\ncount-distinct-prime-factors(100)',\n 'let { count-distinct-prime-factors } = import(\"number-theory\");\\ncount-distinct-prime-factors(37)',\n ],\n seeAlso: ['number-theory.distinct-prime-factors', 'number-theory.prime-factors', 'number-theory.count-prime-factors'],\n },\n 'coprime?': {\n category: 'number-theory',\n description: 'Checks if two numbers are coprime (i.e., their GCD is 1).',\n returns: {\n type: 'boolean',\n },\n args: {\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { coprime? } = import(\"number-theory\");\\ncoprime?(12, 8)',\n 'let { coprime? } = import(\"number-theory\");\\ncoprime?(12, 5)',\n 'let { coprime? } = import(\"number-theory\");\\ncoprime?(37, 1)',\n 'let { coprime? } = import(\"number-theory\");\\ncoprime?(0, 0)',\n 'let { coprime? } = import(\"number-theory\");\\ncoprime?(0, 5)',\n 'let { coprime? } = import(\"number-theory\");\\ncoprime?(5, 0)',\n 'let { coprime? } = import(\"number-theory\");\\ncoprime?(1, 0)',\n 'let { coprime? } = import(\"number-theory\");\\ncoprime?(0, 1)',\n 'let { coprime? } = import(\"number-theory\");\\ncoprime?(1, 1)',\n 'let { coprime? } = import(\"number-theory\");\\ncoprime?(2, 3)',\n ],\n seeAlso: ['number-theory.gcd', 'number-theory.euler-totient', 'number-theory.divisible-by?', 'number-theory.lcm', 'number-theory.carmichael-lambda'],\n },\n 'divisible-by?': {\n category: 'number-theory',\n description: 'Checks if a number is divisible by another number.',\n returns: {\n type: 'boolean',\n },\n args: {\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { divisible-by? } = import(\"number-theory\");\\ndivisible-by?(12, 4)',\n 'let { divisible-by? } = import(\"number-theory\");\\ndivisible-by?(12, 5)',\n 'let { divisible-by? } = import(\"number-theory\");\\ndivisible-by?(37, 1)',\n 'let { divisible-by? } = import(\"number-theory\");\\ndivisible-by?(0, 0)',\n 'let { divisible-by? } = import(\"number-theory\");\\ndivisible-by?(0, 5)',\n 'let { divisible-by? } = import(\"number-theory\");\\ndivisible-by?(5, 0)',\n ],\n seeAlso: ['number-theory.divisors', 'number-theory.gcd', 'number-theory.coprime?'],\n },\n 'gcd': {\n category: 'number-theory',\n description: 'Calculates the greatest common divisor (GCD) of two numbers.',\n returns: {\n type: 'integer',\n },\n args: {\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { gcd } = import(\"number-theory\");\\ngcd(100, 25)',\n 'let { gcd } = import(\"number-theory\");\\ngcd(37, 1)',\n 'let { gcd } = import(\"number-theory\");\\ngcd(0, 0)',\n 'let { gcd } = import(\"number-theory\");\\ngcd(0, 5)',\n 'let { gcd } = import(\"number-theory\");\\ngcd(5, 0)',\n ],\n seeAlso: ['number-theory.lcm', 'number-theory.extended-gcd', 'number-theory.coprime?', 'number-theory.divisible-by?'],\n },\n 'lcm': {\n category: 'number-theory',\n description: 'Calculates the least common multiple (LCM) of two numbers.',\n returns: {\n type: 'integer',\n },\n args: {\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { lcm } = import(\"number-theory\");\\nlcm(100, 25)',\n 'let { lcm } = import(\"number-theory\");\\nlcm(37, 1)',\n 'let { lcm } = import(\"number-theory\");\\nlcm(0, 5)',\n 'let { lcm } = import(\"number-theory\");\\nlcm(5, 0)',\n ],\n seeAlso: ['number-theory.gcd', 'number-theory.divisors', 'number-theory.coprime?'],\n },\n 'multinomial': {\n category: 'number-theory',\n description: 'Calculates the multinomial coefficient from of a list of numbers representing the sizes of each group.',\n returns: {\n type: 'integer',\n },\n args: {\n args: {\n type: 'integer',\n rest: true,\n description: 'The numbers representing the sizes of each group.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'args',\n ],\n },\n ],\n examples: [\n 'let { multinomial } = import(\"number-theory\");\\nmultinomial(5, 2, 3)',\n 'let { multinomial } = import(\"number-theory\");\\nmultinomial(10, 2, 3, 5)',\n ],\n seeAlso: ['number-theory.count-combinations', 'number-theory.factorial', 'number-theory.count-permutations'],\n hideOperatorForm: true,\n },\n 'amicable?': {\n category: 'number-theory',\n description: 'Checks if two numbers are amicable (i.e., the sum of the proper divisors of each number equals the other number).',\n returns: {\n type: 'boolean',\n },\n args: {\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { amicable? } = import(\"number-theory\");\\namicable?(220, 284)',\n 'let { amicable? } = import(\"number-theory\");\\namicable?(1184, 1210)',\n 'let { amicable? } = import(\"number-theory\");\\namicable?(2620, 2924)',\n 'let { amicable? } = import(\"number-theory\");\\namicable?(5020, 5564)',\n 'let { amicable? } = import(\"number-theory\");\\namicable?(6232, 6368)',\n ],\n seeAlso: ['number-theory.proper-divisors', 'number-theory.perfect?', 'number-theory.sigma', 'number-theory.perfect-seq'],\n },\n 'euler-totient': {\n category: 'number-theory',\n description: 'Calculates the Euler\\'s totient function (φ(n)) of a number, which counts the integers up to n that are coprime to n.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to calculate the totient for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { euler-totient } = import(\"number-theory\");\\neuler-totient(1)',\n 'let { euler-totient } = import(\"number-theory\");\\neuler-totient(2)',\n 'let { euler-totient } = import(\"number-theory\");\\neuler-totient(10)',\n 'let { euler-totient } = import(\"number-theory\");\\neuler-totient(20)',\n ],\n seeAlso: ['number-theory.coprime?', 'number-theory.carmichael-lambda', 'number-theory.mobius', 'number-theory.prime-factors', 'number-theory.mertens'],\n },\n 'mobius': {\n category: 'number-theory',\n description: 'Calculates the Möbius function (μ(n)) of a number, which is used in number theory.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to calculate the Möbius function for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { mobius } = import(\"number-theory\");\\nmobius(1)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(2)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(3)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(4)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(6)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(12)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(30)',\n ],\n seeAlso: ['number-theory.mertens', 'number-theory.euler-totient', 'number-theory.prime-factors'],\n },\n 'mertens': {\n category: 'number-theory',\n description: 'Calculates the Mertens function (M(n)) of a number, which is the sum of the Möbius function up to n.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to calculate the Mertens function for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { mobius } = import(\"number-theory\");\\nmobius(1)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(2)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(3)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(4)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(6)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(12)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(30)',\n ],\n seeAlso: ['number-theory.mobius', 'number-theory.euler-totient'],\n },\n 'sigma': {\n category: 'number-theory',\n description: 'Calculates the sum of divisors function (σ(n)) of a number, which is the sum of all positive divisors of n.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to calculate the sum of divisors for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { sigma } = import(\"number-theory\");\\nsigma(1)',\n 'let { sigma } = import(\"number-theory\");\\nsigma(2)',\n 'let { sigma } = import(\"number-theory\");\\nsigma(3)',\n 'let { sigma } = import(\"number-theory\");\\nsigma(4)',\n 'let { sigma } = import(\"number-theory\");\\nsigma(6)',\n 'let { sigma } = import(\"number-theory\");\\nsigma(12)',\n 'let { sigma } = import(\"number-theory\");\\nsigma(30)',\n ],\n seeAlso: ['number-theory.divisors', 'number-theory.perfect?', 'number-theory.abundant?', 'number-theory.deficient?', 'number-theory.amicable?', 'number-theory.count-divisors'],\n },\n 'carmichael-lambda': {\n category: 'number-theory',\n description: 'Calculates the Carmichael function (λ(n)) of a number, which is the smallest positive integer m such that a^m ≡ 1 (mod n) for all integers a coprime to n.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to calculate the Carmichael function for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { carmichael-lambda } = import(\"number-theory\");\\ncarmichael-lambda(1)',\n 'let { carmichael-lambda } = import(\"number-theory\");\\ncarmichael-lambda(2)',\n 'let { carmichael-lambda } = import(\"number-theory\");\\ncarmichael-lambda(3)',\n 'let { carmichael-lambda } = import(\"number-theory\");\\ncarmichael-lambda(4)',\n 'let { carmichael-lambda } = import(\"number-theory\");\\ncarmichael-lambda(6)',\n 'let { carmichael-lambda } = import(\"number-theory\");\\ncarmichael-lambda(12)',\n 'let { carmichael-lambda } = import(\"number-theory\");\\ncarmichael-lambda(30)',\n ],\n seeAlso: ['number-theory.euler-totient', 'number-theory.mod-exp', 'number-theory.coprime?'],\n },\n 'cartesian-product': {\n category: 'number-theory',\n description: 'Calculates the Cartesian product of two or more sets.',\n returns: {\n type: 'array',\n array: true,\n },\n args: {\n sets: {\n type: 'array',\n array: true,\n description: 'The input collections to calculate the Cartesian product from.',\n },\n a: {\n type: 'array',\n },\n b: {\n type: 'array',\n },\n },\n variants: [\n {\n argumentNames: [\n 'sets',\n ],\n },\n ],\n examples: [\n 'let { cartesian-product } = import(\"number-theory\");\\ncartesian-product([1, 2], [\"a\", \"b\"])',\n 'let { cartesian-product } = import(\"number-theory\");\\ncartesian-product([1, 2], [\"a\", \"b\"], [true, false])',\n 'let { cartesian-product } = import(\"number-theory\");\\ncartesian-product([1, 2, 3], [\"x\", \"y\", \"z\"])',\n ],\n seeAlso: ['number-theory.combinations', 'number-theory.power-set', 'number-theory.permutations'],\n },\n 'perfect-power': {\n category: 'number-theory',\n description: 'Returns a tuple of the base and exponent if the number is a perfect power, otherwise returns null.',\n returns: {\n type: 'array',\n array: true,\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { perfect-power } = import(\"number-theory\");\\nperfect-power(1)',\n 'let { perfect-power } = import(\"number-theory\");\\nperfect-power(2)',\n 'let { perfect-power } = import(\"number-theory\");\\nperfect-power(4)',\n 'let { perfect-power } = import(\"number-theory\");\\nperfect-power(8)',\n 'let { perfect-power } = import(\"number-theory\");\\nperfect-power(9)',\n 'let { perfect-power } = import(\"number-theory\");\\nperfect-power(16)',\n 'let { perfect-power } = import(\"number-theory\");\\nperfect-power(19)',\n ],\n seeAlso: ['number-theory.perfect-power?', 'number-theory.perfect-power-seq', 'number-theory.perfect-square?', 'number-theory.perfect-cube?'],\n },\n 'mod-exp': {\n category: 'number-theory',\n description: 'Calculates the modular exponentiation of a base raised to an exponent modulo a modulus.',\n returns: {\n type: 'integer',\n },\n args: {\n base: {\n type: 'integer',\n },\n exponent: {\n type: 'integer',\n },\n modulus: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'base',\n 'exponent',\n 'modulus',\n ],\n },\n ],\n examples: [\n 'let { mod-exp } = import(\"number-theory\");\\nmod-exp(2, 3, 5)',\n 'let { mod-exp } = import(\"number-theory\");\\nmod-exp(3, 4, 7)',\n 'let { mod-exp } = import(\"number-theory\");\\nmod-exp(5, 6, 11)',\n 'let { mod-exp } = import(\"number-theory\");\\nmod-exp(7, 8, 13)',\n ],\n seeAlso: ['number-theory.mod-inv', 'number-theory.carmichael-lambda', 'number-theory.chinese-remainder'],\n },\n 'mod-inv': {\n category: 'number-theory',\n description: 'Calculates the modular multiplicative inverse of a number modulo another number.',\n returns: {\n type: 'integer',\n },\n args: {\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'm',\n ],\n },\n ],\n examples: [\n 'let { mod-inv } = import(\"number-theory\");\\nmod-inv(3, 11)',\n 'let { mod-inv } = import(\"number-theory\");\\nmod-inv(10, 17)',\n 'let { mod-inv } = import(\"number-theory\");\\nmod-inv(5, 13)',\n 'let { mod-inv } = import(\"number-theory\");\\nmod-inv(7, 19)',\n ],\n seeAlso: ['number-theory.mod-exp', 'number-theory.extended-gcd', 'number-theory.chinese-remainder'],\n },\n 'extended-gcd': {\n category: 'number-theory',\n description: 'Calculates the extended greatest common divisor (GCD) of two numbers, returning the GCD and the coefficients of Bézout\\'s identity.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { extended-gcd } = import(\"number-theory\");\\nextended-gcd(30, 12)',\n 'let { extended-gcd } = import(\"number-theory\");\\nextended-gcd(56, 98)',\n 'let { extended-gcd } = import(\"number-theory\");\\nextended-gcd(101, 10)',\n 'let { extended-gcd } = import(\"number-theory\");\\nextended-gcd(17, 13)',\n ],\n seeAlso: ['number-theory.gcd', 'number-theory.mod-inv', 'number-theory.chinese-remainder'],\n },\n 'chinese-remainder': {\n category: 'number-theory',\n description: 'Solves a system of simultaneous congruences using the Chinese Remainder Theorem.',\n returns: {\n type: 'integer',\n },\n args: {\n remainders: {\n type: 'integer',\n array: true,\n description: 'The remainders of the congruences.',\n },\n moduli: {\n type: 'integer',\n array: true,\n description: 'The moduli of the congruences.',\n },\n a: {\n type: 'array',\n },\n b: {\n type: 'array',\n },\n },\n variants: [\n {\n argumentNames: [\n 'remainders',\n 'moduli',\n ],\n },\n ],\n examples: [\n 'let { chinese-remainder } = import(\"number-theory\");\\nchinese-remainder([2, 3], [3, 5])',\n 'let { chinese-remainder } = import(\"number-theory\");\\nchinese-remainder([1, 2], [3, 4])',\n 'let { chinese-remainder } = import(\"number-theory\");\\nchinese-remainder([0, 1], [2, 3])',\n 'let { chinese-remainder } = import(\"number-theory\");\\nchinese-remainder([1, 2, 3], [4, 5, 7])',\n ],\n seeAlso: ['number-theory.mod-exp', 'number-theory.mod-inv', 'number-theory.extended-gcd'],\n },\n 'stirling-first': {\n category: 'number-theory',\n description: 'Calculates the Stirling numbers of the first kind, which count the number of permutations of n elements with k cycles.',\n returns: {\n type: 'integer',\n },\n args: {\n a: {\n type: 'integer',\n description: 'The number of elements.',\n },\n b: {\n type: 'integer',\n description: 'The number of cycles.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { stirling-first } = import(\"number-theory\");\\nstirling-first(5, 2)',\n 'let { stirling-first } = import(\"number-theory\");\\nstirling-first(4, 3)',\n 'let { stirling-first } = import(\"number-theory\");\\nstirling-first(6, 1)',\n 'let { stirling-first } = import(\"number-theory\");\\nstirling-first(7, 4)',\n 'let { stirling-first } = import(\"number-theory\");\\nstirling-first(8, 5)',\n ],\n seeAlso: ['number-theory.stirling-second', 'number-theory.bell-seq', 'number-theory.count-permutations'],\n },\n 'stirling-second': {\n category: 'number-theory',\n description: 'Calculates the Stirling numbers of the second kind, which count the number of ways to partition n elements into k non-empty subsets.',\n returns: {\n type: 'integer',\n },\n args: {\n a: {\n type: 'integer',\n description: 'The number of elements.',\n },\n b: {\n type: 'integer',\n description: 'The number of subsets.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { stirling-second } = import(\"number-theory\");\\nstirling-second(5, 2)',\n 'let { stirling-second } = import(\"number-theory\");\\nstirling-second(4, 3)',\n 'let { stirling-second } = import(\"number-theory\");\\nstirling-second(6, 1)',\n 'let { stirling-second } = import(\"number-theory\");\\nstirling-second(7, 4)',\n 'let { stirling-second } = import(\"number-theory\");\\nstirling-second(8, 5)',\n ],\n seeAlso: ['number-theory.stirling-first', 'number-theory.bell-seq', 'number-theory.count-combinations'],\n },\n}\n","export function binomialCoefficient(n: number, k: number): number {\n if (k === 0 || k === n)\n return 1\n\n let result = 1\n for (let i = 0; i < k; i++)\n result *= (n - i) / (i + 1)\n\n return result\n}\n","import type { Arr } from '../../../interface'\nimport { assertArray } from '../../../typeGuards/array'\nimport { assertNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\nimport { binomialCoefficient } from './binomialCefficient'\n\n/**\n * Generates all possible combinations of a specified size from a collection.\n * @param collection The input collection to generate combinations from\n * @param size The size of each combination\n * @returns An array of arrays, where each inner array is a combination of the specified size\n */\nfunction combinations<T>(collection: T[], size: number): T[][] {\n // Base case: if size is 1, return each element as its own combination\n if (size === 1) {\n return collection.map(item => [item])\n }\n\n const result: T[][] = []\n\n // Recursive approach to build combinations\n for (let i = 0; i <= collection.length - size; i++) {\n // Take the current element\n const current = collection[i]!\n\n // Get all combinations of size-1 from the rest of the elements\n const subCombinations = combinations(\n collection.slice(i + 1),\n size - 1,\n )\n\n // Add the current element to each sub-combination\n for (const subComb of subCombinations) {\n result.push([current, ...subComb])\n }\n }\n\n return result\n}\n\nexport const combinationsNormalExpressions: BuiltinNormalExpressions = {\n 'combinations': {\n evaluate: ([set, n], sourceCodeInfo): Arr[] => {\n assertArray(set, sourceCodeInfo)\n assertNumber(n, sourceCodeInfo, { integer: true, nonNegative: true, lte: set.length })\n if (n === 0)\n return [[]]\n return combinations(set, n)\n },\n arity: toFixedArity(2),\n },\n 'count-combinations': {\n evaluate: ([n, k], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, nonNegative: true })\n assertNumber(k, sourceCodeInfo, { integer: true, nonNegative: true, lte: n })\n return binomialCoefficient(n, k)\n },\n arity: toFixedArity(2),\n },\n}\n","import type { Arr } from '../../../interface'\nimport { assertArray } from '../../../typeGuards/array'\nimport { assertNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\n\nfunction getAllDerangements(arr: Arr): Arr[] {\n const n = arr.length\n const result: Arr[] = []\n const used = Array.from({ length: n }, () => false)\n const temp: Arr = Array.from({ length: n })\n\n function generateDerangements(pos: number): void {\n if (pos === n) {\n result.push([...temp])\n return\n }\n\n for (let i = 0; i < n; i++) {\n // Skip if element is already used or would be in its original position\n if (used[i] || i === pos) {\n continue\n }\n\n used[i] = true\n temp[pos] = arr[i]!\n generateDerangements(pos + 1)\n used[i] = false\n }\n }\n\n generateDerangements(0)\n return result\n}\n\nfunction countDerangements(n: number): number {\n if (n === 1)\n return 0\n\n let a = 1 // !0\n let b = 0 // !1\n let result = 0\n\n for (let i = 2; i <= n; i++) {\n result = (i - 1) * (a + b)\n a = b\n b = result\n }\n\n return result\n}\n\nexport const derangementsNormalExpressions: BuiltinNormalExpressions = {\n 'derangements': {\n evaluate: ([set], sourceCodeInfo): Arr => {\n assertArray(set, sourceCodeInfo)\n return getAllDerangements(set)\n },\n arity: toFixedArity(1),\n },\n 'count-derangements': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { finite: true, integer: true, positive: true })\n return countDerangements(n)\n },\n arity: toFixedArity(1),\n },\n}\n","import { assertNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\n\nfunction calcUnsortedDivisors(number: number): number[] {\n const divisors: number[] = []\n for (let i = 1; i <= Math.sqrt(number); i++) {\n if (number % i === 0) {\n divisors.push(i)\n if (i !== number / i) {\n divisors.push(number / i)\n }\n }\n }\n return divisors\n}\n\nexport function getDivisors(n: number): number[] {\n const unsortedDivisors = calcUnsortedDivisors(n)\n const sortedDivisors = unsortedDivisors.sort((a, b) => a - b)\n return sortedDivisors\n}\n\nexport function getProperDivisors(n: number): number[] {\n return getDivisors(n).slice(0, -1) // Exclude the number itself\n}\n\nexport const divisorsNormalExpressions: BuiltinNormalExpressions = {\n 'divisors': {\n evaluate: ([number], sourceCodeInfo): number[] => {\n assertNumber(number, sourceCodeInfo, { finite: true, integer: true, positive: true })\n return getDivisors(number)\n },\n arity: toFixedArity(1),\n },\n 'count-divisors': {\n evaluate: ([number], sourceCodeInfo): number => {\n assertNumber(number, sourceCodeInfo, { finite: true, integer: true, positive: true })\n return calcUnsortedDivisors(number).length\n },\n arity: toFixedArity(1),\n },\n 'proper-divisors': {\n evaluate: ([number], sourceCodeInfo): number[] => {\n assertNumber(number, sourceCodeInfo, { finite: true, integer: true, positive: true })\n return getProperDivisors(number)\n },\n arity: toFixedArity(1),\n },\n 'count-proper-divisors': {\n evaluate: ([number], sourceCodeInfo): number => {\n assertNumber(number, sourceCodeInfo, { finite: true, integer: true, positive: true })\n return calcUnsortedDivisors(number).length - 1 // Exclude the number itself\n },\n arity: toFixedArity(1),\n },\n}\n","export const factorialNumbers = [\n 1,\n 1,\n 2,\n 6,\n 24,\n 120,\n 720,\n 5040,\n 40320,\n 362880,\n 3628800,\n 39916800,\n 479001600,\n 6227020800,\n 87178291200,\n 1307674368000,\n 20922789888000,\n 355687428096000,\n 6402373705728000,\n]\n","import { assertNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\nimport { factorialNumbers } from './sequences/factorial'\n\nexport function factorialOf(n: number): number {\n if (n < 0)\n throw new Error('Factorial is not defined for negative numbers')\n\n if (n === 0 || n === 1)\n return 1\n\n if (n <= 18) {\n return factorialNumbers[n]!\n }\n let result = factorialNumbers[18]!\n for (let i = 19; i <= n; i++)\n result *= i\n\n return result\n}\n\nexport const factorialNormalExpressions: BuiltinNormalExpressions = {\n factorial: {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, nonNegative: true, lte: 170 })\n return factorialOf(n)\n },\n arity: toFixedArity(1),\n },\n}\n","export const partitionNumbers = [\n 1,\n 2,\n 3,\n 5,\n 7,\n 11,\n 15,\n 22,\n 30,\n 42,\n 56,\n 77,\n 101,\n 135,\n 176,\n 231,\n 297,\n 385,\n 490,\n 627,\n 792,\n 1002,\n 1255,\n 1575,\n 1958,\n 2436,\n 3010,\n 3718,\n 4565,\n 5604,\n 6842,\n 8349,\n 10143,\n 12310,\n 14883,\n 17977,\n 21637,\n 26015,\n 31185,\n 37338,\n 44583,\n 53174,\n 63261,\n 75175,\n 89134,\n 105558,\n 124754,\n 147273,\n 173525,\n 204226,\n 239943,\n 281589,\n 329931,\n 386155,\n 451276,\n 526823,\n 614154,\n 715220,\n 831820,\n 966467,\n 1121505,\n 1300156,\n 1505499,\n 1741630,\n 2012558,\n 2323520,\n 2679689,\n 3087735,\n 3554345,\n 4087968,\n 4697205,\n 5392783,\n 6185689,\n 7089500,\n 8118264,\n 9289091,\n 10619863,\n 12132164,\n 13848650,\n 15796476,\n 18004327,\n 20506255,\n 23338469,\n 26543660,\n 30167357,\n 34262962,\n 38887673,\n 44108109,\n 49995925,\n 56634173,\n 64112359,\n 72533807,\n 82010177,\n 92669720,\n 104651419,\n 118114304,\n 133230930,\n 150198136,\n 169229875,\n 190569292,\n 214481126,\n 241265379,\n 271248950,\n 304801365,\n 342325709,\n 384276336,\n 431149389,\n 483502844,\n 541946240,\n 607163746,\n 679903203,\n 761002156,\n 851376628,\n 952050665,\n 1064144451,\n 1188908248,\n 1327710076,\n 1482074143,\n 1653668665,\n 1844349560,\n 2056148051,\n 2291320912,\n 2552338241,\n 2841940500,\n 3163127352,\n 3519222692,\n 3913864295,\n 4351078600,\n 4835271870,\n 5371315400,\n 5964539504,\n 6620830889,\n 7346629512,\n 8149040695,\n 9035836076,\n 10015581680,\n 11097645016,\n 12292341831,\n 13610949895,\n 15065878135,\n 16670689208,\n 18440293320,\n 20390982757,\n 22540654445,\n 24908858009,\n 27517052599,\n 30388671978,\n 33549419497,\n 37027355200,\n 40853235313,\n 45060624582,\n 49686288421,\n 54770336324,\n 60356673280,\n 66493182097,\n 73232243759,\n 80630964769,\n 88751778802,\n 97662728555,\n 107438159466,\n 118159068427,\n 129913904637,\n 142798995930,\n 156919475295,\n 172389800255,\n 189334822579,\n 207890420102,\n 228204732751,\n 250438925115,\n 274768617130,\n 301384802048,\n 330495499613,\n 362326859895,\n 397125074750,\n 435157697830,\n 476715857290,\n 522115831195,\n 571701605655,\n 625846753120,\n 684957390936,\n 749474411781,\n 819876908323,\n 896684817527,\n 980462880430,\n 1071823774337,\n 1171432692373,\n 1280011042268,\n 1398341745571,\n 1527273599625,\n 1667727404093,\n 1820701100652,\n 1987276856363,\n 2168627105469,\n 2366022741845,\n 2580840212973,\n 2814570987591,\n 3068829878530,\n 3345365983698,\n 3646072432125,\n 3972999029388,\n 4328363658647,\n 4714566886083,\n 5134205287973,\n 5590088317495,\n 6085253859260,\n 6622987708040,\n 7206841706490,\n 7840656226137,\n 8528581302375,\n 9275102575355,\n 10085065885767,\n 10963707205259,\n 11916681236278,\n 12950095925895,\n 14070545699287,\n 15285151248481,\n 16601598107914,\n 18028182516671,\n 19573856161145,\n 21248279009367,\n 23061871173849,\n 25025873760111,\n 27152408925615,\n 29454549941750,\n 31946390696157,\n 34643126322519,\n 37561133582570,\n 40718063627362,\n 44132934884255,\n 47826239745920,\n 51820051838712,\n 56138148670947,\n 60806135438329,\n 65851585970275,\n 71304185514919,\n 77195892663512,\n 83561103925871,\n 90436839668817,\n 97862933703585,\n 105882246722733,\n 114540884553038,\n 123888443077259,\n 133978259344888,\n 144867692496445,\n 156618412527946,\n 169296722391554,\n 182973889854026,\n 197726516681672,\n 213636919820625,\n 230793554364681,\n 249291451168559,\n 269232701252579,\n 290726957916112,\n 313891991306665,\n 338854264248680,\n 365749566870782,\n 394723676655357,\n 425933084409356,\n 459545750448675,\n 495741934760846,\n 534715062908609,\n 576672674947168,\n 621837416509615,\n 670448123060170,\n 722760953690372,\n 779050629562167,\n 839611730366814,\n 904760108316360,\n 974834369944625,\n 1050197489931117,\n 1131238503938606,\n 1218374349844333,\n 1312051800816215,\n 1412749565173450,\n 1520980492851175,\n 1637293969337171,\n 1762278433057269,\n 1896564103591584,\n 2040825852575075,\n 2195786311682516,\n 2362219145337711,\n 2540952590045698,\n 2732873183547535,\n 2938929793929555,\n 3160137867148997,\n 3397584011986773,\n 3652430836071053,\n 3925922161489422,\n 4219388528587095,\n 4534253126900886,\n 4872038056472084,\n 5234371069753672,\n 5622992691950605,\n 6039763882095515,\n 6486674127079088,\n 6965850144195831,\n 7479565078510584,\n 8030248384943040,\n 8620496275465025,\n]\n","import { LitsError } from '../../../errors'\nimport { assertNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\nimport { partitionNumbers } from './sequences/partition'\n\nfunction partitions(n: number): number[][] {\n // Base cases\n if (n <= 0)\n return [[]]\n if (n === 1)\n return [[1]]\n\n const result: number[][] = []\n\n // Helper function to generate partitions recursively\n function generatePartitions(remaining: number, max: number, current: number[]): void {\n if (remaining === 0) {\n result.push([...current])\n return\n }\n\n // Try all possible numbers from 1 up to max\n for (let i = Math.min(max, remaining); i >= 1; i--) {\n current.push(i)\n generatePartitions(remaining - i, i, current)\n current.pop()\n }\n }\n\n generatePartitions(n, n, [])\n return result\n}\n\nexport const partitionsNormalExpressions: BuiltinNormalExpressions = {\n 'partitions': {\n evaluate: ([n], sourceCodeInfo): number[][] => {\n assertNumber(n, sourceCodeInfo, { integer: true, nonNegative: true })\n return partitions(n)\n },\n arity: toFixedArity(1),\n },\n 'count-partitions': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, nonNegative: true })\n if (n === 0)\n return 1\n\n if (n > partitionNumbers.length) {\n throw new LitsError(`n is too large. The maximum value is ${partitionNumbers.length - 1}.`, sourceCodeInfo)\n }\n\n return partitionNumbers[n - 1]!\n },\n arity: toFixedArity(1),\n },\n}\n","import type { Arr } from '../../../interface'\nimport { assertArray } from '../../../typeGuards/array'\nimport { assertNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\nimport { factorialOf } from './factorial'\n\n/**\n * Generates all possible permutations of a collection.\n * @param collection The input collection to generate permutations from\n * @returns An array of arrays, where each inner array is a permutation of the input collection\n */\nfunction permutations<T>(collection: T[]): T[][] {\n // Base case: empty array has one permutation - itself\n if (collection.length === 0) {\n return [[]]\n }\n\n const result: T[][] = []\n\n // For each element in the array\n for (let i = 0; i < collection.length; i++) {\n // Extract the current element\n const current = collection[i]!\n\n // Create a new array without the current element\n const remainingElements = [...collection.slice(0, i), ...collection.slice(i + 1)]\n\n // Generate all permutations of the remaining elements\n const subPermutations = permutations(remainingElements)\n\n // Add the current element to the beginning of each sub-permutation\n for (const subPerm of subPermutations) {\n result.push([current, ...subPerm])\n }\n }\n\n return result\n}\n\nexport const permutationsNormalExpressions: BuiltinNormalExpressions = {\n 'permutations': {\n evaluate: ([set], sourceCodeInfo): Arr[] => {\n assertArray(set, sourceCodeInfo)\n return permutations(set)\n },\n arity: toFixedArity(1),\n },\n 'count-permutations': {\n evaluate: ([n, k], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, nonNegative: true })\n assertNumber(k, sourceCodeInfo, { integer: true, nonNegative: true, lte: n })\n return factorialOf(n) / factorialOf(n - k)\n },\n arity: toFixedArity(2),\n },\n}\n","import type { Arr } from '../../../interface'\nimport { assertArray } from '../../../typeGuards/array'\nimport { assertNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\n\nfunction powerSet(set: Arr): Arr[] {\n const result: Arr[] = [[]]\n\n for (const value of set) {\n const newSubsets = result.map(subset => [...subset, value])\n result.push(...newSubsets)\n }\n\n return result\n}\n\nexport const powerSetNormalExpressions: BuiltinNormalExpressions = {\n 'power-set': {\n evaluate: ([set], sourceCodeInfo): Arr[] => {\n assertArray(set, sourceCodeInfo)\n return powerSet(set)\n },\n arity: toFixedArity(1),\n },\n 'count-power-set': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, nonNegative: true })\n if (n >= 53) {\n // Number.MAX_SAFE_INTEGER is 2^53 - 1\n return Infinity\n }\n\n return 2 ** n\n },\n arity: toFixedArity(1),\n },\n}\n","import { assertNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\n\n/**\n * Returns the prime factorization of a number as an array of its prime factors.\n * For example, factors(12) returns [2, 2, 3].\n * Special case: factors(1) returns an empty array [].\n *\n * @param n - A positive integer to factorize\n * @returns An array of prime factors in ascending order\n */\nexport function primeFactors(n: number): number[] {\n // Special case: 1 has no prime factors\n if (n === 1) {\n return []\n }\n\n const factors: number[] = []\n let divisor = 2\n\n // Find factors by trial division\n while (n > 1) {\n // If divisor divides n evenly\n if (n % divisor === 0) {\n // Add divisor to the factors list\n factors.push(divisor)\n // Divide n by the found factor\n n /= divisor\n }\n else {\n // Move to the next potential divisor\n divisor++\n }\n }\n\n return factors\n}\n\nexport const primeFactorsNormalExpressions: BuiltinNormalExpressions = {\n 'prime-factors': {\n evaluate: ([number], sourceCodeInfo): number[] => {\n assertNumber(number, sourceCodeInfo, { finite: true, integer: true, positive: true })\n return primeFactors(number)\n },\n arity: toFixedArity(1),\n },\n 'distinct-prime-factors': {\n evaluate: ([n], sourceCodeInfo): number[] => {\n assertNumber(n, sourceCodeInfo, { finite: true, integer: true, positive: true })\n const factors = primeFactors(n)\n const distinctFactors = new Set(factors)\n return Array.from(distinctFactors)\n },\n arity: toFixedArity(1),\n },\n 'count-prime-factors': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { finite: true, integer: true, positive: true })\n return primeFactors(n).length\n },\n arity: toFixedArity(1),\n },\n 'count-distinct-prime-factors': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { finite: true, integer: true, positive: true })\n const factors = primeFactors(n)\n const distinctFactors = new Set(factors)\n return distinctFactors.size\n },\n arity: toFixedArity(1),\n },\n}\n","import { getProperDivisors } from '../divisors'\nimport type { SequenceDefinition } from '.'\n\nfunction isAbundant(num: number): boolean {\n const properDivisors = getProperDivisors(num)\n const sum = properDivisors.reduce((acc, curr) => acc + curr, 0)\n return sum > num\n}\n\nexport const abundantSequence: SequenceDefinition<'abundant'> = {\n 'abundant-seq': (length) => {\n const abundants = []\n let num = 2\n while (abundants.length < length) {\n if (isAbundant(num)) {\n abundants.push(num)\n }\n num += 1\n }\n return abundants\n },\n 'abundant?': n => isAbundant(n),\n 'abundant-take-while': (takeWhile) => {\n const abundants = []\n for (let i = 2; ; i += 1) {\n if (!isAbundant(i)) {\n continue\n }\n if (!takeWhile(i, abundants.length)) {\n break\n }\n abundants.push(i)\n }\n return abundants\n },\n}\n","import { assertFunctionLike } from '../../../../typeGuards/lits'\nimport { assertNumber } from '../../../../typeGuards/number'\nimport { approxEqual } from '../../../../utils'\nimport { toFixedArity } from '../../../../utils/arity'\nimport type { SequenceNormalExpressions } from '.'\n\n/**\n * Checks if a number is a member of an arithmetic sequence.\n * @param start The first term of the sequence\n * @param step The common difference between terms\n * @param n The number to check\n * @returns true if the number is in the sequence, false otherwise\n */\nfunction isInArithmeticSequence(\n start: number,\n step: number,\n n: number,\n): boolean {\n // Special case: If step is 0, n must equal start\n if (step === 0) {\n return approxEqual(n, start)\n }\n\n // Calculate position in sequence\n const position = (n - start) / step\n\n // Position must be non-negative\n if (position < 0) {\n return false\n }\n\n // Find nearest integer position\n const roundedPosition = Math.round(position)\n\n // Calculate the value at that position\n const calculatedValue = start + step * roundedPosition\n\n // Check both if position is close to an integer and if the\n // calculated value is close to the input value\n return approxEqual(position, roundedPosition) && approxEqual(calculatedValue, n)\n}\n\nexport const arithmeticNormalExpressions: SequenceNormalExpressions<'arithmetic'> = {\n 'arithmetic-seq': {\n evaluate: ([start, step, length], sourceCodeInfo): number[] => {\n assertNumber(start, sourceCodeInfo, { finite: true })\n assertNumber(step, sourceCodeInfo, { finite: true })\n assertNumber(length, sourceCodeInfo, { integer: true, positive: true })\n\n return Array.from({ length }, (_, i) => start + i * step)\n },\n arity: toFixedArity(3),\n },\n 'arithmetic-take-while': {\n evaluate: ([start, step, fn], sourceCodeInfo, contextStack, { executeFunction }): number[] => {\n assertNumber(start, sourceCodeInfo, { finite: true })\n assertNumber(step, sourceCodeInfo, { finite: true })\n assertFunctionLike(fn, sourceCodeInfo)\n\n const arithmetic = []\n for (let i = 0; ; i += 1) {\n const value = start + i * step\n if (!(executeFunction)(fn, [value, i], contextStack, sourceCodeInfo)) {\n break\n }\n arithmetic[i] = value\n }\n return arithmetic\n },\n arity: toFixedArity(3),\n },\n 'arithmetic-nth': {\n evaluate: ([start, step, n], sourceCodeInfo): number => {\n assertNumber(start, sourceCodeInfo, { finite: true })\n assertNumber(step, sourceCodeInfo, { finite: true })\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n return start + (n - 1) * step\n },\n arity: toFixedArity(3),\n },\n 'arithmetic?': {\n evaluate: ([start, step, n], sourceCodeInfo): boolean => {\n assertNumber(n, sourceCodeInfo)\n assertNumber(start, sourceCodeInfo, { finite: true })\n assertNumber(step, sourceCodeInfo, { finite: true })\n\n return isInArithmeticSequence(start, step, n)\n },\n arity: toFixedArity(3),\n },\n}\n","import { assertFunctionLike } from '../../../../typeGuards/lits'\nimport { assertNumber } from '../../../../typeGuards/number'\nimport { binomialCoefficient } from '../binomialCefficient'\nimport { toFixedArity } from '../../../../utils/arity'\nimport type { SequenceNormalExpressions } from '.'\n\nfunction getBernoulliSeq(length: number): number[] {\n const bernoulli = [1]\n for (let n = 1; n < length; n += 1) {\n let sum = 0\n for (let k = 0; k < n; k += 1) {\n sum += binomialCoefficient(n + 1, k) * bernoulli[k]!\n }\n bernoulli[n] = n > 1 && n % 2 === 1 ? 0 : -sum / (n + 1)\n }\n return bernoulli\n}\n\n/**\n * Generates Bernoulli numbers as long as the predicate function returns true\n * @param predicate - Function that takes a Bernoulli number and its index and returns true if generation should continue\n * @returns Array of Bernoulli numbers generated until predicate returns false\n */\nfunction generateBernoulli(\n predicate: (value: number, index: number) => boolean,\n): number[] {\n const batchSize = 100\n // Start with computing the Bernoulli numbers\n const bernoulli: number[] = [1]\n let n = 1\n\n // Continue generating as long as the predicate returns true\n while (true) {\n // Generate a batch of numbers at a time for efficiency\n const targetLength = bernoulli.length + batchSize\n\n for (; n < targetLength; n++) {\n let sum = 0\n for (let k = 0; k < n; k++) {\n sum += binomialCoefficient(n + 1, k) * bernoulli[k]!\n }\n\n const newValue = n > 1 && n % 2 === 1 ? 0 : -sum / (n + 1)\n\n // Check if we should continue\n if (!predicate(newValue, n)) {\n // We're done, return the generated sequence (including the last value)\n return bernoulli\n }\n bernoulli.push(newValue)\n }\n }\n}\n\nexport const bernoulliNormalExpressions: Omit<SequenceNormalExpressions<'bernoulli'>, 'bernoulli?'> = {\n 'bernoulli-seq': {\n evaluate: ([length], sourceCodeInfo): number[] => {\n assertNumber(length, sourceCodeInfo, { integer: true, positive: true })\n return getBernoulliSeq(length)\n },\n arity: toFixedArity(1),\n },\n 'bernoulli-nth': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n const bernoulli = getBernoulliSeq(n)\n return bernoulli[n - 1]!\n },\n arity: toFixedArity(1),\n },\n 'bernoulli-take-while': {\n evaluate: ([fn], sourceCodeInfo, contextStack, { executeFunction }): number[] => {\n assertFunctionLike(fn, sourceCodeInfo)\n const bernoulli = generateBernoulli((value, index) => !!(executeFunction)(fn, [value, index], contextStack))\n return bernoulli\n },\n arity: toFixedArity(1),\n },\n}\n","import type { SequenceDefinition } from '.'\n\nexport function isPrime(num: number): boolean {\n if (num <= 1) {\n return false\n }\n if (num <= 3) {\n return true\n }\n if (num % 2 === 0 || num % 3 === 0) {\n return false\n }\n\n for (let i = 5; i * i <= num; i += 6) {\n if (num % i === 0 || num % (i + 2) === 0) {\n return false\n }\n }\n return true\n}\n\nexport const primeSequence: SequenceDefinition<'prime'> = {\n 'prime-seq': (length) => {\n const primes = []\n let num = 2\n while (primes.length < length) {\n if (isPrime(num)) {\n primes.push(num)\n }\n num += 1\n }\n return primes\n },\n 'prime?': n => isPrime(n),\n 'prime-take-while': (takeWhile) => {\n const primes = []\n for (let i = 2; ; i += 1) {\n if (!isPrime(i)) {\n continue\n }\n if (!takeWhile(i, primes.length)) {\n break\n }\n primes.push(i)\n }\n return primes\n },\n}\n","import { isPrime } from './prime'\nimport type { SequenceDefinition } from '.'\n\nexport function isComposite(num: number): boolean {\n if (num <= 1) {\n return false\n }\n return !isPrime(num)\n}\n\nexport const compositeSequence: SequenceDefinition<'composite'> = {\n 'composite-seq': (length) => {\n const composites = []\n let num = 2\n while (composites.length < length) {\n if (isComposite(num)) {\n composites.push(num)\n }\n num += 1\n }\n return composites\n },\n 'composite?': n => isComposite(n),\n 'composite-take-while': (takeWhile) => {\n const composites = []\n for (let i = 4; ; i += 1) {\n if (!isComposite(i)) {\n continue\n }\n if (!takeWhile(i, composites.length)) {\n break\n }\n composites.push(i)\n }\n return composites\n },\n}\n","import { getProperDivisors } from '../divisors'\nimport type { SequenceDefinition } from '.'\n\nfunction isDeficient(num: number): boolean {\n const properDivisors = getProperDivisors(num)\n const sum = properDivisors.reduce((acc, curr) => acc + curr, 0)\n return sum < num\n}\n\nexport const deficientSequence: SequenceDefinition<'deficient'> = {\n 'deficient-seq': (length) => {\n const deficients = []\n let num = 1\n while (deficients.length < length) {\n if (isDeficient(num)) {\n deficients.push(num)\n }\n num += 1\n }\n return deficients\n },\n 'deficient?': n => isDeficient(n),\n 'deficient-take-while': (takeWhile) => {\n const deficients = []\n for (let i = 1; ; i += 1) {\n if (!isDeficient(i)) {\n continue\n }\n if (!takeWhile(i, deficients.length)) {\n break\n }\n deficients.push(i)\n }\n return deficients\n },\n}\n","import { assertFunctionLike } from '../../../../typeGuards/lits'\nimport { assertNumber } from '../../../../typeGuards/number'\nimport { approxEqual } from '../../../../utils'\nimport { toFixedArity } from '../../../../utils/arity'\nimport type { SequenceNormalExpressions } from '.'\n\n/**\n * Checks if a number is a member of a geometric sequence.\n * @param initialTerm The first term of the sequence (a)\n * @param ratio The common ratio of the sequence (r)\n * @param number The number to check\n * @returns true if the number is in the sequence, false otherwise\n */\nfunction isInGeometricSequence(\n initialTerm: number,\n ratio: number,\n number: number,\n): boolean {\n // Handle special cases\n if (approxEqual(initialTerm, 0)) {\n return approxEqual(number, 0)\n }\n if (approxEqual(ratio, 1)) {\n return approxEqual(number, initialTerm)\n }\n if (approxEqual(ratio, 0)) {\n return approxEqual(number, 0) || approxEqual(number, initialTerm)\n }\n\n // Check if the number is exactly the initial term\n if (approxEqual(number, initialTerm)) {\n return true\n }\n\n // Special case for ratio = -1 (alternating sequence)\n if (approxEqual(ratio, -1)) {\n // In an alternating sequence with ratio -1, the terms are just initialTerm and -initialTerm\n return approxEqual(number, initialTerm) || approxEqual(number, -initialTerm)\n }\n\n // For negative ratios, we need special handling\n if (ratio < 0) {\n // Calculate log using absolute values\n const logResult = Math.log(Math.abs(number / initialTerm)) / Math.log(Math.abs(ratio))\n\n // Check if logResult is very close to an integer\n const roundedLogResult = Math.round(logResult)\n if (!approxEqual(roundedLogResult, logResult) || roundedLogResult < 0) {\n return false\n }\n\n // For negative ratios, alternating terms have alternating signs\n // Check if sign matches what we expect based on the power\n const expectedSign = roundedLogResult % 2 === 0\n ? Math.sign(initialTerm)\n : Math.sign(initialTerm) * Math.sign(ratio)\n\n return Math.sign(number) === expectedSign\n }\n\n // For positive ratios\n\n // Quick check based on sequence direction\n if ((ratio > 1 && number < initialTerm) || (ratio < 1 && number > initialTerm)) {\n return false\n }\n\n // Calculate n in: number = initialTerm * (ratio^n)\n const logResult = Math.log(number / initialTerm) / Math.log(ratio)\n\n // Check if logResult is very close to an integer and non-negative\n const roundedLogResult = Math.round(logResult)\n if (!approxEqual(roundedLogResult, logResult) || roundedLogResult < 0) {\n return false\n }\n\n // Verify calculated value matches the number exactly\n const calculatedValue = initialTerm * ratio ** roundedLogResult\n\n return approxEqual(calculatedValue, number)\n}\nexport const geometricNormalExpressions: SequenceNormalExpressions<'geometric'> = {\n 'geometric-seq': {\n evaluate: ([start, ratio, length], sourceCodeInfo): number[] => {\n assertNumber(start, sourceCodeInfo, { finite: true })\n assertNumber(ratio, sourceCodeInfo, { finite: true })\n assertNumber(length, sourceCodeInfo, { integer: true, positive: true })\n\n return Array.from({ length }, (_, i) => start * ratio ** i)\n },\n arity: toFixedArity(3),\n },\n 'geometric-take-while': {\n evaluate: ([start, ratio, fn], sourceCodeInfo, contextStack, { executeFunction }): number[] => {\n assertNumber(start, sourceCodeInfo, { finite: true })\n assertNumber(ratio, sourceCodeInfo, { finite: true })\n assertFunctionLike(fn, sourceCodeInfo)\n\n const geometric = []\n for (let i = 0; ; i += 1) {\n const value = start * ratio ** i\n if (!(executeFunction)(fn, [value, i], contextStack, sourceCodeInfo)) {\n break\n }\n geometric[i] = value\n }\n return geometric\n },\n arity: toFixedArity(3),\n },\n 'geometric-nth': {\n evaluate: ([start, ratio, n], sourceCodeInfo): number => {\n assertNumber(start, sourceCodeInfo, { finite: true })\n assertNumber(ratio, sourceCodeInfo, { finite: true })\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n return start * ratio ** (n - 1)\n },\n arity: toFixedArity(3),\n },\n 'geometric?': {\n evaluate: ([start, ratio, n], sourceCodeInfo): boolean => {\n assertNumber(n, sourceCodeInfo)\n assertNumber(start, sourceCodeInfo, { finite: true })\n assertNumber(ratio, sourceCodeInfo, { finite: true })\n\n return isInGeometricSequence(start, ratio, n)\n },\n arity: toFixedArity(3),\n },\n}\n","import type { SequenceDefinition } from '.'\n\nfunction getGolombSeq(n: number): number[] {\n const golomb = [0, 1]\n for (let i = 2; i <= n; i += 1) {\n golomb.push(1 + golomb[i - golomb[golomb[i - 1]!]!]!)\n }\n return golomb.slice(1)\n}\n\nfunction generateGolombSeq(pred: (golombNumber: number, index: number) => boolean): number[] {\n if (!pred(1, 0)) {\n return []\n }\n const golomb = [0, 1]\n for (let i = 2; ; i++) {\n const golombNumber = 1 + golomb[i - golomb[golomb[i - 1]!]!]!\n if (!pred(golombNumber, i - 1)) {\n break\n }\n golomb.push(golombNumber)\n }\n return golomb.slice(1)\n}\n\nexport const golombSequence: SequenceDefinition<'golomb'> = {\n 'golomb-seq': length => getGolombSeq(length),\n 'golomb?': () => true,\n 'golomb-take-while': takeWhile => generateGolombSeq(takeWhile),\n}\n","import type { SequenceDefinition } from '.'\n\nfunction isHappyNumber(n: number): boolean {\n // A happy number is defined by the following process:\n // 1. Starting with any positive integer, replace the number by the sum of the squares of its digits\n // 2. Repeat until either:\n // - The number equals 1 (in which case it's a happy number)\n // - It enters a cycle that doesn't include 1 (in which case it's not a happy number)\n\n if (n <= 0)\n return false\n\n // Use a set to detect cycles\n const seen = new Set()\n\n // Continue until we either reach 1 or detect a cycle\n while (n !== 1 && !seen.has(n)) {\n seen.add(n)\n n = getSumOfSquaredDigits(n)\n }\n\n // If we reached 1, it's a happy number\n return n === 1\n}\n\nfunction getSumOfSquaredDigits(n: number): number {\n let sum = 0\n\n while (n > 0) {\n const digit = n % 10\n sum += digit * digit\n n = Math.floor(n / 10)\n }\n\n return sum\n}\n\nexport const happySequence: SequenceDefinition<'happy'> = {\n 'happy-seq': (length) => {\n const happyNumbers: number[] = []\n for (let i = 1; happyNumbers.length < length; i++) {\n let n = i\n const seen = new Set<number>()\n while (n !== 1 && !seen.has(n)) {\n seen.add(n)\n n = String(n)\n .split('')\n .reduce((sum, digit) => sum + Number(digit) ** 2, 0)\n }\n if (n === 1)\n happyNumbers.push(i)\n }\n return happyNumbers\n },\n 'happy?': n => isHappyNumber(n),\n 'happy-take-while': (takeWhile) => {\n const happyNumbers = []\n\n for (let i = 1; ; i++) {\n let n = i\n const seen = new Set<number>()\n while (n !== 1 && !seen.has(n)) {\n seen.add(n)\n n = String(n)\n .split('')\n .reduce((sum, digit) => sum + Number(digit) ** 2, 0)\n }\n if (n === 1) {\n if (!takeWhile(i, happyNumbers.length)) {\n break\n }\n happyNumbers.push(i)\n }\n }\n\n return happyNumbers\n },\n}\n","import type { SequenceDefinition } from '.'\n\nexport const jugglerSequence: Omit<SequenceDefinition<'juggler'>, 'juggler-nth' | 'juggler-take-while' | 'juggler?'> = {\n 'juggler-seq': (start) => {\n let next = start\n const juggler = [next]\n\n while (next > 1) {\n next = next % 2 === 0\n ? Math.floor(Math.sqrt(next))\n : Math.floor(next ** (3 / 2))\n juggler.push(next)\n }\n return juggler\n },\n 'noNth': true,\n}\n","import type { SequenceDefinition } from '.'\n\n/**\n * Checks if a number is part of the Look-and-Say sequence.\n *\n * The Look-and-Say sequence starts with \"1\" and each subsequent term describes\n * the previous term by counting consecutive digits. For example:\n * 1, 11, 21, 1211, 111221, 312211, 13112221, ...\n *\n * @param {string|number} target - The number to check (can be a string or number)\n * @returns {boolean} - Whether the target is in the sequence\n */\nfunction isLookAndSay(target: string): boolean {\n // The first term of the sequence\n let current = '1'\n\n // Check if the first term matches\n if (current === target) {\n return true\n }\n\n // Generate terms and check against the target\n while (true) {\n current = getNextLookAndSayTerm(current)\n\n if (current === target) {\n return true\n }\n\n // Optimization: if the current term is longer than the target, and\n // the sequence is strictly increasing in length, the target won't be found\n if (current.length > target.length) {\n return false\n }\n }\n}\n\n/**\n * Generates the next term in the Look-and-Say sequence\n *\n * @param {string} term - The current term\n * @returns {string} - The next term in the sequence\n */\nfunction getNextLookAndSayTerm(term: string): string {\n let result = ''\n let count = 1\n\n for (let i = 0; i < term.length; i++) {\n // If the current digit is the same as the next one, increment count\n if (i + 1 < term.length && term[i] === term[i + 1]) {\n count++\n }\n else {\n // Otherwise, append count and the digit to the result\n result += count.toString() + term[i]\n count = 1\n }\n }\n\n return result\n}\n\nexport const lookAndSaySequence: SequenceDefinition<'look-and-say', string> = {\n 'string': true,\n 'look-and-say-seq': (length) => {\n const lookAndSay = ['1']\n for (let i = 1; i < length; i += 1) {\n const prev = lookAndSay[i - 1]!\n const next = prev.replace(/(\\d)\\1*/g, match => `${match.length}${match[0]}`)\n lookAndSay[i] = next\n }\n return lookAndSay\n },\n 'look-and-say-take-while': (takeWhile) => {\n if (!takeWhile('1', 0)) {\n return []\n }\n const lookAndSay = ['1']\n for (let i = 1; ; i += 1) {\n const prev = lookAndSay[i - 1]!\n const next = prev.replace(/(\\d)\\1*/g, match => `${match.length}${match[0]}`)\n if (!takeWhile(next, i)) {\n break\n }\n lookAndSay[i] = next\n }\n return lookAndSay\n },\n 'look-and-say?': n => isLookAndSay(n),\n}\n","import type { SequenceDefinition } from '.'\n\n/**\n * Generates lucky numbers while the predicate function returns true.\n *\n * @param predicate - Function that tests if we should continue generating numbers.\n * Takes the current lucky number and index as parameters.\n * @returns An array of lucky numbers\n */\nfunction generateLuckyNumbers(\n predicate: (luckyNumber: number, index: number) => boolean,\n): number[] {\n // Start with counting from 1\n const numbers: number[] = []\n for (let i = 1; i <= 2000; i++) {\n numbers.push(i)\n }\n\n // First step: remove all even numbers (keep 1)\n let filteredNumbers: number[] = [1]\n for (let i = 1; i < numbers.length; i++) {\n if (numbers[i]! % 2 !== 0) {\n filteredNumbers.push(numbers[i]!)\n }\n }\n\n const luckyNumbers: number[] = [1] // 1 is always the first lucky number\n let count = 1\n\n // Check if we should continue after the first number\n if (!predicate(1, 0)) {\n return []\n }\n\n // Continue the sieve process\n let index = 1 // Start with the second element (index 1, which is 3)\n\n while (index < filteredNumbers.length) {\n // Get the current lucky number\n const luckyNumber = filteredNumbers[index]!\n\n // Check if we should continue\n if (!predicate(luckyNumber, count)) {\n break\n }\n\n // Add to result\n luckyNumbers.push(luckyNumber)\n count++\n\n // Apply the sieve\n const step = luckyNumber\n const newFiltered: number[] = []\n\n for (let i = 0; i < filteredNumbers.length; i++) {\n if ((i + 1) % step !== 0) { // Keep numbers not at positions divisible by step\n newFiltered.push(filteredNumbers[i]!)\n }\n }\n\n filteredNumbers = newFiltered\n index++\n\n // If we're running low on numbers, extend the sequence\n if (index >= filteredNumbers.length - 5) {\n const lastNum = filteredNumbers[filteredNumbers.length - 1]!\n let next = lastNum + 2\n\n while (filteredNumbers.length < index + 1000) {\n filteredNumbers.push(next)\n next += 2\n }\n }\n }\n\n return luckyNumbers\n}\n\n/**\n * Generates lucky numbers up to a specified length or count\n *\n * Lucky numbers are a subset of integers defined by a specific sieving process:\n * 1. Start with all positive integers: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, ...\n * 2. Keep 1, delete every 2nd number: 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, ...\n * 3. The second remaining number is 3, so keep it and delete every 3rd number: 1, 3, 7, 9, 13, 15, 19, ...\n * 4. The third remaining number is 7, so keep it and delete every 7th number\n * 5. Continue this process to get all lucky numbers\n *\n * @param count - The number of lucky numbers to generate\n * @returns An array containing the first 'count' lucky numbers\n */\nfunction getLuckyNumbers(count: number): number[] {\n // Step 1: Start with all odd numbers (we skip the first elimination step since we know\n // the first sieve removes all even numbers)\n const numbers: number[] = []\n let n = 1\n // Generate enough odd numbers to ensure we'll have 'count' lucky numbers after sieving\n // The factor depends on how many numbers we expect to be eliminated\n // For larger counts, we need a higher factor to ensure we have enough numbers\n const factor = count < 100 ? 20 : 30\n const initialSize = count * factor\n\n while (numbers.length < initialSize) {\n numbers.push(n)\n n += 2\n }\n\n // Step 2 and beyond: Apply the lucky number sieve\n let sieveIndex = 1 // Start at index 1 (the second element which is 3)\n\n while (sieveIndex < numbers.length && sieveIndex < count) {\n const sieveValue = numbers[sieveIndex]!\n\n // Remove every sieveValue-th number\n // This is an optimization over creating a new array each time\n let j = 0\n for (let i = 0; i < numbers.length; i++) {\n if ((i + 1) % sieveValue !== 0) {\n numbers[j++] = numbers[i]!\n }\n }\n numbers.length = j // Truncate the array\n\n // Only increment sieveIndex if it's still within the new array bounds\n if (sieveIndex < numbers.length) {\n sieveIndex++\n }\n }\n\n // Return the requested number of lucky numbers\n return numbers.slice(0, count)\n}\n\nexport const luckySequence: SequenceDefinition<'lucky'> = {\n 'lucky-seq': length => getLuckyNumbers(length),\n 'lucky?': n => generateLuckyNumbers(l => l <= n).includes(n),\n 'lucky-take-while': takeWhile => generateLuckyNumbers(takeWhile),\n}\n","import type { SequenceDefinition } from '.'\n\n/**\n * Checks if a number is a Padovan number.\n * Padovan numbers follow the recurrence relation: P(n) = P(n-2) + P(n-3) for n >= 3,\n * with initial values P(0) = P(1) = P(2) = 1.\n *\n * The first few Padovan numbers are:\n * 1, 1, 1, 2, 2, 3, 4, 5, 7, 9, 12, 16, 21, 28, 37, 49, 65, 86, 114, 151, 200, ...\n *\n * @param num - The number to check\n * @returns True if the number is a Padovan number, false otherwise\n */\nfunction isPadovan(num: number): boolean {\n // Padovan numbers are always positive integers\n if (!Number.isInteger(num) || num <= 0) {\n return false\n }\n\n // Special case: The first three Padovan numbers are all 1\n if (num === 1) {\n return true\n }\n\n // Pre-calculated Padovan numbers (for efficient lookup, verified for correctness)\n const padovanNumbers = [\n 1,\n 1,\n 1,\n 2,\n 2,\n 3,\n 4,\n 5,\n 7,\n 9,\n 12,\n 16,\n 21,\n 28,\n 37,\n 49,\n 65,\n 86,\n 114,\n 151,\n 200,\n 265,\n 351,\n 465,\n 616,\n 816,\n 1081,\n 1432,\n 1897,\n 2513,\n 3329,\n 4410,\n 5842,\n 7739,\n 10252,\n 13581,\n 17991,\n 23833,\n 31572,\n 41824,\n 55405,\n 73396,\n 97229,\n ]\n\n // Direct lookup for known values\n if (padovanNumbers.includes(num)) {\n return true\n }\n\n // For numbers larger than our pre-calculated list but within JavaScript's safe range\n if (num > padovanNumbers[padovanNumbers.length - 1]! && num <= Number.MAX_SAFE_INTEGER) {\n // Start with the last three values from our known sequence\n let a = padovanNumbers[padovanNumbers.length - 3]!\n let b = padovanNumbers[padovanNumbers.length - 2]!\n let c = padovanNumbers[padovanNumbers.length - 1]!\n let next\n\n // Generate Padovan numbers until we either find a match or exceed the input\n while (c < num) {\n next = a + b\n a = b\n b = c\n c = next\n\n if (c === num) {\n return true\n }\n\n // Check for numeric overflow/precision issues\n if (!Number.isSafeInteger(c)) {\n return false\n }\n }\n }\n\n return false\n}\n\nexport const padovanSequence: SequenceDefinition<'padovan'> = {\n 'padovan-seq': (length) => {\n const padovan = [1, 1, 1]\n for (let i = 3; i < length; i += 1) {\n padovan[i] = padovan[i - 2]! + padovan[i - 3]!\n }\n return padovan.slice(0, length)\n },\n 'padovan?': n => isPadovan(n),\n 'padovan-take-while': (takeWhile) => {\n const padovan: number[] = []\n if (!takeWhile(1, 0)) {\n return padovan\n }\n padovan.push(1)\n if (!takeWhile(1, 1)) {\n return padovan\n }\n padovan.push(1)\n if (!takeWhile(1, 2)) {\n return padovan\n }\n padovan.push(1)\n\n let a = 1\n let b = 1\n let c = 1\n for (let i = 4; ; i += 1) {\n const temp = a + b\n a = b\n b = c\n c = temp\n if (!takeWhile(c, i)) {\n break\n }\n padovan.push(c)\n }\n return padovan\n },\n}\n","import type { SequenceDefinition } from '.'\n\nexport const perfectCubeSequence: SequenceDefinition<'perfect-cube'> = {\n 'perfect-cube-seq': (length) => {\n const perfectcubes = []\n for (let i = 1; i <= length; i++) {\n perfectcubes.push(i ** 3)\n }\n return perfectcubes\n },\n 'perfect-cube?': n => n > 0 && Number.isInteger(Math.cbrt(n)),\n 'perfect-cube-take-while': (takeWhile) => {\n const perfectcubes = []\n for (let i = 1; ; i++) {\n const value = i ** 3\n if (!takeWhile(value, i)) {\n break\n }\n perfectcubes.push(value)\n }\n return perfectcubes\n },\n}\n","import { approxEqual } from '../../../../utils'\nimport type { SequenceDefinition } from '.'\n\n/**\n * Checks if a number is a perfect power and returns the base and exponent if it is.\n * A perfect power is a number that can be expressed as an integer power of another integer.\n *\n * @param n - The number to check\n * @returns [base, exponent] if n is a perfect power, null otherwise\n */\nexport function perfectPower(n: number): [number, number] | null {\n // Handle edge cases\n if (n < 2) {\n if (n === 1) {\n // 1 is 1^k for any k, we return [1, 2] as the simplest representation\n return [1, 2]\n }\n return null // Non positive numbers are not perfect powers\n }\n\n // For each possible exponent k, try to find base b such that b^k = n\n const maxK = Math.floor(Math.log2(n)) + 1\n\n for (let k = 2; k <= maxK; k++) {\n // Calculate the potential base as n^(1/k)\n const b = n ** (1 / k)\n const roundedB = Math.round(b)\n\n if (approxEqual(roundedB ** k, n)) {\n return [roundedB, k]\n }\n }\n\n return null // Not a perfect power\n}\n\nexport const perfectPowerSequence: SequenceDefinition<'perfect-power'> = {\n 'perfect-power-seq': (length) => {\n const perfectPowers: number[] = []\n for (let i = 1; perfectPowers.length < length; i++) {\n if (perfectPower(i)) {\n perfectPowers.push(i)\n }\n }\n return perfectPowers\n },\n 'perfect-power?': n => perfectPower(n) !== null,\n 'perfect-power-take-while': (takeWhile) => {\n const perfectPowers: number[] = []\n for (let i = 1; ; i++) {\n if (perfectPower(i)) {\n if (!takeWhile(i, perfectPowers.length)) {\n break\n }\n perfectPowers.push(i)\n }\n }\n return perfectPowers\n },\n}\n","import type { SequenceDefinition } from '.'\n\nexport const perfectSquareSequence: SequenceDefinition<'perfect-square'> = {\n 'perfect-square-seq': (length) => {\n const perfectSquares = []\n for (let i = 1; i <= length; i++) {\n perfectSquares.push(i ** 2)\n }\n return perfectSquares\n },\n 'perfect-square?': n => n > 0 && Number.isInteger(Math.sqrt(n)),\n 'perfect-square-take-while': (takeWhile) => {\n const perfectSquares = []\n for (let i = 1; ; i++) {\n const value = i ** 2\n if (!takeWhile(value, i)) {\n break\n }\n perfectSquares.push(value)\n }\n return perfectSquares\n },\n}\n","import { assertFunctionLike } from '../../../../typeGuards/lits'\nimport { assertNumber } from '../../../../typeGuards/number'\nimport { toFixedArity } from '../../../../utils/arity'\nimport type { SequenceNormalExpressions } from '.'\n\nexport const poligonalNormalExpressions: SequenceNormalExpressions<'polygonal'> = {\n 'polygonal-seq': {\n evaluate: ([sides, n], sourceCodeInfo): number[] => {\n assertNumber(sides, sourceCodeInfo, { integer: true, gte: 3 })\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n\n const polygonal = []\n for (let i = 1; i <= n; i += 1) {\n polygonal[i - 1] = (i * i * (sides - 2) - i * (sides - 4)) / 2\n }\n return polygonal\n },\n arity: toFixedArity(2),\n },\n 'polygonal-take-while': {\n evaluate: ([sides, fn], sourceCodeInfo, contextStack, { executeFunction }): number[] => {\n assertNumber(sides, sourceCodeInfo, { integer: true, gte: 3 })\n assertFunctionLike(fn, sourceCodeInfo)\n\n const polygonal = []\n for (let i = 1; ; i += 1) {\n const value = (i * i * (sides - 2) - i * (sides - 4)) / 2\n if (!(executeFunction)(fn, [value, i], contextStack, sourceCodeInfo)) {\n break\n }\n polygonal[i - 1] = (i * i * (sides - 2) - i * (sides - 4)) / 2\n }\n return polygonal\n },\n arity: toFixedArity(2),\n },\n 'polygonal-nth': {\n evaluate: ([sides, n], sourceCodeInfo): number => {\n assertNumber(sides, sourceCodeInfo, { integer: true, gte: 3 })\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n return (n * n * (sides - 2) - n * (sides - 4)) / 2\n },\n arity: toFixedArity(2),\n },\n 'polygonal?': {\n evaluate: ([sides, n], sourceCodeInfo): boolean => {\n assertNumber(n, sourceCodeInfo, { integer: true })\n assertNumber(sides, sourceCodeInfo, { integer: true, gte: 3 })\n\n if (n <= 0) {\n return false\n }\n const a = sides - 2\n const b = sides - 4\n\n const discriminant = 8 * a * n + b * b\n const sqrtPart = Math.sqrt(discriminant)\n\n // Discriminant must yield an integer square root\n if (!Number.isInteger(sqrtPart))\n return false\n\n const numerator = sqrtPart + b\n\n // Numerator must be divisible by 2*a\n if (numerator % (2 * a) !== 0)\n return false\n\n const x = numerator / (2 * a)\n\n // x must be a positive integer\n return Number.isInteger(x) && x > 0\n },\n arity: toFixedArity(2),\n },\n}\n","import type { SequenceDefinition } from '.'\n\n/**\n * Generates the first 'n' terms of the Recamán sequence.\n *\n * @param n - Number of terms to generate\n * @returns Array containing the first n terms of the Recamán sequence\n */\nexport function generateRecamanSequence(n: number): number[] {\n if (n === 1)\n return [0]\n\n const sequence: number[] = [0]\n const seen = new Set<number>([0])\n\n for (let i = 1; i < n; i++) {\n // Try to go backward\n let next = sequence[i - 1]! - i\n\n // If that's not positive or already seen, go forward\n if (next <= 0 || seen.has(next)) {\n next = sequence[i - 1]! + i\n }\n\n sequence.push(next)\n seen.add(next)\n }\n\n return sequence\n}\n\nexport const recamanSequence: SequenceDefinition<'recaman'> = {\n 'recaman-seq': length => generateRecamanSequence(length),\n 'recaman-take-while': (takeWhile) => {\n if (!takeWhile(0, 0))\n return []\n\n const sequence: number[] = [0]\n const seen = new Set<number>([0])\n\n for (let i = 1; ; i++) {\n // Try to go backward\n let next = sequence[i - 1]! - i\n\n // If that's not positive or already seen, go forward\n if (next <= 0 || seen.has(next)) {\n next = sequence[i - 1]! + i\n }\n\n if (!takeWhile(next, i))\n break\n\n sequence.push(next)\n seen.add(next)\n }\n\n return sequence\n },\n 'recaman?': () => true,\n}\n","import type { SequenceDefinition } from '.'\n\nexport const thueMorseSequence: SequenceDefinition<'thue-morse'> = {\n 'thue-morse-seq': (length) => {\n const thueMorse = []\n for (let i = 0; i < length; i += 1) {\n thueMorse[i] = countSetBits(i) % 2\n }\n return thueMorse\n },\n 'thue-morse-take-while': (takeWhile) => {\n const thueMorse = []\n for (let i = 0; ; i += 1) {\n const value = countSetBits(i) % 2\n if (!takeWhile(value, i)) {\n break\n }\n thueMorse[i] = value\n }\n return thueMorse\n },\n 'thue-morse?': n => n === 1 || n === 0,\n}\n\nfunction countSetBits(num: number): number {\n let count = 0\n while (num) {\n count += num & 1\n num >>= 1\n }\n return count\n}\n","export const tribonacciNumbers = [\n 0,\n 1,\n 1,\n 2,\n 4,\n 7,\n 13,\n 24,\n 44,\n 81,\n 149,\n 274,\n 504,\n 927,\n 1705,\n 3136,\n 5768,\n 10609,\n 19513,\n 35890,\n 66012,\n 121415,\n 223317,\n 410744,\n 755476,\n 1389537,\n 2555757,\n 4700770,\n 8646064,\n 15902591,\n 29249425,\n 53798080,\n 98950096,\n 181997601,\n 334745777,\n 615693474,\n 1132436852,\n 2082876103,\n 3831006429,\n 7046319384,\n 12960201916,\n 23837527729,\n 43844049029,\n 80641778674,\n 148323355432,\n 272809183135,\n 501774317241,\n 922906855808,\n 1697490356184,\n 3122171529233,\n 5742568741225,\n 10562230626642,\n 19426970897100,\n 35731770264967,\n 65720971788709,\n 120879712950776,\n 222332455004452,\n 408933139743937,\n 752145307699165,\n 1383410902447554,\n 2544489349890656,\n 4680045560037375,\n 8607945812375585,\n]\n","import { LitsError } from '../../../../errors'\nimport type { SourceCodeInfo } from '../../../../tokenizer/token'\nimport { assertFunctionLike } from '../../../../typeGuards/lits'\nimport { assertNumber } from '../../../../typeGuards/number'\nimport { assertString } from '../../../../typeGuards/string'\nimport { toFixedArity } from '../../../../utils/arity'\nimport type { BuiltinNormalExpression, BuiltinNormalExpressions } from '../../../../builtin/interface'\nimport { abundantSequence } from './abundant'\nimport { arithmeticNormalExpressions } from './arithmetic'\nimport { bellNumbers } from './bell'\nimport { bernoulliNormalExpressions } from './bernoulli'\nimport { catalanNumbers } from './catalan'\nimport { collatzSequence } from './collatz'\nimport { compositeSequence } from './composite'\nimport { deficientSequence } from './deficient'\nimport { factorialNumbers } from './factorial'\nimport { fibonacciNumbers } from './fibonacci'\nimport { geometricNormalExpressions } from './geometric'\nimport { golombSequence } from './golomb'\nimport { happySequence } from './happy'\nimport { jugglerSequence } from './juggler'\nimport { lookAndSaySequence } from './lookAndSay'\nimport { lucasNumbers } from './lucas'\nimport { luckySequence } from './lucky'\nimport { mersenneNumbers } from './mersenne'\nimport { padovanSequence } from './padovan'\nimport { partitionNumbers } from './partition'\nimport { pellNumbers } from './pell'\nimport { perfectNumbers } from './perfect'\nimport { perfectCubeSequence } from './perfectCube'\nimport { perfectPowerSequence } from './perfectPower'\nimport { perfectSquareSequence } from './perfectSquare'\nimport { poligonalNormalExpressions } from './poligonal'\nimport { primeSequence } from './prime'\nimport { recamanSequence } from './recaman'\nimport { sylvesterNumbers } from './sylvester'\nimport { thueMorseSequence } from './thueMorse'\nimport { tribonacciNumbers } from './tribonacci'\n\ntype SeqKey<T extends string> = `${T}-seq`\ntype TakeWhileKey<T extends string> = `${T}-take-while`\ntype NthKey<T extends string> = `${T}-nth`\ntype PredKey<T extends string> = `${T}?`\n\ntype SeqFunction<Type extends number | string> = (length: number, sourceCodeInfo: SourceCodeInfo | undefined) => Type[]\ntype TakeWhileFunction<Type extends number | string> = (pred: (value: Type, index: number) => boolean, sourceCodeInfo: SourceCodeInfo | undefined) => Type[]\ntype PredFunction<Type extends number | string> = (n: Type, sourceCodeInfo: SourceCodeInfo | undefined) => boolean\n\nexport type SequenceKeys<T extends string> = SeqKey<T> | TakeWhileKey<T> | NthKey<T> | PredKey<T>\n\nexport type SequenceDefinition<T extends string, Type extends number | string = number> = {\n [key in Exclude<SequenceKeys<T>, NthKey<T>>]: key extends SeqKey<T>\n ? SeqFunction<Type>\n : key extends TakeWhileKey<T>\n ? TakeWhileFunction<Type>\n : PredFunction<Type>\n} & {\n maxLength?: number\n} & (Type extends string ? {\n string: true\n} : {\n string?: never\n}) & {\n noNth?: true\n}\n\nexport type SequenceNormalExpressions<T extends string, Type extends string | number = number> = {\n [key in SequenceKeys<T>]: key extends SeqKey<T>\n ? BuiltinNormalExpression<Type[]>\n : key extends TakeWhileKey<T>\n ? BuiltinNormalExpression<Type[]>\n : key extends NthKey<T>\n ? BuiltinNormalExpression<Type>\n : BuiltinNormalExpression<boolean>\n}\n\nexport const sequenceNormalExpressions: BuiltinNormalExpressions = {}\n\naddSequence(abundantSequence)\naddSequence(collatzSequence)\naddSequence(compositeSequence)\naddSequence(deficientSequence)\naddSequence(golombSequence)\naddSequence(happySequence)\naddSequence(jugglerSequence)\naddSequence(lookAndSaySequence)\naddSequence(luckySequence)\naddSequence(padovanSequence)\naddSequence(perfectSquareSequence)\naddSequence(perfectCubeSequence)\naddSequence(perfectPowerSequence)\naddSequence(primeSequence)\naddSequence(recamanSequence)\naddSequence(thueMorseSequence)\naddNormalExpressions(getFiniteNumberSequence('tribonacci', tribonacciNumbers))\naddNormalExpressions(getFiniteNumberSequence('catalan', catalanNumbers))\naddNormalExpressions(getFiniteNumberSequence('factorial', factorialNumbers))\naddNormalExpressions(getFiniteNumberSequence('fibonacci', fibonacciNumbers))\naddNormalExpressions(getFiniteNumberSequence('lucas', lucasNumbers))\naddNormalExpressions(getFiniteNumberSequence('mersenne', mersenneNumbers))\naddNormalExpressions(getFiniteNumberSequence('partition', partitionNumbers))\naddNormalExpressions(getFiniteNumberSequence('pell', pellNumbers))\naddNormalExpressions(getFiniteNumberSequence('perfect', perfectNumbers))\naddNormalExpressions(getFiniteNumberSequence('sylvester', sylvesterNumbers))\naddNormalExpressions(getFiniteNumberSequence('bell', bellNumbers))\naddNormalExpressions(arithmeticNormalExpressions)\naddNormalExpressions(bernoulliNormalExpressions)\naddNormalExpressions(geometricNormalExpressions)\naddNormalExpressions(poligonalNormalExpressions)\n\nfunction addNormalExpressions(normalExpressions: BuiltinNormalExpressions) {\n for (const [key, value] of Object.entries(normalExpressions)) {\n /* v8 ignore next 3 */\n if (sequenceNormalExpressions[key]) {\n throw new Error(`Duplicate normal expression key found: ${key}`)\n }\n sequenceNormalExpressions[key] = value\n }\n}\n\nfunction getFiniteNumberSequence<T extends string>(name: T, sequence: number[]): SequenceNormalExpressions<T> {\n return {\n [`${name}-seq`]: createSeqNormalExpression(length => sequence.slice(0, length), sequence.length),\n [`${name}-take-while`]: createTakeWhileNormalExpression((takeWhile) => {\n let i = 0\n for (i = 0; ; i += 1) {\n if (i >= sequence.length) {\n break\n }\n if (!takeWhile(sequence[i]!, i)) {\n break\n }\n }\n return sequence.slice(0, i)\n }, sequence.length),\n [`${name}-nth`]: createNthNormalExpression(() => sequence, sequence.length),\n [`${name}?`]: createNumberPredNormalExpression(n => sequence.includes(n)),\n } as unknown as SequenceNormalExpressions<T>\n}\n\nfunction addSequence<Type extends number | string>(sequence: SequenceDefinition<string, Type>) {\n for (const [key, value] of Object.entries(sequence)) {\n /* v8 ignore next 3 */\n if (sequenceNormalExpressions[key]) {\n throw new Error(`Duplicate normal expression key found: ${key}`)\n }\n if (key.endsWith('seq')) {\n sequenceNormalExpressions[key] = createSeqNormalExpression(value as SeqFunction<Type>, sequence.maxLength)\n if (!sequence.noNth) {\n sequenceNormalExpressions[key.replace(/seq$/, 'nth')] = createNthNormalExpression(value as SeqFunction<Type>, sequence.maxLength)\n }\n }\n else if (key.endsWith('take-while')) {\n sequenceNormalExpressions[key] = createTakeWhileNormalExpression(value as TakeWhileFunction<Type>, sequence.maxLength)\n }\n else if (key.endsWith('?')) {\n if (sequence.string) {\n sequenceNormalExpressions[key] = createStringPredNormalExpression(value as PredFunction<string>)\n }\n else {\n sequenceNormalExpressions[key] = createNumberPredNormalExpression(value as PredFunction<number>)\n }\n }\n }\n}\n\nfunction createSeqNormalExpression<Type extends number | string>(\n seqFunction: SeqFunction<Type>,\n maxLength: number | undefined,\n): BuiltinNormalExpression<Type[]> {\n return {\n evaluate: (params, sourceCodeInfo) => {\n const length = params[0] ?? maxLength\n assertNumber(length, sourceCodeInfo, { integer: true, positive: true, lte: maxLength })\n const result = seqFunction(length, sourceCodeInfo)\n if (typeof result[0] === 'number') {\n /* v8 ignore next 3 */\n if (result.some(n => (n as number) > Number.MAX_SAFE_INTEGER)) {\n throw new LitsError('Result exceeds maximum safe integer', sourceCodeInfo)\n }\n }\n return result\n },\n arity: typeof maxLength === 'number' ? { max: 1 } : toFixedArity(1),\n }\n}\n\nfunction createTakeWhileNormalExpression<Type extends number | string>(\n takeWhileFunction: TakeWhileFunction<Type>,\n maxLength: number | undefined,\n): BuiltinNormalExpression<Type[]> {\n return {\n evaluate: (params, sourceCodeInfo, contextStack, { executeFunction }) => {\n const fn = params[0]\n assertFunctionLike(fn, sourceCodeInfo)\n const result = takeWhileFunction((value, index) => !!executeFunction(fn, [value, index], contextStack), sourceCodeInfo)\n if (typeof result[0] === 'number') {\n /* v8 ignore next 3 */\n if (result.some(n => (n as number) > Number.MAX_SAFE_INTEGER)) {\n throw new LitsError('Result exceeds maximum safe integer', sourceCodeInfo)\n }\n }\n return result\n },\n arity: typeof maxLength === 'number' ? { max: 1 } : toFixedArity(1),\n }\n}\n\nfunction createNthNormalExpression<Type extends number | string>(\n seqFunction: SeqFunction<Type>,\n maxLength: number | undefined,\n): BuiltinNormalExpression<Type> {\n return {\n evaluate: (params, sourceCodeInfo) => {\n const n = params[0]\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true, lte: maxLength })\n const sequence = seqFunction(n, sourceCodeInfo)\n if (typeof sequence[0] === 'number') {\n /* v8 ignore next 3 */\n if (sequence.some(val => (val as number) > Number.MAX_SAFE_INTEGER)) {\n throw new LitsError('Result exceeds maximum safe integer', sourceCodeInfo)\n }\n }\n return sequence[n - 1]!\n },\n arity: toFixedArity(1),\n }\n}\n\nfunction createNumberPredNormalExpression(\n predFunction: PredFunction<number>,\n): BuiltinNormalExpression<boolean> {\n return {\n evaluate: (params, sourceCodeInfo) => {\n const value = params[0]\n assertNumber(value, sourceCodeInfo)\n return predFunction(value, sourceCodeInfo)\n },\n arity: toFixedArity(1),\n }\n}\n\nfunction createStringPredNormalExpression(\n predFunction: PredFunction<string>,\n): BuiltinNormalExpression<boolean> {\n return {\n evaluate: (params, sourceCodeInfo) => {\n const value = params[0]\n assertString(value, sourceCodeInfo)\n return predFunction(value, sourceCodeInfo)\n },\n arity: toFixedArity(1),\n }\n}\n","import { LitsError } from '../../../errors'\nimport type { Arr } from '../../../interface'\nimport { assertVector } from '../../../typeGuards/annotatedArrays'\nimport { assertArray } from '../../../typeGuards/array'\nimport { assertNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\nimport type { LitsModule } from '../interface'\nimport { moduleDocs } from './docs'\nimport { combinationsNormalExpressions } from './combinations'\nimport { derangementsNormalExpressions } from './derangements'\nimport { divisorsNormalExpressions, getDivisors, getProperDivisors } from './divisors'\nimport { factorialNormalExpressions, factorialOf } from './factorial'\nimport { partitionsNormalExpressions } from './partitions'\nimport { permutationsNormalExpressions } from './permutations'\nimport { powerSetNormalExpressions } from './powerSet'\nimport { primeFactors, primeFactorsNormalExpressions } from './primeFactors'\nimport { sequenceNormalExpressions } from './sequences'\nimport { perfectPower } from './sequences/perfectPower'\n\nfunction gcd(a: number, b: number): number {\n while (b !== 0) {\n const temp = b\n b = a % b\n a = temp\n }\n return Math.abs(a)\n}\n\nfunction lcm(a: number, b: number): number {\n return Math.floor((a * b) / gcd(a, b))\n}\n\nfunction mobius(n: number): number {\n if (n === 1)\n return 1\n\n const factors = primeFactors(n)\n const uniqueFactors = new Set(factors)\n\n // If n has a repeated prime factor (not square-free)\n if (uniqueFactors.size !== factors.length)\n return 0\n\n // If square-free with even number of prime factors: return 1\n // If square-free with odd number of prime factors: return -1\n return factors.length % 2 === 0 ? 1 : -1\n}\n\n/**\n * Efficiently computes (base^exponent) % modulus using the square-and-multiply algorithm\n * Based on the pseudocode algorithm for modular exponentiation\n *\n * @param base - The base number\n * @param exponent - The exponent (must be non-negative)\n * @param modulus - The modulus (must be positive)\n * @returns The result of (base^exponent) % modulus\n */\nfunction modExp(base: number, exponent: number, modulus: number): number {\n // Edge case: modulus is 1\n if (modulus === 1) {\n return 0\n }\n\n // Assert: (modulus - 1) * (modulus - 1) does not overflow base\n // This is a limitation of using regular JavaScript numbers instead of BigInt\n\n // Initialize result\n let result = 1\n\n // Apply modulo to base first\n base = base % modulus\n\n // Square and multiply algorithm\n while (exponent > 0) {\n // If current bit of exponent is 1, multiply result with current base\n if (exponent % 2 === 1) {\n result = (result * base) % modulus\n }\n\n // Shift exponent right (divide by 2)\n exponent = exponent >> 1\n\n // Square the base for next iteration\n base = (base * base) % modulus\n }\n\n return result\n}\n\n/**\n * Extended Euclidean Algorithm\n * Finds gcd(a,b) and coefficients x,y such that ax + by = gcd(a,b)\n */\nfunction extendedGcd(a: number, b: number): [number, number, number] {\n if (b === 0) {\n return [a, 1, 0]\n }\n\n const [g, x, y] = extendedGcd(b, a % b)\n return [g, y, x - Math.floor(a / b) * y]\n}\n\n/**\n * Modular Multiplicative Inverse\n * Finds x such that (a * x) % m = 1\n */\nfunction modInverse(a: number, m: number): number {\n const [g, x] = extendedGcd(a, m)\n\n if (g !== 1) {\n throw new Error(`Modular inverse does not exist (gcd(${a}, ${m}) = ${g})`)\n }\n\n return ((x % m) + m) % m // Ensure positive result\n}\n\n/**\n * Chinese Remainder Theorem\n * Solve system of congruences: x ≡ remainders[i] (mod moduli[i])\n * Returns the smallest positive integer that satisfies all congruences\n */\nfunction chineseRemainder(remainders: number[], moduli: number[]): number {\n // Verify moduli are pairwise coprime\n for (let i = 0; i < moduli.length; i++) {\n for (let j = i + 1; j < moduli.length; j++) {\n const extGcd = extendedGcd(moduli[i]!, moduli[j]!)[0]\n if (extGcd !== 1) {\n throw new Error(`Moduli must be pairwise coprime, but gcd(${moduli[i]}, ${moduli[j]}) = ${extGcd}`)\n }\n }\n }\n\n // Calculate product of all moduli\n const product = moduli.reduce((acc, val) => acc * val, 1)\n\n let sum = 0\n\n for (let i = 0; i < remainders.length; i++) {\n const ai = remainders[i]!\n const ni = moduli[i]!\n const bi = product / ni\n\n // Find modular multiplicative inverse of bi modulo ni\n const inverse = modInverse(bi, ni)\n\n // Add contribution from this congruence\n sum = (sum + ai * bi * inverse) % product\n }\n\n return sum\n}\n\nexport const combinatoricalNormalExpression: BuiltinNormalExpressions = {\n 'coprime?': {\n evaluate: ([a, b], sourceCodeInfo): boolean => {\n assertNumber(a, sourceCodeInfo, { integer: true })\n assertNumber(b, sourceCodeInfo, { integer: true })\n return gcd(a, b) === 1\n },\n arity: toFixedArity(2),\n },\n 'divisible-by?': {\n evaluate: ([value, divisor], sourceCodeInfo): boolean => {\n assertNumber(value, sourceCodeInfo, { integer: true })\n assertNumber(divisor, sourceCodeInfo, { integer: true })\n if (divisor === 0)\n return false\n return value % divisor === 0\n },\n arity: toFixedArity(2),\n },\n 'gcd': {\n evaluate: ([a, b], sourceCodeInfo): number => {\n assertNumber(a, sourceCodeInfo)\n assertNumber(b, sourceCodeInfo)\n return gcd(a, b)\n },\n arity: toFixedArity(2),\n },\n 'lcm': {\n evaluate: ([a, b], sourceCodeInfo): number => {\n assertNumber(a, sourceCodeInfo)\n assertNumber(b, sourceCodeInfo)\n return lcm(a, b)\n },\n arity: toFixedArity(2),\n },\n\n 'multinomial': {\n evaluate: ([...args], sourceCodeInfo): number => {\n assertVector(args, sourceCodeInfo)\n const sum = args.reduce((acc: number, curr) => {\n assertNumber(curr, sourceCodeInfo, { integer: true, nonNegative: true })\n return acc + curr\n }, 0)\n return factorialOf(sum) / args.reduce((acc, curr) => acc * factorialOf(curr), 1)\n },\n arity: { min: 1 },\n },\n 'amicable?': {\n evaluate: ([a, b], sourceCodeInfo): boolean => {\n assertNumber(a, sourceCodeInfo, { integer: true, positive: true })\n assertNumber(b, sourceCodeInfo, { integer: true, positive: true })\n const sumA = getProperDivisors(a).reduce((acc, curr) => acc + curr, 0)\n const sumB = getProperDivisors(b).reduce((acc, curr) => acc + curr, 0)\n return sumA === b && sumB === a && a !== b\n },\n arity: toFixedArity(2),\n },\n 'euler-totient': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n let result = n\n for (let p = 2; p * p <= n; p += 1) {\n if (n % p === 0) {\n while (n % p === 0)\n n /= p\n result -= result / p\n }\n }\n if (n > 1)\n result -= result / n\n return result\n },\n arity: toFixedArity(1),\n },\n 'mobius': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n if (n === 1)\n return 1\n\n const factors = primeFactors(n)\n const uniqueFactors = new Set(factors)\n\n // If n has a repeated prime factor (not square-free)\n if (uniqueFactors.size !== factors.length)\n return 0\n\n // If square-free with even number of prime factors: return 1\n // If square-free with odd number of prime factors: return -1\n return factors.length % 2 === 0 ? 1 : -1\n },\n arity: toFixedArity(1),\n },\n 'mertens': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n if (n === 1)\n return 1\n let result = 0\n for (let i = 1; i <= n; i++) {\n const mobiusValue = mobius(i)\n result += mobiusValue// * Math.floor(n / i)\n }\n return result\n },\n arity: toFixedArity(1),\n },\n 'sigma': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n return getDivisors(n).reduce((acc, curr) => acc + curr, 0)\n },\n arity: toFixedArity(1),\n },\n 'carmichael-lambda': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n if (n === 1) {\n return 1\n }\n\n // Count occurrences of each prime factor\n const primes = primeFactors(n)\n const factorMap = new Map<number, number>()\n\n for (const prime of primes) {\n factorMap.set(prime, (factorMap.get(prime) || 0) + 1)\n }\n\n const lambdaValues: number[] = []\n\n // Calculate lambda for each prime power\n for (const [p, k] of factorMap.entries()) {\n if (p === 2) {\n if (k === 1) {\n lambdaValues.push(1) // λ(2) = 1\n }\n else if (k === 2) {\n lambdaValues.push(2) // λ(4) = 2\n }\n else {\n lambdaValues.push(2 ** (k - 2)) // λ(2^k) = 2^(k-2) for k >= 3\n }\n }\n else {\n // For odd prime powers p^k: λ(p^k) = (p-1)*p^(k-1)\n lambdaValues.push((p - 1) * p ** (k - 1))\n }\n }\n\n // Find LCM of all lambda values\n return lambdaValues.reduce((acc, val) => lcm(acc, val), 1)\n },\n arity: toFixedArity(1),\n },\n 'cartesian-product': {\n evaluate: (params, sourceCodeInfo): Arr[] => {\n params.forEach((set) => {\n assertArray(set, sourceCodeInfo)\n })\n const sets = params as Arr[]\n return sets.reduce((acc: Arr[], set) => {\n const result: Arr[] = []\n acc.forEach((arr) => {\n set.forEach((value) => {\n result.push([...arr, value])\n })\n })\n return result\n }, [[]])\n },\n arity: { min: 1 },\n },\n 'perfect-power': {\n evaluate: ([n], sourceCodeInfo): [number, number] | null => {\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n const result = perfectPower(n)\n return result || null\n },\n arity: toFixedArity(1),\n },\n 'mod-exp': {\n evaluate: ([base, exponent, modulus], sourceCodeInfo): number => {\n assertNumber(base, sourceCodeInfo, { finite: true })\n assertNumber(exponent, sourceCodeInfo, { integer: true, positive: true })\n assertNumber(modulus, sourceCodeInfo, { integer: true, positive: true })\n\n return modExp(base, exponent, modulus)\n },\n arity: toFixedArity(3),\n },\n 'mod-inv': {\n evaluate: ([a, m], sourceCodeInfo): number => {\n assertNumber(a, sourceCodeInfo, { integer: true, positive: true })\n assertNumber(m, sourceCodeInfo, { integer: true, positive: true })\n\n try {\n return modInverse(a, m)\n }\n catch (error) {\n throw new LitsError(error, sourceCodeInfo)\n }\n },\n arity: toFixedArity(2),\n },\n 'extended-gcd': {\n evaluate: ([a, b], sourceCodeInfo): [number, number, number] => {\n assertNumber(a, sourceCodeInfo, { integer: true })\n assertNumber(b, sourceCodeInfo, { integer: true })\n\n return extendedGcd(a, b)\n },\n arity: toFixedArity(2),\n },\n 'chinese-remainder': {\n evaluate: ([remainders, moduli], sourceCodeInfo): number => {\n assertVector(remainders, sourceCodeInfo)\n assertVector(moduli, sourceCodeInfo)\n if (remainders.length !== moduli.length) {\n throw new LitsError('Remainders and moduli must have the same length.', sourceCodeInfo)\n }\n try {\n return chineseRemainder(remainders, moduli)\n }\n catch (error) {\n throw new LitsError((error as Error).message, sourceCodeInfo)\n }\n },\n arity: toFixedArity(2),\n },\n 'stirling-first': {\n evaluate: ([n, k], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n assertNumber(k, sourceCodeInfo, { integer: true, positive: true, lte: n })\n\n // Create a table to store results\n const dp: number[][] = Array.from({ length: n + 1 }, () => Array<number>(k + 1).fill(0))\n\n // Base case\n dp[0]![0] = 1\n\n // Fill the table using the recurrence relation\n for (let i = 1; i <= n; i++) {\n for (let j = 1; j <= Math.min(i, k); j++) {\n dp[i]![j] = dp[i - 1]![j - 1]! + (i - 1) * dp[i - 1]![j]!\n }\n }\n\n return dp[n]![k]!\n },\n arity: toFixedArity(2),\n },\n 'stirling-second': {\n evaluate: ([n, k], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n assertNumber(k, sourceCodeInfo, { integer: true, positive: true, lte: n })\n if (k === 1)\n return 1 // Only one way to put n objects into one subset\n if (k === n)\n return 1 // Only one way to put n objects into n subsets (one object per subset)\n\n // Create a 2D array for memoization\n const dp: number[][] = Array.from({ length: n + 1 }, () => Array<number>(k + 1).fill(0))\n\n // Initialize base cases\n dp[0]![0] = 1\n\n // Fill the dp table using the recurrence relation:\n // S(n,k) = k * S(n-1,k) + S(n-1,k-1)\n for (let i = 1; i <= n; i++) {\n for (let j = 1; j <= Math.min(i, k); j++) {\n dp[i]![j] = j * dp[i - 1]![j]! + dp[i - 1]![j - 1]!\n }\n }\n\n return dp[n]![k]!\n },\n arity: toFixedArity(2),\n },\n}\n\naddSequences(sequenceNormalExpressions)\naddNormalExpressions(factorialNormalExpressions)\naddNormalExpressions(divisorsNormalExpressions)\naddNormalExpressions(combinationsNormalExpressions)\naddNormalExpressions(permutationsNormalExpressions)\naddNormalExpressions(partitionsNormalExpressions)\naddNormalExpressions(primeFactorsNormalExpressions)\naddNormalExpressions(derangementsNormalExpressions)\naddNormalExpressions(powerSetNormalExpressions)\n\nfunction addSequences(sequences: BuiltinNormalExpressions) {\n for (const [key, value] of Object.entries(sequences)) {\n /* v8 ignore next 3 */\n if (combinatoricalNormalExpression[key]) {\n throw new Error(`Duplicate normal expression key found: ${key}`)\n }\n combinatoricalNormalExpression[key] = value\n }\n}\n\nfunction addNormalExpressions(normalExpressions: BuiltinNormalExpressions) {\n for (const [key, value] of Object.entries(normalExpressions)) {\n /* v8 ignore next 3 */\n if (combinatoricalNormalExpression[key]) {\n throw new Error(`Duplicate normal expression key found: ${key}`)\n }\n combinatoricalNormalExpression[key] = value\n }\n}\n\nfor (const [key, docs] of Object.entries(moduleDocs)) {\n if (combinatoricalNormalExpression[key])\n combinatoricalNormalExpression[key].docs = docs\n}\n\nexport const numberTheoryModule: LitsModule = {\n name: 'number-theory',\n functions: combinatoricalNormalExpression,\n}\n","import type { SequenceDefinition } from '.'\n\nexport const collatzSequence: Omit<SequenceDefinition<'collatz'>, 'collatz-nth' | 'collatz-take-while' | 'collatz?'> = {\n 'collatz-seq': (start) => {\n let x = start\n const collatz = [x]\n while (x !== 1) {\n if (x % 2 === 0) {\n x /= 2\n }\n else {\n x = 3 * x + 1\n }\n collatz.push(x)\n }\n return collatz\n },\n 'noNth': true,\n}\n","export const catalanNumbers = [\n 1,\n 2,\n 5,\n 14,\n 42,\n 132,\n 429,\n 1430,\n 4862,\n 16796,\n 58786,\n 208012,\n 742900,\n 2674440,\n 9694845,\n 35357670,\n 129644790,\n 477638700,\n 1767263190,\n 6564120420,\n 24466267020,\n 91482563640,\n 343059613650,\n 1289904147324,\n 4861946401452,\n 18367353072152,\n 69533550916004,\n 263747951750360,\n 1002242216651368,\n 3814986502092304,\n]\n","export const fibonacciNumbers = [\n 0,\n 1,\n 1,\n 2,\n 3,\n 5,\n 8,\n 13,\n 21,\n 34,\n 55,\n 89,\n 144,\n 233,\n 377,\n 610,\n 987,\n 1597,\n 2584,\n 4181,\n 6765,\n 10946,\n 17711,\n 28657,\n 46368,\n 75025,\n 121393,\n 196418,\n 317811,\n 514229,\n 832040,\n 1346269,\n 2178309,\n 3524578,\n 5702887,\n 9227465,\n 14930352,\n 24157817,\n 39088169,\n 63245986,\n 102334155,\n 165580141,\n 267914296,\n 433494437,\n 701408733,\n 1134903170,\n 1836311903,\n 2971215073,\n 4807526976,\n 7778742049,\n 12586269025,\n 20365011074,\n 32951280099,\n 53316291173,\n 86267571272,\n 139583862445,\n 225851433717,\n 365435296162,\n 591286729879,\n 956722026041,\n 1548008755920,\n 2504730781961,\n 4052739537881,\n 6557470319842,\n 10610209857723,\n 17167680177565,\n 27777890035288,\n 44945570212853,\n 72723460248141,\n 117669030460994,\n 190392490709135,\n 308061521170129,\n 498454011879264,\n 806515533049393,\n 1304969544928657,\n 2111485077978050,\n 3416454622906707,\n 5527939700884757,\n 8944394323791464,\n]\n","export const lucasNumbers = [\n 2,\n 1,\n 3,\n 4,\n 7,\n 11,\n 18,\n 29,\n 47,\n 76,\n 123,\n 199,\n 322,\n 521,\n 843,\n 1364,\n 2207,\n 3571,\n 5778,\n 9349,\n 15127,\n 24476,\n 39603,\n 64079,\n 103682,\n 167761,\n 271443,\n 439204,\n 710647,\n 1149851,\n 1860498,\n 3010349,\n 4870847,\n 7881196,\n 12752043,\n 20633239,\n 33385282,\n 54018521,\n 87403803,\n 141422324,\n 228826127,\n 370248451,\n 599074578,\n 969323029,\n 1568397607,\n 2537720636,\n 4106118243,\n 6643838879,\n 10749957122,\n 17393796001,\n 28143753123,\n 45537549124,\n 73681302247,\n 119218851371,\n 192900153618,\n 312119004989,\n 505019158607,\n 817138163596,\n 1322157322203,\n 2139295485799,\n 3461452808002,\n 5600748293801,\n 9062201101803,\n 14662949395604,\n 23725150497407,\n 38388099893011,\n 62113250390418,\n 100501350283429,\n 162614600673847,\n 263115950957276,\n 425730551631123,\n 688846502588399,\n 1114577054219522,\n 1803423556807921,\n 2918000611027443,\n 4721424167835364,\n 7639424778862807,\n]\n","export const mersenneNumbers = [3, 7, 31, 127, 2047, 8191, 131071, 524287, 2147483647]\n","export const pellNumbers = [\n 1,\n 2,\n 5,\n 12,\n 29,\n 70,\n 169,\n 408,\n 985,\n 2378,\n 5741,\n 13860,\n 33461,\n 80782,\n 195025,\n 470832,\n 1136689,\n 2744210,\n 6625109,\n 15994428,\n 38613965,\n 93222358,\n 225058681,\n 543339720,\n 1311738121,\n 3166815962,\n 7645370045,\n 18457556052,\n 44560482149,\n 107578520350,\n 259717522849,\n 627013566048,\n 1513744654945,\n 3654502875938,\n 8822750406821,\n 21300003689580,\n 51422757785981,\n 124145519261542,\n 299713796309065,\n 723573111879672,\n 1746860020068409,\n 4217293152016490,\n]\n","export const perfectNumbers = [6, 28, 496, 8128, 33550336, 8589869056, 137438691328]\n","export const sylvesterNumbers = [\n 2,\n 6,\n 42,\n 1806,\n 3263442,\n 10650056950806,\n]\n","export const bellNumbers = [\n 1,\n 2,\n 5,\n 15,\n 52,\n 203,\n 877,\n 4140,\n 21147,\n 115975,\n 678570,\n 4213597,\n 27644437,\n 190899322,\n 1382958545,\n 10480142147,\n 82864869804,\n 682076806159,\n 5832742205057,\n 51724158235372,\n 474869816156751,\n 4506715738447323,\n]\n","import { LitsError } from '../../../errors'\nimport { asNonUndefined } from '../../../typeGuards'\nimport { assertArray } from '../../../typeGuards/array'\nimport { assertNumber } from '../../../typeGuards/number'\nimport { asStringOrNumber, assertString } from '../../../typeGuards/string'\nimport { toNonNegativeInteger } from '../../../utils'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../interface'\nimport type { LitsModule } from '../interface'\nimport type { SourceCodeInfo } from '../../../tokenizer/token'\n\nconst stringUtilsFunctions: BuiltinNormalExpressions = {\n 'string-repeat': {\n evaluate: ([str, count], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n assertNumber(count, sourceCodeInfo, { integer: true, nonNegative: true })\n\n return str.repeat(count)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'string',\n returns: { type: 'number' },\n args: {\n a: { type: 'string' },\n b: { type: 'integer' },\n s: { type: 'string' },\n n: { type: 'integer' },\n },\n variants: [{ argumentNames: ['s', 'n'] }],\n description: 'Repeates $s $n times.',\n seeAlso: ['str', 'repeat'],\n examples: [\n 'let { string-repeat } = import(\"string\"); \"*\" string-repeat 10',\n 'let { string-repeat } = import(\"string\"); string-repeat(\"*\", 10)',\n 'let { string-repeat } = import(\"string\"); string-repeat(\"***\", 0)',\n ],\n },\n },\n\n 'from-char-code': {\n evaluate: ([num], sourceCodeInfo): string => {\n assertNumber(num, sourceCodeInfo, { finite: true })\n const int = toNonNegativeInteger(num)\n try {\n return String.fromCodePoint(int)\n }\n catch (error) {\n throw new LitsError(error as Error, sourceCodeInfo)\n }\n },\n arity: toFixedArity(1),\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: { code: { type: 'number' } },\n variants: [{ argumentNames: ['code'] }],\n description: 'Return character for code point $code.',\n seeAlso: ['string.to-char-code'],\n examples: [\n 'let { from-char-code } = import(\"string\"); from-char-code(65)',\n 'let { from-char-code } = import(\"string\"); from-char-code(0)',\n ],\n },\n },\n\n 'to-char-code': {\n evaluate: ([str], sourceCodeInfo): number => {\n assertString(str, sourceCodeInfo, { nonEmpty: true })\n return asNonUndefined(str.codePointAt(0), sourceCodeInfo)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'string',\n returns: { type: 'number' },\n args: { c: { type: 'string' } },\n variants: [{ argumentNames: ['c'] }],\n description: 'Return code point for first character in $c.',\n seeAlso: ['string.from-char-code'],\n examples: [\n 'let { to-char-code } = import(\"string\"); to-char-code(\"A\")',\n 'let { to-char-code } = import(\"string\"); to-char-code(\"Albert\")',\n ],\n },\n },\n\n 'trim-left': {\n evaluate: ([str], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n return str.replace(/^\\s+/, '')\n },\n arity: toFixedArity(1),\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Returns a new string with leading whitespaces removed.',\n seeAlso: ['trim', 'string.trim-right'],\n examples: [\n 'let { trim-left } = import(\"string\"); trim-left(\" Albert \")',\n 'let { trim-left } = import(\"string\"); trim-left(\" \")',\n 'let { trim-left } = import(\"string\"); trim-left(\"\")',\n ],\n },\n },\n\n 'trim-right': {\n evaluate: ([str], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n return str.replace(/\\s+$/, '')\n },\n arity: toFixedArity(1),\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Returns a new string with trailing whitespaces removed.',\n seeAlso: ['trim', 'string.trim-left'],\n examples: [\n 'let { trim-right } = import(\"string\"); trim-right(\" Albert \")',\n 'let { trim-right } = import(\"string\"); trim-right(\" \")',\n 'let { trim-right } = import(\"string\"); trim-right(\"\")',\n ],\n },\n },\n\n 'split-lines': {\n evaluate: ([str], sourceCodeInfo): string[] => {\n assertString(str, sourceCodeInfo)\n return str.split((/\\r\\n|\\n|\\r/)).filter(line => line !== '')\n },\n arity: toFixedArity(1),\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Divides $s into an array of substrings, each representing a line.',\n seeAlso: ['split'],\n examples: [\n 'let { split-lines } = import(\"string\"); split-lines(\"Albert\\nMojir\\n\")',\n 'let { split-lines } = import(\"string\"); split-lines(\"Albert\\n\\nMojir\")',\n 'let { split-lines } = import(\"string\"); split-lines(\"Albert\\nMojir\\n\\n\")',\n 'let { split-lines } = import(\"string\"); split-lines(\"\")',\n ],\n },\n },\n\n 'pad-left': {\n evaluate: ([str, length, padString], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n assertNumber(length, sourceCodeInfo, { integer: true })\n\n if (padString !== undefined)\n assertString(padString, sourceCodeInfo)\n\n return str.padStart(length, padString)\n },\n arity: { min: 2, max: 3 },\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: {\n a: { type: 'string' },\n b: { type: 'integer' },\n s: { type: 'string' },\n length: { type: 'integer' },\n padString: { type: 'string' },\n },\n variants: [\n { argumentNames: ['s', 'length'] },\n { argumentNames: ['s', 'length', 'padString'] },\n ],\n description: 'Pads from the start of $s with `padString` (multiple times, if needed) until the resulting string reaches the given $length.',\n seeAlso: ['string.pad-right'],\n examples: [\n 'let { pad-left } = import(\"string\"); \"Albert\" pad-left 20',\n 'let { pad-left } = import(\"string\"); pad-left(\"Albert\", 20)',\n 'let { pad-left } = import(\"string\"); pad-left(\"Albert\", 20, \"-*-\")',\n 'let { pad-left } = import(\"string\"); pad-left(\"Albert\", 5)',\n 'let { pad-left } = import(\"string\"); pad-left(\"Albert\", -1)',\n ],\n },\n },\n\n 'pad-right': {\n evaluate: ([str, length, padString], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n assertNumber(length, sourceCodeInfo, { integer: true })\n\n if (padString !== undefined)\n assertString(padString, sourceCodeInfo)\n\n return str.padEnd(length, padString)\n },\n arity: { min: 2, max: 3 },\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: {\n a: { type: 'string' },\n b: { type: 'integer' },\n s: { type: 'string' },\n length: { type: 'integer' },\n padString: { type: 'string' },\n },\n variants: [\n { argumentNames: ['s', 'length'] },\n { argumentNames: ['s', 'length', 'padString'] },\n ],\n description: 'Pads from the start of $s with `padString` (multiple times, if needed) until the resulting string reaches the given `length`.',\n seeAlso: ['string.pad-left'],\n examples: [\n 'let { pad-right } = import(\"string\"); \"Albert\" pad-right 20',\n 'let { pad-right } = import(\"string\"); pad-right(\"Albert\", 20)',\n 'let { pad-right } = import(\"string\"); pad-right(\"Albert\", 20, \"-*-\")',\n 'let { pad-right } = import(\"string\"); pad-right(\"Albert\", 5)',\n 'let { pad-right } = import(\"string\"); pad-right(\"Albert\", -1)',\n ],\n },\n },\n\n 'template': {\n evaluate: ([templateString, ...placeholders], sourceCodeInfo): string => {\n assertString(templateString, sourceCodeInfo)\n assertArray(placeholders, sourceCodeInfo)\n const templateStrings = templateString.split('||||')\n if (templateStrings.length <= 1) {\n return applyPlaceholders(templateStrings[0] as string, placeholders, sourceCodeInfo)\n }\n else {\n // Pluralisation\n const count = placeholders[0]\n assertNumber(count, sourceCodeInfo, { integer: true, nonNegative: true })\n const stringPlaceholders = [`${count}`, ...placeholders.slice(1)] as string[]\n if (templateStrings.length === 2) {\n // Exactly two valiants.\n // First variant (singular) for count = 1, Second variant (plural) for count = 0 or count > 1\n\n const placehoder = templateStrings[count === 1 ? 0 : 1] as string\n return applyPlaceholders(placehoder, stringPlaceholders, sourceCodeInfo)\n }\n else {\n // More than two variant:\n // Use count as index\n // If count >= number of variants, use last variant\n\n const placehoder = templateStrings[Math.min(count, templateStrings.length - 1)] as string\n return applyPlaceholders(placehoder, stringPlaceholders, sourceCodeInfo)\n }\n }\n },\n arity: { min: 1, max: 10 },\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: {\n s: { type: 'string' },\n params: { type: 'any', rest: true },\n },\n variants: [{ argumentNames: ['s', 'params'] }],\n description: 'Applies placeholders to a string. Support for basic pluralization - see examples. If pluralization is used, first placeholder must be a number.',\n seeAlso: ['str'],\n examples: [\n 'let { template } = import(\"string\"); template(\"Hi, $1 and $2\", \"Carl\", \"Larry\")',\n 'let { template } = import(\"string\"); template(\"Hi $1, $2, $3, $4, $5, $6, $7, $8 and $9\", \"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\", \"I\")',\n 'let { template } = import(\"string\"); template(\"$1 book||||$1 books\", 0)',\n 'let { template } = import(\"string\"); template(\"$1 book||||$1 books\", 1)',\n 'let { template } = import(\"string\"); template(\"$1 book||||$1 books\", 2)',\n 'let { template } = import(\"string\"); template(\"No book||||$1 book||||$1 books\", 0)',\n 'let { template } = import(\"string\"); template(\"No book||||$1 book||||$1 books\", 1)',\n 'let { template } = import(\"string\"); template(\"No book||||$1 book||||$1 books\", 10)',\n 'let { template } = import(\"string\"); template(\"No book||||One book||||Two books||||Three books||||$1 books\", 0)',\n 'let { template } = import(\"string\"); template(\"No book||||One book||||Two books||||Three books||||$1 books\", 1)',\n 'let { template } = import(\"string\"); template(\"No book||||One book||||Two books||||Three books||||$1 books\", 2)',\n 'let { template } = import(\"string\"); template(\"No book||||One book||||Two books||||Three books||||$1 books\", 3)',\n 'let { template } = import(\"string\"); template(\"No book||||One book||||Two books||||Three books||||$1 books\", 4)',\n ],\n hideOperatorForm: true,\n },\n },\n\n 'encode-base64': {\n evaluate: ([value], sourceCodeInfo): string => {\n assertString(value, sourceCodeInfo)\n return btoa(\n encodeURIComponent(value).replace(/%([0-9A-F]{2})/g, (_match, p1) => {\n // eslint-disable-next-line ts/no-unsafe-argument\n return String.fromCharCode(Number.parseInt(p1, 16))\n }),\n )\n },\n arity: toFixedArity(1),\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Returns a Base64 encoded string from $s.',\n seeAlso: ['string.decode-base64'],\n examples: [\n 'let { encode-base64 } = import(\"string\"); encode-base64(\"Albert\")',\n ],\n },\n },\n\n 'decode-base64': {\n evaluate: ([value], sourceCodeInfo): string => {\n assertString(value, sourceCodeInfo)\n try {\n return decodeURIComponent(\n Array.prototype.map\n .call(atob(value), (c) => {\n // eslint-disable-next-line ts/no-unsafe-call, ts/no-unsafe-member-access\n return `%${(`00${c.charCodeAt(0).toString(16)}`).slice(-2)}`\n })\n .join(''),\n )\n }\n catch (error) {\n throw new LitsError(error as Error, sourceCodeInfo)\n }\n },\n arity: toFixedArity(1),\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: { base64string: { type: 'string' } },\n variants: [{ argumentNames: ['base64string'] }],\n description: 'Returns a Base64 decoded string from $base64string.',\n seeAlso: ['string.encode-base64'],\n examples: [\n 'let { decode-base64 } = import(\"string\"); decode-base64(\"QWxiZXJ0IPCfkLs=\")',\n ],\n },\n },\n\n 'encode-uri-component': {\n evaluate: ([value], sourceCodeInfo): string => {\n assertString(value, sourceCodeInfo)\n return encodeURIComponent(value)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Returns an escaped `URI` string.',\n seeAlso: ['string.decode-uri-component'],\n examples: [\n 'let { encode-uri-component } = import(\"string\"); encode-uri-component(\"Hi everyone!?\")',\n ],\n },\n },\n\n 'decode-uri-component': {\n evaluate: ([value], sourceCodeInfo): string => {\n assertString(value, sourceCodeInfo)\n try {\n return decodeURIComponent(value)\n }\n catch (error) {\n throw new LitsError(error as Error, sourceCodeInfo)\n }\n },\n arity: toFixedArity(1),\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Returns an un-escaped `URI` string.',\n seeAlso: ['string.encode-uri-component'],\n examples: [\n 'let { decode-uri-component } = import(\"string\"); decode-uri-component(\"Hi%20everyone!%3F%20%F0%9F%91%8D\")',\n ],\n },\n },\n\n 'capitalize': {\n evaluate: ([str], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase()\n },\n arity: toFixedArity(1),\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Returns $s with the first character converted to uppercase and the rest to lowercase.',\n seeAlso: ['lower-case', 'upper-case'],\n examples: [\n 'let { capitalize } = import(\"string\"); capitalize(\"albert\")',\n 'let { capitalize } = import(\"string\"); capitalize(\"ALBERT\")',\n 'let { capitalize } = import(\"string\"); capitalize(\"aLBERT\")',\n 'let { capitalize } = import(\"string\"); capitalize(\"\")',\n ],\n },\n },\n}\n\nconst doubleDollarRegexp = /\\$\\$/g\nfunction applyPlaceholders(templateString: string, placeholders: unknown[], sourceCodeInfo?: SourceCodeInfo): string {\n for (let i = 0; i < 9; i += 1) {\n // Matches $1, $2, ..., $9\n // Does not match $$1\n // But does match $$$1, (since the two first '$' will later be raplaced with a single '$'\n const re = new RegExp(`(\\\\$\\\\$|[^$]|^)\\\\$${i + 1}`, 'g')\n if (re.test(templateString)) {\n const placeHolder = asStringOrNumber(placeholders[i], sourceCodeInfo)\n templateString = templateString.replace(re, `$1${placeHolder}`)\n }\n }\n templateString = templateString.replace(doubleDollarRegexp, '$')\n return templateString\n}\n\nexport const stringUtilsModule: LitsModule = {\n name: 'string',\n functions: stringUtilsFunctions,\n}\n","import type { ContextStack } from '../../../evaluator/ContextStack'\nimport type { ExecuteFunction } from '../../../evaluator/interface'\nimport type { Any, Arr, Coll, Obj } from '../../../interface'\nimport type { SourceCodeInfo } from '../../../tokenizer/token'\nimport { cloneColl, collHasKey, toAny, toNonNegativeInteger } from '../../../utils'\nimport { asColl, assertAny, assertColl, assertFunctionLike, assertObj, isColl, isObj } from '../../../typeGuards/lits'\nimport type { BuiltinNormalExpressions } from '../../interface'\nimport { assertArray } from '../../../typeGuards/array'\nimport { assertNumber, isNumber } from '../../../typeGuards/number'\nimport { asString, asStringOrNumber, assertString, assertStringOrNumber } from '../../../typeGuards/string'\nimport type { FunctionLike } from '../../../parser/types'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { LitsModule } from '../interface'\n\n// --- Private helper: get value from collection by key ---\nfunction get(coll: Coll, key: string | number): Any | undefined {\n if (isObj(coll)) {\n if (typeof key === 'string' && collHasKey(coll, key))\n return toAny(coll[key])\n }\n else {\n if (isNumber(key, { nonNegative: true, integer: true }) && key >= 0 && key < coll.length)\n return toAny(coll[key])\n }\n return undefined\n}\n\n// --- Private helper: assoc value into collection ---\nfunction assoc(coll: Coll, key: string | number, value: Any, sourceCodeInfo?: SourceCodeInfo) {\n assertColl(coll, sourceCodeInfo)\n if (Array.isArray(coll) || typeof coll === 'string') {\n assertNumber(key, sourceCodeInfo, { integer: true })\n assertNumber(key, sourceCodeInfo, { gte: 0 })\n assertNumber(key, sourceCodeInfo, { lte: coll.length })\n if (typeof coll === 'string') {\n assertString(value, sourceCodeInfo, { char: true })\n return `${coll.slice(0, key)}${value}${coll.slice(key + 1)}`\n }\n const copy = [...coll]\n copy[key] = value\n return copy\n }\n assertString(key, sourceCodeInfo)\n const copy = { ...coll }\n copy[key] = value\n return copy\n}\n\n// --- Private helper: update value in collection ---\nfunction update(\n coll: Coll,\n key: string | number,\n fn: FunctionLike,\n params: Arr,\n contextStack: ContextStack,\n executeFunction: ExecuteFunction,\n sourceCodeInfo?: SourceCodeInfo,\n): Coll {\n if (isObj(coll)) {\n assertString(key, sourceCodeInfo)\n const result = { ...coll }\n result[key] = executeFunction(fn, [result[key], ...params], contextStack, sourceCodeInfo)\n return result\n }\n else {\n assertNumber(key, sourceCodeInfo)\n const intKey = toNonNegativeInteger(key)\n assertNumber(intKey, sourceCodeInfo, { lte: coll.length })\n if (Array.isArray(coll)) {\n const result = coll.map((elem, index) => {\n if (intKey === index)\n return executeFunction(fn, [elem, ...params], contextStack, sourceCodeInfo)\n\n return elem\n })\n if (intKey === coll.length)\n result[intKey] = executeFunction(fn, [undefined, ...params], contextStack, sourceCodeInfo)\n\n return result\n }\n else {\n const result = coll.split('').map((elem, index) => {\n if (intKey === index) {\n return asString(executeFunction(fn, [elem, ...params], contextStack, sourceCodeInfo), sourceCodeInfo, {\n char: true,\n })\n }\n return elem\n })\n if (intKey === coll.length) {\n result[intKey] = asString(\n executeFunction(fn, [undefined, ...params], contextStack, sourceCodeInfo),\n sourceCodeInfo,\n {\n char: true,\n },\n )\n }\n return result.join('')\n }\n }\n}\n\ninterface CollMeta {\n coll: Coll\n parent: Obj | Arr\n}\n\n// --- Private helper: clone and get meta for nested operations ---\nfunction cloneAndGetMeta(\n originalColl: Coll,\n keys: Arr,\n sourceCodeInfo?: SourceCodeInfo,\n): { coll: Coll, innerCollMeta: CollMeta } {\n const coll = cloneColl(originalColl)\n\n const butLastKeys = keys.slice(0, keys.length - 1)\n\n const innerCollMeta = butLastKeys.reduce(\n (result: CollMeta, key) => {\n const resultColl = result.coll\n\n let newResultColl: Coll\n if (Array.isArray(resultColl)) {\n assertNumber(key, sourceCodeInfo)\n newResultColl = asColl(resultColl[key], sourceCodeInfo)\n }\n else {\n assertObj(resultColl, sourceCodeInfo)\n assertString(key, sourceCodeInfo)\n if (!collHasKey(result.coll, key))\n (resultColl)[key] = {}\n\n newResultColl = asColl(resultColl[key], sourceCodeInfo)\n }\n\n return { coll: newResultColl, parent: resultColl }\n },\n { coll, parent: {} },\n )\n return { coll, innerCollMeta }\n}\n\nconst collectionUtilsFunctions: BuiltinNormalExpressions = {\n 'get-in': {\n evaluate: (params, sourceCodeInfo): Any => {\n let coll = toAny(params[0])\n const keys = params[1] ?? [] // null behaves as empty array\n const defaultValue = toAny(params[2])\n assertArray(keys, sourceCodeInfo)\n for (const key of keys) {\n assertStringOrNumber(key, sourceCodeInfo)\n if (isColl(coll)) {\n const nextValue = get(coll, key)\n if (nextValue !== undefined)\n coll = nextValue\n else\n return defaultValue\n }\n else {\n return defaultValue\n }\n }\n return coll\n },\n arity: { min: 2, max: 3 },\n docs: {\n category: 'collection',\n returns: { type: 'any' },\n args: {\n 'a': { type: 'collection' },\n 'b': { type: 'array' },\n 'not-found': { type: 'any' },\n },\n variants: [\n { argumentNames: ['a', 'b'] },\n { argumentNames: ['a', 'b', 'not-found'] },\n ],\n description: 'Returns the value in a nested collection, where $b is an array of keys. Returns $not-found if the key is not present. If $not-found is not set, `null` is returned.',\n seeAlso: ['get', 'collection.assoc-in', 'collection.update-in'],\n examples: [\n `\nlet cu = import(\"collection\");\ncu.get-in(\n [[1, 2, 3], [4, { a: \"Kalle\" }, 6]],\n [1, 1, \"a\", 0]\n)`,\n `\nlet cu = import(\"collection\");\ncu.get-in(\n [[1, 2, 3], [4, { a: \"Kalle\" }, 6]],\n [1, 1, \"b\", 0]\n)`,\n `\nlet cu = import(\"collection\");\ncu.get-in(\n [[1, 2, 3], [4, { a: \"Kalle\" }, 6]],\n [1, 1, \"b\", 0],\n \"Lisa\"\n)`,\n ],\n },\n },\n 'assoc-in': {\n evaluate: ([originalColl, keys, value], sourceCodeInfo): Coll => {\n assertColl(originalColl, sourceCodeInfo)\n assertArray(keys, sourceCodeInfo)\n assertAny(value, sourceCodeInfo)\n\n if (keys.length === 1) {\n assertStringOrNumber(keys[0], sourceCodeInfo)\n return assoc(originalColl, keys[0], value, sourceCodeInfo)\n }\n\n const { coll, innerCollMeta } = cloneAndGetMeta(originalColl, keys, sourceCodeInfo)\n\n const lastKey = asStringOrNumber(keys[keys.length - 1], sourceCodeInfo)\n const parentKey = asStringOrNumber(keys[keys.length - 2], sourceCodeInfo)\n\n if (Array.isArray(innerCollMeta.parent)) {\n assertNumber(parentKey, sourceCodeInfo)\n innerCollMeta.parent[parentKey] = assoc(innerCollMeta.coll, lastKey, value, sourceCodeInfo)\n }\n else {\n assertString(parentKey, sourceCodeInfo)\n innerCollMeta.parent[parentKey] = assoc(innerCollMeta.coll, lastKey, value, sourceCodeInfo)\n }\n\n return coll\n },\n arity: toFixedArity(3),\n docs: {\n category: 'collection',\n returns: { type: 'collection' },\n args: {\n coll: { type: 'collection' },\n ks: { type: ['number', 'string'], array: true },\n value: { type: 'any' },\n },\n variants: [{ argumentNames: ['coll', 'ks', 'value'] }],\n description: `\nAssociates a value in the nested collection $coll, where $ks is an array of keys and $value is the new value.\n\nIf any levels do not exist, objects will be created - and the corresponding keys must be of type string.`,\n seeAlso: ['assoc', 'collection.get-in', 'collection.update-in'],\n examples: [\n `\nlet cu = import(\"collection\");\ncu.assoc-in(\n {},\n [\"a\", \"b\", \"c\"],\n \"Albert\"\n)`,\n `\nlet cu = import(\"collection\");\ncu.assoc-in(\n [1, 2, [1, 2, 3]],\n [2, 1],\n \"Albert\"\n)`,\n `\nlet cu = import(\"collection\");\ncu.assoc-in(\n [1, 2, { name: \"albert\" }],\n [2, \"name\", 0],\n \"A\"\n)`,\n ],\n },\n },\n 'update': {\n evaluate: ([coll, key, fn, ...params], sourceCodeInfo, contextStack, { executeFunction }): Coll => {\n assertColl(coll, sourceCodeInfo)\n assertStringOrNumber(key, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n return update(coll, key, fn, params, contextStack, executeFunction, sourceCodeInfo)\n },\n arity: { min: 3 },\n docs: {\n category: 'collection',\n returns: { type: 'collection' },\n args: {\n 'coll': { type: 'collection' },\n 'key': { type: ['string', 'number'] },\n 'fun': { type: 'function' },\n 'fun-args': { type: 'any', rest: true },\n },\n variants: [\n { argumentNames: ['coll', 'value', 'fun'] },\n { argumentNames: ['coll', 'value', 'fun', 'fun-args'] },\n ],\n description: `\nUpdates a value in the $coll collection, where $key is a key. $fun is a function\nthat will take the old value and any supplied $fun-args and\nreturn the new value.\nIf the key does not exist, \\`null\\` is passed as the old value.`,\n seeAlso: ['collection.update-in', 'assoc'],\n examples: [\n `\nlet cu = import(\"collection\");\nlet x = { a: 1, b: 2 };\ncu.update(x, \"a\", inc)`,\n `\nlet cu = import(\"collection\");\nlet x = { a: 1, b: 2 };\ncu.update(\n x,\n \"c\",\n val -> null?(val) ? 0 : inc(val)\n)`,\n ],\n },\n },\n 'update-in': {\n evaluate: ([originalColl, keys, fn, ...params], sourceCodeInfo, contextStack, { executeFunction }): Coll => {\n assertColl(originalColl, sourceCodeInfo)\n assertArray(keys, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n\n if (keys.length === 1) {\n assertStringOrNumber(keys[0], sourceCodeInfo)\n return update(originalColl, keys[0], fn, params, contextStack, executeFunction, sourceCodeInfo)\n }\n\n const { coll, innerCollMeta } = cloneAndGetMeta(originalColl, keys, sourceCodeInfo)\n\n const lastKey = asStringOrNumber(keys[keys.length - 1], sourceCodeInfo)\n const parentKey = asStringOrNumber(keys[keys.length - 2], sourceCodeInfo)\n\n if (Array.isArray(innerCollMeta.parent)) {\n assertNumber(parentKey, sourceCodeInfo)\n innerCollMeta.parent[parentKey] = update(\n innerCollMeta.coll,\n lastKey,\n fn,\n params,\n contextStack,\n executeFunction,\n sourceCodeInfo,\n )\n }\n else {\n assertString(parentKey, sourceCodeInfo)\n innerCollMeta.parent[parentKey] = update(\n innerCollMeta.coll,\n lastKey,\n fn,\n params,\n contextStack,\n executeFunction,\n sourceCodeInfo,\n )\n }\n\n return coll\n },\n arity: { min: 3 },\n docs: {\n category: 'collection',\n returns: { type: 'collection' },\n args: {\n 'coll': { type: 'collection' },\n 'ks': { type: 'array' },\n 'fun': { type: 'function' },\n 'fun-args': { type: 'any', rest: true },\n },\n variants: [\n { argumentNames: ['coll', 'ks', 'fun'] },\n { argumentNames: ['coll', 'ks', 'fun', 'fun-args'] },\n ],\n description: `Updates a value in the $coll collection, where $ks is an array of\nkeys and $fun is a function that will take the old value and\nany supplied $fun-args and return the new value. If any levels do not exist,\nobjects will be created - and the corresponding keys must be of type string.`,\n seeAlso: ['collection.update', 'collection.assoc-in', 'collection.get-in'],\n examples: [\n `\nlet cu = import(\"collection\");\ncu.update-in(\n { a: [1, 2, 3] },\n [\"a\", 1],\n -> null?($) ? 0 : inc($)\n)`,\n `\nlet cu = import(\"collection\");\ncu.update-in(\n { a: { foo: \"bar\"} },\n [\"a\", \"foo\"],\n -> null?($) ? \"?\" : \"!\"\n)`,\n `\nlet cu = import(\"collection\");\ncu.update-in(\n { a: { foo: \"bar\"} },\n [\"a\", \"baz\"],\n -> null?($) ? \"?\" : \"!\"\n)`,\n `\nlet cu = import(\"collection\");\ncu.update-in(\n { a: [1, 2, 3] },\n [\"a\", 1],\n *,\n 10,\n 10,\n 10,\n)`,\n ],\n },\n },\n 'filteri': {\n evaluate: ([coll, fn], sourceCodeInfo, contextStack, { executeFunction }): Coll => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n if (Array.isArray(coll)) {\n const result = coll.filter((elem, index) => executeFunction(fn, [elem, index], contextStack, sourceCodeInfo))\n return result\n }\n if (typeof coll === 'string') {\n return coll\n .split('')\n .filter((elem, index) => executeFunction(fn, [elem, index], contextStack, sourceCodeInfo))\n .join('')\n }\n return Object.entries(coll)\n .filter(([key, value]) => executeFunction(fn, [value, key], contextStack, sourceCodeInfo))\n .reduce((result: Obj, [key, value]) => {\n result[key] = value\n return result\n }, {})\n },\n arity: toFixedArity(2),\n docs: {\n category: 'collection',\n returns: { type: 'collection' },\n args: {\n a: { type: 'collection' },\n b: {\n type: 'function',\n description: 'The function to call for each element in the collection. The function should take two arguments: the element itself and the index.',\n },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Creates a new collection with all elements that pass the test implemented by $b. The function is called for each element in the collection, and it should take two arguments: the element itself and the index.',\n seeAlso: ['filter', 'collection.mapi'],\n examples: [\n 'let cu = import(\"collection\"); cu.filteri([1, 2, 3], (x, i) -> i % 2 == 0)',\n 'let cu = import(\"collection\"); cu.filteri([1, 2, 3], (x, i) -> x % 2 == 0)',\n 'let cu = import(\"collection\"); cu.filteri([1, 2, 3], (x, i) -> x + i > 3)',\n ],\n },\n },\n 'mapi': {\n evaluate: ([coll, fn], sourceCodeInfo, contextStack, { executeFunction }) => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n\n if (Array.isArray(coll)) {\n return coll.map((elem, index) => executeFunction(fn, [elem, index], contextStack, sourceCodeInfo))\n }\n if (typeof coll === 'string') {\n return coll\n .split('')\n .map((elem, index) => executeFunction(fn, [elem, index], contextStack, sourceCodeInfo))\n .join('')\n }\n return Object.entries(coll)\n .reduce((acc: Obj, [key, value]) => {\n acc[key] = executeFunction(fn, [value, key], contextStack, sourceCodeInfo)\n return acc\n }, {})\n },\n arity: toFixedArity(2),\n docs: {\n category: 'collection',\n returns: { type: 'collection' },\n args: {\n a: { type: 'collection' },\n b: {\n type: 'function',\n description: 'The function to call for each element in the collection. The function should take two arguments: the element itself and the index.',\n },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Creates a new collection populated with the results of calling $b on every element in $a. The function is called for each element in the collection, and it should take two arguments: the element itself and the index.',\n seeAlso: ['map', 'collection.filteri'],\n examples: [\n 'let cu = import(\"collection\"); cu.mapi([1, 2, 3], (x, i) -> x + i)',\n 'let cu = import(\"collection\"); cu.mapi([1, 2, 3], (x, i) -> x * i)',\n 'let cu = import(\"collection\"); cu.mapi([1, 2, 3], (x, i) -> x - i)',\n 'let cu = import(\"collection\"); cu.mapi([1, 2, 3], (x, i) -> x / i)',\n 'let cu = import(\"collection\"); cu.mapi([1, 2, 3], (x, i) -> x % inc(i))',\n ],\n },\n },\n 'reducei': {\n evaluate: ([coll, fn, initial], sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n assertAny(initial, sourceCodeInfo)\n\n if (typeof coll === 'string') {\n assertString(initial, sourceCodeInfo)\n if (coll.length === 0)\n return initial\n\n return coll.split('').reduce((result: Any, elem, index) => {\n return executeFunction(fn, [result, elem, index], contextStack, sourceCodeInfo)\n }, initial)\n }\n else if (Array.isArray(coll)) {\n if (coll.length === 0)\n return initial\n\n return coll.reduce((result: Any, elem, index) => {\n return executeFunction(fn, [result, elem, index], contextStack, sourceCodeInfo)\n }, initial)\n }\n else {\n if (Object.keys(coll).length === 0)\n return initial\n\n return Object.entries(coll).reduce((result: Any, [key, elem]) => {\n return executeFunction(fn, [result, elem, key], contextStack, sourceCodeInfo)\n }, initial)\n }\n },\n arity: toFixedArity(3),\n docs: {\n category: 'collection',\n returns: { type: 'any' },\n args: {\n coll: { type: 'collection' },\n fun: {\n type: 'function',\n description: 'The function to call for each element in the collection. The function should take three arguments: the accumulator, the element itself, and the index.',\n },\n initial: {\n type: 'any',\n description: 'The initial value to use as the accumulator.',\n },\n },\n variants: [{ argumentNames: ['coll', 'fun', 'initial'] }],\n description: 'Runs $fun function on each element of the $coll, passing in the return value from the calculation on the preceding element. The final result of running the reducer across all elements of the $coll is a single value. The function is called for each element in the collection, and it should take three arguments: the accumulator, the element itself, and the index.',\n seeAlso: ['reduce', 'collection.reducei-right', 'collection.reductionsi'],\n examples: [\n 'let cu = import(\"collection\"); cu.reducei([1, 2, 3], (acc, x, i) -> acc + x + i, 0)',\n 'let cu = import(\"collection\"); cu.reducei(\"Albert\", (acc, x, i) -> acc ++ x ++ i, \"\")',\n 'let cu = import(\"collection\"); cu.reducei({ a: 1, b: 2 }, -> $1 ++ $3, \"\")',\n ],\n },\n },\n 'reduce-right': {\n evaluate: ([coll, fn, initial], sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n assertAny(initial, sourceCodeInfo)\n\n if (typeof coll === 'string') {\n if (coll.length === 0)\n return initial\n\n return coll.split('').reduceRight((result: Any, elem) => {\n return executeFunction(fn, [result, elem], contextStack, sourceCodeInfo)\n }, initial)\n }\n else if (Array.isArray(coll)) {\n if (coll.length === 0)\n return initial\n\n return coll.reduceRight((result: Any, elem) => {\n return executeFunction(fn, [result, elem], contextStack, sourceCodeInfo)\n }, initial)\n }\n else {\n if (Object.keys(coll).length === 0)\n return initial\n\n return Object.entries(coll).reduceRight((result: Any, [, elem]) => {\n return executeFunction(fn, [result, elem], contextStack, sourceCodeInfo)\n }, initial)\n }\n },\n arity: toFixedArity(3),\n docs: {\n category: 'collection',\n returns: { type: 'any' },\n args: {\n fun: { type: 'function' },\n coll: { type: 'collection' },\n initial: { type: 'any' },\n },\n variants: [{ argumentNames: ['coll', 'fun', 'initial'] }],\n description: 'Runs $fun function on each element of the $coll (starting from the last item), passing in the return value from the calculation on the preceding element. The final result of running the reducer across all elements of the $coll is a single value.',\n seeAlso: ['reduce', 'collection.reducei-right'],\n examples: [\n 'let cu = import(\"collection\"); cu.reduce-right([\"A\", \"B\", \"C\"], str, \"\")',\n 'let cu = import(\"collection\"); cu.reduce-right({ a: 1, b: 2 }, +, 0)',\n ],\n },\n },\n 'reducei-right': {\n evaluate: ([coll, fn, initial], sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n assertAny(initial, sourceCodeInfo)\n\n if (typeof coll === 'string') {\n if (coll.length === 0)\n return initial\n\n return coll.split('').reduceRight((result: Any, elem, index) => {\n return executeFunction(fn, [result, elem, index], contextStack, sourceCodeInfo)\n }, initial)\n }\n else if (Array.isArray(coll)) {\n if (coll.length === 0)\n return initial\n\n return coll.reduceRight((result: Any, elem, index) => {\n return executeFunction(fn, [result, elem, index], contextStack, sourceCodeInfo)\n }, initial)\n }\n else {\n if (Object.keys(coll).length === 0)\n return initial\n\n return Object.entries(coll).reduceRight((result: Any, [key, elem]) => {\n return executeFunction(fn, [result, elem, key], contextStack, sourceCodeInfo)\n }, initial)\n }\n },\n arity: toFixedArity(3),\n docs: {\n category: 'collection',\n returns: { type: 'any' },\n args: {\n coll: { type: 'collection' },\n fun: {\n type: 'function',\n description: 'The function to call for each element in the collection. The function should take three arguments: the accumulator, the element itself, and the index.',\n },\n initial: {\n type: 'any',\n description: 'The initial value to use as the accumulator.',\n },\n },\n variants: [{ argumentNames: ['coll', 'fun', 'initial'] }],\n description: 'Runs $fun function on each element of the $coll (starting from the last item), passing in the return value from the calculation on the preceding element. The final result of running the reducer across all elements of the $coll is a single value. The function is called for each element in the collection, and it should take three arguments: the accumulator, the element itself, and the index.',\n seeAlso: ['collection.reducei', 'collection.reduce-right'],\n examples: [\n 'let cu = import(\"collection\"); cu.reducei-right([1, 2, 3], (acc, x, i) -> acc + x + i, 0)',\n 'let cu = import(\"collection\"); cu.reducei-right(\"Albert\", (acc, x, i) -> acc ++ x ++ i, \"\")',\n 'let cu = import(\"collection\"); cu.reducei-right({ a: 1, b: 2 }, -> $1 ++ $3, \"\")',\n ],\n },\n },\n 'reductions': {\n evaluate: ([coll, fn, initial], sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n assertAny(initial, sourceCodeInfo)\n\n assertAny(initial, sourceCodeInfo)\n if (typeof coll === 'string') {\n assertString(initial, sourceCodeInfo)\n if (coll.length === 0)\n return [initial]\n\n const resultArray: Any[] = [initial]\n coll.split('').reduce((result: Any, elem) => {\n const newVal = executeFunction(fn, [result, elem], contextStack, sourceCodeInfo)\n resultArray.push(newVal)\n return newVal\n }, initial)\n return resultArray\n }\n else if (Array.isArray(coll)) {\n if (coll.length === 0)\n return [initial]\n\n const resultArray: Any[] = [initial]\n coll.reduce((result: Any, elem) => {\n const newVal = executeFunction(fn, [result, elem], contextStack, sourceCodeInfo)\n resultArray.push(newVal)\n return newVal\n }, initial)\n return resultArray\n }\n else {\n if (Object.keys(coll).length === 0)\n return [initial]\n\n const resultArray: Any[] = [initial]\n Object.entries(coll).reduce((result: Any, [, elem]) => {\n const newVal = executeFunction(fn, [result, elem], contextStack, sourceCodeInfo)\n resultArray.push(newVal)\n return newVal\n }, initial)\n return resultArray\n }\n },\n arity: toFixedArity(3),\n docs: {\n category: 'collection',\n returns: { type: 'any', array: true },\n args: {\n fun: { type: 'function' },\n coll: { type: 'collection' },\n initial: { type: 'any' },\n },\n variants: [{ argumentNames: ['coll', 'fun', 'initial'] }],\n description: 'Returns an array of the intermediate values of the reduction (see `reduce`) of $coll by $fun.',\n seeAlso: ['reduce', 'collection.reductionsi'],\n examples: [\n 'let cu = import(\"collection\"); cu.reductions([1, 2, 3], +, 0)',\n 'let cu = import(\"collection\"); cu.reductions([1, 2, 3], +, 10)',\n 'let cu = import(\"collection\"); cu.reductions([], +, 0)',\n 'let cu = import(\"collection\"); cu.reductions({ a: 1, b: 2 }, +, 0)',\n `\nlet cu = import(\"collection\");\ncu.reductions(\n [1, 2, 3, 4, 5, 6, 7, 8, 9],\n (result, value) -> result + (even?(value) ? value : 0),\n 0\n)`,\n ],\n },\n },\n 'reductionsi': {\n evaluate: ([coll, fn, initial], sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n assertAny(initial, sourceCodeInfo)\n\n assertAny(initial, sourceCodeInfo)\n if (typeof coll === 'string') {\n assertString(initial, sourceCodeInfo)\n if (coll.length === 0)\n return [initial]\n\n const resultArray: Any[] = [initial]\n coll.split('').reduce((result: Any, elem, index) => {\n const newVal = executeFunction(fn, [result, elem, index], contextStack, sourceCodeInfo)\n resultArray.push(newVal)\n return newVal\n }, initial)\n return resultArray\n }\n else if (Array.isArray(coll)) {\n if (coll.length === 0)\n return [initial]\n\n const resultArray: Any[] = [initial]\n coll.reduce((result: Any, elem, index) => {\n const newVal = executeFunction(fn, [result, elem, index], contextStack, sourceCodeInfo)\n resultArray.push(newVal)\n return newVal\n }, initial)\n return resultArray\n }\n else {\n if (Object.keys(coll).length === 0)\n return [initial]\n\n const resultArray: Any[] = [initial]\n Object.entries(coll).reduce((result: Any, [key, elem]) => {\n const newVal = executeFunction(fn, [result, elem, key], contextStack, sourceCodeInfo)\n resultArray.push(newVal)\n return newVal\n }, initial)\n return resultArray\n }\n },\n arity: toFixedArity(3),\n docs: {\n category: 'collection',\n returns: { type: 'any', array: true },\n args: {\n coll: { type: 'collection' },\n fun: {\n type: 'function',\n description: 'The function to call for each element in the collection. The function should take three arguments: the accumulator, the element itself, and the index.',\n },\n initial: {\n type: 'any',\n description: 'The initial value to use as the accumulator.',\n },\n },\n variants: [{ argumentNames: ['coll', 'fun', 'initial'] }],\n description: 'Returns an array of the intermediate values of the reduction (see `reduce`) of $coll by $fun. The function is called for each element in the collection, and it should take three arguments: the accumulator, the element itself, and the index.',\n seeAlso: ['collection.reductions', 'collection.reducei'],\n examples: [\n 'let cu = import(\"collection\"); cu.reductionsi([1, 2, 3], (acc, x, i) -> acc + x + i, 0)',\n 'let cu = import(\"collection\"); cu.reductionsi(\"Albert\", (acc, x, i) -> acc ++ x ++ i, \"\")',\n 'let cu = import(\"collection\"); cu.reductionsi({ a: 1, b: 2 }, -> $1 ++ $3, \"\")',\n ],\n },\n },\n 'not-empty': {\n evaluate: ([coll], sourceCodeInfo): Coll | null => {\n if (coll === null)\n return null\n\n assertColl(coll, sourceCodeInfo)\n if (typeof coll === 'string')\n return coll.length > 0 ? coll : null\n\n if (Array.isArray(coll))\n return coll.length > 0 ? coll : null\n\n return Object.keys(coll).length > 0 ? coll : null\n },\n arity: toFixedArity(1),\n docs: {\n category: 'collection',\n returns: { type: 'boolean' },\n args: {\n coll: { type: ['collection', 'null'] },\n },\n variants: [{ argumentNames: ['coll'] }],\n description: 'Returns `null` if $coll is empty or `null`, otherwise $coll.',\n seeAlso: ['empty?', 'not-empty?'],\n examples: [\n 'let cu = import(\"collection\"); cu.not-empty([])',\n 'let cu = import(\"collection\"); cu.not-empty([1, 2, 3])',\n 'let cu = import(\"collection\"); cu.not-empty({})',\n 'let cu = import(\"collection\"); cu.not-empty({ a: 2 })',\n 'let cu = import(\"collection\"); cu.not-empty(\"\")',\n 'let cu = import(\"collection\"); cu.not-empty(\"Albert\")',\n 'let cu = import(\"collection\"); cu.not-empty(null)',\n ],\n },\n },\n 'every?': {\n evaluate: ([coll, fn], sourceCodeInfo, contextStack, { executeFunction }): boolean => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n\n if (Array.isArray(coll))\n return coll.every(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n\n if (typeof coll === 'string')\n return coll.split('').every(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n\n return Object.entries(coll).every(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n },\n arity: toFixedArity(2),\n docs: {\n category: 'collection',\n returns: { type: 'boolean' },\n args: {\n a: { type: 'collection' },\n b: { type: 'function' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns `true` if all entries in $a pass the test implemented by $b, otherwise returns `false`.',\n seeAlso: ['collection.any?', 'collection.not-every?', 'collection.not-any?', 'functional.every-pred', 'grid.every?'],\n examples: [\n 'let cu = import(\"collection\"); cu.every?([1, 2, 3], number?)',\n 'let cu = import(\"collection\"); cu.every?([1, 2, 3], even?)',\n `\nlet cu = import(\"collection\");\ncu.every?(\n [\"Albert\", \"Mojir\", 160, [1, 2]],\n string?,\n)`,\n `\nlet cu = import(\"collection\");\ncu.every?(\n [50, 100, 150, 200],\n -> $ > 10,\n)`,\n 'let cu = import(\"collection\"); cu.every?([], number?)',\n 'let cu = import(\"collection\"); cu.every?(\"\", number?)',\n 'let cu = import(\"collection\"); cu.every?({}, number?)',\n `\nlet cu = import(\"collection\");\ncu.every?(\n { a: 2, b: 4},\n -> even?(second($))\n)`,\n `\nlet cu = import(\"collection\");\ncu.every?(\n { a: 2, b: 3 },\n -> even?(second($))\n)`,\n ],\n },\n },\n 'any?': {\n evaluate: ([coll, fn], sourceCodeInfo, contextStack, { executeFunction }): boolean => {\n assertFunctionLike(fn, sourceCodeInfo)\n assertColl(coll, sourceCodeInfo)\n\n if (Array.isArray(coll))\n return coll.some(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n\n if (typeof coll === 'string')\n return coll.split('').some(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n\n return Object.entries(coll).some(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n },\n arity: toFixedArity(2),\n docs: {\n category: 'collection',\n returns: { type: 'boolean' },\n args: {\n a: { type: 'collection' },\n b: { type: 'function' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns `true` if any element in $a pass the test implemented by $b, otherwise returns `false`.',\n seeAlso: ['collection.every?', 'collection.not-any?', 'collection.not-every?', 'functional.some-pred', 'some', 'grid.some?'],\n examples: [\n `\nlet cu = import(\"collection\");\ncu.any?(\n [\"Albert\", \"Mojir\", 160, [1, 2]],\n string?\n)`,\n `\nlet cu = import(\"collection\");\ncu.any?(\n [50, 100, 150, 200],\n x -> x > 10\n)`,\n 'let cu = import(\"collection\"); cu.any?([], number?)',\n 'let cu = import(\"collection\"); cu.any?(\"\", number?)',\n 'let cu = import(\"collection\"); cu.any?({}, number?)',\n `\nlet cu = import(\"collection\");\ncu.any?(\n { a: 2, b: 3 },\n -> even?(second($))\n)`,\n `\nlet cu = import(\"collection\");\ncu.any?(\n { a: 1, b: 3 },\n -> even?(second($))\n)`,\n ],\n },\n },\n 'not-any?': {\n evaluate: ([coll, fn], sourceCodeInfo, contextStack, { executeFunction }): boolean => {\n assertFunctionLike(fn, sourceCodeInfo)\n assertColl(coll, sourceCodeInfo)\n\n if (Array.isArray(coll))\n return !coll.some(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n\n if (typeof coll === 'string')\n return !coll.split('').some(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n\n return !Object.entries(coll).some(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n },\n arity: toFixedArity(2),\n docs: {\n category: 'collection',\n returns: { type: 'boolean' },\n args: {\n a: { type: 'collection' },\n b: { type: 'function' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns `false` if any element in $a pass the test implemented by $b, otherwise returns `true`.',\n seeAlso: ['collection.any?', 'collection.every?', 'collection.not-every?'],\n examples: [\n `\nlet cu = import(\"collection\");\ncu.not-any?(\n [\"Albert\", \"Mojir\", 160, [1, 2]],\n string?\n)`,\n `\nlet cu = import(\"collection\");\ncu.not-any?(\n [50, 100, 150, 200],\n x -> x > 10\n)`,\n 'let cu = import(\"collection\"); cu.not-any?([], number?)',\n 'let cu = import(\"collection\"); cu.not-any?(\"\", number?)',\n 'let cu = import(\"collection\"); cu.not-any?({}, number?)',\n `\nlet cu = import(\"collection\");\ncu.not-any?(\n { a: 2, b: 3 },\n -> even?(second($))\n)`,\n `\nlet cu = import(\"collection\");\ncu.not-any?(\n { a: 1, b: 3 },\n -> even?(second($))\n)`,\n ],\n },\n },\n 'not-every?': {\n evaluate: ([coll, fn], sourceCodeInfo, contextStack, { executeFunction }): boolean => {\n assertFunctionLike(fn, sourceCodeInfo)\n assertColl(coll, sourceCodeInfo)\n\n if (Array.isArray(coll))\n return !coll.every(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n\n if (typeof coll === 'string')\n return !coll.split('').every(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n\n return !Object.entries(coll).every(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n },\n arity: toFixedArity(2),\n docs: {\n category: 'collection',\n returns: { type: 'boolean' },\n args: {\n a: { type: 'collection' },\n b: { type: 'function' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns `true` if at least one element in $a does not pass the test implemented by $b, otherwise returns `false`.',\n seeAlso: ['collection.every?', 'collection.any?', 'collection.not-any?'],\n examples: [\n `\nlet cu = import(\"collection\");\ncu.not-every?(\n [\"Albert\", \"Mojir\", 160, [1, 2]],\n string?\n)`,\n `\nlet cu = import(\"collection\");\ncu.not-every?(\n [50, 100, 150, 200],\n x -> x > 10\n)`,\n 'let cu = import(\"collection\"); cu.not-every?([], number?)',\n 'let cu = import(\"collection\"); cu.not-every?(\"\", number?)',\n 'let cu = import(\"collection\"); cu.not-every?({}, number?)',\n `\nlet cu = import(\"collection\");\ncu.not-every?(\n { a: 2, b: 4 },\n -> even?(second($))\n)`,\n `\nlet cu = import(\"collection\");\ncu.not-every?(\n { a: 2, b: 3 },\n -> even?(second($))\n)`,\n ],\n },\n },\n}\n\nexport const collectionUtilsModule: LitsModule = {\n name: 'collection',\n functions: collectionUtilsFunctions,\n}\n","import type { Any, Arr, Obj, Seq } from '../../../interface'\nimport type { SourceCodeInfo } from '../../../tokenizer/token'\nimport { asArray, assertArray, assertCharArray } from '../../../typeGuards/array'\nimport { asAny, asSeq, assertAny, assertFunctionLike, assertSeq } from '../../../typeGuards/lits'\nimport { asNumber, assertNumber } from '../../../typeGuards/number'\nimport { assertString, assertStringOrNumber } from '../../../typeGuards/string'\nimport { collHasKey, compare, deepEqual, toNonNegativeInteger } from '../../../utils'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../interface'\nimport type { LitsModule } from '../interface'\n\nconst sequenceUtilsFunctions: BuiltinNormalExpressions = {\n 'position': {\n evaluate: ([seq, fn]: Arr, sourceCodeInfo, contextStack, { executeFunction }): number | null => {\n assertFunctionLike(fn, sourceCodeInfo)\n if (seq === null)\n return null\n\n assertSeq(seq, sourceCodeInfo)\n if (typeof seq === 'string') {\n const index = seq.split('').findIndex(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n return index !== -1 ? index : null\n }\n else {\n const index = seq.findIndex(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n return index !== -1 ? index : null\n }\n },\n arity: toFixedArity(2),\n docs: {\n category: 'sequence',\n returns: { type: ['number', 'null'] },\n args: {\n a: { type: 'sequence' },\n b: { type: 'function' },\n seq: { type: ['sequence', 'null'] },\n fun: { type: 'function' },\n },\n variants: [{ argumentNames: ['seq', 'fun'] }],\n description: 'Returns the index of the first elements that passes the test implemented by $fun. If no element was found, `null` is returned.',\n seeAlso: ['index-of', 'some', 'find'],\n examples: [\n `\nlet su = import(\"sequence\");\nsu.position(\n [\"Albert\", \"Mojir\", 160, [1, 2]],\n string?\n)`,\n `\nlet su = import(\"sequence\");\nsu.position(\n [5, 10, 15, 20],\n -> $ > 10\n)`,\n `\nlet su = import(\"sequence\");\nsu.position(\n [5, 10, 15, 20],\n -> $ > 100\n)`,\n `\nlet su = import(\"sequence\");\nsu.position(\n null,\n -> $ > 100\n)`,\n ],\n },\n },\n 'last-index-of': {\n evaluate: ([seq, value], sourceCodeInfo): number | null => {\n assertAny(value, sourceCodeInfo)\n if (seq === null)\n return null\n\n assertSeq(seq, sourceCodeInfo)\n if (typeof seq === 'string') {\n assertString(value, sourceCodeInfo)\n const index = seq.lastIndexOf(value)\n return index !== -1 ? index : null\n }\n else {\n const index = seq.findLastIndex(item => deepEqual(asAny(item, sourceCodeInfo), value), sourceCodeInfo)\n return index !== -1 ? index : null\n }\n },\n arity: toFixedArity(2),\n docs: {\n category: 'sequence',\n returns: { type: ['number', 'null'] },\n args: {\n a: { type: 'sequence' },\n b: { type: 'any' },\n seq: { type: ['sequence', 'null'] },\n x: { type: 'any' },\n },\n variants: [{ argumentNames: ['seq', 'x'] }],\n description: 'Returns the last index of $x in $seq. If element is not present in $seq `null` is returned.',\n seeAlso: ['index-of'],\n examples: [\n 'let su = import(\"sequence\"); su.last-index-of([[1], [2], [1], [2]], [1])',\n 'let su = import(\"sequence\"); su.last-index-of([\"Albert\", \"Mojir\", 160, [1, 2]], \"Mojir\")',\n 'let su = import(\"sequence\"); su.last-index-of([5, 10, 15, 20, 15], 15)',\n 'let su = import(\"sequence\"); su.last-index-of([5, 10, 15, 20], 1)',\n 'let su = import(\"sequence\"); su.last-index-of(null, 1)',\n ],\n },\n },\n 'shift': {\n evaluate: ([seq], sourceCodeInfo): Any => {\n assertSeq(seq, sourceCodeInfo)\n if (typeof seq === 'string')\n return seq.substring(1)\n\n const copy = [...seq]\n copy.shift()\n return copy\n },\n arity: toFixedArity(1),\n docs: {\n category: 'sequence',\n returns: { type: ['sequence', 'null'] },\n args: { seq: { type: 'sequence' } },\n variants: [{ argumentNames: ['seq'] }],\n description: 'Returns a copy of $seq with first element removed. If $seq is empty `null` is returned.',\n seeAlso: ['sequence.unshift', 'pop', 'rest'],\n examples: [\n 'let su = import(\"sequence\"); su.shift([1, 2, 3])',\n 'let su = import(\"sequence\"); su.shift([])',\n ],\n },\n },\n 'splice': {\n evaluate: (params, sourceCodeInfo): Any => {\n const [seq, start, deleteCount, ...rest] = params\n assertSeq(seq, sourceCodeInfo)\n assertNumber(start, sourceCodeInfo, { integer: true })\n assertNumber(deleteCount, sourceCodeInfo, { integer: true, nonNegative: true })\n\n const from = start < 0 ? seq.length + start : start\n\n if (Array.isArray(seq)) {\n return [...seq.slice(0, from), ...rest, ...seq.slice(from + deleteCount)]\n }\n\n rest.forEach(elem => assertString(elem, sourceCodeInfo))\n return `${seq.substring(0, from)}${rest.join('')}${seq.substring(from + deleteCount)}`\n },\n arity: { min: 3 },\n docs: {\n category: 'sequence',\n returns: { type: 'sequence' },\n args: {\n seq: { type: 'sequence', rest: true },\n start: { type: 'integer' },\n deleteCount: { type: 'integer' },\n items: { type: 'any', rest: true },\n },\n variants: [\n { argumentNames: ['seq', 'start', 'deleteCount'] },\n { argumentNames: ['seq', 'start', 'deleteCount', 'items'] },\n ],\n description: 'Returns a a spliced array. Removes $deleteCount elements from $seq starting at $start and replaces them with $items. If $start is negative, it is counting from the end of the array.',\n seeAlso: ['slice', 'sequence.remove-at'],\n examples: [\n 'let su = import(\"sequence\"); su.splice([1, 2, 3, 4, 5], 2, 2, \"x\")',\n 'let su = import(\"sequence\"); su.splice([1, 2, 3, 4, 5], -2, 1, \"x\")',\n 'let su = import(\"sequence\"); su.splice(\"Albert\", 2, 2, \"fo\")',\n ],\n },\n },\n 'sort-by': {\n evaluate: (params: Arr, sourceCodeInfo, contextStack, { executeFunction }): Seq => {\n const [seq, keyfn] = params\n const defaultComparer = params.length === 2\n\n assertSeq(seq, sourceCodeInfo)\n assertFunctionLike(keyfn, sourceCodeInfo)\n const comparer = defaultComparer ? null : params[2]\n\n if (typeof seq === 'string') {\n const result = seq.split('')\n if (defaultComparer) {\n result.sort((a, b) => {\n const aKey = executeFunction(keyfn, [a], contextStack, sourceCodeInfo)\n assertStringOrNumber(aKey, sourceCodeInfo)\n const bKey = executeFunction(keyfn, [b], contextStack, sourceCodeInfo)\n assertStringOrNumber(bKey, sourceCodeInfo)\n return compare(aKey, bKey, sourceCodeInfo)\n })\n }\n else {\n assertFunctionLike(comparer, sourceCodeInfo)\n result.sort((a, b) => {\n const aKey = executeFunction(keyfn, [a], contextStack, sourceCodeInfo)\n const bKey = executeFunction(keyfn, [b], contextStack, sourceCodeInfo)\n const compareValue = executeFunction(comparer, [aKey, bKey], contextStack, sourceCodeInfo)\n assertNumber(compareValue, sourceCodeInfo, { finite: true })\n return compareValue\n })\n }\n return result.join('')\n }\n\n const result = [...seq]\n if (defaultComparer) {\n result.sort((a, b) => {\n const aKey = executeFunction(keyfn, [a], contextStack, sourceCodeInfo)\n assertStringOrNumber(aKey, sourceCodeInfo)\n const bKey = executeFunction(keyfn, [b], contextStack, sourceCodeInfo)\n assertStringOrNumber(bKey, sourceCodeInfo)\n return compare(aKey, bKey, sourceCodeInfo)\n })\n }\n else {\n assertFunctionLike(comparer, sourceCodeInfo)\n result.sort((a, b) => {\n const aKey = executeFunction(keyfn, [a], contextStack, sourceCodeInfo)\n const bKey = executeFunction(keyfn, [b], contextStack, sourceCodeInfo)\n const compareValue = executeFunction(comparer, [aKey, bKey], contextStack, sourceCodeInfo)\n assertNumber(compareValue, sourceCodeInfo, { finite: true })\n return compareValue\n })\n }\n return result\n },\n arity: { min: 2, max: 3 },\n docs: {\n category: 'sequence',\n returns: { type: 'any', rest: true },\n args: {\n a: { type: 'sequence' },\n b: { type: 'function' },\n seq: { type: 'sequence' },\n keyfn: { type: 'function' },\n comparer: { type: 'function' },\n },\n variants: [\n { argumentNames: ['seq', 'keyfn'] },\n { argumentNames: ['seq', 'keyfn', 'comparer'] },\n ],\n description: 'Returns a sorted sequence of the items in $seq, where the sort order is determined by comparing `(keyfn item)`. If no $comparer is supplied, uses builtin `compare`.',\n seeAlso: ['sort', 'compare'],\n examples: [\n 'let su = import(\"sequence\"); su.sort-by([\"Albert\", \"Mojir\", \"Nina\"], count)',\n 'let su = import(\"sequence\"); su.sort-by([\"Albert\", \"Mojir\", \"Nina\"], count)',\n 'let su = import(\"sequence\"); su.sort-by(\"Albert\", lower-case, -> $2 compare $1)',\n ],\n },\n },\n 'take': {\n evaluate: ([input, n], sourceCodeInfo): Seq => {\n assertNumber(n, sourceCodeInfo)\n assertSeq(input, sourceCodeInfo)\n const num = Math.max(Math.ceil(n), 0)\n return input.slice(0, num)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'integer' },\n n: { type: 'integer' },\n seq: { type: 'sequence' },\n },\n variants: [{ argumentNames: ['seq', 'n'] }],\n description: 'Constructs a new array/string with the $n first elements from $seq.',\n seeAlso: ['sequence.take-last', 'sequence.take-while', 'sequence.drop', 'slice', 'sequence.split-at'],\n examples: [\n 'let su = import(\"sequence\"); su.take([1, 2, 3, 4, 5], 3)',\n 'let su = import(\"sequence\"); su.take([1, 2, 3, 4, 5], 3)',\n 'let su = import(\"sequence\"); su.take([1, 2, 3, 4, 5], 0)',\n 'let su = import(\"sequence\"); su.take(\"Albert\", 2)',\n 'let su = import(\"sequence\"); su.take(\"Albert\", 50)',\n ],\n },\n },\n 'take-last': {\n evaluate: ([array, n], sourceCodeInfo): Seq => {\n assertSeq(array, sourceCodeInfo)\n assertNumber(n, sourceCodeInfo)\n const num = Math.max(Math.ceil(n), 0)\n const from = array.length - num\n return array.slice(from)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'integer' },\n n: { type: 'integer' },\n seq: { type: 'sequence' },\n },\n variants: [{ argumentNames: ['n', 'seq'] }],\n description: 'Constructs a new array with the $n last elements from $seq.',\n seeAlso: ['sequence.take', 'sequence.drop-last'],\n examples: [\n 'let su = import(\"sequence\"); su.take-last([1, 2, 3, 4, 5], 3)',\n 'let su = import(\"sequence\"); su.take-last([1, 2, 3, 4, 5], 3)',\n 'let su = import(\"sequence\"); su.take-last([1, 2, 3, 4, 5], 0)',\n ],\n },\n },\n 'take-while': {\n evaluate: ([seq, fn]: Arr, sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertSeq(seq, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n\n const result: Arr = []\n for (const item of seq) {\n if (executeFunction(fn, [item], contextStack, sourceCodeInfo))\n result.push(item)\n else\n break\n }\n return typeof seq === 'string' ? result.join('') : result\n },\n arity: toFixedArity(2),\n docs: {\n category: 'sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'function' },\n seq: { type: 'sequence' },\n fun: { type: 'function' },\n },\n variants: [{ argumentNames: ['seq', 'fun'] }],\n description: 'Returns the members of $seq in order, stopping before the first one for which `predicate` returns a falsy value.',\n seeAlso: ['sequence.take', 'sequence.drop-while', 'sequence.split-with'],\n examples: [\n `\nlet su = import(\"sequence\");\nsu.take-while(\n [1, 2, 3, 2, 1],\n -> $ < 3\n)`,\n `\nlet su = import(\"sequence\");\nsu.take-while(\n [1, 2, 3, 2, 1],\n -> $ > 3\n)`,\n ],\n },\n },\n 'drop': {\n evaluate: ([input, n], sourceCodeInfo): Seq => {\n assertNumber(n, sourceCodeInfo)\n const num = Math.max(Math.ceil(n), 0)\n assertSeq(input, sourceCodeInfo)\n return input.slice(num)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'integer' },\n seq: { type: 'sequence' },\n n: { type: 'integer' },\n },\n variants: [{ argumentNames: ['seq', 'n'] }],\n description: 'Constructs a new array/string with the $n first elements dropped from $seq.',\n seeAlso: ['sequence.drop-last', 'sequence.drop-while', 'sequence.take', 'slice', 'sequence.split-at'],\n examples: [\n 'let su = import(\"sequence\"); su.drop([1, 2, 3, 4, 5], 3)',\n 'let su = import(\"sequence\"); su.drop([1, 2, 3, 4, 5], 0)',\n 'let su = import(\"sequence\"); su.drop(\"Albert\", 2)',\n 'let su = import(\"sequence\"); su.drop(\"Albert\", 50)',\n ],\n },\n },\n 'drop-last': {\n evaluate: ([array, n], sourceCodeInfo): Seq => {\n assertSeq(array, sourceCodeInfo)\n assertNumber(n, sourceCodeInfo)\n const num = Math.max(Math.ceil(n), 0)\n\n const from = array.length - num\n return array.slice(0, from)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'integer' },\n seq: { type: 'sequence' },\n n: { type: 'integer' },\n },\n variants: [{ argumentNames: ['seq', 'n'] }],\n description: 'Constructs a new array with the $n last elements dropped from $seq.',\n seeAlso: ['sequence.drop', 'sequence.take-last'],\n examples: [\n 'let su = import(\"sequence\"); su.drop-last([1, 2, 3, 4, 5], 3)',\n 'let su = import(\"sequence\"); su.drop-last([1, 2, 3, 4, 5], 3)',\n 'let su = import(\"sequence\"); su.drop-last([1, 2, 3, 4, 5], 0)',\n ],\n },\n },\n 'drop-while': {\n evaluate: ([seq, fn]: Arr, sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertSeq(seq, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n\n if (Array.isArray(seq)) {\n const from = seq.findIndex(elem => !executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n return seq.slice(from)\n }\n const charArray = seq.split('')\n const from = charArray.findIndex(elem => !executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n return charArray.slice(from).join('')\n },\n arity: toFixedArity(2),\n docs: {\n category: 'sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'function' },\n seq: { type: 'sequence' },\n fun: { type: 'function' },\n },\n variants: [{ argumentNames: ['seq', 'fun'] }],\n description: 'Returns the members of $seq in order, skipping the fist elements for witch the `predicate` returns a truethy value.',\n seeAlso: ['sequence.drop', 'sequence.take-while', 'sequence.split-with'],\n examples: [\n `\nlet su = import(\"sequence\");\nsu.drop-while(\n [1, 2, 3, 2, 1],\n -> $ < 3\n)`,\n `\nlet su = import(\"sequence\");\nsu.drop-while(\n [1, 2, 3, 2, 1],\n -> $ > 3\n)`,\n ],\n },\n },\n 'unshift': {\n evaluate: ([seq, ...values], sourceCodeInfo): Seq => {\n assertSeq(seq, sourceCodeInfo)\n if (typeof seq === 'string') {\n assertCharArray(values, sourceCodeInfo)\n return [...values, seq].join('')\n }\n const copy = [...seq]\n copy.unshift(...values)\n return copy\n },\n arity: { min: 2 },\n docs: {\n category: 'sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'any' },\n seq: { type: 'sequence' },\n values: { type: 'any', rest: true },\n },\n variants: [{ argumentNames: ['seq', 'values'] }],\n description: 'Returns copy of $seq with $values added to the beginning.',\n seeAlso: ['push', 'sequence.shift', '++'],\n examples: [\n 'let su = import(\"sequence\"); su.unshift([1, 2, 3], 4)',\n 'let su = import(\"sequence\"); su.unshift([1, 2, 3], 4)',\n 'let su = import(\"sequence\"); su.unshift([1, 2, 3], 4, 5, 6)',\n `\nlet su = import(\"sequence\");\nlet l = [1, 2, 3];\nsu.unshift(l, 4);\nl`,\n ],\n },\n },\n 'distinct': {\n evaluate: ([input], sourceCodeInfo): Seq => {\n assertSeq(input, sourceCodeInfo)\n\n if (Array.isArray(input)) {\n const result: Any[] = []\n for (const item of input) {\n assertAny(item, sourceCodeInfo)\n if (!result.some(existingItem => deepEqual(existingItem, item, sourceCodeInfo))) {\n result.push(item)\n }\n }\n return result\n }\n\n return Array.from(new Set(input.split(''))).join('')\n },\n arity: toFixedArity(1),\n docs: {\n category: 'sequence',\n returns: { type: 'sequence' },\n args: { seq: { type: 'sequence' } },\n variants: [{ argumentNames: ['seq'] }],\n description: 'Returns a copy of $seq with no duplicates.',\n seeAlso: ['sequence.frequencies'],\n examples: [\n 'let su = import(\"sequence\"); su.distinct([[1], [2], [3], [1], [3], [5]])',\n 'let su = import(\"sequence\"); su.distinct([1, 2, 3, 1, 3, 5])',\n 'let su = import(\"sequence\"); su.distinct(\"Albert Mojir\")',\n 'let su = import(\"sequence\"); su.distinct([])',\n 'let su = import(\"sequence\"); su.distinct(\"\")',\n ],\n },\n },\n 'remove': {\n evaluate: ([input, fn], sourceCodeInfo, contextStack, { executeFunction }): Seq => {\n assertFunctionLike(fn, sourceCodeInfo)\n assertSeq(input, sourceCodeInfo)\n if (Array.isArray(input))\n return input.filter(elem => !executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n\n return input\n .split('')\n .filter(elem => !executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n .join('')\n },\n arity: toFixedArity(2),\n docs: {\n category: 'sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'function' },\n seq: { type: 'sequence' },\n fun: { type: 'function' },\n },\n variants: [{ argumentNames: ['seq', 'fun'] }],\n description: 'Returns a new sequence of items in $seq for witch `pred(item)` returns a falsy value.',\n seeAlso: ['filter', 'sequence.remove-at'],\n examples: [\n 'let su = import(\"sequence\"); su.remove([1, 2, 3, 1, 3, 5], odd?)',\n 'let su = import(\"sequence\"); su.remove([1, 2, 3, 1, 3, 5], even?)',\n 'let su = import(\"sequence\"); su.remove(\"Albert Mojir\", -> \"aoueiyAOUEIY\" contains? $)',\n ],\n },\n },\n 'remove-at': {\n evaluate: ([input, index], sourceCodeInfo): Seq => {\n assertNumber(index, sourceCodeInfo, { integer: true })\n assertSeq(input, sourceCodeInfo)\n\n const at = index < 0 ? input.length + index : index\n if (at < 0 || at >= input.length)\n return input\n\n if (Array.isArray(input)) {\n return input.filter((_, i) => i !== at)\n }\n return `${input.substring(0, at)}${input.substring(at + 1)}`\n },\n arity: toFixedArity(2),\n docs: {\n category: 'sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'integer' },\n seq: { type: 'sequence' },\n n: { type: 'number' },\n },\n variants: [{ argumentNames: ['seq', 'n'] }],\n description: 'Returns a new sequence of all items in $seq except item at position $n. If $n is negative, it is counting from the end of the sequence.',\n seeAlso: ['sequence.remove', 'sequence.splice'],\n examples: [\n 'let su = import(\"sequence\"); su.remove-at([1, 2, 3, 1, 3, 5], 2)',\n 'let su = import(\"sequence\"); su.remove-at(\"Albert\", -2)',\n 'let su = import(\"sequence\"); su.remove-at([1, 2, 3, 1, 3, 5], 0)',\n 'let su = import(\"sequence\"); su.remove-at([1, 2, 3, 1, 3, 5], -1)',\n 'let su = import(\"sequence\"); su.remove-at(\"Albert Mojir\", 6)',\n ],\n },\n },\n 'split-at': {\n evaluate: ([seq, pos], sourceCodeInfo): Seq => {\n assertNumber(pos, sourceCodeInfo, { integer: true })\n assertSeq(seq, sourceCodeInfo)\n\n const at = pos < 0 ? seq.length + pos : pos\n return [seq.slice(0, at), seq.slice(at)]\n },\n arity: toFixedArity(2),\n docs: {\n category: 'sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'integer' },\n seq: { type: 'sequence' },\n n: { type: 'number' },\n },\n variants: [{ argumentNames: ['seq', 'n'] }],\n description: 'Returns a pair of sequence `[take(pos input), drop(pos input)]`.',\n seeAlso: ['sequence.split-with', 'sequence.take', 'sequence.drop'],\n examples: [\n 'let su = import(\"sequence\"); su.split-at([1, 2, 3, 4, 5], 2)',\n 'let su = import(\"sequence\"); su.split-at(\"Albert\", -2)',\n 'let su = import(\"sequence\"); su.split-at([1, 2, 3, 4, 5], -2)',\n 'let su = import(\"sequence\"); su.split-at(\"Albert\", 2)',\n ],\n },\n },\n\n 'split-with': {\n evaluate: ([seq, fn], sourceCodeInfo, contextStack, { executeFunction }): Seq => {\n assertFunctionLike(fn, sourceCodeInfo)\n assertSeq(seq, sourceCodeInfo)\n const seqIsArray = Array.isArray(seq)\n const arr = seqIsArray ? seq : seq.split('')\n const index = arr.findIndex(elem => !executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n if (index === -1)\n return [seq, seqIsArray ? [] : '']\n\n return [seq.slice(0, index), seq.slice(index)]\n },\n arity: toFixedArity(2),\n docs: {\n category: 'sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'function' },\n seq: { type: 'sequence' },\n fun: { type: 'function' },\n },\n variants: [{ argumentNames: ['seq', 'fun'] }],\n description: 'Returns a pair of sequences `[take-while(input, fun), drop-while(input, fun)]`.',\n seeAlso: ['sequence.split-at', 'sequence.take-while', 'sequence.drop-while'],\n examples: [\n 'let su = import(\"sequence\"); su.split-with([1, 2, 3, 4, 5], odd?)',\n 'let su = import(\"sequence\"); su.split-with([1, 2, 3, 4, 5], -> $ > 3)',\n 'let su = import(\"sequence\"); su.split-with(\"Albert\", -> $ <= \"o\")',\n ],\n },\n },\n\n 'frequencies': {\n evaluate: ([seq], sourceCodeInfo): Obj => {\n assertSeq(seq, sourceCodeInfo)\n\n const arr = typeof seq === 'string' ? seq.split('') : seq\n\n return arr.reduce((result: Obj, val) => {\n assertString(val, sourceCodeInfo)\n if (collHasKey(result, val))\n result[val] = (result[val] as number) + 1\n else\n result[val] = 1\n\n return result\n }, {})\n },\n arity: toFixedArity(1),\n docs: {\n category: 'sequence',\n returns: { type: 'object' },\n args: { seq: { type: 'sequence' } },\n variants: [{ argumentNames: ['seq'] }],\n description: 'Returns an object from distinct items in $seq to the number of times they appear. Note that all items in $seq must be valid object keys i.e. strings.',\n seeAlso: ['sequence.group-by', 'sequence.distinct', 'vector.count-values'],\n examples: [\n 'let su = import(\"sequence\"); su.frequencies([\"Albert\", \"Mojir\", \"Nina\", \"Mojir\"])',\n 'let su = import(\"sequence\"); su.frequencies(\"Pneumonoultramicroscopicsilicovolcanoconiosis\")',\n ],\n },\n },\n\n 'group-by': {\n evaluate: ([seq, fn], sourceCodeInfo, contextStack, { executeFunction }): Obj => {\n assertFunctionLike(fn, sourceCodeInfo)\n assertSeq(seq, sourceCodeInfo)\n const arr = Array.isArray(seq) ? seq : seq.split('')\n\n return arr.reduce((result: Obj, val) => {\n const key = executeFunction(fn, [val], contextStack, sourceCodeInfo)\n assertString(key, sourceCodeInfo)\n if (!collHasKey(result, key))\n result[key] = []\n\n ;(result[key] as Arr).push(val)\n return result\n }, {})\n },\n arity: toFixedArity(2),\n docs: {\n category: 'sequence',\n returns: { type: 'object' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'function' },\n seq: { type: 'sequence' },\n fun: { type: 'function' },\n },\n variants: [{ argumentNames: ['seq', 'fun'] }],\n description: 'Returns an object of the elements of $seq keyed by the result of $fun on each element. The value at each key will be an array of the corresponding elements.',\n seeAlso: ['sequence.frequencies', 'sequence.partition-by'],\n examples: [\n 'let su = import(\"sequence\"); su.group-by([{ name: \"Albert\" }, { name: \"Albert\" }, { name: \"Mojir\" }], \"name\")',\n 'let su = import(\"sequence\"); su.group-by([{name: \"Albert\"}, {name: \"Albert\"}, {name: \"Mojir\"}], \"name\")',\n 'let su = import(\"sequence\"); su.group-by(\"Albert Mojir\", -> \"aoueiAOUEI\" contains? $ ? \"vowel\" : \"other\")',\n ],\n },\n },\n\n 'partition': {\n evaluate: (params, sourceCodeInfo): Seq => {\n const seq = asSeq(params[0], sourceCodeInfo)\n const n = toNonNegativeInteger(asNumber(params[1], sourceCodeInfo))\n const step = params.length >= 3 ? toNonNegativeInteger(asNumber(params[2], sourceCodeInfo)) : n\n const pad = params.length === 4\n ? params[3] === null ? [] : asArray(params[3], sourceCodeInfo)\n : undefined\n\n return partitionHelper(n, step, seq, pad, sourceCodeInfo)\n },\n arity: { min: 2, max: 4 },\n docs: {\n category: 'sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'number' },\n seq: { type: 'sequence' },\n n: { type: 'number' },\n step: { type: 'number' },\n pad: { type: 'array' },\n },\n variants: [\n { argumentNames: ['seq', 'n'] },\n { argumentNames: ['seq', 'n', 'step'] },\n { argumentNames: ['seq', 'n', 'step', 'pad'] },\n ],\n description: 'Returns an array of sequences of $n items each, at offsets $step apart. If $step is not supplied, defaults to $n. If a $pad array is supplied, use its elements as necessary to complete last partition upto $n items. In case there are not enough padding elements, return a partition with less than $n items.',\n seeAlso: ['sequence.partition-all', 'sequence.partition-by'],\n examples: [\n 'let su = import(\"sequence\"); su.partition(range(20), 4)',\n 'let su = import(\"sequence\"); su.partition(range(20), 4)',\n 'let su = import(\"sequence\"); su.partition(range(22), 4)',\n 'let su = import(\"sequence\"); su.partition(range(20), 4, 6)',\n 'let su = import(\"sequence\"); su.partition(range(20), 4, 3)',\n 'let su = import(\"sequence\"); su.partition(range(20), 3, 6, [\"a\"])',\n 'let su = import(\"sequence\"); su.partition(range(20), 4, 6, [\"a\"])',\n 'let su = import(\"sequence\"); su.partition(range(20), 4, 6, [\"a\", \"b\", \"c\", \"d\"])',\n 'let su = import(\"sequence\"); su.partition([\"a\", \"b\", \"c\", \"d\", \"e\", \"f\"], 3, 1)',\n 'let su = import(\"sequence\"); su.partition([1, 2, 3, 4], 10)',\n 'let su = import(\"sequence\"); su.partition([1, 2, 3, 4], 10, 10)',\n 'let su = import(\"sequence\"); su.partition([1, 2, 3, 4], 10, 10, [])',\n 'let su = import(\"sequence\"); su.partition([1, 2, 3, 4], 10, 10, null)',\n 'let su = import(\"sequence\"); su.partition(\"superfragilistic\", 5)',\n 'let su = import(\"sequence\"); su.partition(\"superfragilistic\", 5, 5, null)',\n 'let su = import(\"sequence\"); let foo = [5, 6, 7, 8]; su.partition(foo, 2, 1, foo)',\n ],\n },\n },\n\n 'partition-all': {\n evaluate: (params, sourceCodeInfo): Seq => {\n const seq = asSeq(params[0], sourceCodeInfo)\n const n = toNonNegativeInteger(asNumber(params[1], sourceCodeInfo))\n const step = params.length === 3 ? toNonNegativeInteger(asNumber(params[2], sourceCodeInfo)) : n\n\n return partitionHelper(n, step, seq, [], sourceCodeInfo)\n },\n arity: { min: 2, max: 3 },\n docs: {\n category: 'sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'number' },\n seq: { type: 'sequence' },\n n: { type: 'number' },\n step: { type: 'number' },\n },\n variants: [\n { argumentNames: ['seq', 'n'] },\n { argumentNames: ['seq', 'n', 'step'] },\n ],\n description: 'Returns an array of sequences like partition, but may include partitions with fewer than n items at the end.',\n seeAlso: ['sequence.partition', 'sequence.partition-by'],\n examples: [\n 'let su = import(\"sequence\"); su.partition-all([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 4)',\n 'let su = import(\"sequence\"); su.partition-all([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 4)',\n 'let su = import(\"sequence\"); su.partition([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 4)',\n 'let su = import(\"sequence\"); su.partition-all([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 2, 4)',\n ],\n },\n },\n\n 'partition-by': {\n evaluate: ([seq, fn], sourceCodeInfo, contextStack, { executeFunction }): Seq => {\n assertFunctionLike(fn, sourceCodeInfo)\n assertSeq(seq, sourceCodeInfo)\n const isStringSeq = typeof seq === 'string'\n let oldValue: unknown\n\n const result = (isStringSeq ? seq.split('') : seq).reduce((acc: Arr, elem) => {\n const value = executeFunction(fn, [elem], contextStack, sourceCodeInfo)\n if (value !== oldValue) {\n acc.push([])\n oldValue = value\n }\n ;(acc[acc.length - 1] as Arr).push(elem)\n return acc\n }, [])\n\n return isStringSeq ? result.map(elem => (elem as Arr).join('')) : result\n },\n arity: toFixedArity(2),\n docs: {\n category: 'sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'function' },\n seq: { type: 'sequence' },\n fun: { type: 'function' },\n },\n variants: [{ argumentNames: ['seq', 'fun'] }],\n description: 'Applies $fun to each value in $seq, splitting it each time $fun returns a new value. Returns an array of sequences.',\n seeAlso: ['sequence.partition', 'sequence.partition-all', 'sequence.group-by'],\n examples: [\n 'let su = import(\"sequence\"); su.partition-by([1, 2, 3, 4, 5], odd?)',\n 'let su = import(\"sequence\"); su.partition-by([1, 2, 3, 4, 5], -> $ == 3)',\n 'let su = import(\"sequence\"); su.partition-by([1, 1, 1, 2, 2, 3, 3], odd?)',\n 'let su = import(\"sequence\"); su.partition-by(\"Leeeeeerrroyyy\", identity)',\n ],\n },\n },\n 'ends-with?': {\n evaluate: ([str, search], sourceCodeInfo): boolean => {\n assertSeq(str, sourceCodeInfo)\n\n if (typeof str === 'string') {\n assertString(search, sourceCodeInfo)\n return str.endsWith(search)\n }\n\n return deepEqual(asAny(str.at(-1), sourceCodeInfo), asAny(search, sourceCodeInfo), sourceCodeInfo)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'sequence',\n returns: { type: 'boolean' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'sequence' },\n seq: { type: 'sequence' },\n suffix: { type: 'sequence' },\n },\n variants: [{ argumentNames: ['seq', 'suffix'] }],\n description: 'Returns `true` if $seq ends with $suffix, otherwise `false`.',\n seeAlso: ['sequence.starts-with?'],\n examples: [\n 'let su = import(\"sequence\"); su.ends-with?([[1], [2], [3], [4], [5]], [5])',\n 'let su = import(\"sequence\"); su.ends-with?([[1], [2], [3], [4], [5]], 5)',\n 'let su = import(\"sequence\"); su.ends-with?([1, 2, 3, 4, 5], 5)',\n 'let su = import(\"sequence\"); su.ends-with?([1, 2, 3, 4, 5], [5])',\n 'let su = import(\"sequence\"); su.ends-with?(\"Albert\", \"rt\")',\n 'let su = import(\"sequence\"); su.ends-with?(\"Albert\", \"RT\")',\n ],\n },\n },\n 'starts-with?': {\n evaluate: ([seq, search], sourceCodeInfo): boolean => {\n assertSeq(seq, sourceCodeInfo)\n\n if (typeof seq === 'string') {\n assertString(search, sourceCodeInfo)\n return seq.startsWith(search)\n }\n\n return deepEqual(asAny(seq[0], sourceCodeInfo), asAny(search, sourceCodeInfo), sourceCodeInfo)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'sequence',\n returns: { type: 'boolean' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'sequence' },\n seq: { type: 'sequence' },\n prefix: { type: 'sequence' },\n },\n variants: [{ argumentNames: ['seq', 'prefix'] }],\n description: 'Returns `true` if $seq starts with $prefix, otherwise `false`.',\n seeAlso: ['sequence.ends-with?'],\n examples: [\n 'let su = import(\"sequence\"); su.starts-with?([[1], [2], [3], [4], [5]], [1])',\n 'let su = import(\"sequence\"); su.starts-with?([1, 2, 3, 4, 5], 1)',\n 'let su = import(\"sequence\"); su.starts-with?([1, 2, 3, 4, 5], [1])',\n 'let su = import(\"sequence\"); su.starts-with?(\"Albert\", \"Al\")',\n 'let su = import(\"sequence\"); su.starts-with?(\"Albert\", \"al\")',\n ],\n },\n },\n 'interleave': {\n evaluate: ([...seqs], sourceCodeInfo): Seq => {\n const isStringSeq = typeof seqs[0] === 'string'\n\n const seqsArr = isStringSeq\n ? seqs.map((seq) => {\n assertString(seq, sourceCodeInfo)\n return seq.split('')\n })\n : seqs.map((seq) => {\n assertArray(seq, sourceCodeInfo)\n return seq\n })\n\n const maxLength = Math.min(...seqsArr.map(seq => seq.length))\n const result: Arr = []\n for (let i = 0; i < maxLength; i += 1) {\n for (const seq of seqsArr) {\n if (i < seq.length)\n result.push(seq[i])\n }\n }\n return isStringSeq ? result.join('') : result\n },\n arity: { min: 1 },\n docs: {\n category: 'sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'sequence' },\n seqs: { type: 'sequence', rest: true },\n },\n variants: [{ argumentNames: ['seqs'] }],\n description: 'Returns a sequence of the first item from each of the $seqs, then the second item from each of the $seqs, until all items from the shortest seq are exhausted.',\n seeAlso: ['sequence.interpose', 'zipmap'],\n examples: [\n 'let su = import(\"sequence\"); su.interleave([1, 2, 3], [4, 5, 6])',\n 'let su = import(\"sequence\"); su.interleave(\"Albert\", \".,.,.,\")',\n 'let su = import(\"sequence\"); su.interleave([1, 2, 3], [4, 5, 6])',\n 'let su = import(\"sequence\"); su.interleave([1, 2, 3], [4, 5, 6], [7, 8, 9])',\n 'let su = import(\"sequence\"); su.interleave([1, 2, 3], [4, 5, 6], [7, 8])',\n 'let su = import(\"sequence\"); su.interleave([1, 2, 3], [4, 5, 6], [7])',\n 'let su = import(\"sequence\"); su.interleave([1, 2, 3], [4, 5, 6], [])',\n 'let su = import(\"sequence\"); su.interleave([1, 2, 3], [])',\n 'let su = import(\"sequence\"); su.interleave([])',\n ],\n },\n },\n 'interpose': {\n evaluate: ([seq, separator], sourceCodeInfo): Seq => {\n assertSeq(seq, sourceCodeInfo)\n if (typeof seq === 'string') {\n assertString(separator, sourceCodeInfo)\n return seq.split('').join(separator)\n }\n\n if (seq.length === 0)\n return []\n\n const result: Arr = []\n for (let i = 0; i < seq.length - 1; i += 1) {\n result.push(seq[i], separator)\n }\n result.push(seq[seq.length - 1])\n return result\n },\n arity: toFixedArity(2),\n docs: {\n category: 'sequence',\n returns: { type: 'sequence' },\n args: {\n a: { type: 'sequence' },\n b: { type: 'any' },\n seq: { type: 'sequence' },\n separator: { type: 'any' },\n },\n variants: [{ argumentNames: ['seq', 'separator'] }],\n description: 'Returns a sequence of the elements of $seq separated by $separator. If $seq is a string, the separator must be a string.',\n seeAlso: ['sequence.interleave', 'join'],\n examples: [\n 'let su = import(\"sequence\"); su.interpose(\"Albert\", \"-\")',\n 'let su = import(\"sequence\"); su.interpose([1, 2, 3, 4, 5], \"a\")',\n 'let su = import(\"sequence\"); su.interpose([\"Albert\", \"Mojir\", \"Nina\"], \", \")',\n 'let su = import(\"sequence\"); su.interpose(\"Albert\", \".\")',\n ],\n },\n },\n}\n\nfunction partitionHelper(n: number, step: number, seq: Seq, pad: Arr | undefined, sourceCodeInfo?: SourceCodeInfo) {\n assertNumber(step, sourceCodeInfo, { positive: true })\n const isStringSeq = typeof seq === 'string'\n\n const result: Arr[] = []\n let start = 0\n outer: while (start < seq.length) {\n const innerArr: Arr = []\n for (let i = start; i < start + n; i += 1) {\n if (i >= seq.length) {\n const padIndex = i - seq.length\n if (!pad) {\n start += step\n continue outer\n }\n if (padIndex >= pad.length)\n break\n\n innerArr.push(pad[padIndex])\n }\n else {\n innerArr.push(seq[i])\n }\n }\n result.push(innerArr)\n start += step\n }\n return isStringSeq ? result.map(x => x.join('')) : result\n}\n\nexport const sequenceUtilsModule: LitsModule = {\n name: 'sequence',\n functions: sequenceUtilsFunctions,\n}\n","import type { SourceCodeInfo } from '../../../tokenizer/token'\nimport { isMatrix, isVector } from '../../../typeGuards/annotatedArrays'\nimport { isNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport { LitsError } from '../../../errors'\nimport type { BuiltinNormalExpressions } from '../../interface'\nimport type { LitsModule } from '../interface'\n\ntype NumberVectorOrMatrix = number | number[] | number[][]\n\nfunction getNumberVectorOrMatrixOperation(\n param: unknown,\n sourceCodeInfo: SourceCodeInfo | undefined,\n):\n | ['number', number]\n | ['vector', number[]]\n | ['matrix', number[][]] {\n if (isVector(param)) {\n return ['vector', param]\n }\n if (isMatrix(param)) {\n return ['matrix', param]\n }\n if (!isNumber(param)) {\n throw new LitsError(`Invalid parameter type: ${typeof param}`, sourceCodeInfo)\n }\n return ['number', param]\n}\n\nfunction unaryMathOp(\n fn: (val: number) => number,\n): (params: unknown[], sourceCodeInfo: SourceCodeInfo | undefined) => NumberVectorOrMatrix {\n return ([param], sourceCodeInfo) => {\n const [operation, operand] = getNumberVectorOrMatrixOperation(param, sourceCodeInfo)\n if (operation === 'number') {\n return fn(operand)\n }\n else if (operation === 'vector') {\n return operand.map(val => fn(val))\n }\n else {\n return operand.map(row => row.map(val => fn(val)))\n }\n }\n}\n\nconst mathUtilsFunctions: BuiltinNormalExpressions = {\n 'sin': {\n evaluate: unaryMathOp(val => Math.sin(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `sin` function computes the sine of an angle (in radians), working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the sine of each element while preserving the original structure.',\n seeAlso: ['math.asin', 'math.sinh', 'math.cos', 'math.tan', 'math.to-rad'],\n examples: [\n 'let { sin } = import(\"math\"); sin(0)',\n 'let { sin } = import(\"math\"); sin(1)',\n 'let { sin } = import(\"math\"); sin(PI)',\n 'let { sin } = import(\"math\"); sin(-0.5)',\n 'let { sin } = import(\"math\"); sin([1, 2, 3])',\n 'let { sin } = import(\"math\"); sin([[1, 2], [3, 4]])',\n ],\n },\n },\n 'asin': {\n evaluate: unaryMathOp(val => Math.asin(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `asin` function computes the arcsine (inverse sine) of a `number` in radians, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the arcsine of each element while preserving the original structure.',\n seeAlso: ['math.sin', 'math.asinh', 'math.acos', 'math.atan'],\n examples: [\n 'let { asin } = import(\"math\"); asin(0)',\n 'let { asin } = import(\"math\"); asin(1)',\n 'let { asin } = import(\"math\"); asin(-0.5)',\n 'let { asin } = import(\"math\"); asin([1, 2, 3])',\n 'let { asin } = import(\"math\"); asin([[1, 2], [3, 4]])',\n ],\n },\n },\n 'sinh': {\n evaluate: unaryMathOp(val => Math.sinh(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `sinh` function computes the hyperbolic sine of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the hyperbolic sine of each element while preserving the original structure.',\n seeAlso: ['math.asinh', 'math.sin', 'math.cosh', 'math.tanh'],\n examples: [\n 'let { sinh } = import(\"math\"); sinh(0)',\n 'let { sinh } = import(\"math\"); sinh(1)',\n 'let { sinh } = import(\"math\"); sinh(-0.5)',\n 'let { sinh } = import(\"math\"); sinh([0.1, 0.2, 0.3])',\n 'let { sinh } = import(\"math\"); sinh([[0.1, 0.2], [0.3, 0.4]])',\n ],\n },\n },\n 'asinh': {\n evaluate: unaryMathOp(val => Math.asinh(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `asinh` function computes the inverse hyperbolic sine of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the inverse hyperbolic sine of each element while preserving the original structure.',\n seeAlso: ['math.sinh', 'math.asin', 'math.acosh', 'math.atanh'],\n examples: [\n 'let { asinh } = import(\"math\"); asinh(10)',\n 'let { asinh } = import(\"math\"); asinh(90)',\n 'let { asinh } = import(\"math\"); asinh(50)',\n 'let { asinh } = import(\"math\"); asinh([10, 20, 30])',\n 'let { asinh } = import(\"math\"); asinh([[10, 20], [30, 40]])',\n ],\n },\n },\n 'cos': {\n evaluate: unaryMathOp(val => Math.cos(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `cos` function computes the cosine of an angle (in radians), working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the cosine of each element while preserving the original structure.',\n seeAlso: ['math.acos', 'math.cosh', 'math.sin', 'math.tan', 'math.to-rad'],\n examples: [\n 'let { cos } = import(\"math\"); cos(0)',\n 'let { cos } = import(\"math\"); cos(1)',\n 'let { cos } = import(\"math\"); cos(PI)',\n 'let { cos } = import(\"math\"); cos(-0.5)',\n 'let { cos } = import(\"math\"); cos([1, 2, 3])',\n 'let { cos } = import(\"math\"); cos([[1, 2], [3, 4]])',\n ],\n },\n },\n 'acos': {\n evaluate: unaryMathOp(val => Math.acos(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `acos` function computes the arccosine (inverse cosine) of a `number` in radians, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the arccosine of each element while preserving the original structure.',\n seeAlso: ['math.cos', 'math.acosh', 'math.asin', 'math.atan'],\n examples: [\n 'let { acos } = import(\"math\"); acos(0)',\n 'let { acos } = import(\"math\"); acos(1)',\n 'let { acos } = import(\"math\"); acos(-0.5)',\n 'let { acos } = import(\"math\"); acos([0.1, 0.2, 0.3])',\n 'let { acos } = import(\"math\"); acos([[0.1, 0.2], [0.3, 0.4]])',\n ],\n },\n },\n 'cosh': {\n evaluate: unaryMathOp(val => Math.cosh(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `cosh` function computes the hyperbolic cosine of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the hyperbolic cosine of each element while preserving the original structure.',\n seeAlso: ['math.acosh', 'math.cos', 'math.sinh', 'math.tanh'],\n examples: [\n 'let { cosh } = import(\"math\"); cosh(0)',\n 'let { cosh } = import(\"math\"); cosh(1)',\n 'let { cosh } = import(\"math\"); cosh(-0.5)',\n 'let { cosh } = import(\"math\"); cosh([0.1, 0.2, 0.3])',\n 'let { cosh } = import(\"math\"); cosh([[0.1, 0.2], [0.3, 0.4]])',\n ],\n },\n },\n 'acosh': {\n evaluate: unaryMathOp(val => Math.acosh(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `acosh` function computes the inverse hyperbolic cosine of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the inverse hyperbolic cosine of each element while preserving the original structure.',\n seeAlso: ['math.cosh', 'math.acos', 'math.asinh', 'math.atanh'],\n examples: [\n 'let { acosh } = import(\"math\"); acosh(1)',\n 'let { acosh } = import(\"math\"); acosh(2)',\n 'let { acosh } = import(\"math\"); acosh(100)',\n 'let { acosh } = import(\"math\"); acosh(50)',\n 'let { acosh } = import(\"math\"); acosh([1, 2, 3])',\n 'let { acosh } = import(\"math\"); acosh([[1, 2], [3, 4]])',\n ],\n },\n },\n 'tan': {\n evaluate: unaryMathOp(val => Math.tan(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `tan` function computes the tangent of an angle (in radians), working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the tangent of each element while preserving the original structure.',\n seeAlso: ['math.atan', 'math.tanh', 'math.sin', 'math.cos', 'math.to-rad'],\n examples: [\n 'let { tan } = import(\"math\"); tan(0)',\n 'let { tan } = import(\"math\"); tan(1)',\n 'let { tan } = import(\"math\"); tan(PI)',\n 'let { tan } = import(\"math\"); tan(-0.5)',\n 'let { tan } = import(\"math\"); tan([1, 2, 3])',\n 'let { tan } = import(\"math\"); tan([[1, 2], [3, 4]])',\n ],\n },\n },\n 'atan': {\n evaluate: unaryMathOp(val => Math.atan(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `atan` function computes the arctangent (inverse tangent) of a `number` in radians, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the arctangent of each element while preserving the original structure.',\n seeAlso: ['math.tan', 'math.atanh', 'math.asin', 'math.acos'],\n examples: [\n 'let { atan } = import(\"math\"); atan(0)',\n 'let { atan } = import(\"math\"); atan(1)',\n 'let { atan } = import(\"math\"); atan(-0.5)',\n 'let { atan } = import(\"math\"); atan([0.1, 0.2, 0.3])',\n 'let { atan } = import(\"math\"); atan([[0.1, 0.2], [0.3, 0.4]])',\n ],\n },\n },\n 'tanh': {\n evaluate: unaryMathOp(val => Math.tanh(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `tanh` function computes the hyperbolic tangent of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the hyperbolic tangent of each element while preserving the original structure.',\n seeAlso: ['math.atanh', 'math.tan', 'math.sinh', 'math.cosh'],\n examples: [\n 'let { tanh } = import(\"math\"); tanh(0)',\n 'let { tanh } = import(\"math\"); tanh(1)',\n 'let { tanh } = import(\"math\"); tanh(-0.5)',\n 'let { tanh } = import(\"math\"); tanh(50)',\n ],\n },\n },\n 'atanh': {\n evaluate: unaryMathOp(val => Math.atanh(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `atanh` function computes the inverse hyperbolic tangent of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the inverse hyperbolic tangent of each element while preserving the original structure.',\n seeAlso: ['math.tanh', 'math.atan', 'math.asinh', 'math.acosh'],\n examples: [\n 'let { atanh } = import(\"math\"); atanh(0)',\n 'let { atanh } = import(\"math\"); atanh(0.9)',\n 'let { atanh } = import(\"math\"); atanh(-0.5)',\n 'let { atanh } = import(\"math\"); atanh([0.1, 0.2, 0.3])',\n 'let { atanh } = import(\"math\"); atanh([[0.1, 0.2], [0.3, 0.4]])',\n ],\n },\n },\n 'ln': {\n evaluate: unaryMathOp(val => Math.log(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `ln` function computes the natural logarithm (base `e`) of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the natural logarithm of each element while preserving the original structure.',\n seeAlso: ['math.log2', 'math.log10', '^'],\n examples: [\n 'let { ln } = import(\"math\"); ln(0.01)',\n 'let { ln } = import(\"math\"); ln(2.5)',\n 'let { ln } = import(\"math\"); ln(E)',\n 'let { ln } = import(\"math\"); ln([1, 2, 3])',\n 'let { ln } = import(\"math\"); ln([[1, 2], [3, 4]])',\n ],\n },\n },\n 'log2': {\n evaluate: unaryMathOp(val => Math.log2(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `log2` function computes the base `2` logarithm of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the base-2 logarithm of each element while preserving the original structure.',\n seeAlso: ['math.ln', 'math.log10'],\n examples: [\n 'let { log2 } = import(\"math\"); log2(0.01)',\n 'let { log2 } = import(\"math\"); log2(2 ^ 12)',\n 'let { log2 } = import(\"math\"); log2(2.5)',\n 'let { log2 } = import(\"math\"); log2([1, 2, 3])',\n 'let { log2 } = import(\"math\"); log2([[1, 2], [3, 4]])',\n ],\n },\n },\n 'log10': {\n evaluate: unaryMathOp(val => Math.log10(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `log10` function computes the base `10` logarithm of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the base-10 logarithm of each element while preserving the original structure.',\n seeAlso: ['math.ln', 'math.log2'],\n examples: [\n 'let { log10 } = import(\"math\"); log10(0.01)',\n 'let { log10 } = import(\"math\"); log10(10 ^ 12)',\n 'let { log10 } = import(\"math\"); log10(2.5)',\n 'let { log10 } = import(\"math\"); log10([1, 2, 3])',\n 'let { log10 } = import(\"math\"); log10([[1, 2], [3, 4]])',\n ],\n },\n },\n 'to-rad': {\n evaluate: unaryMathOp(val => (val * Math.PI) / 180),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `to-rad` function converts an angle from degrees to radians, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it converts each element while preserving the original structure.',\n seeAlso: ['math.to-deg', 'math.sin', 'math.cos', 'math.tan'],\n examples: [\n 'let { to-rad } = import(\"math\"); to-rad(0)',\n 'let { to-rad } = import(\"math\"); to-rad(90)',\n 'let { to-rad } = import(\"math\"); to-rad(180)',\n 'let { to-rad } = import(\"math\"); to-rad(360)',\n 'let { to-rad } = import(\"math\"); to-rad([0, 90, 180])',\n 'let { to-rad } = import(\"math\"); to-rad([[0, 90], [180, 360]])',\n ],\n },\n },\n 'to-deg': {\n evaluate: unaryMathOp(val => (val * 180) / Math.PI),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `to-deg` function converts an angle from radians to degrees, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it converts each element while preserving the original structure.',\n seeAlso: ['math.to-rad'],\n examples: [\n 'let { to-deg } = import(\"math\"); to-deg(0)',\n 'let { to-deg } = import(\"math\"); to-deg(PI)',\n 'let { to-deg } = import(\"math\"); to-deg(PI / 2)',\n 'let { to-deg } = import(\"math\"); to-deg(3 * PI / 2)',\n 'let { to-deg } = import(\"math\"); to-deg([0, PI, PI / 2])',\n 'let { to-deg } = import(\"math\"); to-deg([[0, PI], [PI / 2, 3 * PI / 2]])',\n ],\n },\n },\n}\n\nexport const mathUtilsModule: LitsModule = {\n name: 'math',\n functions: mathUtilsFunctions,\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/lits'\nimport { LitsError } from '../../../errors'\nimport type { LitsModule } 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 LitsError('All functions must accept the same number of arguments', sourceCodeInfo)\n }\n return {\n [FUNCTION_SYMBOL]: true,\n sourceCodeInfo,\n functionType: 'Juxt',\n params,\n arity,\n }\n },\n arity: { min: 1 },\n docs: {\n category: 'functional',\n returns: { type: 'function' },\n args: {\n a: { type: 'function' },\n b: { type: 'function' },\n fun: { type: 'function' },\n fns: { type: 'function', rest: true },\n },\n variants: [\n { argumentNames: ['fun'] },\n { argumentNames: ['fun', 'fns'] },\n ],\n description: `Takes one or many function and returns a function that is the juxtaposition of those functions.\nThe returned function takes a variable number of args,\nand returns a vector containing the result of applying each function to the args (left-to-right).`,\n seeAlso: ['comp'],\n examples: [\n `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: LitsModule = {\n name: 'functional',\n functions: functionalUtilsNormalExpression,\n}\n","import { assertNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { Argument, BuiltinNormalExpressions } from '../../interface'\nimport type { LitsModule } from '../interface'\n\nfunction getOperatorArgs(a: 'integer', b: 'integer'): Record<string, Argument> {\n return { a: { type: a }, b: { type: b } }\n}\n\nconst bitwiseUtilsNormalExpression: BuiltinNormalExpressions = {\n 'bit-not': {\n evaluate: ([num], sourceCodeInfo): number => {\n assertNumber(num, sourceCodeInfo, { integer: true })\n return ~num\n },\n arity: toFixedArity(1),\n docs: {\n category: 'bitwise',\n returns: { type: 'integer' },\n args: { a: { type: 'integer' } },\n variants: [{ argumentNames: ['a'] }],\n description: 'Returns bitwise `not` of $a.',\n seeAlso: ['&', '|', 'xor', 'bitwise.bit-and-not'],\n examples: [\n 'let { bit-not } = import(\"bitwise\");\\nbit-not(0)',\n 'let { bit-not } = import(\"bitwise\");\\nbit-not(255)',\n ],\n },\n },\n 'bit-and-not': {\n evaluate: ([first, ...rest], sourceCodeInfo): number => {\n assertNumber(first, sourceCodeInfo, { integer: true })\n\n return rest.reduce((result: number, value) => {\n assertNumber(value, sourceCodeInfo, { integer: true })\n return result & ~value\n }, first)\n },\n arity: { min: 2 },\n docs: {\n category: 'bitwise',\n returns: { type: 'integer' },\n args: {\n ...getOperatorArgs('integer', 'integer'),\n c: { type: 'integer', rest: true },\n },\n variants: [\n { argumentNames: ['a', 'b'] },\n { argumentNames: ['a', 'b', 'c'] },\n ],\n description: 'Returns bitwise `and` with complement.',\n seeAlso: ['&', '|', 'xor', 'bitwise.bit-not'],\n examples: [\n 'let { bit-and-not } = import(\"bitwise\");\\n0b0011 bit-and-not 0b0110',\n 'let { bit-and-not } = import(\"bitwise\");\\nbit-and-not(0b0011, 0b0110)',\n 'let { bit-and-not } = import(\"bitwise\");\\nbit-and-not(0b0011, 0b0110, 0b1001)',\n ],\n },\n },\n 'bit-flip': {\n evaluate: ([num, index], sourceCodeInfo): number => {\n assertNumber(num, sourceCodeInfo, { integer: true })\n assertNumber(index, sourceCodeInfo, { integer: true, nonNegative: true })\n\n const mask = 1 << index\n return (num ^= mask)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'bitwise',\n returns: { type: 'integer' },\n args: { ...getOperatorArgs('integer', 'integer') },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Flips bit number $b.',\n seeAlso: ['bitwise.bit-set', 'bitwise.bit-clear', 'bitwise.bit-test'],\n examples: [\n 'let { bit-flip } = import(\"bitwise\");\\n0b0011 bit-flip 1',\n 'let { bit-flip } = import(\"bitwise\");\\nbit-flip(0b0011, 1)',\n 'let { bit-flip } = import(\"bitwise\");\\nbit-flip(0b1100, 1)',\n ],\n },\n },\n 'bit-set': {\n evaluate: ([num, index], sourceCodeInfo): number => {\n assertNumber(num, sourceCodeInfo, { integer: true })\n assertNumber(index, sourceCodeInfo, { integer: true, nonNegative: true })\n\n const mask = 1 << index\n return (num |= mask)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'bitwise',\n returns: { type: 'integer' },\n args: { ...getOperatorArgs('integer', 'integer') },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Sets bit number $b.',\n seeAlso: ['bitwise.bit-flip', 'bitwise.bit-clear', 'bitwise.bit-test'],\n examples: [\n 'let { bit-set } = import(\"bitwise\");\\n0b0010 bit-set 1',\n 'let { bit-set } = import(\"bitwise\");\\nbit-set(0b0011, 1)',\n 'let { bit-set } = import(\"bitwise\");\\nbit-set(0b1100, 1)',\n ],\n },\n },\n 'bit-clear': {\n evaluate: ([num, index], sourceCodeInfo): number => {\n assertNumber(num, sourceCodeInfo, { integer: true })\n assertNumber(index, sourceCodeInfo, { integer: true, nonNegative: true })\n\n const mask = 1 << index\n return (num &= ~mask)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'bitwise',\n returns: { type: 'integer' },\n args: { ...getOperatorArgs('integer', 'integer') },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Clears bit number $b.',\n seeAlso: ['bitwise.bit-flip', 'bitwise.bit-set', 'bitwise.bit-test'],\n examples: [\n 'let { bit-clear } = import(\"bitwise\");\\n0b0011 bit-clear 1',\n 'let { bit-clear } = import(\"bitwise\");\\nbit-clear(0b0011, 1)',\n 'let { bit-clear } = import(\"bitwise\");\\nbit-clear(0b1100, 1)',\n ],\n },\n },\n 'bit-test': {\n evaluate: ([num, index], sourceCodeInfo): boolean => {\n assertNumber(num, sourceCodeInfo, { integer: true })\n assertNumber(index, sourceCodeInfo, { integer: true, nonNegative: true })\n\n const mask = 1 << index\n return !!(num & mask)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'bitwise',\n returns: { type: 'boolean' },\n args: { ...getOperatorArgs('integer', 'integer') },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Checks if bit number $b is set.',\n seeAlso: ['bitwise.bit-flip', 'bitwise.bit-set', 'bitwise.bit-clear'],\n examples: [\n 'let { bit-test } = import(\"bitwise\");\\n0b0011 bit-test 1',\n 'let { bit-test } = import(\"bitwise\");\\nbit-test(0b0011, 1)',\n 'let { bit-test } = import(\"bitwise\");\\nbit-test(0b1100, 1)',\n ],\n },\n },\n}\n\nexport const bitwiseUtilsModule: LitsModule = {\n name: 'bitwise',\n functions: bitwiseUtilsNormalExpression,\n}\n","import type { DatatypeName } from './api'\nimport type { DatatypeReference } from '.'\n\nexport const datatype: Record<DatatypeName, DatatypeReference> = {\n '-type-number': {\n datatype: true,\n title: 'number',\n category: 'datatype',\n description: 'A `number`',\n examples: [\n '42',\n '3.14',\n ],\n },\n '-type-string': {\n datatype: true,\n title: 'string',\n category: 'datatype',\n description: 'A `string`',\n examples: [\n '\"hello\"',\n '\"\"',\n ],\n },\n '-type-object': {\n datatype: true,\n title: 'object',\n category: 'datatype',\n description: 'An `object`, a collection of key-value pairs where keys are `strings`',\n examples: [\n '{}',\n '{ a: 1, b: 2}',\n ],\n },\n '-type-array': {\n datatype: true,\n title: 'array',\n category: 'datatype',\n description: 'An `array`',\n examples: [\n '[]',\n '[1, 2, 3]',\n '[\"a\", null, true]',\n ],\n },\n '-type-vector': {\n datatype: true,\n title: 'vector',\n category: 'datatype',\n description: 'An `array` of `numbers`',\n examples: [\n '[]',\n '[1, 2, 3]',\n ],\n },\n '-type-matrix': {\n datatype: true,\n title: 'matrix',\n category: 'datatype',\n description: 'A `matrix`, a two-dimensional `array` with `numbers` where each row has the same number of columns. A `matrix` is also a `grid`.',\n examples: [\n '[[]]',\n '[[1, 2], [3, 4]]',\n '[[1, 2], [3, 4], [5, 6]]',\n ],\n },\n '-type-grid': {\n datatype: true,\n title: 'grid',\n category: 'datatype',\n description: 'A `grid`, a two-dimensional `array` where each row has the same number of columns',\n examples: [\n '[[]]',\n '[[1, 2], [3, 4]]',\n '[[\"a\", \"b\"], [3, 4], [5, 6]]',\n ],\n },\n '-type-boolean': {\n datatype: true,\n title: 'boolean',\n category: 'datatype',\n description: 'A `boolean`',\n examples: [\n 'true',\n 'false',\n ],\n },\n '-type-function': {\n datatype: true,\n title: 'function',\n category: 'datatype',\n description: 'A `function`',\n examples: [\n 'x -> x + 1',\n '(a, b, c) -> (a + b) * c',\n '() -> 42',\n '-> $1 + $2',\n ],\n },\n '-type-integer': {\n datatype: true,\n title: 'integer',\n category: 'datatype',\n description: 'An `integer`',\n examples: [\n '42',\n '-42',\n ],\n },\n '-type-any': {\n datatype: true,\n title: 'any',\n category: 'datatype',\n description: '`Any` value',\n examples: [\n '42',\n '\"hello\"',\n 'true',\n 'null',\n ],\n },\n '-type-null': {\n datatype: true,\n title: 'null',\n category: 'datatype',\n description: 'The value `null`',\n examples: [\n 'null',\n ],\n },\n '-type-collection': {\n datatype: true,\n title: 'collection',\n category: 'datatype',\n description: 'A collection, an `object`, an `array` or a `string`',\n examples: [\n '{ foo: 42 }',\n '[1, 2, 3]',\n '\"hello\"',\n ],\n },\n '-type-sequence': {\n datatype: true,\n title: 'sequence',\n category: 'datatype',\n description: 'A sequence, an `array` or a `string`',\n examples: [\n '[1, 2, 3]',\n '\"hello\"',\n ],\n },\n '-type-regexp': {\n datatype: true,\n title: 'regexp',\n category: 'datatype',\n description: 'A regular expression',\n examples: [\n 'regexp(\"^\\\\\\\\s*(.*)$\")',\n '#\"albert\"ig',\n ],\n },\n '-type-never': {\n datatype: true,\n title: 'never',\n category: 'datatype',\n description: 'A value that can never be created',\n examples: [`\n// throw(\"error\") will never return a value\ntry throw(\"error\") catch \"never\" end`,\n ],\n },\n}\n","import type { ShorthandName } from './api'\nimport type { ShorthandReference } from '.'\n\nexport const shorthand: Record<ShorthandName, ShorthandReference> = {\n '-short-regexp': {\n shorthand: true,\n title: '#\"pattern\"',\n category: 'shorthand',\n description: 'Shorthand for `regexp(pattern)`. Only difference is that escaping is not needed.',\n examples: [\n '#\"^\\\\s*(.*)$\"',\n '#\"albert\"ig',\n ],\n seeAlso: ['regexp', 'match', 'replace', 'replace-all'],\n },\n '-short-fn': {\n shorthand: true,\n title: '-> expression',\n category: 'shorthand',\n description: `\nShorthand for \\`(args, ...) -> expression\\`.\n\\`$1, $2, $3, ...\\` are shorthand for the first, second, third, ... argument.\n\nYou can reference the first argument using either \\`$1\\` or \\`$\\`.\nHowever, please note that \\`$1\\` and \\`$\\` are mutually exclusive and cannot be used simultaneously.\nE.g. \\`#(* $ $1)\\` is not valid.`,\n examples: [\n '-> $1 + $2',\n '(-> $ * $)(9)',\n ],\n },\n}\n","import type { SpecialExpressionName } from '../src/builtin'\nimport { specialExpressions } from '../src/builtin'\nimport { normalExpressions } from '../src/builtin/normalExpressions'\nimport { specialExpressionTypes } from '../src/builtin/specialExpressionTypes'\nimport { isSymbolicOperator } from '../src/tokenizer/operators'\nimport { canBeOperator } from '../src/utils/arity'\nimport type { BuiltinNormalExpressions, FunctionDocs, SpecialExpressionDocs } from '../src/builtin/interface'\nimport { isFunctionDocs } from '../src/builtin/interface'\n\n// Core categories — all derive reference from co-located docs\nimport { bitwiseNormalExpression } from '../src/builtin/core/bitwise'\nimport { arrayNormalExpression } from '../src/builtin/core/array'\nimport { collectionNormalExpression } from '../src/builtin/core/collection'\nimport { functionalNormalExpression } from '../src/builtin/core/functional'\nimport { mathNormalExpression } from '../src/builtin/core/math'\nimport { getMetaNormalExpression } from '../src/builtin/core/meta'\nimport { miscNormalExpression } from '../src/builtin/core/misc'\nimport { objectNormalExpression } from '../src/builtin/core/object'\nimport { predicatesNormalExpression } from '../src/builtin/core/predicates'\nimport { regexpNormalExpression } from '../src/builtin/core/regexp'\nimport { sequenceNormalExpression } from '../src/builtin/core/sequence'\nimport { stringNormalExpression } from '../src/builtin/core/string'\nimport { vectorNormalExpression } from '../src/builtin/core/vector'\n\n// Module categories — derive reference from co-located docs\nimport { assertModule } from '../src/builtin/modules/assert'\nimport { gridModule } from '../src/builtin/modules/grid'\nimport { randomModule } from '../src/builtin/modules/random'\nimport { vectorModule } from '../src/builtin/modules/vector'\nimport { linearAlgebraModule } from '../src/builtin/modules/linear-algebra'\nimport { matrixModule } from '../src/builtin/modules/matrix'\nimport { numberTheoryModule } from '../src/builtin/modules/number-theory'\nimport { stringUtilsModule } from '../src/builtin/modules/string'\nimport { collectionUtilsModule } from '../src/builtin/modules/collection'\nimport { sequenceUtilsModule } from '../src/builtin/modules/sequence'\nimport { mathUtilsModule } from '../src/builtin/modules/math'\nimport { functionalUtilsModule } from '../src/builtin/modules/functional'\nimport { bitwiseUtilsModule } from '../src/builtin/modules/bitwise'\nimport type { ApiName, ArrayApiName, BitwiseApiName, Category, CollectionApiName, CoreApiName, CoreNormalExpressionName, DataType, FunctionalApiName, MathApiName, MetaApiName, MiscApiName, ModuleExpressionName, ObjectApiName, PredicateApiName, RegularExpressionApiName, SequenceApiName, StringApiName, VectorApiName } from './api'\nimport { datatype } from './datatype'\nimport { shorthand } from './shorthand'\n\n// --- Helper: derive FunctionReference from co-located docs ---\n\nfunction docsToReference(expressions: BuiltinNormalExpressions): Record<string, FunctionReference> {\n const result: Record<string, FunctionReference> = {}\n for (const [key, expr] of Object.entries(expressions)) {\n const docs: FunctionDocs | undefined = expr.docs\n if (!docs) {\n throw new Error(`Missing docs for expression \"${key}\"`)\n }\n result[key] = {\n title: key,\n category: docs.category,\n description: docs.description,\n returns: docs.returns,\n args: docs.args,\n variants: docs.variants,\n examples: docs.examples,\n ...(docs.seeAlso ? { seeAlso: docs.seeAlso as ApiName[] } : {}),\n ...(docs.hideOperatorForm ? { noOperatorDocumentation: true } : {}),\n }\n }\n return result\n}\n\n// --- Helper: derive FunctionReference from module co-located docs ---\n\nfunction moduledDocsToReference(moduleName: string, expressions: BuiltinNormalExpressions): Record<string, FunctionReference> {\n const result: Record<string, FunctionReference> = {}\n for (const [key, expr] of Object.entries(expressions)) {\n const docs: FunctionDocs | undefined = expr.docs\n if (!docs) {\n throw new Error(`Missing docs for ${moduleName}.${key}`)\n }\n const qualifiedKey = `${moduleName}.${key}`\n result[qualifiedKey] = {\n title: qualifiedKey,\n category: docs.category,\n description: docs.description,\n returns: docs.returns,\n args: docs.args,\n variants: docs.variants,\n examples: docs.examples,\n ...(docs.seeAlso ? { seeAlso: docs.seeAlso as ApiName[] } : {}),\n ...(docs.hideOperatorForm ? { noOperatorDocumentation: true } : {}),\n }\n }\n return result\n}\n\n// Derive all core category references from co-located docs\nconst bitwiseReference = docsToReference(bitwiseNormalExpression) as Record<BitwiseApiName, FunctionReference<'bitwise'>>\nconst arrayRef = docsToReference(arrayNormalExpression) as Record<ArrayApiName, FunctionReference<'array'>>\nconst collectionRef = docsToReference(collectionNormalExpression) as Record<CollectionApiName, FunctionReference<'collection'>>\nconst functionalRef = docsToReference(functionalNormalExpression) as Record<FunctionalApiName, FunctionReference<'functional'>>\nconst mathRef = docsToReference(mathNormalExpression) as Record<MathApiName, FunctionReference<'math'>>\nconst emptyRef: Record<string, FunctionReference> = {}\nconst metaRef = docsToReference(getMetaNormalExpression(emptyRef)) as Record<MetaApiName, FunctionReference<'meta'>>\nconst miscRef = docsToReference(miscNormalExpression) as Record<MiscApiName, FunctionReference<'misc'>>\nconst objectRef = docsToReference(objectNormalExpression) as Record<ObjectApiName, FunctionReference<'object'>>\nconst predicatesRef = docsToReference(predicatesNormalExpression) as Record<PredicateApiName, FunctionReference<'predicate'>>\nconst regexpRef = docsToReference(regexpNormalExpression) as Record<RegularExpressionApiName, FunctionReference<'regular-expression'>>\nconst sequenceRef = docsToReference(sequenceNormalExpression) as Record<SequenceApiName, FunctionReference<'sequence'>>\nconst stringRef = docsToReference(stringNormalExpression) as Record<StringApiName, FunctionReference<'string'>>\nconst vectorRef = docsToReference(vectorNormalExpression) as Record<VectorApiName, FunctionReference<'vector'>>\n\n// --- Helper: derive special expression reference from co-located docs ---\n\nfunction specialExpressionDocsToReference(): Record<string, FunctionReference<'special-expression'> | CustomReference<'special-expression'>> {\n const result: Record<string, FunctionReference<'special-expression'> | CustomReference<'special-expression'>> = {}\n for (const [name, index] of Object.entries(specialExpressionTypes)) {\n const expr = specialExpressions[index]\n const docs: SpecialExpressionDocs | undefined = expr?.docs\n if (!docs) {\n continue // skip undocumented special expressions\n }\n if (isFunctionDocs(docs)) {\n result[name] = {\n title: name,\n category: docs.category as 'special-expression',\n description: docs.description,\n returns: docs.returns,\n args: docs.args,\n variants: docs.variants,\n examples: docs.examples,\n ...(docs.seeAlso ? { seeAlso: docs.seeAlso as ApiName[] } : {}),\n ...(docs.hideOperatorForm ? { noOperatorDocumentation: true } : {}),\n }\n }\n else {\n result[name] = {\n title: name,\n category: docs.category as 'special-expression',\n description: docs.description,\n customVariants: docs.customVariants,\n ...(docs.details ? { details: docs.details } : {}),\n ...(docs.returns ? { returns: docs.returns } : {}),\n examples: docs.examples,\n ...(docs.seeAlso ? { seeAlso: docs.seeAlso as ApiName[] } : {}),\n }\n }\n }\n return result\n}\n\nconst specialExpressionsReference = specialExpressionDocsToReference()\n\nexport interface TypedValue {\n type: DataType[] | DataType\n rest?: true\n array?: true\n}\n\nexport type NormalExpressionArgument = TypedValue & {\n description?: string\n}\n\nexport type Argument = NormalExpressionArgument\n\ninterface Variant {\n argumentNames: string[]\n}\n\nexport interface CommonReference<T extends Category> {\n title: string\n category: T\n examples: string[]\n description: string\n seeAlso?: ApiName[]\n}\nexport type FunctionReference<T extends Category = Category> = CommonReference<T> & {\n returns: TypedValue\n args: Record<string, Argument>\n variants: Variant[]\n noOperatorDocumentation?: true\n _isOperator?: boolean\n _prefereOperator?: boolean\n}\n\nexport type CustomReference<T extends Category = Category> = CommonReference<T> & {\n customVariants: string[]\n details?: [string, string, string | undefined][]\n}\n\nexport interface ShorthandReference extends CommonReference<'shorthand'> {\n shorthand: true\n}\n\nexport interface DatatypeReference extends CommonReference<'datatype'> {\n datatype: true\n}\n\nexport type Reference<T extends Category = Category> = FunctionReference<T> | CustomReference<T> | ShorthandReference | DatatypeReference\n\nexport function isFunctionReference<T extends Category>(ref: Reference<T>): ref is FunctionReference<T> {\n return 'returns' in ref && 'args' in ref && 'variants' in ref\n}\n\nexport function isCustomReference<T extends Category>(ref: Reference<T>): ref is CustomReference<T> {\n return 'customVariants' in ref\n}\n\nexport function isShorthandReference<T extends Category>(ref: Reference<T>): ref is ShorthandReference {\n return 'shorthand' in ref\n}\n\nexport function isDatatypeReference<T extends Category>(ref: Reference<T>): ref is DatatypeReference {\n return 'datatype' in ref\n}\n\nexport const normalExpressionReference: Record<CoreNormalExpressionName, FunctionReference> = {\n // Core categories — all derived from co-located docs\n ...bitwiseReference,\n ...collectionRef,\n ...arrayRef,\n ...sequenceRef,\n ...mathRef,\n ...functionalRef,\n ...metaRef,\n ...miscRef,\n ...objectRef,\n ...predicatesRef,\n ...regexpRef,\n ...stringRef,\n ...vectorRef,\n}\n\n// Module functions — all derived from co-located docs\n// eslint-disable-next-line ts/consistent-type-assertions\nexport const moduleReference: Record<ModuleExpressionName, FunctionReference> = {\n ...moduledDocsToReference(assertModule.name, assertModule.functions),\n ...moduledDocsToReference(gridModule.name, gridModule.functions),\n ...moduledDocsToReference(randomModule.name, randomModule.functions),\n ...moduledDocsToReference(vectorModule.name, vectorModule.functions),\n ...moduledDocsToReference(linearAlgebraModule.name, linearAlgebraModule.functions),\n ...moduledDocsToReference(matrixModule.name, matrixModule.functions),\n ...moduledDocsToReference(numberTheoryModule.name, numberTheoryModule.functions),\n ...moduledDocsToReference(stringUtilsModule.name, stringUtilsModule.functions),\n ...moduledDocsToReference(collectionUtilsModule.name, collectionUtilsModule.functions),\n ...moduledDocsToReference(sequenceUtilsModule.name, sequenceUtilsModule.functions),\n ...moduledDocsToReference(mathUtilsModule.name, mathUtilsModule.functions),\n ...moduledDocsToReference(functionalUtilsModule.name, functionalUtilsModule.functions),\n ...moduledDocsToReference(bitwiseUtilsModule.name, bitwiseUtilsModule.functions),\n} as Record<ModuleExpressionName, FunctionReference>\n\nObject.entries(normalExpressionReference).forEach(([key, obj]) => {\n if (!normalExpressions[key]) {\n throw new Error(`Missing normal expression ${key} in normalExpressions`)\n }\n const arity = normalExpressions[key].arity\n if (!obj.noOperatorDocumentation && canBeOperator(arity)) {\n obj._isOperator = true\n if (isSymbolicOperator(key)) {\n obj._prefereOperator = true\n }\n }\n})\n\nObject.entries(specialExpressionsReference).forEach(([key, obj]) => {\n if (isFunctionReference(obj)) {\n const arity = specialExpressions[specialExpressionTypes[key as SpecialExpressionName]]?.arity\n if (arity && canBeOperator(arity)) {\n obj._isOperator = true\n }\n }\n})\n\nexport const functionReference = {\n ...normalExpressionReference,\n ...specialExpressionsReference,\n}\n\n// Core API reference (always available)\nexport const apiReference: Record<CoreApiName, Reference> = sortByCategory({ ...functionReference, ...shorthand, ...datatype })\n\n// All references including modules (for search and full documentation)\nexport const allReference: Record<ApiName, Reference> = sortByCategory({ ...apiReference, ...moduleReference })\n\nObject.values(allReference).forEach((ref) => {\n ref.title = ref.title.replace(/\"/g, '&quot;')\n})\n\nfunction sortByCategory<T extends Record<string, Reference>>(ref: T): T {\n return Object.fromEntries(\n Object.entries(ref).sort(([keyA, refA], [keyB, refB]) => {\n const catA = refA.category === 'special-expression' ? '' : refA.category\n const catB = refB.category === 'special-expression' ? '' : refB.category\n if (catA !== catB) {\n return catA.localeCompare(catB)\n }\n return keyA.localeCompare(keyB)\n }),\n ) as T\n}\n\nexport function getLinkName(reference: Reference): string {\n return encodeURIComponent(`${reference.category}-${reference.title}`)\n}\n","/**\n * Side-effect import: wires up reference data for the `doc` builtin function.\n * Import this module before using `doc()` on built-in functions.\n *\n * In the full entry point (src/full.ts), this is done automatically.\n * In the minimal entry point (src/index.ts), `doc()` returns '' for builtins.\n */\nimport { normalExpressionReference } from '../reference/index'\nimport { setNormalExpressionReference } from './builtin/normalExpressions'\n\nsetNormalExpressionReference(normalExpressionReference)\n","import type { Builtin } from '../builtin/interface'\nimport type { DoNode } from '../builtin/specialExpressions/block'\nimport { specialExpressionTypes } from '../builtin/specialExpressionTypes'\nimport { NodeTypes } from '../constants/constants'\nimport { LitsError } from '../errors'\nimport type { ContextStack } from '../evaluator/ContextStack'\nimport type { EvaluateNode } from '../evaluator/interface'\nimport type { Ast, Node, NormalExpressionNode, SpecialExpressionNode, SpreadNode, UserDefinedSymbolNode } from '../parser/types'\nimport { isNormalExpressionNodeWithName, isUserDefinedSymbolNode } from '../typeGuards/astNode'\n\nexport type UndefinedSymbols = Set<string>\n\nexport const getUndefinedSymbols: GetUndefinedSymbols = (ast, contextStack, builtin, evaluateNode) => {\n const nodes: Node[] = Array.isArray(ast)\n ? ast\n : [[NodeTypes.SpecialExpression, [specialExpressionTypes.block, ast.body]] satisfies DoNode]\n\n const unresolvedSymbols = new Set<string>()\n\n for (const subNode of nodes) {\n findUnresolvedSymbolsInNode(subNode, contextStack, builtin, evaluateNode)\n ?.forEach(symbol => unresolvedSymbols.add(symbol))\n }\n return unresolvedSymbols\n}\n\nexport type GetUndefinedSymbols = (ast: Ast | Node[], contextStack: ContextStack, builtin: Builtin, evaluateNode: EvaluateNode) => UndefinedSymbols\n\nfunction findUnresolvedSymbolsInNode(node: Node, contextStack: ContextStack, builtin: Builtin, evaluateNode: EvaluateNode): UndefinedSymbols | null {\n const nodeType = node[0]\n switch (nodeType) {\n case NodeTypes.UserDefinedSymbol: {\n const symbolNode = node as UserDefinedSymbolNode\n const lookUpResult = contextStack.lookUp(symbolNode)\n if (lookUpResult === null)\n return new Set([symbolNode[1]])\n\n return null\n }\n case NodeTypes.NormalBuiltinSymbol:\n case NodeTypes.SpecialBuiltinSymbol:\n case NodeTypes.String:\n case NodeTypes.Number:\n case NodeTypes.ReservedSymbol:\n case NodeTypes.Binding:\n return null\n case NodeTypes.NormalExpression: {\n const normalExpressionNode = node as NormalExpressionNode\n const unresolvedSymbols = new Set<string>()\n if (isNormalExpressionNodeWithName(normalExpressionNode)) {\n const [, [symbolNode]] = normalExpressionNode\n if (isUserDefinedSymbolNode(symbolNode)) {\n const lookUpResult = contextStack.lookUp(symbolNode)\n if (lookUpResult === null)\n unresolvedSymbols.add(symbolNode[1])\n }\n }\n else {\n const [, [expressionNode]] = normalExpressionNode\n findUnresolvedSymbolsInNode(expressionNode, contextStack, builtin, evaluateNode)?.forEach(symbol => unresolvedSymbols.add(symbol))\n }\n for (const subNode of normalExpressionNode[1][1]) {\n findUnresolvedSymbolsInNode(subNode, contextStack, builtin, evaluateNode)?.forEach(symbol => unresolvedSymbols.add(symbol))\n }\n return unresolvedSymbols\n }\n case NodeTypes.SpecialExpression: {\n const specialExpressionNode = node as SpecialExpressionNode\n const specialExpressionType = specialExpressionNode[1][0]\n const specialExpression = builtin.specialExpressions[specialExpressionType]\n\n const castedGetUndefinedSymbols = specialExpression.getUndefinedSymbols as Function\n\n return castedGetUndefinedSymbols(specialExpressionNode, contextStack, {\n getUndefinedSymbols,\n builtin,\n evaluateNode,\n }) as UndefinedSymbols\n }\n case NodeTypes.Spread:\n return findUnresolvedSymbolsInNode((node as SpreadNode)[1], contextStack, builtin, evaluateNode)\n\n /* v8 ignore next 2 */\n default:\n throw new LitsError(`Unhandled node type: ${nodeType satisfies never}`, node[2])\n }\n}\n","import type { Any } from '../interface'\n\nconst nonNumberReservedSymbolRecord = {\n true: true,\n false: false,\n null: null,\n do: null,\n else: null,\n case: null,\n each: null,\n in: null,\n when: null,\n while: null,\n catch: null,\n function: null,\n export: null,\n as: null,\n then: null,\n end: null,\n _: null,\n} as const satisfies Record<string, Any>\n\nconst phi = (1 + Math.sqrt(5)) / 2\nexport const numberReservedSymbolRecord = {\n 'E': Math.E,\n '-E': -Math.E,\n 'ε': Math.E,\n '-ε': -Math.E,\n 'PI': Math.PI,\n '-PI': -Math.PI,\n 'π': Math.PI,\n '-π': -Math.PI,\n 'PHI': phi,\n '-PHI': -phi,\n 'φ': phi,\n '-φ': -phi,\n 'POSITIVE_INFINITY': Number.POSITIVE_INFINITY,\n '∞': Number.POSITIVE_INFINITY,\n 'NEGATIVE_INFINITY': Number.NEGATIVE_INFINITY,\n '-∞': Number.NEGATIVE_INFINITY,\n 'MAX_SAFE_INTEGER': Number.MAX_SAFE_INTEGER,\n 'MIN_SAFE_INTEGER': Number.MIN_SAFE_INTEGER,\n 'MAX_VALUE': Number.MAX_VALUE,\n 'MIN_VALUE': Number.MIN_VALUE,\n 'NaN': Number.NaN,\n} as const satisfies Record<string, number>\n\nexport const reservedSymbolRecord = {\n ...nonNumberReservedSymbolRecord,\n ...numberReservedSymbolRecord,\n} as const\n\nexport type ReservedSymbol = keyof typeof reservedSymbolRecord\n\nexport function isReservedSymbol(symbol: string): symbol is keyof typeof reservedSymbolRecord {\n return symbol in reservedSymbolRecord\n}\n\nexport function isNumberReservedSymbol(symbol: string): symbol is keyof typeof numberReservedSymbolRecord {\n return symbol in numberReservedSymbolRecord\n}\n","import { specialExpressions } from '../builtin'\nimport { evaluateBindingNodeValues } from '../builtin/bindingNode'\nimport { allNormalExpressions } from '../builtin/normalExpressions'\nimport { LitsError, RecurSignal } from '../errors'\nimport { arityAcceptsMin, assertNumberOfParams } from '../utils/arity'\nimport type { Any, Arr } from '../interface'\nimport type {\n CompFunction,\n ComplementFunction,\n ConstantlyFunction,\n EveryPredFunction,\n FNullFunction,\n JuxtFunction,\n LitsFunctionType,\n ModuleFunction,\n NativeJsFunction,\n NormalBuiltinFunction,\n PartialFunction,\n SomePredFunction,\n SpecialBuiltinFunction,\n UserDefinedFunction,\n} from '../parser/types'\nimport { bindingTargetTypes } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { asNonUndefined, isUnknownRecord } from '../typeGuards'\nimport { asAny, asFunctionLike } from '../typeGuards/lits'\nimport { toAny } from '../utils'\nimport { valueToString } from '../utils/debug/debugTools'\nimport type { ContextStack } from './ContextStack'\nimport type { Context, EvaluateNode, ExecuteFunction } from './interface'\n\ntype FunctionExecutors = Record<LitsFunctionType, (\n fn: any,\n params: Arr,\n sourceCodeInfo: SourceCodeInfo | undefined,\n contextStack: ContextStack,\n helpers: { evaluateNode: EvaluateNode, executeFunction: ExecuteFunction },\n) => Any>\n\nexport const functionExecutors: FunctionExecutors = {\n NativeJsFunction: (fn: NativeJsFunction, params, sourceCodeInfo) => {\n try {\n return toAny(fn.nativeFn.fn(...params))\n }\n catch (error) {\n const message\n = typeof error === 'string'\n ? error\n : isUnknownRecord(error) && typeof error.message === 'string'\n ? error.message\n : '<no message>'\n throw new LitsError(`Native function threw: \"${message}\"`, sourceCodeInfo)\n }\n },\n UserDefined: (fn: UserDefinedFunction, params, sourceCodeInfo, contextStack, { evaluateNode }) => {\n for (;;) {\n if (!arityAcceptsMin(fn.arity, params.length)) {\n throw new LitsError(`Expected ${fn.arity} arguments, got ${params.length}.`, sourceCodeInfo)\n }\n const evaluatedFunction = fn.evaluatedfunction\n const args = evaluatedFunction[0]\n const nbrOfNonRestArgs: number = args.filter(arg => arg[0] !== bindingTargetTypes.rest).length\n\n const newContextStack = contextStack.create(fn.evaluatedfunction[2])\n const newContext: Context = { self: { value: fn } }\n\n const rest: Arr = []\n for (let i = 0; i < params.length; i += 1) {\n if (i < nbrOfNonRestArgs) {\n const param = toAny(params[i])\n const valueRecord = evaluateBindingNodeValues(args[i]!, param, node =>\n evaluateNode(node, newContextStack.create(newContext)))\n Object.entries(valueRecord).forEach(([key, value]) => {\n newContext[key] = { value }\n })\n }\n else {\n rest.push(toAny(params[i]))\n }\n }\n\n for (let i = params.length; i < nbrOfNonRestArgs; i++) {\n const arg = args[i]!\n const defaultValue = evaluateNode(arg[1][1]!, contextStack.create(newContext))\n const valueRecord = evaluateBindingNodeValues(arg, defaultValue, node =>\n evaluateNode(node, contextStack.create(newContext)))\n Object.entries(valueRecord).forEach(([key, value]) => {\n newContext[key] = { value }\n })\n }\n\n const restArgument = args.find(arg => arg[0] === bindingTargetTypes.rest)\n if (restArgument !== undefined) {\n const valueRecord = evaluateBindingNodeValues(restArgument, rest, node => evaluateNode(node, contextStack.create(newContext)))\n Object.entries(valueRecord).forEach(([key, value]) => {\n newContext[key] = { value }\n })\n }\n\n try {\n let result: Any = null\n const newContextStack2 = newContextStack.create(newContext)\n for (const node of evaluatedFunction[1]) {\n result = evaluateNode(node, newContextStack2)\n }\n\n return result\n }\n catch (error) {\n if (error instanceof RecurSignal) {\n params = error.params\n continue\n }\n throw error\n }\n }\n },\n Partial: (fn: PartialFunction, params, sourceCodeInfo, contextStack, { executeFunction }) => {\n const actualParams = [...fn.params]\n if (params.length !== fn.placeholders.length) {\n throw new LitsError(`(partial) expects ${fn.placeholders.length} arguments, got ${params.length}.`, sourceCodeInfo)\n }\n const paramsCopy = [...params]\n for (const placeholderIndex of fn.placeholders) {\n actualParams.splice(placeholderIndex, 0, paramsCopy.shift())\n }\n return executeFunction(fn.function, actualParams, contextStack, sourceCodeInfo)\n },\n Comp: (fn: CompFunction, params, sourceCodeInfo, contextStack, { executeFunction }) => {\n const { params: f } = fn\n if (f.length === 0) {\n if (params.length !== 1)\n throw new LitsError(`(comp) expects one argument, got ${valueToString(params.length)}.`, sourceCodeInfo)\n\n return asAny(params[0], sourceCodeInfo)\n }\n return asAny(\n f.reduceRight((result: Arr, fun) => {\n return [executeFunction(asFunctionLike(fun, sourceCodeInfo), result, contextStack, sourceCodeInfo)]\n }, params)[0],\n sourceCodeInfo,\n )\n },\n Constantly: (fn: ConstantlyFunction) => {\n return fn.value\n },\n Juxt: (fn: JuxtFunction, params, sourceCodeInfo, contextStack, { executeFunction }) => {\n return fn.params.map(fun => executeFunction(asFunctionLike(fun, sourceCodeInfo), params, contextStack, sourceCodeInfo))\n },\n Complement: (fn: ComplementFunction, params, sourceCodeInfo, contextStack, { executeFunction }) => {\n return !executeFunction(fn.function, params, contextStack, sourceCodeInfo)\n },\n EveryPred: (fn: EveryPredFunction, params, sourceCodeInfo, contextStack, { executeFunction }) => {\n for (const f of fn.params) {\n for (const param of params) {\n const result = executeFunction(asFunctionLike(f, sourceCodeInfo), [param], contextStack, sourceCodeInfo)\n if (!result)\n return false\n }\n }\n return true\n },\n SomePred: (fn: SomePredFunction, params, sourceCodeInfo, contextStack, { executeFunction }) => {\n for (const f of fn.params) {\n for (const param of params) {\n const result = executeFunction(asFunctionLike(f, sourceCodeInfo), [param], contextStack, sourceCodeInfo)\n if (result)\n return true\n }\n }\n return false\n },\n Fnull: (fn: FNullFunction, params, sourceCodeInfo, contextStack, { executeFunction }) => {\n const fnulledParams = params.map((param, index) => (param === null ? toAny(fn.params[index]) : param))\n return executeFunction(asFunctionLike(fn.function, sourceCodeInfo), fnulledParams, contextStack, sourceCodeInfo)\n },\n Builtin: (fn: NormalBuiltinFunction, params, sourceCodeInfo, contextStack, { executeFunction }) => {\n const normalExpression = asNonUndefined(allNormalExpressions[fn.normalBuiltinSymbolType], sourceCodeInfo)\n return normalExpression.evaluate(params, sourceCodeInfo, contextStack, { executeFunction })\n },\n SpecialBuiltin: (fn: SpecialBuiltinFunction, params, sourceCodeInfo, contextStack, { executeFunction }) => {\n const specialExpression = asNonUndefined(specialExpressions[fn.specialBuiltinSymbolType], sourceCodeInfo)\n if (specialExpression.evaluateAsNormalExpression) {\n return specialExpression.evaluateAsNormalExpression(params, sourceCodeInfo, contextStack, { executeFunction })\n }\n else {\n throw new LitsError(`Special builtin function ${fn.specialBuiltinSymbolType} is not supported as normal expression.`, sourceCodeInfo)\n }\n },\n Module: (fn: ModuleFunction, params, sourceCodeInfo, contextStack, { executeFunction }) => {\n const module = contextStack.getModule(fn.moduleName)\n if (!module) {\n throw new LitsError(`Module '${fn.moduleName}' not found.`, sourceCodeInfo)\n }\n const expression = module.functions[fn.functionName]\n if (!expression) {\n throw new LitsError(`Function '${fn.functionName}' not found in module '${fn.moduleName}'.`, sourceCodeInfo)\n }\n assertNumberOfParams(expression.arity, params.length, sourceCodeInfo)\n return expression.evaluate(params, sourceCodeInfo, contextStack, { executeFunction })\n },\n}\n","import type { SpecialExpression } from '../builtin'\nimport { builtin } from '../builtin'\nimport { NodeTypes, getNodeTypeName } from '../constants/constants'\nimport { LitsError, UndefinedSymbolError } from '../errors'\nimport { getUndefinedSymbols } from '../getUndefinedSymbols'\nimport type { Any, Arr, Obj } from '../interface'\nimport type {\n Ast,\n FunctionLike,\n Node,\n NormalExpressionNode,\n NumberNode,\n PartialFunction,\n ReservedSymbolNode,\n SpecialExpressionNode,\n StringNode,\n SymbolNode,\n} from '../parser/types'\nimport { reservedSymbolRecord } from '../tokenizer/reservedNames'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { asNonUndefined } from '../typeGuards'\nimport { annotate } from '../typeGuards/annotatedArrays'\nimport { isNormalBuiltinSymbolNode, isNormalExpressionNodeWithName, isSpreadNode } from '../typeGuards/astNode'\nimport { asFunctionLike, assertSeq, isObj } from '../typeGuards/lits'\nimport { isLitsFunction } from '../typeGuards/litsFunction'\nimport { assertNumber, isNumber } from '../typeGuards/number'\nimport { assertString } from '../typeGuards/string'\nimport { toAny } from '../utils'\nimport { valueToString } from '../utils/debug/debugTools'\nimport { toFixedArity } from '../utils/arity'\nimport { FUNCTION_SYMBOL } from '../utils/symbols'\nimport type { ContextStack } from './ContextStack'\nimport { functionExecutors } from './functionExecutors'\n\nexport function evaluate(ast: Ast, contextStack: ContextStack): Any {\n let result: Any = null\n\n for (const node of ast.body) {\n result = evaluateNode(node, contextStack)\n }\n\n return result\n}\n\nexport function evaluateNode(node: Node, contextStack: ContextStack): Any {\n switch (node[0]) {\n case NodeTypes.Number:\n return evaluateNumber(node as NumberNode)\n case NodeTypes.String:\n return evaluateString(node as StringNode)\n case NodeTypes.NormalBuiltinSymbol:\n case NodeTypes.SpecialBuiltinSymbol:\n case NodeTypes.UserDefinedSymbol:\n return contextStack.evaluateSymbol(node as SymbolNode)\n case NodeTypes.ReservedSymbol:\n return evaluateReservedSymbol(node as ReservedSymbolNode)\n case NodeTypes.NormalExpression: {\n const result = evaluateNormalExpression(node as NormalExpressionNode, contextStack)\n if (typeof result === 'number' && Number.isNaN(result)) {\n throw new LitsError('Number is NaN', node[2])\n }\n return annotate(result)\n }\n case NodeTypes.SpecialExpression:\n return annotate(evaluateSpecialExpression(node as SpecialExpressionNode, contextStack))\n /* v8 ignore next 2 */\n default:\n throw new LitsError(`${getNodeTypeName(node[0])}-node cannot be evaluated`, node[2])\n }\n}\n\nfunction evaluateNumber(node: NumberNode): number {\n return node[1]\n}\n\nfunction evaluateString(node: StringNode): string {\n return node[1]\n}\n\nfunction evaluateReservedSymbol(node: ReservedSymbolNode): Any {\n const reservedName = node[1]\n if (!['true', 'false', 'null'].includes(reservedName)) {\n throw new LitsError(`Reserved symbol ${reservedName} cannot be evaluated`, node[2])\n }\n const value = reservedSymbolRecord[reservedName]\n return asNonUndefined(value, node[2])\n}\n\nfunction evaluateNormalExpression(node: NormalExpressionNode, contextStack: ContextStack): Any {\n const sourceCodeInfo = node[2]\n const paramNodes: Node[] = node[1][1]\n const params: Arr = []\n const placeholders: number[] = []\n paramNodes.forEach((paramNode, index) => {\n if (isSpreadNode(paramNode)) {\n const spreadValue = evaluateNode(paramNode[1], contextStack)\n if (Array.isArray(spreadValue)) {\n params.push(...spreadValue)\n }\n else {\n throw new LitsError(`Spread operator requires an array, got ${valueToString(paramNode)}`, paramNode[2])\n }\n }\n else if (paramNode[0] === NodeTypes.ReservedSymbol && paramNode[1] === '_') {\n placeholders.push(index)\n }\n else {\n params.push(evaluateNode(paramNode, contextStack))\n }\n })\n if (isNormalExpressionNodeWithName(node)) {\n const nameSymbol = node[1][0]\n if (placeholders.length > 0) {\n const fn = evaluateNode(nameSymbol, contextStack)\n const partialFunction: PartialFunction = {\n [FUNCTION_SYMBOL]: true,\n function: asFunctionLike(fn, sourceCodeInfo),\n functionType: 'Partial',\n params,\n placeholders,\n sourceCodeInfo,\n arity: toFixedArity(placeholders.length),\n }\n return partialFunction\n }\n\n if (isNormalBuiltinSymbolNode(nameSymbol)) {\n const type = nameSymbol[1]\n const normalExpression = builtin.allNormalExpressions[type]!\n return normalExpression.evaluate(params, node[2], contextStack, { executeFunction })\n }\n else {\n const fn = contextStack.getValue(nameSymbol[1])\n if (fn !== undefined) {\n return executeFunction(asFunctionLike(fn, sourceCodeInfo), params, contextStack, sourceCodeInfo)\n }\n throw new UndefinedSymbolError(nameSymbol[1], node[2])\n }\n }\n else {\n const fnNode: Node = node[1][0]\n const fn = asFunctionLike(evaluateNode(fnNode, contextStack), sourceCodeInfo)\n if (placeholders.length > 0) {\n const partialFunction: PartialFunction = {\n [FUNCTION_SYMBOL]: true,\n function: fn,\n functionType: 'Partial',\n params,\n placeholders,\n sourceCodeInfo,\n arity: toFixedArity(placeholders.length),\n }\n return partialFunction\n }\n return executeFunction(fn, params, contextStack, sourceCodeInfo)\n }\n}\n\nfunction executeFunction(fn: FunctionLike, params: Arr, contextStack: ContextStack, sourceCodeInfo?: SourceCodeInfo): Any {\n if (isLitsFunction(fn))\n return functionExecutors[fn.functionType](fn, params, sourceCodeInfo, contextStack, { evaluateNode, executeFunction })\n\n if (Array.isArray(fn))\n return evaluateArrayAsFunction(fn, params, sourceCodeInfo)\n\n if (isObj(fn))\n return evalueateObjectAsFunction(fn, params, sourceCodeInfo)\n\n if (typeof fn === 'string')\n return evaluateStringAsFunction(fn, params, sourceCodeInfo)\n\n if (isNumber(fn)) {\n return evaluateNumberAsFunction(fn, params, sourceCodeInfo)\n /* v8 ignore next 4 */\n }\n throw new LitsError('Unexpected function type', sourceCodeInfo)\n}\n\nfunction evaluateSpecialExpression(node: SpecialExpressionNode, contextStack: ContextStack): Any {\n const specialExpressionType = node[1][0]\n const specialExpression: SpecialExpression = asNonUndefined(builtin.specialExpressions[specialExpressionType], node[2])\n const castedEvaluate = specialExpression.evaluate as Function\n\n return castedEvaluate(node, contextStack, { evaluateNode, builtin, getUndefinedSymbols }) as Any\n}\n\nfunction evalueateObjectAsFunction(fn: Obj, params: Arr, sourceCodeInfo?: SourceCodeInfo): Any {\n if (params.length !== 1)\n throw new LitsError('Object as function requires one string parameter.', sourceCodeInfo)\n\n const key = params[0]\n assertString(key, sourceCodeInfo)\n return toAny(fn[key])\n}\n\nfunction evaluateArrayAsFunction(fn: Arr, params: Arr, sourceCodeInfo?: SourceCodeInfo): Any {\n if (params.length !== 1)\n throw new LitsError('Array as function requires one non negative integer parameter.', sourceCodeInfo)\n\n const index = params[0]\n assertNumber(index, sourceCodeInfo, { integer: true, nonNegative: true })\n return toAny(fn[index])\n}\n\nfunction evaluateStringAsFunction(fn: string, params: Arr, sourceCodeInfo?: SourceCodeInfo): Any {\n if (params.length !== 1)\n throw new LitsError('String as function requires one Obj parameter.', sourceCodeInfo)\n\n const param = toAny(params[0])\n if (isObj(param))\n return toAny((param)[fn])\n\n if (isNumber(param, { integer: true }))\n return toAny(fn[param])\n\n throw new LitsError(\n `string as function expects Obj or integer parameter, got ${valueToString(param)}`,\n sourceCodeInfo,\n )\n}\n\nfunction evaluateNumberAsFunction(fn: number, params: Arr, sourceCodeInfo?: SourceCodeInfo): Any {\n assertNumber(fn, sourceCodeInfo, { integer: true })\n if (params.length !== 1)\n throw new LitsError('Number as function requires one Arr parameter.', sourceCodeInfo)\n\n const param = params[0]\n assertSeq(param, sourceCodeInfo)\n return toAny(param[fn])\n}\n","import type { SpecialExpression } from '../builtin'\nimport { builtin, normalExpressionKeys, specialExpressionKeys } from '../builtin'\nimport { allNormalExpressions } from '../builtin/normalExpressions'\nimport { specialExpressionTypes } from '../builtin/specialExpressionTypes'\nimport { LitsError, UndefinedSymbolError } from '../errors'\nimport type { Any } from '../interface'\nimport type { ContextParams } from '../Lits/Lits'\nimport type { LitsModule } from '../builtin/modules/interface'\nimport { type NativeJsFunction, type NativeJsModule, type NormalBuiltinFunction, type SpecialBuiltinFunction, type SymbolNode, type UserDefinedSymbolNode, assertJsFunction } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { asNonUndefined } from '../typeGuards'\nimport { isNormalBuiltinSymbolNode, isSpecialBuiltinSymbolNode } from '../typeGuards/astNode'\nimport { toAny } from '../utils'\nimport { FUNCTION_SYMBOL } from '../utils/symbols'\nimport type { Context, LookUpResult } from './interface'\nimport { isContextEntry } from './interface'\n\nexport type ContextStack = ContextStackImpl\n\nexport class ContextStackImpl {\n private contexts: Context[]\n public globalContext: Context\n private values?: Record<string, unknown>\n private nativeJsFunctions?: NativeJsModule\n private modules: Map<string, LitsModule>\n constructor({\n contexts,\n values: hostValues,\n nativeJsFunctions,\n modules,\n }: {\n contexts: Context[]\n values?: Record<string, unknown>\n nativeJsFunctions?: NativeJsModule\n modules?: Map<string, LitsModule>\n }) {\n this.globalContext = asNonUndefined(contexts[0])\n this.contexts = contexts\n this.values = hostValues\n this.nativeJsFunctions = nativeJsFunctions\n this.modules = modules ?? new Map<string, LitsModule>()\n }\n\n public getModule(name: string): LitsModule | undefined {\n return this.modules.get(name)\n }\n\n public create(context: Context): ContextStack {\n const globalContext = this.globalContext\n const contextStack = new ContextStackImpl({\n contexts: [context, ...this.contexts],\n values: this.values,\n nativeJsFunctions: this.nativeJsFunctions,\n modules: this.modules,\n })\n contextStack.globalContext = globalContext\n return contextStack\n }\n\n public new(context: Context): ContextStack {\n const contexts = [{}, context]\n\n return new ContextStackImpl({ contexts, modules: this.modules })\n }\n\n public exportValues(values: Record<string, Any>, sourceCodeInfo: SourceCodeInfo | undefined) {\n for (const [name, value] of Object.entries(values)) {\n if (this.globalContext[name]) {\n throw new LitsError(`Cannot redefine exported value \"${name}\"`, sourceCodeInfo)\n }\n const shadowedName = getShadowedBuiltinName(name)\n if (shadowedName) {\n throw new LitsError(`Cannot shadow ${shadowedName}`, sourceCodeInfo)\n }\n this.globalContext[name] = { value }\n }\n if (this.contexts[0] !== this.globalContext) {\n this.addValues(values, sourceCodeInfo)\n }\n }\n\n public addValues(values: Record<string, Any>, sourceCodeInfo: SourceCodeInfo | undefined) {\n const currentContext = this.contexts[0]!\n for (const [name, value] of Object.entries(values)) {\n if (currentContext[name]) {\n throw new LitsError(`Cannot redefine value \"${name}\"`, sourceCodeInfo)\n }\n const shadowedName = getShadowedBuiltinName(name)\n if (shadowedName) {\n throw new LitsError(`Cannot shadow ${shadowedName}`, sourceCodeInfo)\n }\n currentContext[name] = { value: toAny(value) }\n }\n }\n\n public getValue(name: string): unknown {\n for (const context of this.contexts) {\n const contextEntry = context[name]\n if (contextEntry)\n return contextEntry.value\n }\n\n const nativeJsFunction = this.nativeJsFunctions?.[name]\n if (nativeJsFunction)\n return nativeJsFunction\n\n return this.values?.[name]\n }\n\n public lookUp(node: UserDefinedSymbolNode): LookUpResult {\n const value = node[1]\n\n for (const context of this.contexts) {\n const contextEntry = context[value]\n if (contextEntry)\n return contextEntry\n }\n const hostValue = this.values?.[value]\n if (hostValue !== undefined) {\n return {\n value: toAny(hostValue),\n }\n }\n\n const nativeJsFunction = this.nativeJsFunctions?.[value]\n if (nativeJsFunction) {\n return {\n value: nativeJsFunction,\n }\n }\n\n return null\n }\n\n public evaluateSymbol(node: SymbolNode): Any {\n if (isSpecialBuiltinSymbolNode(node)) {\n const functionType = node[1]\n switch (functionType) {\n case specialExpressionTypes['&&']:\n case specialExpressionTypes['||']:\n case specialExpressionTypes.array:\n case specialExpressionTypes.object:\n case specialExpressionTypes['defined?']:\n case specialExpressionTypes.recur:\n case specialExpressionTypes.throw:\n case specialExpressionTypes['??']: {\n const specialExpression: SpecialExpression = asNonUndefined(builtin.specialExpressions[functionType], node[2])\n return {\n [FUNCTION_SYMBOL]: true,\n functionType: 'SpecialBuiltin',\n specialBuiltinSymbolType: functionType,\n sourceCodeInfo: node[2],\n arity: specialExpression.arity,\n } satisfies SpecialBuiltinFunction\n }\n default:\n throw new LitsError(`Unknown special builtin symbol type: ${functionType}`, node[2])\n }\n }\n if (isNormalBuiltinSymbolNode(node)) {\n const type = node[1]\n const normalExpression = allNormalExpressions[type]!\n const name = normalExpression.name!\n return {\n [FUNCTION_SYMBOL]: true,\n functionType: 'Builtin',\n normalBuiltinSymbolType: type,\n sourceCodeInfo: node[2],\n arity: normalExpression.arity,\n name,\n } satisfies NormalBuiltinFunction\n }\n const lookUpResult = this.lookUp(node)\n\n if (isContextEntry(lookUpResult))\n return lookUpResult.value\n\n throw new UndefinedSymbolError(node[1], node[2])\n }\n}\n\nfunction getShadowedBuiltinName(name: string): string | null {\n if (specialExpressionKeys.includes(name))\n return `special expression \"${name}\"`\n if (normalExpressionKeys.includes(name))\n return `builtin function \"${name}\"`\n if (name === 'self')\n return `builtin value \"${name}\"`\n return null\n}\n\nfunction assertNotShadowingBuiltin(name: string): void {\n const shadowedName = getShadowedBuiltinName(name)\n if (shadowedName) {\n throw new LitsError(`Cannot shadow ${shadowedName}`, undefined)\n }\n}\n\nexport function createContextStack(params: ContextParams = {}, modules?: Map<string, LitsModule>): ContextStack {\n const globalContext = params.globalContext ?? {}\n // Contexts are checked from left to right\n const contexts = params.contexts ? [globalContext, ...params.contexts] : [globalContext]\n const contextStack = new ContextStackImpl({\n contexts,\n values: params.values,\n modules,\n nativeJsFunctions:\n params.jsFunctions\n && Object.entries(params.jsFunctions).reduce((acc: NativeJsModule, [identifier, entry]) => {\n const identifierParts = identifier.split('.')\n const name = identifierParts.pop()!\n if (/^[A-Z]/.test(name)) {\n throw new LitsError(`Invalid identifier \"${identifier}\" in jsFunctions, function name must not start with an uppercase letter`, undefined)\n }\n let scope: NativeJsModule = acc\n for (const part of identifierParts) {\n if (part.length === 0) {\n throw new LitsError(`Invalid empty identifier \"${identifier}\" in jsFunctions`, undefined)\n }\n if (!/^[A-Z]/.test(part)) {\n throw new LitsError(`Invalid identifier \"${identifier}\" in jsFunctions, module name must start with an uppercase letter`, undefined)\n }\n if (!scope[part]) {\n scope[part] = {}\n }\n scope = scope[part] as NativeJsModule\n }\n\n assertJsFunction(entry)\n const nativeFn: NativeJsFunction = {\n functionType: 'NativeJsFunction',\n nativeFn: entry,\n name,\n [FUNCTION_SYMBOL]: true,\n arity: entry.arity ?? {},\n docString: entry.docString ?? '',\n }\n\n if (scope === acc) {\n assertNotShadowingBuiltin(name)\n }\n scope[name] = nativeFn\n return acc\n }, {}),\n })\n return params.globalModuleScope ? contextStack : contextStack.create({})\n}\n","import type { Any, Arr } from '../interface'\nimport type { FunctionLike, Node } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { isUnknownRecord } from '../typeGuards'\nimport type { ContextStack } from './ContextStack'\n\nexport interface ContextEntry { value: Any }\nexport type Context = Record<string, ContextEntry>\n\nexport type EvaluateNode = (node: Node, contextStack: ContextStack) => Any\nexport type ExecuteFunction = (fn: FunctionLike, params: Arr, contextStack: ContextStack, sourceCodeInfo?: SourceCodeInfo) => Any\n\nexport type LookUpResult = ContextEntry | null\n\nexport function isContextEntry(value: unknown): value is ContextEntry {\n return isUnknownRecord(value) && value.value !== undefined\n}\n","import { isSymbolicOperator } from './operators'\nimport type { BasePrefixedNumberToken, DocStringToken, ErrorToken, LBraceToken, LBracketToken, LParenToken, MultiLineCommentToken, NumberToken, OperatorToken, RBraceToken, RBracketToken, RParenToken, RegexpShorthandToken, ReservedSymbolToken, SingleLineCommentToken, StringToken, SymbolToken, Token, TokenDescriptor, WhitespaceToken } from './token'\nimport type { ReservedSymbol } from './reservedNames'\nimport { reservedSymbolRecord } from './reservedNames'\n\nexport type Tokenizer<T extends Token> = (input: string, position: number) => TokenDescriptor<T | ErrorToken>\n\nconst illegalSymbolCharacters = [\n '(',\n ')',\n '[',\n ']',\n '{',\n '}',\n '\\'',\n '\"',\n '`',\n ',',\n '.',\n ';',\n ' ',\n '\\n',\n '\\r',\n '\\t',\n]\nconst illegalFirstSymbolCharacters = [\n '0',\n '1',\n '2',\n '3',\n '4',\n '5',\n '6',\n '7',\n '8',\n '9',\n ...illegalSymbolCharacters,\n]\nconst illegalSymbolCharacterSet = new Set(illegalSymbolCharacters)\nconst illegalFirstSymbolCharacterSet = new Set(illegalFirstSymbolCharacters)\n\nconst whitespaceRegExp = /\\s/\n\nexport const NO_MATCH: TokenDescriptor<never> = [0]\n\nconst tokenizeLParen: Tokenizer<LParenToken> = (input, position) =>\n tokenizeToken('LParen', '(', input, position)\nconst tokenizeRParen: Tokenizer<RParenToken> = (input, position) =>\n tokenizeToken('RParen', ')', input, position)\nconst tokenizeLBracket: Tokenizer<LBracketToken> = (input, position) =>\n tokenizeToken('LBracket', '[', input, position)\nconst tokenizeRBracket: Tokenizer<RBracketToken> = (input, position) =>\n tokenizeToken('RBracket', ']', input, position)\nconst tokenizeLBrace: Tokenizer<LBraceToken> = (input, position) =>\n tokenizeToken('LBrace', '{', input, position)\nconst tokenizeRBrace: Tokenizer<RBraceToken> = (input, position) =>\n tokenizeToken('RBrace', '}', input, position)\n\nexport const tokenizeDocString: Tokenizer<DocStringToken> = (input, position) => {\n if (input[position] !== '\"' || input[position + 1] !== '\"' || input[position + 2] !== '\"')\n return NO_MATCH\n\n let value = '\"\"\"'\n let length = 3\n let char = input[position + length]\n let nextThreeChars = input.slice(position + length, position + length + 3)\n let escaping = false\n while (char && (nextThreeChars !== '\"\"\"' || escaping)) {\n length += 1\n if (escaping) {\n escaping = false\n value += char\n }\n else {\n if (char === '\\\\') {\n escaping = true\n }\n value += char\n }\n char = input[position + length]\n nextThreeChars = input.slice(position + length, position + length + 3)\n }\n if (!char) {\n return [length, ['Error', value, undefined, `Unclosed doc string at position ${position}`]]\n }\n value += '\"\"\"' // closing quote\n return [length + 3, ['DocString', value]]\n}\n\nconst tokenizeString: Tokenizer<StringToken> = (input, position) => {\n if (input[position] !== '\"')\n return NO_MATCH\n\n let value = '\"'\n let length = 1\n let char = input[position + length]\n let escaping = false\n while (char && (char !== '\"' || escaping)) {\n length += 1\n if (escaping) {\n escaping = false\n value += char\n }\n else {\n if (char === '\\\\') {\n escaping = true\n }\n value += char\n }\n char = input[position + length]\n }\n if (!char) {\n return [length, ['Error', value, undefined, `Unclosed string at position ${position}`]]\n }\n value += '\"' // closing quote\n return [length + 1, ['string', value]]\n}\n\nconst tokenizeRegexpShorthand: Tokenizer<RegexpShorthandToken> = (input, position) => {\n if (input[position] !== '#')\n return NO_MATCH\n\n const [stringLength, token] = tokenizeString(input, position + 1)\n if (!token)\n return NO_MATCH\n\n if (token[0] === 'Error') {\n const errorToken: ErrorToken = ['Error', `#${token[1]}`, undefined, `Unclosed regexp at position ${position}`]\n return [stringLength + 1, errorToken]\n }\n\n position += stringLength + 1\n let length = stringLength + 1\n\n let options = ''\n while (input[position] === 'g' || input[position] === 'i') {\n options += input[position]!\n length += 1\n position += 1\n if (options.includes(input[position]!)) {\n return [length, ['Error', `#${token[1]}${options}`, undefined, `Duplicated regexp option \"${input[position]}\"`]]\n }\n }\n\n return [length, ['RegexpShorthand', `#${token[1]}${options}`]]\n}\n\nfunction tokenizeToken<T extends Token>(\n type: T[0],\n value: string,\n input: string,\n position: number,\n): TokenDescriptor<T> {\n if (value === input.slice(position, position + value.length))\n return [value.length, [type, value] as T]\n else\n return NO_MATCH\n}\n\nexport const tokenizeWhitespace: Tokenizer<WhitespaceToken> = (input, position) => {\n let char = input[position]\n if (!char || !whitespaceRegExp.test(char)) {\n return NO_MATCH\n }\n let value = char\n position += 1\n char = input[position]\n while (char && whitespaceRegExp.test(char)) {\n value += char\n position += 1\n char = input[position]\n }\n return [value.length, ['Whitespace', value]]\n}\n\nconst decimalNumberRegExp = /\\d/\nconst octalNumberRegExp = /[0-7]/\nconst hexNumberRegExp = /[0-9a-f]/i\nconst binaryNumberRegExp = /[01]/\nconst postNumberRegExp = /[\\s)\\]}(,;]/\n\nexport const tokenizeNumber: Tokenizer<NumberToken> = (input, position) => {\n let i: number\n const negate = input[position] === '-'\n const plusPrefix = input[position] === '+'\n const start = negate || plusPrefix ? position + 1 : position\n let hasDecimalPoint = false\n let hasExponent = false\n for (i = start; i < input.length; i += 1) {\n const char = input[i] as string\n\n if (char === '_') {\n if (!decimalNumberRegExp.test(input[i - 1]!) || !decimalNumberRegExp.test(input[i + 1]!)) {\n if (i === start) {\n return NO_MATCH\n }\n return [i - position + 1, ['Error', input.substring(position, i + 1), undefined, `Invalid number format at position ${i + 1}`]]\n }\n }\n\n else if (char === '.') {\n if (i === start) {\n return NO_MATCH\n }\n if (hasDecimalPoint || hasExponent) {\n return [i - position + 1, ['Error', input.substring(position, i + 1), undefined, `Invalid number format at position ${i + 1}`]]\n }\n hasDecimalPoint = true\n }\n\n else if (char === 'e' || char === 'E') {\n if (i === start) {\n return NO_MATCH\n }\n\n if (hasExponent) {\n return [i - position + 1, ['Error', input.substring(position, i + 1), undefined, `Invalid number format at position ${i + 1}`]]\n }\n\n if (input[i - 1] === '.' || input[i - 1] === '+' || input[i - 1] === '-') {\n return [i - position + 1, ['Error', input.substring(position, i + 1), undefined, `Invalid number format at position ${i + 1}`]]\n }\n\n if (input[i + 1] === '+' || input[i + 1] === '-') {\n i += 1\n }\n\n hasExponent = true\n }\n\n else if (!decimalNumberRegExp.test(char)) {\n break\n }\n }\n\n if ((negate || plusPrefix) && i === start) {\n return NO_MATCH\n }\n\n const length = i - position\n if (length === 0) {\n return NO_MATCH\n }\n\n const nextChar = input[i]\n if (nextChar && nextChar !== ':' && !postNumberRegExp.test(nextChar)) {\n return [i - position + 1, ['Error', input.substring(position, i + 1), undefined, `Invalid number format at position ${i + 1}`]]\n }\n\n return [length, ['Number', input.substring(position, i)]]\n}\n\nexport const tokenizeBasePrefixedNumber: Tokenizer<BasePrefixedNumberToken> = (input, position) => {\n if (input[position] !== '0') {\n return NO_MATCH\n }\n\n const baseChar = input[position + 1]\n\n const type = baseChar === 'b' || baseChar === 'B'\n ? 'binary'\n : baseChar === 'o' || baseChar === 'O'\n ? 'octal'\n : baseChar === 'x' || baseChar === 'X'\n ? 'hex'\n : null\n\n if (type === null) {\n return NO_MATCH\n }\n\n let i: number\n for (i = position + 2; i < input.length; i += 1) {\n const char = input[i] as string\n if (type === 'binary' && !binaryNumberRegExp.test(char)) {\n break\n }\n if (type === 'octal' && !octalNumberRegExp.test(char)) {\n break\n }\n if (type === 'hex' && !hexNumberRegExp.test(char)) {\n break\n }\n }\n\n const length = i - position\n if (length <= 2) {\n return NO_MATCH\n }\n\n const nextChar = input[i]\n if (nextChar && !postNumberRegExp.test(nextChar)) {\n return NO_MATCH\n }\n\n return [length, ['BasePrefixedNumber', input.substring(position, i)]]\n}\n\nexport const tokenizeSymbol: Tokenizer<SymbolToken> = (input, position) => {\n let value = input[position]!\n\n if (value === '\\'') {\n let length = 1\n let char = input[position + length]\n let escaping = false\n while (char !== '\\'' || escaping) {\n if (char === undefined)\n return [length, ['Error', value, undefined, `Unclosed quoted symbol at position ${position}`]]\n\n length += 1\n if (escaping) {\n escaping = false\n value += char\n }\n else {\n if (char === '\\\\') {\n escaping = true\n }\n value += char\n }\n char = input[position + length]\n }\n value += '\\'' // closing quote\n return [length + 1, ['Symbol', value]]\n }\n\n if (!illegalFirstSymbolCharacterSet.has(value)) {\n const initialPosition = position\n position += 1\n let char = input[position]\n\n while (char && !illegalSymbolCharacterSet.has(char)) {\n value += char\n position += 1\n char = input[position]\n }\n\n // : can be used as symbol character, but it must not be the last character\n return value.endsWith(':')\n ? [position - initialPosition - 1, ['Symbol', value.slice(0, -1)]]\n : [position - initialPosition, ['Symbol', value]]\n }\n\n return NO_MATCH\n}\n\nexport const tokenizeReservedSymbolToken: Tokenizer<ReservedSymbolToken> = (input, position) => {\n const symbolMeta = tokenizeSymbol(input, position)\n if (symbolMeta[0] === 0 || !symbolMeta[1]) {\n return NO_MATCH\n }\n let symbolName = symbolMeta[1][1]\n symbolName = symbolName.startsWith('\\'') ? symbolName.slice(1, symbolName.length - 1) : symbolName\n\n const info = reservedSymbolRecord[symbolName as ReservedSymbol]\n if (info === undefined) {\n return NO_MATCH\n }\n return [symbolMeta[0], ['ReservedSymbol', symbolName as ReservedSymbol]]\n}\n\nexport const tokenizeOperator: Tokenizer<OperatorToken> = (input, position) => {\n const threeChars = input.slice(position, position + 3)\n if (position + 2 < input.length && isSymbolicOperator(threeChars)) {\n return [3, ['Operator', threeChars]]\n }\n\n const twoChars = input.slice(position, position + 2)\n if (position + 1 < input.length && isSymbolicOperator(twoChars)) {\n return [2, ['Operator', twoChars]]\n }\n\n const oneChar = input[position] ?? ''\n if (isSymbolicOperator(oneChar)) {\n return [1, ['Operator', oneChar]]\n }\n return NO_MATCH\n}\n\nexport const tokenizeMultiLineComment: Tokenizer<MultiLineCommentToken> = (input, position) => {\n if (input[position] === '/' && input[position + 1] === '*') {\n let length = 2\n let value = '/*'\n while ((input[position + length] !== '*' || input[position + length + 1] !== '/') && position + length + 1 < input.length) {\n value += input[position + length]\n length += 1\n }\n if (position + length + 1 >= input.length) {\n return [length, ['Error', value, undefined, `Unclosed multi-line comment at position ${position}`]]\n }\n value += '*/'\n length += 2\n\n return [length, ['MultiLineComment', value]]\n }\n return NO_MATCH\n}\n\nexport const tokenizeShebang: Tokenizer<SingleLineCommentToken> = (input, position) => {\n if (input[position] === '#' && input[position + 1] === '!') {\n let length = 2\n let value = '#!'\n while (input[position + length] !== '\\n' && position + length < input.length) {\n value += input[position + length]\n length += 1\n }\n\n return [length, ['SingleLineComment', value]]\n }\n return NO_MATCH\n}\n\nexport const tokenizeSingleLineComment: Tokenizer<SingleLineCommentToken> = (input, position) => {\n if (input[position] === '/' && input[position + 1] === '/') {\n let length = 2\n let value = '//'\n while (input[position + length] !== '\\n' && position + length < input.length) {\n value += input[position + length]\n length += 1\n }\n\n return [length, ['SingleLineComment', value]]\n }\n return NO_MATCH\n}\n\n// All tokenizers, order matters!\nexport const tokenizers = [\n tokenizeWhitespace,\n tokenizeMultiLineComment,\n tokenizeSingleLineComment,\n tokenizeReservedSymbolToken,\n tokenizeLParen,\n tokenizeRParen,\n tokenizeLBracket,\n tokenizeRBracket,\n tokenizeLBrace,\n tokenizeRBrace,\n tokenizeDocString,\n tokenizeString,\n tokenizeRegexpShorthand,\n tokenizeBasePrefixedNumber,\n tokenizeNumber,\n tokenizeOperator,\n tokenizeSymbol,\n] as const satisfies Tokenizer<Token>[]\n","import type { FilePathParams } from '../Lits/Lits'\nimport { tokenizeShebang, tokenizers } from './tokenizers'\nimport type { SourceCodeInfo, Token, TokenDescriptor } from './token'\n\nexport interface TokenStream {\n tokens: Token[]\n hasDebugData: boolean\n filePath?: string\n}\n\nexport function tokenize(input: string, debug: boolean, filePath: FilePathParams['filePath']): TokenStream {\n let position = 0\n const tokenStream: TokenStream = {\n tokens: [],\n filePath,\n hasDebugData: debug,\n }\n\n while (position < input.length) {\n const sourceCodeInfo: SourceCodeInfo | undefined = debug\n ? createSourceCodeInfo(input, position, filePath)\n : undefined\n\n const tokenDescriptor = getCurrentToken(input, position)\n\n const [count, token] = tokenDescriptor\n\n position += count\n if (token) {\n if (sourceCodeInfo) {\n token[2] = sourceCodeInfo\n }\n\n tokenStream.tokens.push(token)\n }\n }\n\n return tokenStream\n}\n\nfunction getSourceCodeLine(input: string, lineNbr: number): string {\n return input.split(/\\r\\n|\\r|\\n/)[lineNbr] as string\n}\n\nfunction createSourceCodeInfo(input: string, position: number, filePath?: string): SourceCodeInfo {\n const lines = input.substring(0, position + 1).split(/\\r\\n|\\r|\\n/)\n const lastLine = lines[lines.length - 1] as string\n\n const code = getSourceCodeLine(input, lines.length - 1)\n const line = lines.length\n const column = lastLine.length\n return {\n code,\n position: {\n line,\n column,\n },\n filePath,\n }\n}\n\nfunction getCurrentToken(input: string, position: number): TokenDescriptor<Token> {\n const initialPosition = position\n\n if (position === 0) {\n const [nbrOfCharacters, token] = tokenizeShebang(input, position)\n position += nbrOfCharacters\n if (nbrOfCharacters > 0) {\n return [position - initialPosition, token]\n }\n }\n\n for (const tokenizer of tokenizers) {\n const [nbrOfCharacters, token] = tokenizer(input, position)\n position += nbrOfCharacters\n if (nbrOfCharacters === 0) {\n continue\n }\n\n return [position - initialPosition, token]\n }\n return [1, ['Error', input[initialPosition], undefined, 'Unrecognized character']] as TokenDescriptor<Token>\n}\n","import { LitsError } from '../errors'\nimport type { ReservedSymbol } from './reservedNames'\nimport { type SymbolicBinaryOperator, type SymbolicOperator, isBinaryOperator } from './operators'\n\nexport const tokenTypes = [\n 'LBrace',\n 'LBracket',\n 'RBrace',\n 'RBracket',\n 'LParen',\n 'RParen',\n 'BasePrefixedNumber',\n 'DocString',\n 'Error',\n 'MultiLineComment',\n 'Number',\n 'Operator',\n 'RegexpShorthand',\n 'ReservedSymbol',\n 'SingleLineComment',\n 'Shebang',\n 'string',\n 'Symbol',\n 'Whitespace',\n] as const\n\nexport type TokenType = typeof tokenTypes[number]\n\nconst modifierNames = ['&rest', '&let', '&when', '&while'] as const\nexport type ModifierName = typeof modifierNames[number]\n\ntype GenericToken<T extends TokenType, V extends string = string> = [T, V] | [T, V, SourceCodeInfo]\n\nexport type ErrorToken = ['Error', string, SourceCodeInfo | undefined, string]\n\nexport type LBraceToken = GenericToken<'LBrace', '{'>\nexport type LBracketToken = GenericToken<'LBracket', '['>\nexport type LParenToken = GenericToken<'LParen', '('>\nexport type RBraceToken = GenericToken<'RBrace', '}'>\nexport type RBracketToken = GenericToken<'RBracket', ']'>\nexport type RParenToken = GenericToken<'RParen', ')'>\n\nexport type BasePrefixedNumberToken = GenericToken<'BasePrefixedNumber'>\nexport type MultiLineCommentToken = GenericToken<'MultiLineComment'>\nexport type NumberToken = GenericToken<'Number'>\nexport type OperatorToken<T extends SymbolicOperator = SymbolicOperator> = GenericToken<'Operator', T>\nexport type RegexpShorthandToken = GenericToken<'RegexpShorthand'>\nexport type ReservedSymbolToken<T extends ReservedSymbol = ReservedSymbol> = GenericToken<'ReservedSymbol', T>\nexport type SingleLineCommentToken = GenericToken<'SingleLineComment'>\nexport type ShebangToken = GenericToken<'Shebang'>\nexport type StringToken = GenericToken<'string'>\nexport type DocStringToken = GenericToken<'DocString'>\nexport type SymbolToken<T extends string = string> = GenericToken<'Symbol', T>\nexport type WhitespaceToken = GenericToken<'Whitespace'>\n\nexport type Token =\n | LBraceToken\n | LBracketToken\n | LParenToken\n | RBraceToken\n | RBracketToken\n | RParenToken\n | BasePrefixedNumberToken\n | DocStringToken\n | ErrorToken\n | MultiLineCommentToken\n | NumberToken\n | OperatorToken\n | RegexpShorthandToken\n | ReservedSymbolToken\n | SingleLineCommentToken\n | ShebangToken\n | StringToken\n | SymbolToken\n | WhitespaceToken\n\nexport type TokenDescriptor<T extends Token> = [length: number, token?: T]\n\nexport interface SourceCodeInfo {\n position: {\n line: number\n column: number\n }\n code: string\n filePath?: string\n}\n\nexport function isSymbolToken<T extends string>(token: Token | undefined | undefined, symbolName?: T): token is SymbolToken<T> {\n if (token?.[0] !== 'Symbol') {\n return false\n }\n if (symbolName && token[1] !== symbolName) {\n return false\n }\n return true\n}\n\nexport function assertSymbolToken<T extends string>(token: Token | undefined | undefined, symbolName?: T): asserts token is SymbolToken<T> {\n if (!isSymbolToken(token, symbolName)) {\n throwUnexpectedToken('Symbol', undefined, token)\n }\n}\nexport function asSymbolToken<T extends string>(token: Token | undefined | undefined, symbolName?: T): SymbolToken<T> {\n assertSymbolToken(token, symbolName)\n return token\n}\n\nexport function isReservedSymbolToken<T extends ReservedSymbol>(token: Token | undefined | undefined, symbolName?: T): token is ReservedSymbolToken<T> {\n if (token?.[0] !== 'ReservedSymbol') {\n return false\n }\n if (symbolName && token[1] !== symbolName) {\n return false\n }\n return true\n}\nexport function assertReservedSymbolToken<T extends ReservedSymbol>(token: Token | undefined | undefined, symbolName?: T): asserts token is ReservedSymbolToken<T> {\n if (!isReservedSymbolToken(token, symbolName)) {\n throwUnexpectedToken('ReservedSymbol', symbolName, token)\n }\n}\nexport function asReservedSymbolToken<T extends ReservedSymbol>(token: Token | undefined | undefined, symbolName?: T): ReservedSymbolToken<T> {\n assertReservedSymbolToken(token, symbolName)\n return token\n}\n\nexport function isShebangToken(token: Token | undefined): token is SingleLineCommentToken {\n return token?.[0] === 'Shebang'\n}\n\nexport function isSingleLineCommentToken(token: Token | undefined): token is SingleLineCommentToken {\n return token?.[0] === 'SingleLineComment'\n}\n\nexport function isMultiLineCommentToken(token: Token | undefined): token is MultiLineCommentToken {\n return token?.[0] === 'MultiLineComment'\n}\n\nexport function isOperatorToken<T extends SymbolicOperator>(token: Token | undefined | undefined, operatorName?: T): token is OperatorToken<T> {\n if (token?.[0] !== 'Operator') {\n return false\n }\n if (operatorName && token[1] !== operatorName) {\n return false\n }\n return true\n}\nexport function assertOperatorToken<T extends SymbolicOperator>(token: Token | undefined | undefined, operatorName?: T): asserts token is OperatorToken<T> {\n if (!isOperatorToken(token, operatorName)) {\n throwUnexpectedToken('Operator', operatorName, token)\n }\n}\nexport function asOperatorToken<T extends SymbolicOperator>(token: Token | undefined | undefined, operatorName?: T): OperatorToken<T> {\n assertOperatorToken(token, operatorName)\n return token\n}\n\nexport function isWhitespaceToken(token: Token | undefined): token is WhitespaceToken {\n return token?.[0] === 'Whitespace'\n}\nexport function assertWhitespaceToken(token: Token | undefined): asserts token is WhitespaceToken {\n if (!isWhitespaceToken(token)) {\n throwUnexpectedToken('Whitespace', undefined, token)\n }\n}\nexport function asWhitespaceToken(token: Token | undefined): WhitespaceToken {\n assertWhitespaceToken(token)\n return token\n}\n\nexport function isNumberToken(token: Token | undefined): token is NumberToken {\n return token?.[0] === 'Number'\n}\nexport function assertNumberToken(token: Token | undefined): asserts token is NumberToken {\n if (!isNumberToken(token)) {\n throwUnexpectedToken('Number', undefined, token)\n }\n}\nexport function asNumberToken(token: Token | undefined): NumberToken {\n assertNumberToken(token)\n return token\n}\n\nexport function isBasePrefixedNumberToken(token: Token | undefined): token is BasePrefixedNumberToken {\n return token?.[0] === 'BasePrefixedNumber'\n}\nexport function assertBasePrefixedNumberToken(token: Token | undefined): asserts token is BasePrefixedNumberToken {\n if (!isBasePrefixedNumberToken(token)) {\n throwUnexpectedToken('BasePrefixedNumber', undefined, token)\n }\n}\nexport function asBasePrefixedNumberToken(token: Token | undefined): BasePrefixedNumberToken {\n assertBasePrefixedNumberToken(token)\n return token\n}\n\nexport function isLParenToken(token: Token | undefined): token is LParenToken {\n return token?.[0] === 'LParen'\n}\nexport function assertLParenToken(token: Token | undefined): asserts token is LParenToken {\n if (!isLParenToken(token)) {\n throwUnexpectedToken('LParen', undefined, token)\n }\n}\nexport function asLParenToken(token: Token | undefined): LParenToken {\n assertLParenToken(token)\n return token\n}\n\nexport function isRParenToken(token: Token | undefined): token is RParenToken {\n return token?.[0] === 'RParen'\n}\nexport function assertRParenToken(token: Token | undefined): asserts token is RParenToken {\n if (!isRParenToken(token)) {\n throwUnexpectedToken('RParen', undefined, token)\n }\n}\nexport function asRParenToken(token: Token | undefined): RParenToken {\n assertRParenToken(token)\n return token\n}\n\nexport function isLBracketToken(token: Token | undefined): token is LBracketToken {\n return token?.[0] === 'LBracket'\n}\nexport function assertLBracketToken(token: Token | undefined): asserts token is LBracketToken {\n if (!isLBracketToken(token)) {\n throwUnexpectedToken('LBracket', undefined, token)\n }\n}\nexport function asLBracketToken(token: Token | undefined): LBracketToken {\n assertLBracketToken(token)\n return token\n}\n\nexport function isRBracketToken(token: Token | undefined): token is RBracketToken {\n return token?.[0] === 'RBracket'\n}\nexport function assertRBracketToken(token: Token | undefined): asserts token is RBracketToken {\n if (!isRBracketToken(token)) {\n throwUnexpectedToken('RBracket', undefined, token)\n }\n}\nexport function asRBracketToken(token: Token | undefined): RBracketToken {\n assertRBracketToken(token)\n return token\n}\n\nexport function isLBraceToken(token: Token | undefined): token is LBraceToken {\n return token?.[0] === 'LBrace'\n}\nexport function assertLBraceToken(token: Token | undefined): asserts token is LBraceToken {\n if (!isLBraceToken(token)) {\n throwUnexpectedToken('LBrace', undefined, token)\n }\n}\nexport function asLBraceToken(token: Token | undefined): LBraceToken {\n assertLBraceToken(token)\n return token\n}\n\nexport function isRBraceToken(token: Token | undefined): token is RBraceToken {\n return token?.[0] === 'RBrace'\n}\nexport function assertRBraceToken(token: Token | undefined): asserts token is RBraceToken {\n if (!isRBraceToken(token)) {\n throwUnexpectedToken('RBrace', undefined, token)\n }\n}\nexport function asRBraceToken(token: Token | undefined): RBraceToken {\n assertRBraceToken(token)\n return token\n}\n\nexport function isStringToken(token: Token | undefined): token is StringToken {\n return token?.[0] === 'string'\n}\nexport function assertStringToken(token: Token | undefined): asserts token is StringToken {\n if (!isStringToken(token)) {\n throwUnexpectedToken('string', undefined, token)\n }\n}\nexport function asStringToken(token: Token | undefined): StringToken {\n assertStringToken(token)\n return token\n}\n\nexport function isDocStringToken(token: Token | undefined): token is DocStringToken {\n return token?.[0] === 'DocString'\n}\n\nexport function isRegexpShorthandToken(token: Token | undefined): token is RegexpShorthandToken {\n return token?.[0] === 'RegexpShorthand'\n}\nexport function assertRegexpShorthandToken(token: Token | undefined): asserts token is RegexpShorthandToken {\n if (!isRegexpShorthandToken(token)) {\n throwUnexpectedToken('RegexpShorthand', undefined, token)\n }\n}\nexport function asRegexpShorthandToken(token: Token | undefined): RegexpShorthandToken {\n assertRegexpShorthandToken(token)\n return token\n}\n\nexport function isA_BinaryOperatorToken(token: Token | undefined): token is OperatorToken<SymbolicBinaryOperator> {\n return token?.[0] === 'Operator' && isBinaryOperator(token[1])\n}\nexport function assertA_BinaryOperatorToken(token: Token | undefined): asserts token is OperatorToken<SymbolicBinaryOperator> {\n if (!isA_BinaryOperatorToken(token)) {\n throwUnexpectedToken('Operator', undefined, token)\n }\n}\nexport function asA_BinaryOperatorToken(token: Token | undefined): OperatorToken<SymbolicBinaryOperator> {\n assertA_BinaryOperatorToken(token)\n return token\n}\n\nfunction throwUnexpectedToken(expected: TokenType, expectedValue: string | undefined, actual: Token | undefined): never {\n const actualOutput = actual ? `${actual[0]} '${actual[1]}'` : 'end of input'\n throw new LitsError(`Unexpected token: ${actualOutput}, expected ${expected}${expectedValue ? ` '${expectedValue}'` : ''}`, actual?.[2])\n}\n","import type { TokenStream } from './tokenize'\nimport { isMultiLineCommentToken, isShebangToken, isSingleLineCommentToken, isWhitespaceToken } from './token'\n\nexport function minifyTokenStream(tokenStream: TokenStream, { removeWhiteSpace }: { removeWhiteSpace: boolean }): TokenStream {\n const tokens = tokenStream.tokens\n .filter((token) => {\n if (isSingleLineCommentToken(token)\n || isMultiLineCommentToken(token)\n || isShebangToken(token)\n || (removeWhiteSpace && isWhitespaceToken(token))) {\n return false\n }\n return true\n })\n\n return { ...tokenStream, tokens }\n}\n","import type { NormalExpressionName } from '../../reference/api'\nimport { type SpecialExpression, type SpecialExpressionName, type SpecialExpressionType, builtin } from '../builtin'\nimport { getAllBindingTargetNames } from '../builtin/bindingNode'\nimport { allNormalExpressions, normalExpressionTypes } from '../builtin/normalExpressions'\nimport type { AndNode } from '../builtin/specialExpressions/and'\nimport type { ArrayNode } from '../builtin/specialExpressions/array'\nimport type { CondNode } from '../builtin/specialExpressions/cond'\nimport type { DefinedNode } from '../builtin/specialExpressions/defined'\nimport type { DefNode } from '../builtin/specialExpressions/def'\nimport type { DoNode } from '../builtin/specialExpressions/block'\nimport type { LambdaNode } from '../builtin/specialExpressions/functions'\nimport type { IfNode } from '../builtin/specialExpressions/if'\nimport type { LetNode } from '../builtin/specialExpressions/let'\nimport type { LoopNode } from '../builtin/specialExpressions/loop'\nimport type { DoSeqNode, ForNode, LoopBindingNode } from '../builtin/specialExpressions/loops'\nimport type { ObjectNode } from '../builtin/specialExpressions/object'\nimport type { OrNode } from '../builtin/specialExpressions/or'\nimport type { QqNode } from '../builtin/specialExpressions/qq'\nimport type { RecurNode } from '../builtin/specialExpressions/recur'\nimport type { SwitchNode } from '../builtin/specialExpressions/switch'\nimport type { ThrowNode } from '../builtin/specialExpressions/throw'\nimport type { TryNode } from '../builtin/specialExpressions/try'\nimport type { UnlessNode } from '../builtin/specialExpressions/unless'\nimport { specialExpressionTypes } from '../builtin/specialExpressionTypes'\nimport { NodeTypes } from '../constants/constants'\nimport { LitsError } from '../errors'\nimport { type SymbolicBinaryOperator, isBinaryOperator, isFunctionOperator } from '../tokenizer/operators'\nimport { isNumberReservedSymbol, numberReservedSymbolRecord } from '../tokenizer/reservedNames'\nimport type { OperatorToken, ReservedSymbolToken, SourceCodeInfo, StringToken, SymbolToken, Token, TokenType } from '../tokenizer/token'\nimport {\n asLBraceToken,\n asLBracketToken,\n asReservedSymbolToken,\n asSymbolToken,\n assertLParenToken,\n assertOperatorToken,\n assertRBraceToken,\n assertRBracketToken,\n assertRParenToken,\n assertReservedSymbolToken,\n isA_BinaryOperatorToken,\n isDocStringToken,\n isLBraceToken,\n isLBracketToken,\n isLParenToken,\n isOperatorToken,\n isRBraceToken,\n isRBracketToken,\n isRParenToken,\n isReservedSymbolToken,\n isStringToken,\n isSymbolToken,\n} from '../tokenizer/token'\nimport type { TokenStream } from '../tokenizer/tokenize'\nimport { asUserDefinedSymbolNode, isNormalBuiltinSymbolNode, isSpecialBuiltinSymbolNode, isUserDefinedSymbolNode } from '../typeGuards/astNode'\nimport { smartTrim } from '../utils'\nimport { assertNumberOfParams } from '../utils/arity'\nimport { type BindingNode, type BindingTarget, type Node, type NormalBuiltinSymbolNode, type NormalExpressionNodeExpression, type NormalExpressionNodeWithName, type NumberNode, type ParseState, type ReservedSymbolNode, type SpecialBuiltinSymbolNode, type StringNode, type SymbolNode, type UserDefinedSymbolNode, bindingTargetTypes } from './types'\n\n// Reverse lookup tables for getting symbol names from builtin types\nconst normalExpressionNames: string[] = Object.entries(normalExpressionTypes).reduce((acc, [name, index]) => {\n acc[index] = name\n return acc\n}, [] as string[])\n\nconst specialExpressionNames: string[] = Object.entries(specialExpressionTypes).reduce((acc, [name, index]) => {\n acc[index] = name\n return acc\n}, [] as string[])\n\n/**\n * Extract the symbol name from any symbol node type.\n * UserDefinedSymbolNode: node[1] is the string name\n * NormalBuiltinSymbolNode: node[1] is an index, need reverse lookup\n * SpecialBuiltinSymbolNode: node[1] is an index, need reverse lookup\n */\nfunction getSymbolName(symbol: SymbolNode): string {\n if (isUserDefinedSymbolNode(symbol)) {\n return symbol[1]\n }\n if (isNormalBuiltinSymbolNode(symbol)) {\n return normalExpressionNames[symbol[1]]!\n }\n // SpecialBuiltinSymbolNode\n return specialExpressionNames[symbol[1]]!\n}\n\ntype InternalLoopBindingDelimiter = 'let' | 'when' | 'while'\ntype ImplicitBlockEnd = 'end' | 'else' | 'catch' | 'case'\n\nconst exponentiationPrecedence = 12\nconst binaryFunctionalOperatorPrecedence = 3\nconst conditionalOperatorPrecedence = 1\nconst maxShorthandLambdaArity = 20\nconst placeholderRegexp = /^\\$([1-9]\\d?)?$/\n\nfunction withSourceCodeInfo<T extends Node | BindingTarget>(node: T, sourceCodeInfo: SourceCodeInfo | undefined): T {\n if (sourceCodeInfo) {\n node[2] = sourceCodeInfo\n }\n return node\n}\n\nfunction getPrecedence(operatorSign: SymbolicBinaryOperator, sourceCodeInfo: SourceCodeInfo | undefined): number {\n switch (operatorSign) {\n case '^': // exponentiation\n return exponentiationPrecedence\n\n case '*': // multiplication\n case '/': // division\n case '%': // remainder\n return 11\n\n case '+': // addition\n case '-': // subtraction\n return 10\n\n case '<<': // left shift\n case '>>': // signed right shift\n case '>>>': // unsigned right shift\n return 9\n\n case '++': // string concatenation\n return 8\n\n case '<': // less than\n case '<=': // less than or equal\n case '≤': // less than or equal\n case '>': // greater than\n case '>=': // greater than or equal\n case '≥': // greater than or equal\n return 7\n\n case '==': // equal\n case '!=': // not equal\n case '≠': // not equal\n return 6\n\n case '&': // bitwise AND\n case 'xor': // bitwise XOR\n case '|': // bitwise OR\n return 5\n\n case '&&': // logical AND\n case '||': // logical OR\n case '??': // nullish coalescing\n return 4\n\n // leave room for binaryFunctionalOperatorPrecedence = 3\n\n case '|>': // pipe\n return 2\n\n // leave room for conditionalOperatorPrecedence = 1\n\n /* v8 ignore next 2 */\n default:\n throw new LitsError(`Unknown binary operator: ${operatorSign satisfies never}`, sourceCodeInfo)\n }\n}\n\nfunction createNamedNormalExpressionNode(symbolNode: NormalBuiltinSymbolNode | UserDefinedSymbolNode, params: Node[], sourceCodeInfo: SourceCodeInfo | undefined): NormalExpressionNodeWithName {\n const node: NormalExpressionNodeWithName = withSourceCodeInfo([NodeTypes.NormalExpression, [symbolNode, params]], sourceCodeInfo)\n\n if (isNormalBuiltinSymbolNode(symbolNode)) {\n assertNumberOfParams(allNormalExpressions[symbolNode[1]]!.arity, node[1][1].length, sourceCodeInfo)\n }\n\n return node\n}\n\nfunction createAccessorNode(left: Node, right: Node, sourceCodeInfo: SourceCodeInfo | undefined): NormalExpressionNodeExpression {\n return withSourceCodeInfo([NodeTypes.NormalExpression, [[NodeTypes.NormalBuiltinSymbol, normalExpressionTypes.get], [left, right]]], sourceCodeInfo)\n}\n\nfunction fromBinaryOperatorToNode(operator: OperatorToken, symbolNode: SymbolNode, left: Node, right: Node, sourceCodeInfo: SourceCodeInfo | undefined): Node {\n const operatorName = operator[1]\n\n switch (operatorName) {\n case '^': // exponentiation\n case '*':\n case '/':\n case '%':\n case '+':\n case '-':\n case '<<':\n case '>>':\n case '>>>':\n case '++':\n case '<':\n case '<=':\n case '≤':\n case '>':\n case '>=':\n case '≥':\n case '==':\n case '!=':\n case '≠':\n case '&':\n case 'xor':\n case '|':\n case '|>':\n return createNamedNormalExpressionNode(symbolNode as NormalBuiltinSymbolNode, [left, right], sourceCodeInfo)\n case '&&':\n case '||':\n case '??':\n return withSourceCodeInfo([NodeTypes.SpecialExpression, [specialExpressionTypes[operatorName], [left, right]]] as AndNode, sourceCodeInfo)\n /* v8 ignore next 11 */\n case '.':\n case ';':\n case ':':\n case '=':\n case ',':\n case '->':\n case '...':\n case '?':\n throw new LitsError(`Unknown binary operator: ${operatorName}`, sourceCodeInfo)\n default:\n throw new LitsError(`Unknown binary operator: ${operatorName satisfies never}`, sourceCodeInfo)\n }\n}\n\nexport class Parser {\n constructor(\n private readonly tokenStream: TokenStream,\n private parseState: ParseState,\n ) {}\n\n private peek(): Token | undefined {\n return this.tokenStream.tokens[this.parseState.position]\n }\n\n private peekSourceCodeInfo(): SourceCodeInfo | undefined {\n const currentToken = this.peek()\n return currentToken ? currentToken[2] : this.tokenStream.tokens.at(-1)?.[2]\n }\n\n private peekAhead(count: number): Token {\n return this.tokenStream.tokens[this.parseState.position + count]!\n }\n\n private advance(): void {\n this.parseState.position += 1\n }\n\n public parse(): Node[] {\n this.tokenStream.tokens.forEach((token) => {\n if (token[0] === 'Error') {\n throw new LitsError(token[3], token[2])\n }\n })\n\n const nodes: Node[] = []\n while (!this.isAtEnd()) {\n nodes.push(this.parseExpression(0, true))\n if (isOperatorToken(this.peek(), ';')) {\n this.advance()\n }\n else {\n if (!this.isAtEnd()) {\n throw new LitsError('Expected ;', this.peekSourceCodeInfo())\n }\n }\n }\n return nodes\n }\n\n private parseExpression(precedence = 0, moduleScope = false): Node {\n const firstToken = this.peek()\n\n let left: Node\n\n if (isSymbolToken(firstToken)) {\n switch (firstToken[1]) {\n case 'let':\n return this.parseLet(firstToken)\n case 'if':\n case 'unless':\n left = this.parseIfOrUnless(firstToken)\n break\n case 'cond':\n left = this.parseCond(firstToken)\n break\n case 'switch':\n left = this.parseSwitch(firstToken)\n break\n case 'for':\n case 'doseq':\n left = this.parseForOrDoseq(firstToken)\n break\n case 'loop':\n left = this.parseLoop(firstToken)\n break\n case 'try':\n left = this.parseTry(firstToken)\n break\n }\n }\n else if (isReservedSymbolToken(firstToken, 'do')) {\n left = this.parseBlock()[0]\n }\n else if (isReservedSymbolToken(firstToken, 'export')) {\n if (!moduleScope) {\n throw new LitsError('export is only allowed in module scope', firstToken[2])\n }\n return this.parseExport(firstToken)\n }\n\n left ||= this.parseOperand()\n let operator = this.peek()\n\n while (!this.isAtExpressionEnd()) {\n if (isA_BinaryOperatorToken(operator)) {\n const name = operator[1]\n const newPrecedece = getPrecedence(name, operator[2])\n if (\n newPrecedece <= precedence\n // ^ (exponentiation) is right associative\n && !(newPrecedece === exponentiationPrecedence && precedence === exponentiationPrecedence)) {\n break\n }\n const symbol: SymbolNode = specialExpressionTypes[name as SpecialExpressionName]\n ? withSourceCodeInfo([NodeTypes.SpecialBuiltinSymbol, specialExpressionTypes[name as SpecialExpressionName]], operator[2])\n : withSourceCodeInfo([NodeTypes.NormalBuiltinSymbol, normalExpressionTypes[name]!], operator[2])\n this.advance()\n const right = this.parseExpression(newPrecedece)\n left = fromBinaryOperatorToNode(operator, symbol, left, right, operator[2])\n }\n else if (isSymbolToken(operator)) {\n if (!isFunctionOperator(operator[1])) {\n break\n }\n const newPrecedece = binaryFunctionalOperatorPrecedence\n if (newPrecedece <= precedence) {\n break\n }\n const operatorSymbol = this.parseSymbol()\n const right = this.parseExpression(newPrecedece)\n if (isSpecialBuiltinSymbolNode(operatorSymbol)) {\n throw new LitsError('Special expressions are not allowed in binary functional operators', operatorSymbol[2])\n }\n left = createNamedNormalExpressionNode(operatorSymbol, [left, right], operator[2])\n }\n else if (operator?.[1] === '?') {\n if (conditionalOperatorPrecedence <= precedence) {\n break\n }\n this.advance()\n const trueNode = this.parseExpression()\n if (!isOperatorToken(this.peek(), ':')) {\n throw new LitsError('Expected :', this.peekSourceCodeInfo())\n }\n this.advance()\n const falseNode = this.parseExpression()\n left = withSourceCodeInfo([NodeTypes.SpecialExpression, [specialExpressionTypes.if, [left, trueNode, falseNode]]], left[2]) satisfies IfNode\n }\n else {\n break\n }\n\n operator = this.peek()\n }\n\n return left\n }\n\n asToken(token: Token | undefined): Token {\n if (!token) {\n throw new LitsError('Unexpected end of input', this.peekSourceCodeInfo())\n }\n return token\n }\n\n private parseOperand(): Node {\n let operand = this.parseOperandPart()\n let token = this.peek()\n\n while (isOperatorToken(token, '.') || isLBracketToken(token) || isLParenToken(token)) {\n if (token[1] === '.') {\n this.advance()\n const symbolToken = this.asToken(this.peek())\n if (!isSymbolToken(symbolToken)) {\n throw new LitsError('Expected symbol', this.peekSourceCodeInfo())\n }\n const stringNode: StringNode = withSourceCodeInfo([NodeTypes.String, symbolToken[1]], symbolToken[2])\n operand = createAccessorNode(operand, stringNode, token[2])\n this.advance()\n token = this.peek()\n }\n else if (isLBracketToken(token)) {\n this.advance()\n const expression = this.parseExpression()\n if (!isRBracketToken(this.peek())) {\n throw new LitsError('Expected closing bracket', this.peekSourceCodeInfo())\n }\n operand = createAccessorNode(operand, expression, token[2])\n this.advance()\n token = this.peek()\n }\n else if (isLParenToken(token)) {\n operand = this.parseFunctionCall(operand)\n token = this.peek()\n }\n }\n return operand\n }\n\n private parseOperandPart(): Node {\n const token = this.asToken(this.peek())\n\n // Parentheses\n if (isLParenToken(token)) {\n const positionBefore = this.parseState.position\n const lamdaFunction = this.parseLambdaFunction()\n if (lamdaFunction) {\n return lamdaFunction\n }\n this.parseState.position = positionBefore\n this.advance()\n const expression = this.parseExpression()\n if (!isRParenToken(this.peek())) {\n throw new LitsError('Expected closing parenthesis', this.peekSourceCodeInfo())\n }\n this.advance()\n return expression\n }\n\n else if (isOperatorToken(token)) {\n const operatorName = token[1]\n if (isBinaryOperator(operatorName)) {\n this.advance()\n if (specialExpressionTypes[operatorName as SpecialExpressionName] !== undefined) {\n return withSourceCodeInfo([NodeTypes.SpecialBuiltinSymbol, specialExpressionTypes[operatorName as SpecialExpressionName]], token[2]) satisfies SpecialBuiltinSymbolNode\n }\n return withSourceCodeInfo([NodeTypes.NormalBuiltinSymbol, normalExpressionTypes[operatorName as NormalExpressionName] as number], token[2]) satisfies NormalBuiltinSymbolNode\n }\n\n if (operatorName === '->') {\n return this.parseShorthandLambdaFunction()\n }\n else {\n throw new LitsError(`Illegal operator: ${operatorName}`, token[2])\n }\n }\n\n // Object litteral, e.g. {a: 1, b: 2}\n if (isLBraceToken(token)) {\n return this.parseObject()\n }\n\n // Array litteral, e.g. [1, 2]\n if (isLBracketToken(token)) {\n return this.parseArray()\n }\n\n const tokenType = token[0] as Exclude<\n TokenType,\n | 'Operator' // Handled above\n | 'LParen' // Handled above\n | 'LBrace' // Handled above\n | 'LBracket' // Handled above\n\n | 'RParen' // Illegal token\n | 'RBrace' // Illegal token\n | 'RBracket' // Illegal token\n\n | 'MultiLineComment' // Should have been removed\n | 'SingleLineComment' // Should have been removed\n | 'Whitespace' // Should have been removed\n >\n switch (tokenType) {\n case 'Number':\n case 'BasePrefixedNumber':\n return this.parseNumber()\n case 'string':\n return this.parseString(token as StringToken)\n case 'Symbol': {\n const positionBefore = this.parseState.position\n const lamdaFunction = this.parseLambdaFunction()\n if (lamdaFunction) {\n return lamdaFunction\n }\n this.parseState.position = positionBefore\n return this.parseSymbol()\n }\n case 'ReservedSymbol':\n return this.parseReservedSymbol()\n case 'RegexpShorthand':\n return this.parseRegexpShorthand()\n\n default:\n throw new LitsError(`Unknown token type: ${tokenType}`, token[2])\n }\n }\n\n private parseObject(): ObjectNode {\n const\n firstToken = asLBraceToken(this.peek())\n this.advance()\n const params: Node[] = []\n while (!this.isAtEnd() && !isRBraceToken(this.peek())) {\n if (isOperatorToken(this.peek(), '...')) {\n this.advance()\n params.push(withSourceCodeInfo([NodeTypes.Spread, this.parseExpression()], this.peekSourceCodeInfo()))\n }\n else {\n const token = this.peek()\n if (isStringToken(token)) {\n const stringNode = this.parseString(token)\n params.push(withSourceCodeInfo([NodeTypes.String, stringNode[1]], token[2]))\n }\n else if (isSymbolToken(token)) {\n const value = token[1].startsWith('\\'')\n ? this.stringFromQuotedSymbol(token[1])\n : token[1]\n params.push(withSourceCodeInfo([NodeTypes.String, value], token[2]))\n this.advance()\n }\n else if (isLBracketToken(token)) {\n this.advance()\n params.push(this.parseExpression())\n assertRBracketToken(this.peek())\n this.advance()\n }\n else {\n throw new LitsError('Expected key to be a symbol or a string', this.peekSourceCodeInfo())\n }\n\n assertOperatorToken(this.peek(), ':')\n this.advance()\n\n params.push(this.parseExpression())\n }\n const nextToken = this.peek()\n if (!isOperatorToken(nextToken, ',') && !isRBraceToken(nextToken)) {\n throw new LitsError('Expected comma or closing brace', this.peekSourceCodeInfo())\n }\n\n if (isOperatorToken(nextToken, ',')) {\n this.advance()\n }\n }\n\n assertRBraceToken(this.peek())\n this.advance()\n\n return withSourceCodeInfo([NodeTypes.SpecialExpression, [specialExpressionTypes.object, params]], firstToken[2])\n }\n\n private parseArray(): ArrayNode {\n const firstToken = asLBracketToken(this.peek())\n this.advance()\n const params: Node[] = []\n while (!this.isAtEnd() && !isRBracketToken(this.peek())) {\n if (isOperatorToken(this.peek(), '...')) {\n this.advance()\n params.push(withSourceCodeInfo([NodeTypes.Spread, this.parseExpression()], this.peekSourceCodeInfo()))\n }\n else {\n params.push(this.parseExpression())\n }\n const nextToken = this.peek()\n if (!isOperatorToken(nextToken, ',') && !isRBracketToken(nextToken)) {\n throw new LitsError('Expected comma or closing parenthesis', this.peekSourceCodeInfo())\n }\n if (isOperatorToken(nextToken, ',')) {\n this.advance()\n }\n }\n\n assertRBracketToken(this.peek())\n this.advance()\n\n return withSourceCodeInfo([NodeTypes.SpecialExpression, [specialExpressionTypes.array, params]], firstToken[2])\n }\n\n private parseFunctionCall(symbol: Node): Node {\n this.advance()\n\n const params: Node[] = []\n while (!this.isAtEnd() && !isRParenToken(this.peek())) {\n if (isOperatorToken(this.peek(), '...')) {\n this.advance()\n params.push(withSourceCodeInfo([NodeTypes.Spread, this.parseExpression()], this.peekSourceCodeInfo()))\n }\n else {\n params.push(this.parseExpression())\n }\n const nextToken = this.peek()\n if (!isOperatorToken(nextToken, ',') && !isRParenToken(nextToken)) {\n throw new LitsError('Expected comma or closing parenthesis', this.peek()?.[2])\n }\n if (isOperatorToken(nextToken, ',')) {\n this.advance()\n }\n }\n if (!isRParenToken(this.peek())) {\n throw new LitsError('Expected closing parenthesis', this.peekSourceCodeInfo())\n }\n this.advance()\n\n if (isSpecialBuiltinSymbolNode(symbol)) { // Named function\n const specialExpressionType = symbol[1]\n\n const type = specialExpressionType as Exclude<\n SpecialExpressionType,\n | typeof specialExpressionTypes.for\n | typeof specialExpressionTypes.if\n | typeof specialExpressionTypes.unless\n | typeof specialExpressionTypes.cond\n | typeof specialExpressionTypes.switch\n | typeof specialExpressionTypes.let\n | typeof specialExpressionTypes.block\n | typeof specialExpressionTypes.loop\n | typeof specialExpressionTypes.try\n | typeof specialExpressionTypes.doseq\n >\n const specialExpression: SpecialExpression = builtin.specialExpressions[type]\n assertNumberOfParams(specialExpression.arity, params.length, symbol[2])\n switch (type) {\n case specialExpressionTypes['||']:\n return withSourceCodeInfo([NodeTypes.SpecialExpression, [type, params]], symbol[2]) satisfies OrNode\n case specialExpressionTypes['&&']:\n return withSourceCodeInfo([NodeTypes.SpecialExpression, [type, params]], symbol[2]) satisfies AndNode\n case specialExpressionTypes.recur:\n return withSourceCodeInfo([NodeTypes.SpecialExpression, [type, params]], symbol[2]) satisfies RecurNode\n case specialExpressionTypes.array:\n return withSourceCodeInfo([NodeTypes.SpecialExpression, [type, params]], symbol[2]) satisfies ArrayNode\n case specialExpressionTypes.object:\n return withSourceCodeInfo([NodeTypes.SpecialExpression, [type, params]], symbol[2]) satisfies ObjectNode\n case specialExpressionTypes['??']:\n return withSourceCodeInfo([NodeTypes.SpecialExpression, [type, params]], symbol[2]) satisfies QqNode\n case specialExpressionTypes['defined?']: {\n const [param] = params\n return withSourceCodeInfo([NodeTypes.SpecialExpression, [type, param as SymbolNode]], symbol[2]) satisfies DefinedNode\n }\n case specialExpressionTypes.throw: {\n const [param] = params\n return withSourceCodeInfo([NodeTypes.SpecialExpression, [type, param!]], symbol[2]) satisfies ThrowNode\n }\n case specialExpressionTypes['0_lambda']:\n case specialExpressionTypes['0_def']:\n throw new LitsError(`${type} is not allowed`, symbol[2])\n /* v8 ignore next 2 */\n default:\n throw new LitsError(`Unknown special expression: ${type satisfies never}`, symbol[2])\n }\n }\n else if (isNormalBuiltinSymbolNode(symbol) || isUserDefinedSymbolNode(symbol)) {\n return createNamedNormalExpressionNode(symbol, params, symbol[2])\n }\n\n else {\n return withSourceCodeInfo([NodeTypes.NormalExpression, [symbol, params]], symbol[2]) satisfies NormalExpressionNodeExpression\n }\n }\n\n parseLambdaFunction(): LambdaNode | null {\n const firstToken = this.asToken(this.peek())\n\n if (isLParenToken(firstToken)\n && isSymbolToken(this.peekAhead(1))\n && isOperatorToken(this.peekAhead(2), '->')) {\n return null\n }\n\n try {\n const functionArguments = this.parseFunctionArguments()\n\n if (!isOperatorToken(this.peek(), '->')) {\n return null\n }\n this.advance()\n let nodes: Node[] | undefined\n let docString = ''\n if (isReservedSymbolToken(this.peek(), 'do')) {\n const parsedBlock = this.parseBlock(true)\n docString = parsedBlock[1]\n nodes = parsedBlock[0][1][1]\n }\n else {\n nodes = [this.parseExpression()]\n }\n\n return withSourceCodeInfo([\n NodeTypes.SpecialExpression,\n [\n specialExpressionTypes['0_lambda'],\n [\n functionArguments,\n nodes,\n ],\n docString,\n ],\n ], firstToken[2]) satisfies LambdaNode\n }\n catch {\n return null\n }\n }\n\n parseFunctionArguments(): BindingTarget[] {\n const firstToken = this.peek()\n if (isSymbolToken(firstToken)) {\n return [withSourceCodeInfo([bindingTargetTypes.symbol, [this.parseSymbol(), undefined]], firstToken[2])]\n }\n\n assertLParenToken(firstToken)\n this.advance()\n\n let rest = false\n let defaults = false\n const functionArguments: BindingTarget[] = []\n while (!this.isAtEnd() && !isRParenToken(this.peek()) && !isSymbolToken(this.peek(), 'let')) {\n if (rest) {\n throw new LitsError('Rest argument must be last', this.peekSourceCodeInfo())\n }\n const bindingTarget = this.parseBindingTarget()\n if (bindingTarget[1][1] !== undefined) {\n defaults = true\n }\n if (bindingTarget[0] === bindingTargetTypes.rest) {\n rest = true\n }\n if (defaults && !bindingTarget[1][1]) {\n throw new LitsError('Default arguments must be last', this.peekSourceCodeInfo())\n }\n functionArguments.push(bindingTarget)\n\n if (!isOperatorToken(this.peek(), ',') && !isRParenToken(this.peek()) && !isSymbolToken(this.peek(), 'let')) {\n throw new LitsError('Expected comma or closing parenthesis', this.peekSourceCodeInfo())\n }\n if (isOperatorToken(this.peek(), ',')) {\n this.advance()\n }\n }\n\n if (!isRParenToken(this.peek())) {\n throw new LitsError('Expected closing parenthesis', this.peekSourceCodeInfo())\n }\n\n this.advance()\n\n return functionArguments\n }\n\n private parseShorthandLambdaFunction(): LambdaNode {\n const firstToken = this.asToken(this.peek())\n this.advance()\n const startPos = this.parseState.position\n\n let nodes: Node[] | undefined\n let docString = ''\n if (isReservedSymbolToken(this.peek(), 'do')) {\n const parsedBlock = this.parseBlock(true)\n docString = parsedBlock[1]\n nodes = parsedBlock[0][1][1]\n }\n else {\n nodes = [this.parseExpression()]\n }\n\n const endPos = this.parseState.position - 1\n\n let arity = 0\n let dollar1: 'NOT_SET' | 'WITH_1' | 'NAKED' = 'NOT_SET' // referring to argument bindings. $ = NAKED, $1, $2, $3, etc = WITH_1\n for (let pos = startPos; pos <= endPos; pos += 1) {\n const token = this.tokenStream.tokens[pos]!\n if (isSymbolToken(token)) {\n const match = placeholderRegexp.exec(token[1])\n if (match) {\n const number = match[1] ?? '1'\n if (number === '1') {\n const mixedPercent1 = (!match[1] && dollar1 === 'WITH_1') || (match[1] && dollar1 === 'NAKED')\n if (mixedPercent1)\n throw new LitsError('Please make up your mind, either use $ or $1', firstToken[2])\n\n dollar1 = match[1] ? 'WITH_1' : 'NAKED'\n }\n\n arity = Math.max(arity, Number(number))\n if (arity > maxShorthandLambdaArity)\n throw new LitsError('Can\\'t specify more than 20 arguments', firstToken[2])\n }\n }\n }\n\n const functionArguments: BindingTarget[] = []\n\n for (let i = 1; i <= arity; i += 1) {\n if (i === 1 && dollar1 === 'NAKED') {\n functionArguments.push(withSourceCodeInfo([bindingTargetTypes.symbol, [[NodeTypes.UserDefinedSymbol, '$'], undefined]], firstToken[2]))\n }\n else {\n functionArguments.push(withSourceCodeInfo([bindingTargetTypes.symbol, [[NodeTypes.UserDefinedSymbol, `$${i}`], undefined]], firstToken[2]))\n }\n }\n\n const node: LambdaNode = withSourceCodeInfo([NodeTypes.SpecialExpression, [specialExpressionTypes['0_lambda'], [\n functionArguments,\n nodes,\n ], docString]], firstToken[2])\n\n return node\n }\n\n private parseOptionalDefaulValue(): Node | undefined {\n if (isOperatorToken(this.peek(), '=')) {\n this.advance()\n return this.parseExpression()\n }\n return undefined\n }\n\n private parseBindingTarget({ requireDefaultValue, noRest }: { requireDefaultValue?: true, noRest?: true } = {}): BindingTarget {\n const firstToken = this.peek()\n\n // Symbol\n if (isSymbolToken(firstToken)) {\n const symbol = this.parseSymbol()\n if (!isUserDefinedSymbolNode(symbol)) {\n throw new LitsError('Expected user defined symbol', firstToken[2])\n }\n\n const defaultValue = this.parseOptionalDefaulValue()\n if (requireDefaultValue && !defaultValue) {\n throw new LitsError('Expected assignment', this.peekSourceCodeInfo())\n }\n\n return withSourceCodeInfo([bindingTargetTypes.symbol, [symbol, defaultValue]], firstToken[2])\n }\n\n // Rest\n if (isOperatorToken(firstToken, '...')) {\n if (noRest) {\n throw new LitsError('Rest element not allowed', firstToken[2])\n }\n this.advance()\n const symbol = asUserDefinedSymbolNode(this.parseSymbol())\n if (isOperatorToken(this.peek(), '=')) {\n throw new LitsError('Rest argument can not have default value', this.peekSourceCodeInfo())\n }\n return withSourceCodeInfo([bindingTargetTypes.rest, [symbol[1], undefined]], firstToken[2])\n }\n\n // Array\n if (isLBracketToken(firstToken)) {\n this.advance()\n const elements: (BindingTarget | null)[] = []\n let token = this.asToken(this.peek())\n\n let rest = false\n while (!isRBracketToken(token)) {\n if (rest) {\n throw new LitsError('Rest argument must be last', token[2])\n }\n if (isOperatorToken(token, ',')) {\n elements.push(null)\n this.advance()\n token = this.asToken(this.peek())\n continue\n }\n\n const target = this.parseBindingTarget()\n\n if (target[0] === bindingTargetTypes.rest) {\n rest = true\n }\n\n elements.push(target)\n token = this.asToken(this.peek())\n\n if (!isRBracketToken(token)) {\n assertOperatorToken(token, ',')\n this.advance()\n }\n token = this.asToken(this.peek())\n }\n this.advance()\n\n const defaultValue = this.parseOptionalDefaulValue()\n if (requireDefaultValue && !defaultValue) {\n throw new LitsError('Expected assignment', this.peekSourceCodeInfo())\n }\n\n return withSourceCodeInfo([bindingTargetTypes.array, [elements, defaultValue]], firstToken[2])\n }\n\n // Object\n if (isLBraceToken(firstToken)) {\n this.advance()\n const elements: Record<string, BindingTarget> = {}\n let token = this.asToken(this.peek())\n let rest = false\n while (!isRBraceToken(token)) {\n if (rest) {\n throw new LitsError('Rest argument must be last', token[2])\n }\n if (isOperatorToken(token, '...')) {\n rest = true\n this.advance()\n }\n // Parse the key symbol - can be any symbol type (including builtins) when using 'as' alias\n const keySymbol = this.parseSymbol()\n const keyName = getSymbolName(keySymbol)\n token = this.asToken(this.peek())\n if (isReservedSymbolToken(token, 'as')) {\n if (rest) {\n throw new LitsError('Rest argument can not have alias', token[2])\n }\n this.advance()\n const name = asUserDefinedSymbolNode(this.parseSymbol())\n if (elements[name[1]]) {\n throw new LitsError(`Duplicate binding name: ${name}`, token[2])\n }\n elements[keyName] = withSourceCodeInfo([bindingTargetTypes.symbol, [name, this.parseOptionalDefaulValue()]], firstToken[2])\n }\n else if (isRBraceToken(token) || isOperatorToken(token, ',') || isOperatorToken(token, '=')) {\n // Without 'as' alias, the key becomes the binding name - must be user-defined symbol\n const key = asUserDefinedSymbolNode(keySymbol, keySymbol[2])\n if (elements[key[1]]) {\n throw new LitsError(`Duplicate binding name: ${key}`, token[2])\n }\n if (rest && isOperatorToken(this.peek(), '=')) {\n throw new LitsError('Rest argument can not have default value', this.peekSourceCodeInfo())\n }\n\n elements[key[1]] = rest\n ? withSourceCodeInfo([bindingTargetTypes.rest, [key[1], this.parseOptionalDefaulValue()]], firstToken[2])\n : withSourceCodeInfo([bindingTargetTypes.symbol, [key, this.parseOptionalDefaulValue()]], firstToken[2])\n }\n else if (isOperatorToken(token, ':')) {\n this.advance()\n token = this.asToken(this.peek())\n if (!isLBraceToken(token) && !isLBracketToken(token)) {\n throw new LitsError('Expected object or array', token[2])\n }\n elements[keyName] = this.parseBindingTarget()\n }\n\n if (!isRBraceToken(this.peek())) {\n assertOperatorToken(this.peek(), ',')\n this.advance()\n }\n token = this.asToken(this.peek())\n }\n this.advance()\n token = this.asToken(this.peek())\n\n const defaultValue = this.parseOptionalDefaulValue()\n if (requireDefaultValue && !defaultValue) {\n throw new LitsError('Expected assignment', token[2])\n }\n\n return withSourceCodeInfo([bindingTargetTypes.object, [elements, defaultValue]], firstToken[2])\n }\n\n throw new LitsError('Expected symbol', this.peekSourceCodeInfo())\n }\n\n private parseLet(token: SymbolToken): LetNode {\n this.advance()\n\n const target = this.parseBindingTarget({ requireDefaultValue: true, noRest: true })\n\n const value = target[1][1]!\n target[1][1] = undefined\n\n const bindingTarget: BindingNode = withSourceCodeInfo([NodeTypes.Binding, [target, value]], token[2])\n return withSourceCodeInfo([NodeTypes.SpecialExpression, [specialExpressionTypes.let, bindingTarget]], token[2]) satisfies LetNode\n }\n\n private parseBlock(allowDocString = false): [DoNode, string] {\n const token = asReservedSymbolToken(this.peek(), 'do')\n this.advance()\n let docString: string = ''\n if (allowDocString && isDocStringToken(this.peek())) {\n docString = this.parseDocString()\n }\n\n const expressions: Node[] = []\n while (!this.isAtEnd() && !isReservedSymbolToken(this.peek(), 'end')) {\n expressions.push(this.parseExpression())\n if (isOperatorToken(this.peek(), ';')) {\n this.advance()\n }\n else if (!isReservedSymbolToken(this.peek(), 'end')) {\n throw new LitsError('Expected end', this.peekSourceCodeInfo())\n }\n }\n assertReservedSymbolToken(this.peek(), 'end')\n this.advance()\n return [\n withSourceCodeInfo([NodeTypes.SpecialExpression, [specialExpressionTypes.block, expressions]], token[2]) satisfies DoNode,\n docString,\n ]\n }\n\n private parseImplicitBlock(ends: ImplicitBlockEnd[]): Node {\n const nodes: Node[] = []\n while (!this.isAtEnd() && !this.isImplicitBlockEnd(ends)) {\n if (isOperatorToken(this.peek(), ';')) {\n this.advance()\n }\n else {\n nodes.push(this.parseExpression())\n }\n }\n this.assertImplicitBlockEnd(ends)\n\n if (nodes.length === 0) {\n throw new LitsError('Expected expression', this.peekSourceCodeInfo())\n }\n\n return nodes.length === 1\n ? nodes[0]!\n : withSourceCodeInfo([NodeTypes.SpecialExpression, [specialExpressionTypes.block, nodes]], this.peekSourceCodeInfo()) satisfies DoNode\n }\n\n private assertImplicitBlockEnd(ends: ImplicitBlockEnd[]): void {\n if (!this.isImplicitBlockEnd(ends)) {\n throw new LitsError(`Expected ${ends.map(e => e[1]).join(' or ')}`, this.peekSourceCodeInfo())\n }\n }\n\n private isImplicitBlockEnd(ends: ImplicitBlockEnd[]): boolean {\n for (const end of ends) {\n if (isReservedSymbolToken(this.peek(), end)) {\n return true\n }\n }\n return false\n }\n\n private parseLoop(firstToken: SymbolToken): LoopNode {\n this.advance()\n\n assertLParenToken(this.peek())\n this.advance()\n\n const bindingNodes: BindingNode[] = []\n let token = this.peek()\n while (!this.isAtEnd() && !isRParenToken(token)) {\n const target = this.parseBindingTarget({ requireDefaultValue: true, noRest: true })\n const value = target[1][1]!\n target[1][1] = undefined\n\n bindingNodes.push(withSourceCodeInfo([NodeTypes.Binding, [target, value]], target[2]) satisfies BindingNode)\n\n if (isOperatorToken(this.peek(), ',')) {\n this.advance()\n }\n token = this.peek()\n }\n if (bindingNodes.length === 0) {\n throw new LitsError('Expected binding', this.peekSourceCodeInfo())\n }\n\n assertRParenToken(token)\n this.advance()\n\n assertOperatorToken(this.peek(), '->')\n this.advance()\n\n const expression = this.parseExpression()\n\n return withSourceCodeInfo([NodeTypes.SpecialExpression, [specialExpressionTypes.loop, bindingNodes, expression]], firstToken[2]) satisfies LoopNode\n }\n\n private parseTry(token: SymbolToken): TryNode {\n this.advance()\n const tryExpression = this.parseImplicitBlock(['catch'])\n\n this.advance()\n\n let errorSymbol: SymbolNode | undefined\n if (isLParenToken(this.peek())) {\n this.advance()\n errorSymbol = this.parseSymbol()\n assertRParenToken(this.peek())\n this.advance()\n }\n\n const catchExpression = this.parseImplicitBlock(['end'])\n\n this.advance()\n\n return withSourceCodeInfo([NodeTypes.SpecialExpression, [specialExpressionTypes.try, tryExpression, errorSymbol, catchExpression]], token[2]) satisfies TryNode\n }\n\n private parseForOrDoseq(firstToken: SymbolToken): ForNode | DoSeqNode {\n const isDoseq = firstToken[1] === 'doseq'\n this.advance()\n\n assertLParenToken(this.peek())\n this.advance()\n\n const forLoopBindings: LoopBindingNode[] = []\n\n while (!this.isAtEnd() && !isRParenToken(this.peek())) {\n const loopBinding = this.parseForLoopBinding()\n const existingBoundNames = forLoopBindings.flatMap(b => Object.keys(getAllBindingTargetNames(b[0][1][0])))\n const newBoundNames = getAllBindingTargetNames(loopBinding[0][1][0])\n if (Object.keys(newBoundNames).some(n => existingBoundNames.includes(n))) {\n throw new LitsError('Duplicate binding', loopBinding[0][2])\n }\n forLoopBindings.push(loopBinding)\n if (isOperatorToken(this.peek(), ',')) {\n this.advance()\n }\n }\n\n assertRParenToken(this.peek())\n this.advance()\n\n assertOperatorToken(this.peek(), '->')\n this.advance()\n\n const expression = this.parseExpression()\n\n return isDoseq\n ? withSourceCodeInfo([NodeTypes.SpecialExpression, [specialExpressionTypes.doseq, forLoopBindings, expression]], firstToken[2]) satisfies DoSeqNode\n : withSourceCodeInfo([NodeTypes.SpecialExpression, [specialExpressionTypes.for, forLoopBindings, expression]], firstToken[2]) satisfies ForNode\n }\n\n private parseForLoopBinding(): LoopBindingNode {\n const bindingNode = this.parseBinding()\n\n const modifiers: Array<'&let' | '&when' | '&while'> = []\n let token = this.asToken(this.peek())\n\n this.assertInternalLoopBindingDelimiter(token, ['let', 'when', 'while'])\n\n const letBindings: BindingNode[] = []\n if (token[1] === 'let') {\n modifiers.push('&let')\n while (isSymbolToken(token, 'let')) {\n const letNode = this.parseLet(token)\n const existingBoundNames = letBindings.flatMap(b => Object.keys(getAllBindingTargetNames(b[1][0])))\n const newBoundNames = Object.keys(getAllBindingTargetNames(letNode[1][1][1][0]))\n if (newBoundNames.some(n => existingBoundNames.includes(n))) {\n throw new LitsError('Duplicate binding', letNode[1][1][2])\n }\n\n letBindings.push(letNode[1][1])\n token = this.asToken(this.peek())\n this.assertInternalLoopBindingDelimiter(token, ['let', 'when', 'while'])\n token = this.asToken(this.peek())\n }\n }\n\n let whenNode: Node | undefined\n let whileNode: Node | undefined\n while (\n isReservedSymbolToken(token, 'when')\n || isReservedSymbolToken(token, 'while')\n ) {\n this.advance()\n\n if (token[1] === 'when') {\n modifiers.push('&when')\n whenNode = this.parseExpression()\n }\n else {\n modifiers.push('&while')\n whileNode = this.parseExpression()\n }\n token = this.asToken(this.peek())\n\n const symbols: ('when' | 'while')[] = modifiers.includes('&when') && modifiers.includes('&while')\n ? []\n : modifiers.includes('&when')\n ? ['while']\n : ['when']\n\n this.assertInternalLoopBindingDelimiter(token, symbols)\n token = this.asToken(this.peek())\n }\n\n this.assertInternalLoopBindingDelimiter(token, [])\n\n return [bindingNode, letBindings, whenNode, whileNode] satisfies LoopBindingNode\n }\n\n assertInternalLoopBindingDelimiter(token: Token, symbols: InternalLoopBindingDelimiter[]): void {\n if (!this.isInternalLoopBindingDelimiter(token, symbols)) {\n const symbolsString = `${[...symbols, ','].map(symbol => `\"${symbol}\"`).join(', ')} or \")\"`\n throw new LitsError(`Expected symbol ${symbolsString}`, token[2])\n }\n }\n\n isInternalLoopBindingDelimiter(token: Token, symbols: InternalLoopBindingDelimiter[]): boolean {\n // end of loop binding\n if (isOperatorToken(token, ',') || isRParenToken(token)) {\n return true\n }\n for (const symbol of symbols) {\n if (symbol === 'let' && isSymbolToken(token, 'let')) {\n return true\n }\n if (['when', 'while'].includes(symbol) && isReservedSymbolToken(token, symbol as 'when' | 'while')) {\n return true\n }\n }\n return false\n }\n\n private parseBinding(): BindingNode {\n const firstToken = asSymbolToken(this.peek())\n const name = asUserDefinedSymbolNode(this.parseSymbol())\n\n assertReservedSymbolToken(this.peek(), 'in')\n this.advance()\n\n const value = this.parseExpression()\n\n const node: BindingNode = withSourceCodeInfo(\n [\n NodeTypes.Binding,\n [\n withSourceCodeInfo([bindingTargetTypes.symbol, [name, undefined]], firstToken[2]),\n value,\n ],\n ],\n firstToken[2],\n )\n return node\n }\n\n parseIfOrUnless(token: SymbolToken): IfNode | UnlessNode {\n const isUnless = token[1] === 'unless'\n this.advance()\n const condition = this.parseExpression()\n assertReservedSymbolToken(this.peek(), 'then')\n this.advance()\n const thenExpression = this.parseImplicitBlock(['else', 'end'])\n\n let elseExpression: Node | undefined\n if (isReservedSymbolToken(this.peek(), 'else')) {\n this.advance()\n elseExpression = this.parseImplicitBlock(['end'])\n }\n\n this.advance()\n\n return isUnless\n ? withSourceCodeInfo([NodeTypes.SpecialExpression, [specialExpressionTypes.unless, [condition, thenExpression, elseExpression]]], token[2]) satisfies UnlessNode\n : withSourceCodeInfo([NodeTypes.SpecialExpression, [specialExpressionTypes.if, [condition, thenExpression, elseExpression]]], token[2]) satisfies IfNode\n }\n\n parseCond(token: SymbolToken): CondNode {\n this.advance()\n\n const params: [Node, Node][] = []\n\n while (!this.isAtEnd() && !isReservedSymbolToken(this.peek(), 'end')) {\n assertReservedSymbolToken(this.peek(), 'case')\n this.advance()\n const caseExpression = this.parseExpression()\n assertReservedSymbolToken(this.peek(), 'then')\n this.advance()\n const thenExpression = this.parseImplicitBlock(['case', 'end'])\n\n params.push([caseExpression, thenExpression])\n if (isReservedSymbolToken(this.peek(), 'end')) {\n break\n }\n }\n\n assertReservedSymbolToken(this.peek())\n this.advance()\n\n return withSourceCodeInfo([NodeTypes.SpecialExpression, [specialExpressionTypes.cond, params]], token[2]) satisfies CondNode\n }\n\n parseSwitch(token: SymbolToken): SwitchNode {\n this.advance()\n const valueExpression = this.parseExpression()\n const params: [Node, Node][] = []\n\n while (!this.isAtEnd() && !isReservedSymbolToken(this.peek(), 'end')) {\n assertReservedSymbolToken(this.peek(), 'case')\n this.advance()\n const caseExpression = this.parseExpression()\n assertReservedSymbolToken(this.peek(), 'then')\n this.advance()\n const thenExpression = this.parseImplicitBlock(['case', 'end'])\n\n params.push([caseExpression, thenExpression])\n if (isReservedSymbolToken(this.peek(), 'end')) {\n break\n }\n }\n\n assertReservedSymbolToken(this.peek(), 'end')\n this.advance()\n\n return withSourceCodeInfo([NodeTypes.SpecialExpression, [specialExpressionTypes.switch, valueExpression, params]], token[2]) satisfies SwitchNode\n }\n\n private isAtEnd(): boolean {\n return this.parseState.position >= this.tokenStream.tokens.length\n }\n\n private isAtExpressionEnd(): boolean {\n if (this.isAtEnd()) {\n return true\n }\n const token = this.peek()\n if (isOperatorToken(token)) {\n return [';', ',', ':'].includes(token[1])\n }\n if (isReservedSymbolToken(token)) {\n return ['else', 'when', 'while', 'case', 'catch', 'let', 'then', 'end', 'do'].includes(token[1])\n }\n return false\n }\n\n private parseExport(exportToken: ReservedSymbolToken<'export'>): DefNode {\n this.advance()\n const token = this.peek()\n if (isSymbolToken(token, 'let')) {\n const letNode = this.parseLet(asSymbolToken(token))\n return withSourceCodeInfo([NodeTypes.SpecialExpression, [specialExpressionTypes['0_def'], letNode[1][1]]], exportToken[2]) satisfies DefNode\n }\n else {\n throw new LitsError('Expected let', this.peekSourceCodeInfo())\n }\n }\n\n private stringToSymbolNode(value: string, sourceCodeInfo: SourceCodeInfo | undefined): SymbolNode {\n if (specialExpressionTypes[value as SpecialExpressionName] !== undefined && value !== 'fn' && value !== 'def' && value !== 'defn') {\n return withSourceCodeInfo([NodeTypes.SpecialBuiltinSymbol, specialExpressionTypes[value as SpecialExpressionName]], sourceCodeInfo) satisfies SymbolNode\n }\n if (normalExpressionTypes[value as NormalExpressionName] !== undefined) {\n return withSourceCodeInfo([NodeTypes.NormalBuiltinSymbol, normalExpressionTypes[value as NormalExpressionName] as number], sourceCodeInfo) satisfies SymbolNode\n }\n return withSourceCodeInfo([NodeTypes.UserDefinedSymbol, value], sourceCodeInfo) satisfies SymbolNode\n }\n\n stringFromQuotedSymbol(value: string): string {\n return value.substring(1, value.length - 1)\n .replace(\n /(\\\\{2})|(\\\\')|\\\\(.)/g,\n (\n _,\n backslash: string,\n singleQuote: string,\n normalChar: string,\n ) => {\n if (backslash) {\n return '\\\\'\n }\n if (singleQuote) {\n return '\\''\n }\n return `\\\\${normalChar}`\n },\n )\n }\n\n private parseSymbol(): SymbolNode | NormalBuiltinSymbolNode | SpecialBuiltinSymbolNode {\n const token = this.asToken(this.peek())\n this.advance()\n if (!isSymbolToken(token)) {\n throw new LitsError(`Expected symbol token, got ${token[0]}`, token[2])\n }\n if (token[1][0] === '\\'') {\n return this.stringToSymbolNode(this.stringFromQuotedSymbol(token[1]), token[2])\n }\n else {\n return this.stringToSymbolNode(token[1], token[2])\n }\n }\n\n private parseReservedSymbol(): ReservedSymbolNode | NumberNode {\n const token = asReservedSymbolToken(this.peek())\n this.advance()\n\n const symbol = token[1]\n if (isNumberReservedSymbol(symbol)) {\n return withSourceCodeInfo([NodeTypes.Number, numberReservedSymbolRecord[symbol]], token[2]) satisfies NumberNode\n }\n return withSourceCodeInfo([NodeTypes.ReservedSymbol, token[1]], token[2]) satisfies ReservedSymbolNode\n }\n\n private parseNumber(): NumberNode {\n const token = this.asToken(this.peek())\n this.advance()\n\n const value = token[1]\n const negative = value[0] === '-'\n const numberString = (negative ? value.substring(1) : value).replace(/_/g, '')\n return withSourceCodeInfo([NodeTypes.Number, negative ? -Number(numberString) : Number(numberString)], token[2]) satisfies NumberNode\n }\n\n private parseDocString(): string {\n const token = this.asToken(this.peek())\n const stringToken: StringToken = token[2] ? ['string', token[1].slice(2, -2), token[2]] : ['string', token[1].slice(2, -2)]\n const stringNode = this.parseString(stringToken)\n return smartTrim(stringNode[1]) // Extract the string value from the StringNode\n }\n\n private parseString(token: StringToken): StringNode {\n this.advance()\n const value = token[1].substring(1, token[1].length - 1)\n .replace(\n /(\\\\{2})|(\\\\\")|(\\\\n)|(\\\\t)|(\\\\r)|(\\\\b)|(\\\\f)|\\\\(.)/g,\n (\n _,\n backslash: string,\n doubleQuote: string,\n newline: string,\n tab: string,\n carriageReturn: string,\n backspace: string,\n formFeed: string,\n normalChar: string,\n ) => {\n // If it's a double escape (\\\\x), return \\x\n if (backslash) {\n return '\\\\'\n }\n // If it's a special character (\\n, \\t, \\r, \\b, \\f), return the special character\n else if (newline) {\n return '\\n'\n }\n else if (tab) {\n return '\\t'\n }\n else if (carriageReturn) {\n return '\\r'\n }\n else if (backspace) {\n return '\\b'\n }\n else if (formFeed) {\n return '\\f'\n }\n else if (doubleQuote) {\n return '\"'\n }\n return normalChar\n },\n )\n\n return withSourceCodeInfo([NodeTypes.String, value], token[2]) satisfies StringNode\n }\n\n private parseRegexpShorthand(): NormalExpressionNodeWithName {\n const token = this.asToken(this.peek())\n this.advance()\n\n const endStringPosition = token[1].lastIndexOf('\"')\n const regexpString = token[1].substring(2, endStringPosition)\n const optionsString = token[1].substring(endStringPosition + 1)\n const stringNode: StringNode = withSourceCodeInfo([NodeTypes.String, regexpString], token[2]) satisfies StringNode\n\n const optionsNode: StringNode = withSourceCodeInfo([NodeTypes.String, optionsString], token[2]) satisfies StringNode\n\n const node: NormalExpressionNodeWithName = withSourceCodeInfo([\n NodeTypes.NormalExpression,\n [\n withSourceCodeInfo([NodeTypes.NormalBuiltinSymbol, normalExpressionTypes.regexp as number], token[2]),\n [stringNode, optionsNode],\n ],\n ], token[2])\n\n return node\n }\n}\n","import { normalExpressionKeys, specialExpressionKeys } from '../builtin'\nimport type { ContextParams, Lits } from '../Lits/Lits'\nimport { reservedSymbolRecord } from '../tokenizer/reservedNames'\n\nexport type AutoCompleteSuggestion = {\n program: string\n position: number\n}\n\nconst litsCommands = new Set([...normalExpressionKeys, ...specialExpressionKeys, ...Object.keys(reservedSymbolRecord)])\n\n// TODO: replace with get suggestions function\nexport class AutoCompleter {\n private prefixProgram: string = ''\n private suffixProgram: string = ''\n private searchString: string = ''\n private suggestions: string[] = []\n private suggestionIndex: null | number = null\n\n constructor(public readonly originalProgram: string, public readonly originalPosition: number, lits: Lits, params: ContextParams) {\n const partialProgram = this.originalProgram.slice(0, this.originalPosition)\n const tokenStream = lits.tokenize(partialProgram)\n\n const lastToken = tokenStream.tokens.at(-1)\n if (!lastToken) {\n return\n }\n\n if (lastToken[0] === 'Error') {\n return\n }\n\n this.searchString = lastToken[1]\n this.prefixProgram = this.originalProgram.slice(0, this.originalPosition - this.searchString.length)\n this.suffixProgram = this.originalProgram.slice(this.prefixProgram.length + this.searchString.length)\n this.originalProgram.slice(this.prefixProgram.length + this.searchString.length)\n this.suggestions = this.generateSuggestions(params)\n }\n\n public getNextSuggestion(): AutoCompleteSuggestion | null {\n return this.getAutoCompleteSuggestionResult(this.getNextSuggestionSymbol())\n }\n\n public getPreviousSuggestion(): AutoCompleteSuggestion | null {\n return this.getAutoCompleteSuggestionResult(this.getPreviousSuggestionSymbol())\n }\n\n private getAutoCompleteSuggestionResult(suggestion: string | null): AutoCompleteSuggestion | null {\n if (suggestion === null) {\n return null\n }\n\n return {\n program: this.prefixProgram + suggestion + this.suffixProgram,\n position: this.prefixProgram.length + suggestion.length,\n }\n }\n\n private getNextSuggestionSymbol(): string | null {\n if (this.suggestions.length === 0) {\n return null\n }\n\n if (this.suggestionIndex === null) {\n this.suggestionIndex = 0\n }\n else {\n this.suggestionIndex += 1\n if (this.suggestionIndex >= this.suggestions.length) {\n this.suggestionIndex = 0\n }\n }\n\n return this.suggestions[this.suggestionIndex]!\n }\n\n private getPreviousSuggestionSymbol(): string | null {\n if (this.suggestions.length === 0) {\n return null\n }\n\n if (this.suggestionIndex === null) {\n this.suggestionIndex = this.suggestions.length - 1\n }\n else {\n this.suggestionIndex -= 1\n if (this.suggestionIndex < 0) {\n this.suggestionIndex = this.suggestions.length - 1\n }\n }\n\n return this.suggestions[this.suggestionIndex]!\n }\n\n public getSuggestions(): string[] {\n return [...this.suggestions]\n }\n\n public getSearchString(): string {\n return this.searchString\n }\n\n private generateSuggestions(params: ContextParams): string[] {\n const blacklist = new Set<string>(['0_def', '0_defn', '0_lambda'])\n\n const startsWithCaseSensitive = this.generateWithPredicate(params, suggestion =>\n !blacklist.has(suggestion) && suggestion.startsWith(this.searchString))\n startsWithCaseSensitive.forEach(suggestion => blacklist.add(suggestion))\n\n const startsWithCaseInsensitive = this.generateWithPredicate(params, suggestion =>\n !blacklist.has(suggestion) && suggestion.toLowerCase().startsWith(this.searchString.toLowerCase()))\n startsWithCaseInsensitive.forEach(suggestion => blacklist.add(suggestion))\n\n const includesCaseSensitive = this.generateWithPredicate(params, suggestion =>\n !blacklist.has(suggestion) && suggestion.includes(this.searchString))\n includesCaseSensitive.forEach(suggestion => blacklist.add(suggestion))\n\n const includesCaseInsensitive = this.generateWithPredicate(params, suggestion =>\n !blacklist.has(suggestion) && suggestion.includes(this.searchString.toLowerCase()))\n includesCaseInsensitive.forEach(suggestion => blacklist.add(suggestion))\n\n return [...startsWithCaseSensitive, ...startsWithCaseInsensitive, ...includesCaseSensitive, ...includesCaseInsensitive]\n }\n\n private generateWithPredicate(params: ContextParams, shouldInclude: (suggestion: string) => boolean): string[] {\n const suggestions = new Set<string>()\n\n litsCommands.forEach((suggestion) => {\n if (shouldInclude(suggestion)) {\n suggestions.add(suggestion)\n }\n })\n\n Object.keys(params.globalContext ?? {})\n .filter(shouldInclude)\n .forEach(suggestion => suggestions.add(suggestion))\n\n params.contexts?.forEach((context) => {\n Object.keys(context)\n .filter(shouldInclude)\n .forEach(suggestion => suggestions.add(suggestion))\n })\n\n Object.keys(params.jsFunctions ?? {})\n .filter(shouldInclude)\n .forEach(suggestion => suggestions.add(suggestion))\n\n Object.keys(params.values ?? {})\n .filter(shouldInclude)\n .forEach(suggestion => suggestions.add(suggestion))\n\n return [...suggestions].sort((a, b) => a.localeCompare(b))\n }\n}\n","import type { Ast } from '../parser/types'\nimport { toNonNegativeInteger } from '../utils'\nimport { valueToString } from '../utils/debug/debugTools'\n\ninterface CacheEntry {\n key: string\n value: Ast\n nextEntry: CacheEntry | undefined\n}\n\nexport class Cache {\n private cache: Record<string, CacheEntry> = {}\n private firstEntry: CacheEntry | undefined = undefined\n private lastEntry: CacheEntry | undefined = undefined\n private _size = 0\n private maxSize: number | null\n constructor(maxSize: number | null) {\n this.maxSize = maxSize === null ? null : toNonNegativeInteger(maxSize)\n if (typeof this.maxSize === 'number' && this.maxSize < 1)\n throw new Error(`1 is the minimum maxSize, got ${valueToString(maxSize)}`)\n }\n\n public getContent(): Record<string, Ast> {\n return Object.entries(this.cache).reduce((result: Record<string, Ast>, [key, entry]) => {\n result[key] = entry.value\n return result\n }, {})\n }\n\n public get size(): number {\n return this._size\n }\n\n public get(key: string): Ast | undefined {\n return this.cache[key]?.value\n }\n\n public clear(): void {\n this.cache = {}\n this.firstEntry = undefined\n this.lastEntry = undefined\n this._size = 0\n }\n\n public has(key: string): boolean {\n return !!this.cache[key]\n }\n\n public set(key: string, value: Ast): void {\n if (this.has(key))\n throw new Error(`AstCache - key already present: ${key}`)\n\n const newEntry: CacheEntry = { value, nextEntry: undefined, key }\n\n this.cache[key] = newEntry\n this._size += 1\n\n if (this.lastEntry)\n this.lastEntry.nextEntry = newEntry\n\n this.lastEntry = newEntry\n\n if (!this.firstEntry)\n this.firstEntry = this.lastEntry\n\n while (this.maxSize !== null && this.size > this.maxSize)\n this.dropFirstEntry()\n }\n\n private dropFirstEntry(): void {\n const firstEntry = this.firstEntry as CacheEntry\n delete this.cache[firstEntry.key]\n this._size -= 1\n this.firstEntry = firstEntry.nextEntry\n }\n}\n","import type { LitsModule } from './builtin/modules/interface'\nimport { assertModule } from './builtin/modules/assert'\nimport { gridModule } from './builtin/modules/grid'\nimport { randomModule } from './builtin/modules/random'\nimport { vectorModule } from './builtin/modules/vector'\nimport { linearAlgebraModule } from './builtin/modules/linear-algebra'\nimport { matrixModule } from './builtin/modules/matrix'\nimport { numberTheoryModule } from './builtin/modules/number-theory'\nimport { mathUtilsModule } from './builtin/modules/math'\nimport { functionalUtilsModule } from './builtin/modules/functional'\nimport { stringUtilsModule } from './builtin/modules/string'\nimport { collectionUtilsModule } from './builtin/modules/collection'\nimport { sequenceUtilsModule } from './builtin/modules/sequence'\nimport { bitwiseUtilsModule } from './builtin/modules/bitwise'\n\nexport const allBuiltinModules: LitsModule[] = [\n assertModule,\n gridModule,\n randomModule,\n vectorModule,\n linearAlgebraModule,\n matrixModule,\n numberTheoryModule,\n mathUtilsModule,\n functionalUtilsModule,\n stringUtilsModule,\n collectionUtilsModule,\n sequenceUtilsModule,\n bitwiseUtilsModule,\n]\n","export { categories, categoryRecord, coreCategories, isDataType, moduleCategories } from '../src/builtin/interface'\nexport type { Category, DataType } from '../src/builtin/interface'\n\nfunction getNumberTheorySequenceNames<T extends string>(name: T): [`number-theory.${T}-seq`, `number-theory.${T}-nth`, `number-theory.${T}-take-while`, `number-theory.${T}?`] {\n return [`number-theory.${name}-seq`, `number-theory.${name}-nth`, `number-theory.${name}-take-while`, `number-theory.${name}?`]\n}\n\nfunction getVectorReductionNames<T extends string>(name: T): [`vector.${T}`, `vector.moving-${string}`, `vector.centered-moving-${string}`, `vector.running-${string}`] {\n const baseName = name.replace(/^/, '')\n return [`vector.${name}`, `vector.moving-${baseName}`, `vector.centered-moving-${baseName}`, `vector.running-${baseName}`]\n}\n\nexport const api = {\n collection: [\n 'filter',\n 'map',\n 'reduce',\n 'count',\n 'get',\n 'contains?',\n 'assoc',\n '++',\n ] as const,\n collectionUtils: [\n 'collection.filteri',\n 'collection.mapi',\n 'collection.reducei',\n 'collection.reduce-right',\n 'collection.reducei-right',\n 'collection.reductions',\n 'collection.reductionsi',\n 'collection.get-in',\n 'collection.assoc-in',\n 'collection.update',\n 'collection.update-in',\n 'collection.not-empty',\n 'collection.every?',\n 'collection.not-every?',\n 'collection.any?',\n 'collection.not-any?',\n ] as const,\n array: [\n 'range',\n 'repeat',\n 'flatten',\n 'mapcat',\n 'moving-fn',\n 'running-fn',\n ] as const,\n sequence: [\n 'nth',\n 'push',\n 'pop',\n 'index-of',\n 'some',\n 'reverse',\n 'first',\n 'second',\n 'last',\n 'rest',\n 'next',\n 'sort',\n 'slice',\n ] as const,\n sequenceUtils: [\n 'sequence.position',\n 'sequence.last-index-of',\n 'sequence.shift',\n 'sequence.unshift',\n 'sequence.splice',\n 'sequence.sort-by',\n 'sequence.take',\n 'sequence.take-last',\n 'sequence.take-while',\n 'sequence.drop',\n 'sequence.drop-last',\n 'sequence.drop-while',\n 'sequence.distinct',\n 'sequence.remove',\n 'sequence.remove-at',\n 'sequence.split-at',\n 'sequence.split-with',\n 'sequence.frequencies',\n 'sequence.group-by',\n 'sequence.partition',\n 'sequence.partition-all',\n 'sequence.partition-by',\n 'sequence.starts-with?',\n 'sequence.ends-with?',\n 'sequence.interleave',\n 'sequence.interpose',\n ] as const,\n math: [\n '+',\n '-',\n '*',\n '/',\n 'mod',\n '%',\n 'quot',\n 'inc',\n 'dec',\n 'sqrt',\n 'cbrt',\n '^',\n 'round',\n 'trunc',\n 'floor',\n 'ceil',\n 'min',\n 'max',\n 'abs',\n 'sign',\n ] as const,\n mathUtils: [\n 'math.ln',\n 'math.log2',\n 'math.log10',\n 'math.sin',\n 'math.cos',\n 'math.tan',\n 'math.asin',\n 'math.acos',\n 'math.atan',\n 'math.sinh',\n 'math.cosh',\n 'math.tanh',\n 'math.asinh',\n 'math.acosh',\n 'math.atanh',\n 'math.to-rad',\n 'math.to-deg',\n ] as const,\n functional: [\n '|>',\n 'apply',\n 'identity',\n 'comp',\n 'constantly',\n ] as const,\n functionalUtils: [\n 'functional.juxt',\n 'functional.complement',\n 'functional.every-pred',\n 'functional.some-pred',\n 'functional.fnull',\n ] as const,\n meta: [\n 'doc',\n 'arity',\n ] as const,\n misc: [\n '≠',\n '==',\n '<',\n '>',\n '<=',\n '>=',\n '!',\n 'write!',\n 'iso-date->epoch',\n 'epoch->iso-date',\n 'boolean',\n 'compare',\n 'identical?',\n 'import',\n 'json-parse',\n 'json-stringify',\n ] as const,\n object: [\n 'dissoc',\n 'keys',\n 'vals',\n 'entries',\n 'find',\n 'merge',\n 'merge-with',\n 'zipmap',\n 'select-keys',\n ] as const,\n predicate: [\n 'boolean?',\n 'null?',\n 'number?',\n 'string?',\n 'function?',\n 'integer?',\n 'array?',\n 'object?',\n 'collection?',\n 'sequence?',\n 'regexp?',\n 'zero?',\n 'pos?',\n 'neg?',\n 'even?',\n 'odd?',\n 'finite?',\n 'negative-infinity?',\n 'positive-infinity?',\n 'false?',\n 'true?',\n 'empty?',\n 'not-empty?',\n 'vector?',\n 'grid?',\n 'matrix?',\n ] as const,\n regularExpression: [\n 'regexp',\n 'match',\n 'replace',\n 'replace-all',\n ] as const,\n string: [\n 'str',\n 'number',\n 'lower-case',\n 'upper-case',\n 'trim',\n 'split',\n 'join',\n 'blank?',\n ] as const,\n stringUtils: [\n 'string.string-repeat',\n 'string.from-char-code',\n 'string.to-char-code',\n 'string.trim-left',\n 'string.trim-right',\n 'string.pad-left',\n 'string.pad-right',\n 'string.split-lines',\n 'string.template',\n 'string.encode-base64',\n 'string.decode-base64',\n 'string.encode-uri-component',\n 'string.decode-uri-component',\n 'string.capitalize',\n ] as const,\n bitwise: [\n '<<',\n '>>',\n '>>>',\n '&',\n '|',\n 'xor',\n ] as const,\n bitwiseUtils: [\n 'bitwise.bit-not',\n 'bitwise.bit-and-not',\n 'bitwise.bit-flip',\n 'bitwise.bit-clear',\n 'bitwise.bit-set',\n 'bitwise.bit-test',\n ] as const,\n assert: [\n 'assert.assert',\n 'assert.assert=',\n 'assert.assert!=',\n 'assert.assert-gt',\n 'assert.assert-lt',\n 'assert.assert-gte',\n 'assert.assert-lte',\n 'assert.assert-true',\n 'assert.assert-false',\n 'assert.assert-truthy',\n 'assert.assert-falsy',\n 'assert.assert-null',\n 'assert.assert-throws',\n 'assert.assert-throws-error',\n 'assert.assert-not-throws',\n 'assert.assert-array',\n 'assert.assert-boolean',\n 'assert.assert-collection',\n 'assert.assert-function',\n 'assert.assert-grid',\n 'assert.assert-integer',\n 'assert.assert-matrix',\n 'assert.assert-number',\n 'assert.assert-object',\n 'assert.assert-regexp',\n 'assert.assert-sequence',\n 'assert.assert-string',\n 'assert.assert-vector',\n ] as const,\n grid: [\n 'grid.every?',\n 'grid.some?',\n 'grid.every-row?',\n 'grid.some-row?',\n 'grid.every-col?',\n 'grid.some-col?',\n 'grid.row',\n 'grid.col',\n 'grid.shape',\n 'grid.fill',\n 'grid.generate',\n 'grid.reshape',\n 'grid.transpose',\n 'grid.flip-h',\n 'grid.flip-v',\n 'grid.rotate',\n 'grid.reverse-rows',\n 'grid.reverse-cols',\n 'grid.slice',\n 'grid.slice-rows',\n 'grid.slice-cols',\n 'grid.splice-rows',\n 'grid.splice-cols',\n 'grid.concat-rows',\n 'grid.concat-cols',\n 'grid.map',\n 'grid.mapi',\n 'grid.reduce',\n 'grid.reducei',\n 'grid.push-rows',\n 'grid.unshift-rows',\n 'grid.pop-row',\n 'grid.shift-row',\n 'grid.push-cols',\n 'grid.unshift-cols',\n 'grid.pop-col',\n 'grid.shift-col',\n 'grid.from-array',\n ] as const,\n matrix: [\n 'matrix.mul',\n 'matrix.det',\n 'matrix.inv',\n 'matrix.adj',\n 'matrix.cofactor',\n 'matrix.minor',\n 'matrix.trace',\n 'matrix.symmetric?',\n 'matrix.triangular?',\n 'matrix.upper-triangular?',\n 'matrix.lower-triangular?',\n 'matrix.diagonal?',\n 'matrix.square?',\n 'matrix.orthogonal?',\n 'matrix.identity?',\n 'matrix.invertible?',\n 'matrix.hilbert',\n 'matrix.vandermonde',\n 'matrix.band',\n 'matrix.banded?',\n 'matrix.rank',\n 'matrix.frobenius-norm',\n 'matrix.one-norm',\n 'matrix.inf-norm',\n 'matrix.max-norm',\n ] as const,\n vector: [\n 'sum',\n 'mean',\n 'median',\n 'prod',\n ] as const,\n vectorUtils: [\n 'vector.monotonic?',\n 'vector.strictly-monotonic?',\n 'vector.increasing?',\n 'vector.decreasing?',\n 'vector.strictly-increasing?',\n 'vector.strictly-decreasing?',\n 'vector.median',\n 'vector.mode',\n 'vector.min-index',\n 'vector.max-index',\n 'vector.sort-indices',\n 'vector.count-values',\n 'vector.linspace',\n 'vector.ones',\n 'vector.zeros',\n 'vector.fill',\n 'vector.generate',\n 'vector.cumsum',\n 'vector.cumprod',\n 'vector.quartiles',\n 'vector.percentile',\n 'vector.quantile',\n 'vector.histogram',\n 'vector.ecdf',\n 'vector.outliers?',\n 'vector.outliers',\n 'vector.bincount',\n 'vector.winsorize',\n 'vector.mse',\n 'vector.mae',\n 'vector.rmse',\n 'vector.smape',\n ...getVectorReductionNames('mean'),\n ...getVectorReductionNames('median'),\n ...getVectorReductionNames('variance'),\n ...getVectorReductionNames('sample-variance'),\n ...getVectorReductionNames('sum'),\n ...getVectorReductionNames('prod'),\n ...getVectorReductionNames('stdev'),\n ...getVectorReductionNames('sample-stdev'),\n ...getVectorReductionNames('iqr'),\n ...getVectorReductionNames('span'),\n ...getVectorReductionNames('geometric-mean'),\n ...getVectorReductionNames('harmonic-mean'),\n ...getVectorReductionNames('skewness'),\n ...getVectorReductionNames('sample-skewness'),\n ...getVectorReductionNames('kurtosis'),\n ...getVectorReductionNames('sample-kurtosis'),\n ...getVectorReductionNames('excess-kurtosis'),\n ...getVectorReductionNames('sample-excess-kurtosis'),\n ...getVectorReductionNames('rms'),\n ...getVectorReductionNames('mad'),\n ...getVectorReductionNames('medad'),\n ...getVectorReductionNames('gini-coefficient'),\n ...getVectorReductionNames('entropy'),\n ...getVectorReductionNames('skewness'),\n ] as const,\n linAlg: [\n 'linear-algebra.reflect',\n 'linear-algebra.refract',\n 'linear-algebra.lerp',\n 'linear-algebra.rotate2d',\n 'linear-algebra.rotate3d',\n 'linear-algebra.dot',\n 'linear-algebra.cross',\n 'linear-algebra.normalize-minmax',\n 'linear-algebra.normalize-zscore',\n 'linear-algebra.normalize-robust',\n 'linear-algebra.normalize-l1',\n 'linear-algebra.normalize-l2',\n 'linear-algebra.normalize-log',\n 'linear-algebra.angle',\n 'linear-algebra.projection',\n 'linear-algebra.orthogonal?',\n 'linear-algebra.parallel?',\n 'linear-algebra.collinear?',\n 'linear-algebra.cosine-similarity',\n 'linear-algebra.euclidean-distance',\n 'linear-algebra.euclidean-norm',\n 'linear-algebra.manhattan-distance',\n 'linear-algebra.manhattan-norm',\n 'linear-algebra.hamming-distance',\n 'linear-algebra.hamming-norm',\n 'linear-algebra.chebyshev-distance',\n 'linear-algebra.chebyshev-norm',\n 'linear-algebra.minkowski-distance',\n 'linear-algebra.minkowski-norm',\n 'linear-algebra.cov',\n 'linear-algebra.corr',\n 'linear-algebra.spearman-corr',\n 'linear-algebra.pearson-corr',\n 'linear-algebra.kendall-tau',\n 'linear-algebra.autocorrelation',\n 'linear-algebra.cross-correlation',\n 'linear-algebra.rref',\n 'linear-algebra.solve',\n 'linear-algebra.to-polar',\n 'linear-algebra.from-polar',\n ] as const,\n numberTheory: [\n ...getNumberTheorySequenceNames('abundant'),\n ...getNumberTheorySequenceNames('arithmetic'),\n ...getNumberTheorySequenceNames('bell'),\n ...getNumberTheorySequenceNames('catalan'),\n ...getNumberTheorySequenceNames('composite'),\n ...getNumberTheorySequenceNames('deficient'),\n ...getNumberTheorySequenceNames('factorial'),\n ...getNumberTheorySequenceNames('fibonacci'),\n ...getNumberTheorySequenceNames('geometric'),\n ...getNumberTheorySequenceNames('golomb'),\n ...getNumberTheorySequenceNames('happy'),\n ...getNumberTheorySequenceNames('look-and-say'),\n ...getNumberTheorySequenceNames('lucas'),\n ...getNumberTheorySequenceNames('lucky'),\n ...getNumberTheorySequenceNames('mersenne'),\n ...getNumberTheorySequenceNames('padovan'),\n ...getNumberTheorySequenceNames('partition'),\n ...getNumberTheorySequenceNames('pell'),\n ...getNumberTheorySequenceNames('perfect'),\n ...getNumberTheorySequenceNames('perfect-cube'),\n ...getNumberTheorySequenceNames('perfect-power'),\n ...getNumberTheorySequenceNames('perfect-square'),\n ...getNumberTheorySequenceNames('polygonal'),\n ...getNumberTheorySequenceNames('prime'),\n ...getNumberTheorySequenceNames('recaman'),\n ...getNumberTheorySequenceNames('sylvester'),\n ...getNumberTheorySequenceNames('thue-morse'),\n ...getNumberTheorySequenceNames('tribonacci'),\n 'number-theory.collatz-seq',\n 'number-theory.juggler-seq',\n 'number-theory.bernoulli-seq',\n 'number-theory.bernoulli-take-while',\n 'number-theory.bernoulli-nth',\n 'number-theory.combinations',\n 'number-theory.count-combinations',\n 'number-theory.derangements',\n 'number-theory.count-derangements',\n 'number-theory.divisors',\n 'number-theory.count-divisors',\n 'number-theory.proper-divisors',\n 'number-theory.count-proper-divisors',\n 'number-theory.prime-factors',\n 'number-theory.count-prime-factors',\n 'number-theory.distinct-prime-factors',\n 'number-theory.count-distinct-prime-factors',\n 'number-theory.factorial',\n 'number-theory.partitions',\n 'number-theory.count-partitions',\n 'number-theory.permutations',\n 'number-theory.count-permutations',\n 'number-theory.power-set',\n 'number-theory.count-power-set',\n 'number-theory.coprime?',\n 'number-theory.divisible-by?',\n 'number-theory.gcd',\n 'number-theory.lcm',\n 'number-theory.multinomial',\n 'number-theory.amicable?',\n 'number-theory.euler-totient',\n 'number-theory.mobius',\n 'number-theory.mertens',\n 'number-theory.sigma',\n 'number-theory.carmichael-lambda',\n 'number-theory.cartesian-product',\n 'number-theory.perfect-power',\n 'number-theory.mod-exp',\n 'number-theory.mod-inv',\n 'number-theory.extended-gcd',\n 'number-theory.chinese-remainder',\n 'number-theory.stirling-first',\n 'number-theory.stirling-second',\n ] as const,\n random: [\n 'random.random!',\n 'random.random-int!',\n 'random.random-int-inclusive!',\n 'random.random-float!',\n 'random.random-boolean!',\n 'random.random-item!',\n 'random.random-sample!',\n 'random.random-sample-unique!',\n 'random.shuffle!',\n 'random.random-normal!',\n 'random.random-exponential!',\n 'random.random-binomial!',\n 'random.random-poisson!',\n 'random.random-gamma!',\n 'random.random-pareto!',\n 'random.uuid!',\n 'random.random-char!',\n 'random.random-string!',\n 'random.random-id!',\n 'random.random-color!',\n ] as const,\n shorthand: [\n '-short-regexp',\n '-short-fn',\n ] as const satisfies `-short-${string}`[],\n datatype: [\n '-type-number',\n '-type-string',\n '-type-object',\n '-type-array',\n '-type-vector',\n '-type-matrix',\n '-type-grid',\n '-type-boolean',\n '-type-function',\n '-type-integer',\n '-type-any',\n '-type-null',\n '-type-collection',\n '-type-sequence',\n '-type-regexp',\n '-type-never',\n ] as const satisfies `-type-${string}`[],\n} as const\n\nexport type CollectionApiName = typeof api.collection[number]\nexport type ArrayApiName = typeof api.array[number]\nexport type SequenceApiName = typeof api.sequence[number]\nexport type MathApiName = typeof api.math[number]\nexport type FunctionalApiName = typeof api.functional[number]\nexport type MiscApiName = typeof api.misc[number]\nexport type MetaApiName = typeof api.meta[number]\nexport type ObjectApiName = typeof api.object[number]\nexport type PredicateApiName = typeof api.predicate[number]\nexport type RegularExpressionApiName = typeof api.regularExpression[number]\nexport type SpecialExpressionsApiName = string\nexport type StringApiName = typeof api.string[number]\nexport type StringUtilsApiName = typeof api.stringUtils[number]\nexport type CollectionUtilsApiName = typeof api.collectionUtils[number]\nexport type SequenceUtilsApiName = typeof api.sequenceUtils[number]\nexport type BitwiseApiName = typeof api.bitwise[number]\nexport type BitwiseUtilsApiName = typeof api.bitwiseUtils[number]\nexport type AssertApiName = typeof api.assert[number]\nexport type GridApiName = typeof api.grid[number]\nexport type MatrixApiName = typeof api.matrix[number]\nexport type NumberTheoryApiName = typeof api.numberTheory[number]\nexport type VectorApiName = typeof api.vector[number]\nexport type VectorUtilsApiName = typeof api.vectorUtils[number]\nexport type LinAlgApiName = typeof api.linAlg[number]\nexport type RandomApiName = typeof api.random[number]\nexport type MathUtilsApiName = typeof api.mathUtils[number]\nexport type FunctionalUtilsApiName = typeof api.functionalUtils[number]\n\n// Core functions - always available without import\nexport type CoreNormalExpressionName =\n | CollectionApiName\n | ArrayApiName\n | SequenceApiName\n | MathApiName\n | FunctionalApiName\n | MetaApiName\n | MiscApiName\n | ObjectApiName\n | PredicateApiName\n | RegularExpressionApiName\n | StringApiName\n | BitwiseApiName\n | VectorApiName\n\n// Module functions - require import()\nexport type ModuleExpressionName =\n | MatrixApiName\n | VectorUtilsApiName\n | LinAlgApiName\n | GridApiName\n | NumberTheoryApiName\n | RandomApiName\n | MathUtilsApiName\n | FunctionalUtilsApiName\n | AssertApiName\n | StringUtilsApiName\n | CollectionUtilsApiName\n | SequenceUtilsApiName\n | BitwiseUtilsApiName\n\n// All normal expression names\nexport type NormalExpressionName =\n | CoreNormalExpressionName\n | ModuleExpressionName\n\nexport type FunctionName =\n | NormalExpressionName\n | SpecialExpressionsApiName\n\nexport type ShorthandName = typeof api.shorthand[number]\n\nexport type DatatypeName = typeof api.datatype[number]\n\n// Core API function names (always available)\nconst coreApiFunctionNames = [\n ...api.collection,\n ...api.array,\n ...api.sequence,\n ...api.math,\n ...api.functional,\n ...api.meta,\n ...api.misc,\n ...api.object,\n ...api.predicate,\n ...api.regularExpression,\n ...api.string,\n ...api.bitwise,\n ...api.vector,\n] as const\n\n// Module API function names (require import())\nconst moduleApiFunctionNames = [\n ...api.matrix,\n ...api.vectorUtils,\n ...api.linAlg,\n ...api.grid,\n ...api.numberTheory,\n ...api.random,\n ...api.mathUtils,\n ...api.functionalUtils,\n ...api.assert,\n ...api.stringUtils,\n ...api.collectionUtils,\n ...api.sequenceUtils,\n ...api.bitwiseUtils,\n] as const\n\n// All API function names\nconst apiFunctionNames = [\n ...coreApiFunctionNames,\n ...moduleApiFunctionNames,\n] as const\n\n// Core API names (core functions + shorthand + datatype)\nconst coreApiNames = [\n ...coreApiFunctionNames,\n ...api.shorthand,\n ...api.datatype,\n] as const\n\nconst apiNames = [\n ...apiFunctionNames,\n ...api.shorthand,\n ...api.datatype,\n] as const\n\nexport type CoreApiName = typeof coreApiNames[number]\nexport type ApiName = typeof apiNames[number]\n\nexport function isApiName(arg: string): arg is ApiName {\n return apiNames.includes(arg as ApiName)\n}\n\nexport function isCoreApiName(arg: string): arg is CoreApiName {\n return coreApiNames.includes(arg as CoreApiName)\n}\n","import { getUndefinedSymbols } from '../getUndefinedSymbols'\nimport { evaluate, evaluateNode } from '../evaluator'\nimport { createContextStack } from '../evaluator/ContextStack'\nimport type { Context } from '../evaluator/interface'\nimport type { Any, Obj } from '../interface'\nimport type { Ast, LitsFunction, ParseState } from '../parser/types'\nimport { tokenize } from '../tokenizer/tokenize'\nimport type { TokenStream } from '../tokenizer/tokenize'\nimport { minifyTokenStream } from '../tokenizer/minifyTokenStream'\nimport { transformSymbolTokens } from '../transformer'\nimport { untokenize } from '../untokenizer'\nimport { builtin } from '../builtin'\nimport { Parser } from '../parser/Parser'\nimport { AutoCompleter } from '../AutoCompleter/AutoCompleter'\nimport type { Arity } from '../builtin/interface'\nimport type { LitsModule } from '../builtin/modules/interface'\n\nimport { Cache } from './Cache'\n\nexport interface LitsRuntimeInfo {\n astCache: Cache | null\n astCacheSize: number | null\n debug: boolean\n}\n\nexport interface JsFunction {\n fn: (...args: any[]) => unknown\n arity?: Arity\n docString?: string\n}\n\nexport interface ContextParams {\n globalContext?: Context\n contexts?: Context[]\n values?: Record<string, unknown>\n jsFunctions?: Record<string, unknown>\n globalModuleScope?: boolean\n}\n\nexport interface MinifyParams {\n minify?: boolean\n}\n\nexport interface FilePathParams {\n filePath?: string\n}\n\ninterface LitsConfig {\n initialCache?: Record<string, Ast>\n astCacheSize?: number | null\n debug?: boolean\n modules?: LitsModule[]\n}\n\nexport class Lits {\n private astCache: Cache | null\n private astCacheSize: number | null\n private debug: boolean\n private modules: Map<string, LitsModule>\n\n constructor(config: LitsConfig = {}) {\n this.debug = config.debug ?? false\n this.astCacheSize = config.astCacheSize ?? null\n if (this.astCacheSize) {\n this.astCache = new Cache(this.astCacheSize)\n const initialCache = config.initialCache ?? {}\n for (const cacheEntry of Object.keys(initialCache))\n this.astCache.set(cacheEntry, initialCache[cacheEntry] as Ast)\n }\n else {\n this.astCache = null\n }\n const nsList = config.modules ?? []\n this.modules = new Map(nsList.map(ns => [ns.name, ns]))\n }\n\n public getRuntimeInfo(): LitsRuntimeInfo {\n return {\n astCacheSize: this.astCacheSize,\n astCache: this.astCache,\n debug: this.debug,\n }\n }\n\n public run(program: string, params: ContextParams & FilePathParams = {}): unknown {\n const ast = this.generateAst(program, params)\n const result = this.evaluate(ast, params)\n return result\n }\n\n public context(programOrAst: string | Ast, params: ContextParams & FilePathParams = {}): Context {\n const ast = typeof programOrAst === 'string' ? this.generateAst(programOrAst, params) : programOrAst\n const contextStack = createContextStack(params, this.modules)\n evaluate(ast, contextStack)\n return contextStack.globalContext\n }\n\n public getUndefinedSymbols(programOrAst: string | Ast, params: ContextParams = {}): Set<string> {\n const ast = typeof programOrAst === 'string' ? this.generateAst(programOrAst, params) : programOrAst\n const contextStack = createContextStack(params, this.modules)\n return getUndefinedSymbols(ast, contextStack, builtin, evaluateNode)\n }\n\n public tokenize(program: string, tokenizeParams: FilePathParams & MinifyParams = {}): TokenStream {\n const tokenStream = tokenize(program, this.debug, tokenizeParams.filePath)\n return tokenizeParams.minify ? minifyTokenStream(tokenStream, { removeWhiteSpace: false }) : tokenStream\n }\n\n public parse(tokenStream: TokenStream): Ast {\n tokenStream = minifyTokenStream(tokenStream, { removeWhiteSpace: true })\n const ast: Ast = {\n body: [],\n hasDebugData: tokenStream.hasDebugData,\n }\n\n const parseState: ParseState = {\n position: 0,\n }\n\n ast.body = new Parser(tokenStream, parseState).parse()\n\n return ast\n }\n\n public evaluate(ast: Ast, params: ContextParams): Any {\n const contextStack = createContextStack(params, this.modules)\n return evaluate(ast, contextStack)\n }\n\n public transformSymbols(tokenStream: TokenStream, transformer: (symbol: string) => string): TokenStream {\n return transformSymbolTokens(tokenStream, transformer)\n }\n\n public untokenize(tokenStream: TokenStream): string {\n return untokenize(tokenStream)\n }\n\n public apply(fn: LitsFunction, fnParams: unknown[], params: ContextParams = {}): Any {\n const fnName = 'FN_2eb7b316_471c_5bfa_90cb_d3dfd9164a59'\n const program = this.generateApplyFunctionCall(fnName, fnParams)\n\n const ast = this.generateAst(program, params)\n\n const hostValues: Obj = fnParams.reduce(\n (result: Obj, param, index) => {\n result[`${fnName}_${index}`] = param\n return result\n },\n { [fnName]: fn },\n )\n\n params.values = { ...params.values, ...hostValues }\n\n return this.evaluate(ast, params)\n }\n\n private generateApplyFunctionCall(fnName: string, fnParams: unknown[]) {\n const paramsString: string = fnParams\n .map((_, index) => {\n return `${fnName}_${index}`\n })\n .join(', ')\n return `${fnName}(${paramsString})`\n }\n\n private generateAst(program: string, params: ContextParams & FilePathParams): Ast {\n if (this.astCache) {\n const cachedAst = this.astCache.get(program)\n if (cachedAst)\n return cachedAst\n }\n const tokenStream = this.tokenize(program, {\n filePath: params.filePath,\n })\n const ast: Ast = this.parse(tokenStream)\n this.astCache?.set(program, ast)\n return ast\n }\n\n public getAutoCompleter(program: string, position: number, params: ContextParams = {}): AutoCompleter {\n return new AutoCompleter(program, position, this, params)\n }\n}\n","import type { TokenStream } from '../tokenizer/tokenize'\nimport { isSymbolToken } from '../tokenizer/token'\n\nexport function transformSymbolTokens(tokenStram: TokenStream, transformer: (symbol: string) => string): TokenStream {\n return {\n ...tokenStram,\n tokens: tokenStram.tokens.map(token => isSymbolToken(token)\n ? [token[0], transformer(token[1])]\n : token),\n }\n}\n","import type { TokenStream } from '../tokenizer/tokenize'\n\nexport function untokenize(tokenStream: TokenStream): string {\n return tokenStream.tokens.reduce((acc: string, token) => {\n return `${acc}${token[1]}`\n }, '')\n}\n"],"names":["getCodeMarker","sourceCodeInfo","position","code","leftPadding","column","rightPadding","length","repeat","Math","max","RecurSignal","Error","params","constructor","super","Object","setPrototypeOf","this","prototype","name","LitsError","shortMessage","err","message","location","line","filePath","getLitsErrorMessage","UserDefinedError","userMessage","AssertionError","UndefinedSymbolError","symbol","symbolName","NodeTypes","Number","String","NormalExpression","SpecialExpression","UserDefinedSymbol","NormalBuiltinSymbol","SpecialBuiltinSymbol","ReservedSymbol","Binding","Spread","NodeTypesSet","Set","values","getNodeTypeName","type","keys","find","key","functionTypeSet","FUNCTION_SYMBOL","REGEXP_SYMBOL","isLitsFunction","func","has","isFunctionType","functionType","isNode","value","Array","isArray","isNodeType","valueToString","RegExp","toString","JSON","stringify","getSourceCodeInfo","anyValue","isNumber","options","isNaN","integer","isInteger","finite","isFinite","zero","nonZero","positive","negative","nonPositive","nonNegative","gt","gte","lt","lte","assertNumber","sign","getSignString","numberType","range","getRangeString","filter","x","join","getNumberTypeName","asNumber","getAssertionError","typeName","asNonUndefined","assertNonUndefined","undefined","isNonUndefined","isUnknownRecord","assertLitsFunction","isUserDefinedFunction","assertUserDefinedFunction","isNativeJsFunction","assertNativeJsFunction","isAny","asAny","assertAny","isSeq","asSeq","assertSeq","isObj","isRegularExpression","assertObj","isColl","asColl","assertColl","regexp","assertStringOrRegularExpression","isStringOrRegularExpression","asFunctionLike","assertFunctionLike","isFunctionLike","arityAcceptsMin","arity","nbrOfParams","min","getArityFromFunction","param","toFixedArity","assertNumberOfParams","canBeOperator","count","getOperatorArgs","a","b","bitwiseNormalExpression","evaluate","num","docs","category","returns","args","variants","argumentNames","description","seeAlso","examples","first","rest","reduce","result","c","xor","isString","nonEmpty","char","assertString","asString","isStringOrNumber","asStringOrNumber","assertStringOrNumber","collHasKey","coll","getOwnPropertyDescriptor","compare","deepEqual","approxEqual","i","s","f","aKeys","bKeys","toNonNegativeInteger","ceil","toAny","clone","entries","entry","val","map","item","cloneColl","joinSets","results","symbols","forEach","add","addToSet","target","source","EPSILON","epsilon","diff","abs","approxZero","smartTrim","str","minIndent","lines","split","match","shift","pop","indent","acc","lineIndent","Infinity","slice","trimEnd","assertArray","assertStringArray","every","v","isStringArray","assertCharArray","isCharArray","collectionNormalExpression","fn","contextStack","executeFunction","elem","fun","at","colls","obj","objKeys","includes","push","mapObjects","seqs","isStr","len","seq","paramArray","mapped","p","initial","get","defaultValue","assoc","copy","kvs","arr","concat","assign","arrayNormalExpression","second","third","from","to","step","array","flatten","depth","actualDepth","POSITIVE_INFINITY","flat","hideOperatorForm","mapcat","windowSize","subArr","sequenceNormalExpression","nth","n","last","substring","index","indexOf","findIndex","next","reverse","start","stop","some","sort","defaultComparer","comparer","compareValue","annotatedArrays","WeakSet","vectors","notVectors","matrices","notMatrices","grids","notGrids","annotate","isVector","isMatrix","isGrid","vector","assertVector","assert2dVector","is2dVector","assert3dVector","is3dVector","assertNonEmptyVector","grid","nbrOfCols","row","assertGrid","matrix","cell","assertMatrix","assertSquareMatrix","getNumberVectorOrMatrixOperation","hasVector","hasMatrix","rows","cold","unaryMathOp","operation","operands","binaryMathOp","j","reduceMathOp","identity","m","mathNormalExpression","inc","dec","xs","firstVector","firstMatrix","quot","trunc","mod","floor","sqrt","cbrt","round","decimals","factor","isEqual","firstAny","miscNormalExpression","ys","isIdentical","currentValue","ms","Date","toISOString","dateTime","valueOf","iso","console","log","boolean","parse","import","importPath","dotIndex","moduleName","functionName","module","getModule","expression","functions","path","objectNormalExpression","vals","dissoc","newObj","merge","objs","zipmap","predicatesNormalExpression","NEGATIVE_INFINITY","table","regexpNormalExpression","sourceArg","flagsArg","flags","e","pattern","text","assertRegularExpression","exec","replace","matcher","replaceAll","blankRegexp","stringNormalExpression","number","toLowerCase","toUpperCase","trim","stringList","delimiter","stringOrRegExpValue","limit","test","functionalNormalExpression","apply","comp","fns","constantly","generateDocString","reference","title","_isOperator","functionForms","variant","argName","operatorForm","signature","arg","argStrings","example","argType","typeString","getMetaNormalExpression","normalExpressionReference","doc","docString","vectorNormalExpression","sum","prod","mean","median","sorted","mid","calcMedian","expressions","normalExpressions","normalExpressionTypes","allNormalExpressions","andSpecialExpression","node","evaluateNode","evaluateAsNormalExpression","getUndefinedSymbols","builtin","condSpecialExpression","customVariants","details","form","switchSpecialExpression","switchValueNode","cases","switchValue","isSymbolNode","nodeType","isUserDefinedSymbolNode","asUserDefinedSymbolNode","assertUserDefinedSymbolNode","isNormalBuiltinSymbolNode","isSpecialBuiltinSymbolNode","isNormalExpressionNodeWithName","isNormalExpressionNode","isSpreadNode","definedSpecialExpression","symbolNode","assertSymbolNode","lookUp","bindingTargetTypes","walkDefaults","bindingTarget","onDefault","element","evaluateBindingNodeValues","record","createRecord","assertUnknownRecord","capturedKeys","restElement","restValues","restIndex","getAllBindingTargetNames","names","getNamesFromBindingTarget","defSpecialExpression","bindingNode","bindingValue","evaluateBindingTargetValues","Node","exportValues","bindingResult","defaultNode","addValues","doSpecialExpression","newContextStack","create","lambdaSpecialExpression","evaluatedFunction","functionContext","context","ctx","undefinedSymbols","new","getValue","evaluateFunction","evaluatedfunction","newContext","self","overloadResult","getFunctionUnresolvedSymbols","ifSpecialExpression","conditionNode","trueNode","falseNode","unlessSpecialExpression","letSpecialExpression","loopSpecialExpression","bindingNodes","bindingContext","valueRecord","body","error","addToContext","bindings","evaluateLoop","returnResult","loopNode","loopBindings","bindingIndices","abort","skip","bindingsLoop","bindingIndex","letBindings","whenNode","whileNode","targetNode","valueNode","analyze","loopBindingNode","letBindingNode","letTarget","letValue","forDocs","forSpecialExpression","helpers","doseqDocs","doseqSpecialExpression","orSpecialExpression","qqSpecialExpression","recurSpecialExpression","evaluatedParams","paramNode","throwSpecialExpression","expr","trySpecialExpression","tryExpression","errorSymbol","catchExpression","tryResult","arraySpecialExpression","spreadValue","objectSpecialExpression","kvps","keyNode","spreadObject","specialExpressionTypes","cond","block","doseq","for","if","let","loop","object","recur","switch","throw","try","unless","specialExpressions","normalExpressionKeys","specialExpressionKeys","binaryOperators","symbolicOperators","nonFunctionOperatorSet","isFunctionOperator","operator","binaryOperatorSet","isBinaryOperator","symbolicOperatorSet","isSymbolicOperator","dataTypes","isFunctionDocs","moduleDocs","assert","assertNormalExpression","throwMessage","errorMessage","assertModule","col","shape","g","fill","cols","generate","reshape","transpose","rotate","begin","deleteCount","items","mapi","reducei","gridFunctions","predicate","transposed","generator","flatTable","times","height","width","y","end","rowStart","colStart","rowEnd","colEnd","trMatrix","rowDeleteCount","colDeleteCount","initialValue","accumulator","flatArray","fromArray","gridModule","prob","stdDev","lambda","scale","alpha","charSet","randomFunctions","random","probability","randomIndex","copyArray","splice","shuffledArray","u1","u2","cos","PI","u","k","L","exp","randomGamma","chars","padStart","d","randn","randomModule","variance","stdev","iqr","span","skewness","kurtosis","rms","mad","medad","entropy","mode","linspace","ones","zeros","cumsum","cumprod","quartiles","percentile","quantile","histogram","bins","ecdf","threshold","outliers","bincount","minSize","weights","winsorize","mse","rmse","mae","smape","q1Index","q1","q3Index","q3","lowerBound","upperBound","calcPercentile","data","sortedData","lowerIndex","upperIndex","weight","midIndex","q2","lowerHalf","upperHalf","midLower","midUpper","calcMean","geometricMeanReductionFunction","medianReductionFunction","calcVariance","optionalMean","varianceReductionFunction","sampleVarianceReductionFunction","calcSampleVariance","minLength","calcStdDev","stdevReductionFunction","sampleStdevReductionFunction","calcSampleStdDev","iqrReductionFunction","spanReductionFunction","skewnessReductionFunction","sampleSkewnessReductionFunction","sumSquaredDiffs","sumCubedDiffs","sampleVariance","sampleStdDev","sampleSkewness","kurtosisReductionFunction","eccessKurtosisReductionFunction","excessKurtosis","sampleKurtosisReductionFunction","sampleKurtosis","sampleExcessKurtosisReductionFunction","sampleExcessKurtosis","rmsReductionFunction","madReductionFunction","calcMad","calcMedad","medadReductionFunction","giniCoefficientReductionFunction","entropyReductionFunction","frequencies","Map","set","total","frequency","log2","calculateEntropy","reductionFunctionNormalExpressions","addReductionFunctions","reductionFn","baseKey","movingKey","centeredMovingKey","runningKey","createReductionNormalExpression","createMovingNormalExpression","createCenteredMovingNormalExpression","padding","createRunningNormalExpression","reductionFunction","halfWindowSize","paddedVector","nullsCount","vectorFunctions","frequencyMap","maxFrequency","modes","countDiff","numPoints","_","binSize","binStart","binEnd","calcHistogram","hasOutliers","maxValue","outputLength","counts","lowerQuantile","upperQuantile","vectorA","vectorB","denom","sequences","vectorModule","reflect","refract","axis","eta","lerp","t","rotate2d","rotate3d","radians","dot","cross","angle","projection","cov","corr","autocorrelation","lag","rref","solve","polar","gaussJordanElimination","rank","rowsProcessed","pivotRow","pivotValue","areVectorsCollinear","isZeroVector","vec","component","ratio","pearsonCorr","meanA","meanB","sumNumerator","sumSquareA","sumSquareB","diffA","diffB","calcFractionalRanks","indices","ranks","currentRank","averageRank","calcCovariance","segmentA","segmentB","getUnit","vector1","vector2","subtract","scalar","linearAlgebraNormalExpression","cosTheta","sinTheta","sin","w","dotProduct","normal","unitNormal","normalizedV","normalizedNormal","discriminant","norm","magnitudeA","magnitudeB","acos","areVectorsParallel","ranksA","ranksB","concordant","discordant","tiesInA","tiesInB","isTieA","isTieB","n1","n2","kendallTau","absLag","numerator","laggedIndex","denominator","overlapLength","extractOverlappingSegments","stdA","stdB","calcCorrelation","A","augmented","echelon","atan2","r","theta","linearAlgebraModule","mul","det","inv","adj","cofactor","minor","trace","hilbert","vandermonde","band","lband","uband","determinant","maxRow","minorRow","adjugate","isSquare","isIdentity","matrixMultiply","B","C","aik","matrixNormalExpression","matrix1","matrix2","inverseMatrix","inverse","cofactors","isSymetric","isUpperTriangular","isLowerTriangular","isTriangular","isTriangularUpper","isTriangularLower","isDiagonal","isOrthogonal","isSquareMatrix","size","maxBand","lower","upper","isBanded","rowSum","numRows","numCols","maxColSum","colSum","norm1","maxVal","rowMax","matrixModule","takeWhile","term","sides","combinations","derangements","divisors","factorial","partitions","permutations","gcd","lcm","multinomial","mobius","mertens","sigma","sets","base","exponent","modulus","remainders","moduli","binomialCoefficient","collection","current","subCombinations","subComb","combinationsNormalExpressions","derangementsNormalExpressions","used","temp","generateDerangements","pos","getAllDerangements","countDerangements","calcUnsortedDivisors","getDivisors","getProperDivisors","divisorsNormalExpressions","factorialNumbers","factorialOf","factorialNormalExpressions","partitionNumbers","partitionsNormalExpressions","generatePartitions","remaining","subPermutations","subPerm","permutationsNormalExpressions","powerSetNormalExpressions","newSubsets","subset","powerSet","primeFactors","factors","divisor","primeFactorsNormalExpressions","distinctFactors","isAbundant","curr","abundantSequence","abundants","arithmeticNormalExpressions","arithmetic","roundedPosition","calculatedValue","isInArithmeticSequence","getBernoulliSeq","bernoulli","bernoulliNormalExpressions","targetLength","newValue","generateBernoulli","isPrime","primeSequence","primes","isComposite","compositeSequence","composites","isDeficient","deficientSequence","deficients","geometricNormalExpressions","geometric","initialTerm","logResult","roundedLogResult","expectedSign","isInGeometricSequence","golombSequence","golomb","getGolombSeq","pred","golombNumber","generateGolombSeq","getSumOfSquaredDigits","digit","happySequence","happyNumbers","seen","isHappyNumber","jugglerSequence","juggler","noNth","getNextLookAndSayTerm","lookAndSaySequence","string","lookAndSay","isLookAndSay","generateLuckyNumbers","numbers","filteredNumbers","luckyNumbers","luckyNumber","newFiltered","luckySequence","initialSize","sieveIndex","sieveValue","getLuckyNumbers","l","padovanSequence","padovan","padovanNumbers","MAX_SAFE_INTEGER","isSafeInteger","isPadovan","perfectCubeSequence","perfectcubes","perfectPower","maxK","roundedB","perfectPowerSequence","perfectPowers","perfectSquareSequence","perfectSquares","poligonalNormalExpressions","polygonal","sqrtPart","recamanSequence","sequence","generateRecamanSequence","thueMorseSequence","thueMorse","countSetBits","sequenceNormalExpressions","addNormalExpressions","getFiniteNumberSequence","createSeqNormalExpression","createTakeWhileNormalExpression","createNthNormalExpression","createNumberPredNormalExpression","addSequence","endsWith","maxLength","createStringPredNormalExpression","seqFunction","takeWhileFunction","predFunction","extendedGcd","modInverse","collatz","combinatoricalNormalExpression","sumA","sumB","factorMap","prime","lambdaValues","modExp","extGcd","product","ai","ni","bi","chineseRemainder","dp","addSequences","numberTheoryModule","stringUtilsFunctions","int","fromCodePoint","codePointAt","padString","padEnd","template","templateString","placeholders","templateStrings","applyPlaceholders","stringPlaceholders","btoa","encodeURIComponent","_match","p1","fromCharCode","parseInt","decodeURIComponent","call","atob","charCodeAt","base64string","capitalize","charAt","doubleDollarRegexp","re","placeHolder","stringUtilsModule","update","intKey","cloneAndGetMeta","originalColl","innerCollMeta","resultColl","newResultColl","parent","collectionUtilsFunctions","nextValue","lastKey","parentKey","ks","filteri","reduceRight","reductions","resultArray","newVal","reductionsi","collectionUtilsModule","sequenceUtilsFunctions","lastIndexOf","findLastIndex","keyfn","aKey","bKey","take","input","drop","charArray","unshift","distinct","existingItem","remove","seqIsArray","partition","pad","asArray","partitionHelper","isStringSeq","oldValue","search","suffix","startsWith","prefix","interleave","seqsArr","interpose","separator","outer","innerArr","padIndex","sequenceUtilsModule","operand","mathUtilsModule","asin","sinh","asinh","cosh","acosh","tan","atan","tanh","atanh","ln","log10","functionalUtilsModule","juxt","aMin","aMax","bMin","bMax","getCommonArityFromFunctions","complement","function","fnull","bitwiseUtilsModule","datatype","shorthand","docsToReference","noOperatorDocumentation","moduledDocsToReference","qualifiedKey","bitwiseReference","arrayRef","collectionRef","functionalRef","mathRef","metaRef","miscRef","objectRef","predicatesRef","regexpRef","sequenceRef","stringRef","vectorRef","specialExpressionsReference","specialExpressionDocsToReference","isFunctionReference","ref","moduleReference","_prefereOperator","apiReference","sortByCategory","allReference","fromEntries","keyA","refA","keyB","refB","catA","catB","localeCompare","ast","nodes","unresolvedSymbols","subNode","findUnresolvedSymbolsInNode","normalExpressionNode","expressionNode","specialExpressionNode","specialExpressionType","castedGetUndefinedSymbols","phi","numberReservedSymbolRecord","E","PHI","MIN_SAFE_INTEGER","MAX_VALUE","MIN_VALUE","NaN","reservedSymbolRecord","true","false","null","do","else","case","each","in","when","while","catch","export","as","then","functionExecutors","NativeJsFunction","nativeFn","UserDefined","nbrOfNonRestArgs","restArgument","newContextStack2","Partial","actualParams","paramsCopy","placeholderIndex","Comp","Constantly","Juxt","Complement","EveryPred","SomePred","Fnull","fnulledParams","Builtin","normalBuiltinSymbolType","SpecialBuiltin","specialExpression","specialBuiltinSymbolType","Module","evaluateString","evaluateSymbol","reservedName","evaluateReservedSymbol","paramNodes","nameSymbol","evaluateNormalExpression","castedEvaluate","evaluateSpecialExpression","evaluateArrayAsFunction","evalueateObjectAsFunction","evaluateStringAsFunction","evaluateNumberAsFunction","ContextStackImpl","contexts","globalContext","nativeJsFunctions","modules","hostValues","shadowedName","getShadowedBuiltinName","currentContext","contextEntry","nativeJsFunction","hostValue","normalExpression","lookUpResult","createContextStack","jsFunctions","identifier","identifierParts","scope","part","isJsFunction","TypeError","assertJsFunction","assertNotShadowingBuiltin","globalModuleScope","illegalSymbolCharacters","illegalFirstSymbolCharacters","illegalSymbolCharacterSet","illegalFirstSymbolCharacterSet","whitespaceRegExp","NO_MATCH","tokenizeString","escaping","tokenizeToken","decimalNumberRegExp","octalNumberRegExp","hexNumberRegExp","binaryNumberRegExp","postNumberRegExp","tokenizeSymbol","initialPosition","tokenizers","symbolMeta","nextThreeChars","stringLength","token","baseChar","nextChar","negate","plusPrefix","hasDecimalPoint","hasExponent","threeChars","twoChars","oneChar","createSourceCodeInfo","lastLine","lineNbr","getSourceCodeLine","getCurrentToken","nbrOfCharacters","tokenizeShebang","tokenizer","isSymbolToken","asSymbolToken","throwUnexpectedToken","assertSymbolToken","isReservedSymbolToken","assertReservedSymbolToken","asReservedSymbolToken","isOperatorToken","operatorName","assertOperatorToken","isLParenToken","assertLParenToken","isRParenToken","assertRParenToken","isLBracketToken","asLBracketToken","assertLBracketToken","isRBracketToken","assertRBracketToken","isLBraceToken","asLBraceToken","assertLBraceToken","isRBraceToken","isStringToken","isA_BinaryOperatorToken","expected","expectedValue","actual","actualOutput","minifyTokenStream","tokenStream","removeWhiteSpace","tokens","isSingleLineCommentToken","isMultiLineCommentToken","isShebangToken","isWhitespaceToken","normalExpressionNames","specialExpressionNames","getSymbolName","placeholderRegexp","withSourceCodeInfo","getPrecedence","operatorSign","createNamedNormalExpressionNode","createAccessorNode","left","right","fromBinaryOperatorToNode","Parser","parseState","peek","peekSourceCodeInfo","currentToken","peekAhead","advance","isAtEnd","parseExpression","precedence","moduleScope","firstToken","parseLet","parseIfOrUnless","parseCond","parseSwitch","parseForOrDoseq","parseLoop","parseTry","parseBlock","parseExport","parseOperand","isAtExpressionEnd","newPrecedece","operatorSymbol","parseSymbol","asToken","parseOperandPart","symbolToken","parseFunctionCall","positionBefore","lamdaFunction","parseLambdaFunction","parseShorthandLambdaFunction","parseObject","parseArray","tokenType","parseNumber","parseString","parseReservedSymbol","parseRegexpShorthand","stringNode","stringFromQuotedSymbol","nextToken","functionArguments","parseFunctionArguments","parsedBlock","defaults","parseBindingTarget","startPos","endPos","dollar1","parseOptionalDefaulValue","requireDefaultValue","noRest","elements","keySymbol","keyName","allowDocString","isDocStringToken","parseDocString","parseImplicitBlock","ends","isImplicitBlockEnd","assertImplicitBlockEnd","isDoseq","forLoopBindings","loopBinding","parseForLoopBinding","existingBoundNames","flatMap","newBoundNames","parseBinding","modifiers","assertInternalLoopBindingDelimiter","letNode","isInternalLoopBindingDelimiter","symbolsString","isUnless","condition","thenExpression","elseExpression","caseExpression","valueExpression","exportToken","stringToSymbolNode","backslash","singleQuote","normalChar","isNumberReservedSymbol","numberString","stringToken","doubleQuote","newline","tab","carriageReturn","backspace","formFeed","endStringPosition","regexpString","optionsString","optionsNode","litsCommands","AutoCompleter","originalProgram","originalPosition","prefixProgram","suffixProgram","searchString","suggestions","suggestionIndex","lits","partialProgram","lastToken","tokenize","generateSuggestions","getNextSuggestion","getAutoCompleteSuggestionResult","getNextSuggestionSymbol","getPreviousSuggestion","getPreviousSuggestionSymbol","suggestion","program","getSuggestions","getSearchString","blacklist","startsWithCaseSensitive","generateWithPredicate","startsWithCaseInsensitive","includesCaseSensitive","includesCaseInsensitive","shouldInclude","Cache","cache","firstEntry","lastEntry","_size","maxSize","getContent","clear","newEntry","nextEntry","dropFirstEntry","allBuiltinModules","getNumberTheorySequenceNames","getVectorReductionNames","baseName","api","collectionUtils","sequenceUtils","math","mathUtils","functional","functionalUtils","meta","misc","regularExpression","stringUtils","bitwise","bitwiseUtils","vectorUtils","linAlg","numberTheory","apiNames","astCache","astCacheSize","debug","config","initialCache","cacheEntry","nsList","ns","getRuntimeInfo","run","generateAst","programOrAst","tokenizeParams","hasDebugData","tokenDescriptor","minify","transformSymbols","transformer","tokenStram","transformSymbolTokens","untokenize","fnParams","fnName","generateApplyFunctionCall","paramsString","cachedAst","getAutoCompleter"],"mappings":"aAEM,SAAUA,EAAcC,GAC5B,IAAKA,EAAeC,WAAaD,EAAeE,KAC9C,MAAO,GAET,MAAMC,EAAcH,EAAeC,SAASG,OAAS,EAC/CC,EAAeL,EAAeE,KAAKI,OAASH,EAAc,EAChE,MAAO,GAAG,IAAII,OAAOC,KAAKC,IAAIN,EAAa,OAAO,IAAII,OAAOC,KAAKC,IAAIJ,EAAc,KACtF,CCQM,MAAOK,UAAoBC,MACxBC,OACP,WAAAC,CAAYD,GACVE,MAAM,kBAAkBF,KACxBG,OAAOC,eAAeC,KAAMP,EAAYQ,WACxCD,KAAKE,KAAO,cACZF,KAAKL,OAASA,CACf,EAGG,MAAOQ,UAAkBT,MACbX,eACAqB,aAChB,WAAAR,CAAYS,EAActB,GACxB,MAAMuB,EAAUD,aAAeX,MAC3BW,EAAIC,QACJ,GAAGD,IAEPR,MA/BJ,SAA6BS,EAAiBvB,GAC5C,IAAKA,EACH,OAAOuB,EAET,MAAMC,EAAW,GAAGxB,EAAeC,SAASwB,QAAQzB,EAAeC,SAASG,SAM5E,MAAO,GAAGmB,IALWvB,EAAe0B,SAChC,KAAK1B,EAAe0B,YAAYF,IAChC,cAAcA,QACIxB,EAAeE,SACbH,EAAcC,IAExC,CAoBU2B,CAAoBJ,EAASvB,IACnCiB,KAAKI,aAAeE,EACpBN,KAAKjB,eAAiBA,EACtBe,OAAOC,eAAeC,KAAMG,EAAUF,WACtCD,KAAKE,KAAO,WACb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GAE/C8H,MAAOK,EAAa,KCtDXo0B,GAAmB,CAC9B,EACA,EACA,EACA,EACA,GACA,IACA,IACA,KACA,MACA,OACA,QACA,SACA,UACA,WACA,YACA,aACA,cACA,eACA,iBCdI,SAAUC,GAAY9rB,GAC1B,GAAIA,EAAI,EACN,MAAM,IAAIrQ,MAAM,iDAElB,GAAU,IAANqQ,GAAiB,IAANA,EACb,OAAO,EAET,GAAIA,GAAK,GACP,OAAO6rB,GAAiB7rB,GAE1B,IAAIjH,EAAS8yB,GAAiB,IAC9B,IAAK,IAAI7xB,EAAI,GAAIA,GAAKgG,EAAGhG,IACvBjB,GAAUiB,EAEZ,OAAOjB,CACT,CAEO,MAAMgzB,GAAuD,CAClElC,UAAW,CACT5xB,SAAU,EAAE+H,GAAIhR,KACd0F,EAAasL,EAAGhR,EAAgB,CAAE4E,SAAS,EAAMS,aAAa,EAAMI,IAAK,MAClEq3B,GAAY9rB,IAErB5I,MAAOK,EAAa,KC5BXu0B,GAAmB,CAC9B,EACA,EACA,EACA,EACA,EACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,iBACA,iBACA,iBACA,iBACA,iBACA,iBACA,iBACA,iBACA,iBACA,kBCzQK,MAAMC,GAAwD,CACnEnC,WAAc,CACZ7xB,SAAU,EAAE+H,GAAIhR,KACd0F,EAAasL,EAAGhR,EAAgB,CAAE4E,SAAS,EAAMS,aAAa,IA/BpE,SAAoB2L,GAElB,GAAIA,GAAK,EACP,MAAO,CAAC,IACV,GAAU,IAANA,EACF,MAAO,CAAC,CAAC,IAEX,MAAMjH,EAAqB,GAkB3B,OAfA,SAASmzB,EAAmBC,EAAmB18B,EAAaq7B,GAC1D,GAAkB,IAAdqB,EAMJ,IAAK,IAAInyB,EAAIxK,KAAK8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Ef,OAAOs+B,GAET1D,OAAS,IF+DXiD,GAAY3E,IACZ2E,GAAYxE,IACZwE,GAAY/D,IACZ+D,GAAYvD,IACZuD,GAAYnD,IACZmD,GAAY/C,IACZ+C,GAAYrC,IACZqC,GAAY/B,IACZ+B,GAAYlB,IACZkB,GAAYzB,IACZyB,GAAYpB,IACZoB,GAAY9E,IACZ8E,GAAYb,IACZa,GAAYV,IACZI,GAAqBC,GAAwB,aD9FZ,CAC/B,EACA,EACA,EACA,EACA,EACA,EACA,GACA,GACA,GACA,GACA,IACA,IACA,IACA,IACA,KACA,KACA,KACA,MACA,MACA,MACA,MACA,OACA,OACA,OACA,OACA,QACA,QACA,QACA,QACA,SACA,SACA,SACA,SACA,UACA,UACA,UACA,WACA,WACA,WACA,WACA,YACA,YACA,YACA,YACA,aACA,aACA,aACA,aACA,cACA,cACA,cACA,cACA,eACA,eACA,eACA,eACA,eACA,gBACA,gBACA,gBACA,gBACA,iBACA,oBCgCFD,GAAqBC,GAAwB,UG/Ff,CAC5B,EACA,EACA,EACA,GACA,GACA,IACA,IACA,KACA,KACA,MACA,MACA,OACA,OACA,QACA,QACA,SACA,UACA,UACA,WACA,WACA,YACA,YACA,aACA,cACA,cACA,eACA,eACA,eACA,gBACA,mBHkEFD,GAAqBC,GAAwB,YAAa5G,KAC1D2G,GAAqBC,GAAwB,YIjGb,CAC9B,EACA,EACA,EACA,EACA,EACA,EACA,EACA,GACA,GACA,GACA,GACA,GACA,IACA,IACA,IACA,IACA,IACA,KACA,KACA,KACA,KACA,MACA,MACA,MACA,MACA,MACA,OACA,OACA,OACA,OACA,OACA,QACA,QACA,QACA,QACA,QACA,SACA,SACA,SACA,SACA,UACA,UACA,UACA,UACA,UACA,WACA,WACA,WACA,WACA,WACA,YACA,YACA,YACA,YACA,YACA,aACA,aACA,aACA,aACA,aACA,cACA,cACA,cACA,cACA,cACA,cACA,eACA,eACA,eACA,eACA,eACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,iBACA,oBJmBFD,GAAqBC,GAAwB,QKlGjB,CAC1B,EACA,EACA,EACA,EACA,EACA,GACA,GACA,GACA,GACA,GACA,IACA,IACA,IACA,IACA,IACA,KACA,KACA,KACA,KACA,KACA,MACA,MACA,MACA,MACA,OACA,OACA,OACA,OACA,OACA,QACA,QACA,QACA,QACA,QACA,SACA,SACA,SACA,SACA,SACA,UACA,UACA,UACA,UACA,UACA,WACA,WACA,WACA,WACA,YACA,YACA,YACA,YACA,YACA,aACA,aACA,aACA,aACA,aACA,cACA,cACA,cACA,cACA,cACA,cACA,eACA,eACA,eACA,eACA,eACA,eACA,gBACA,gBACA,gBACA,gBACA,gBACA,iBACA,oBLsBFD,GAAqBC,GAAwB,WMnGd,CAAC,EAAG,EAAG,GAAI,IAAK,KAAM,KAAM,OAAQ,OAAQ,cNoG3ED,GAAqBC,GAAwB,YAAazG,KAC1DwG,GAAqBC,GAAwB,OOrGlB,CACzB,EACA,EACA,EACA,GACA,GACA,GACA,IACA,IACA,IACA,KACA,KACA,MACA,MACA,MACA,OACA,OACA,QACA,QACA,QACA,SACA,SACA,SACA,UACA,UACA,WACA,WACA,WACA,YACA,YACA,aACA,aACA,aACA,cACA,cACA,cACA,eACA,eACA,eACA,gBACA,gBACA,gBACA,mBP4DFD,GAAqBC,GAAwB,UQtGf,CAAC,EAAG,GAAI,IAAK,KAAM,SAAU,WAAY,gBRuGvED,GAAqBC,GAAwB,YSvGb,CAC9B,EACA,EACA,GACA,KACA,QACA,iBTkGFD,GAAqBC,GAAwB,OUxGlB,CACzB,EACA,EACA,EACA,GACA,GACA,IACA,IACA,KACA,MACA,OACA,OACA,QACA,SACA,UACA,WACA,YACA,YACA,aACA,cACA,eACA,gBACA,oBVmFFD,GAAqBpF,IACrBoF,GAAqB7E,IACrB6E,GAAqBhE,IACrBgE,GAAqBV,IC6Cd,MAAM0B,GAA2D,CACtE,WAAY,CACVv7B,SAAU,EAAEH,EAAGC,GAAI/I,KACjB0F,EAAaoD,EAAG9I,EAAgB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ACA,sBAEFC,KAAM,CACJ,IACA,IACA,IACA,IACA,MACA,IACA,OACA,MACA,MACA,OACA,OACA,IACA,QACA,QACA,QACA,OACA,MACA,MACA,MACA,QAEFC,UAAW,CACT,UACA,YACA,aACA,WACA,WACA,WACA,YACA,YACA,YACA,YACA,YACA,YACA,aACA,aACA,aACA,cACA,eAEFC,WAAY,CACV,KACA,QACA,WACA,OACA,cAEFC,gBAAiB,CACf,kBACA,wBACA,wBACA,uBACA,oBAEFC,KAAM,CACJ,MACA,SAEFC,KAAM,CACJ,IACA,KACA,IACA,IACA,KACA,KACA,IACA,SACA,kBACA,kBACA,UACA,UACA,aACA,SACA,aACA,kBAEF9/B,OAAQ,CACN,SACA,OACA,OACA,UACA,OACA,QACA,aACA,SACA,eAEFyC,UAAW,CACT,WACA,QACA,UACA,UACA,YACA,WACA,SACA,UACA,cACA,YACA,UACA,QACA,OACA,OACA,QACA,OACA,UACA,qBACA,qBACA,SACA,QACA,SACA,aACA,UACA,QACA,WAEFs9B,kBAAmB,CACjB,SACA,QACA,UACA,eAEFziB,OAAQ,CACN,MACA,SACA,aACA,aACA,OACA,QACA,OACA,UAEF0iB,YAAa,CACX,uBACA,wBACA,sBACA,mBACA,oBACA,kBACA,mBACA,qBACA,kBACA,uBACA,uBACA,8BACA,8BACA,qBAEFC,QAAS,CACP,KACA,KACA,MACA,IACA,IACA,OAEFC,aAAc,CACZ,kBACA,sBACA,mBACA,oBACA,kBACA,oBAEF7+B,OAAQ,CACN,gBACA,iBACA,kBACA,mBACA,mBACA,oBACA,oBACA,qBACA,sBACA,uBACA,sBACA,qBACA,uBACA,6BACA,2BACA,sBACA,wBACA,2BACA,yBACA,qBACA,wBACA,uBACA,uBACA,uBACA,uBACA,yBACA,uBACA,wBAEF7R,KAAM,CACJ,cACA,aACA,kBACA,iBACA,kBACA,iBACA,WACA,WACA,aACA,YACA,gBACA,eACA,iBACA,cACA,cACA,cACA,oBACA,oBACA,aACA,kBACA,kBACA,mBACA,mBACA,mBACA,mBACA,WACA,YACA,cACA,eACA,iBACA,oBACA,eACA,iBACA,iBACA,oBACA,eACA,iBACA,mBAEFI,OAAQ,CACN,aACA,aACA,aACA,aACA,kBACA,eACA,eACA,oBACA,qBACA,2BACA,2BACA,mBACA,iBACA,qBACA,mBACA,qBACA,iBACA,qBACA,cACA,iBACA,cACA,wBACA,kBACA,kBACA,mBAEFX,OAAQ,CACN,MACA,OACA,SACA,QAEFkxC,YAAa,CACX,oBACA,6BACA,qBACA,qBACA,8BACA,8BACA,gBACA,cACA,mBACA,mBACA,sBACA,sBACA,kBACA,cACA,eACA,cACA,kBACA,gBACA,iBACA,mBACA,oBACA,kBACA,mBACA,cACA,mBACA,kBACA,kBACA,mBACA,aACA,aACA,cACA,kBACGf,GAAwB,WACxBA,GAAwB,aACxBA,GAAwB,eACxBA,GAAwB,sBACxBA,GAAwB,UACxBA,GAAwB,WACxBA,GAAwB,YACxBA,GAAwB,mBACxBA,GAAwB,UACxBA,GAAwB,WACxBA,GAAwB,qBACxBA,GAAwB,oBACxBA,GAAwB,eACxBA,GAAwB,sBACxBA,GAAwB,eACxBA,GAAwB,sBACxBA,GAAwB,sBACxBA,GAAwB,6BACxBA,GAAwB,UACxBA,GAAwB,UACxBA,GAAwB,YACxBA,GAAwB,uBACxBA,GAAwB,cACxBA,GAAwB,aAE7BgB,OAAQ,CACN,yBACA,yBACA,sBACA,0BACA,0BACA,qBACA,uBACA,kCACA,kCACA,kCACA,8BACA,8BACA,+BACA,uBACA,4BACA,6BACA,2BACA,4BACA,mCACA,oCACA,gCACA,oCACA,gCACA,kCACA,8BACA,oCACA,gCACA,oCACA,gCACA,qBACA,sBACA,+BACA,8BACA,6BACA,iCACA,mCACA,sBACA,uBACA,0BACA,6BAEFC,aAAc,IACTlB,GAA6B,eAC7BA,GAA6B,iBAC7BA,GAA6B,WAC7BA,GAA6B,cAC7BA,GAA6B,gBAC7BA,GAA6B,gBAC7BA,GAA6B,gBAC7BA,GAA6B,gBAC7BA,GA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