@mojir/lits 2.2.2 → 2.2.3

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 (208) hide show
  1. package/dist/cli/cli.js +1145 -1105
  2. package/dist/cli/src/AutoCompleter/AutoCompleter.d.ts +2 -1
  3. package/dist/cli/src/builtin/bindingNode.d.ts +3 -3
  4. package/dist/cli/src/builtin/index.d.ts +0 -1
  5. package/dist/cli/src/builtin/interface.d.ts +3 -4
  6. package/dist/cli/src/builtin/specialExpressionTypes.d.ts +0 -1
  7. package/dist/cli/src/builtin/specialExpressions/and.d.ts +2 -2
  8. package/dist/cli/src/builtin/specialExpressions/array.d.ts +2 -2
  9. package/dist/cli/src/builtin/specialExpressions/block.d.ts +2 -2
  10. package/dist/cli/src/builtin/specialExpressions/cond.d.ts +2 -2
  11. package/dist/cli/src/builtin/specialExpressions/if.d.ts +2 -2
  12. package/dist/cli/src/builtin/specialExpressions/loop.d.ts +2 -2
  13. package/dist/cli/src/builtin/specialExpressions/loops.d.ts +4 -4
  14. package/dist/cli/src/builtin/specialExpressions/object.d.ts +2 -2
  15. package/dist/cli/src/builtin/specialExpressions/or.d.ts +2 -2
  16. package/dist/cli/src/builtin/specialExpressions/qq.d.ts +2 -2
  17. package/dist/cli/src/builtin/specialExpressions/recur.d.ts +2 -2
  18. package/dist/cli/src/builtin/specialExpressions/switch.d.ts +2 -2
  19. package/dist/cli/src/builtin/specialExpressions/throw.d.ts +2 -2
  20. package/dist/cli/src/builtin/specialExpressions/try.d.ts +2 -2
  21. package/dist/cli/src/builtin/specialExpressions/unless.d.ts +2 -2
  22. package/dist/cli/src/builtin/utils.d.ts +2 -2
  23. package/dist/cli/src/evaluator/index.d.ts +2 -2
  24. package/dist/cli/src/evaluator/interface.d.ts +4 -3
  25. package/dist/cli/src/getUndefinedSymbols/index.d.ts +2 -2
  26. package/dist/cli/src/parser/ParserContext.d.ts +20 -0
  27. package/dist/cli/src/parser/helpers.d.ts +19 -0
  28. package/dist/cli/src/parser/index.d.ts +3 -0
  29. package/dist/cli/src/parser/subParsers/getPrecedence.d.ts +3 -0
  30. package/dist/cli/src/parser/subParsers/parseArray.d.ts +3 -0
  31. package/dist/cli/src/parser/subParsers/parseBindingTarget.d.ts +6 -0
  32. package/dist/cli/src/parser/subParsers/parseCond.d.ts +4 -0
  33. package/dist/cli/src/parser/subParsers/parseDo.d.ts +3 -0
  34. package/dist/cli/src/parser/subParsers/parseForOrDoseq.d.ts +4 -0
  35. package/dist/cli/src/parser/subParsers/parseFunction.d.ts +4 -0
  36. package/dist/cli/src/parser/subParsers/parseFunctionCall.d.ts +3 -0
  37. package/dist/cli/src/parser/subParsers/parseIfOrUnless.d.ts +5 -0
  38. package/dist/cli/src/parser/subParsers/parseImplicitBlock.d.ts +5 -0
  39. package/dist/cli/src/parser/subParsers/parseLet.d.ts +4 -0
  40. package/dist/cli/src/parser/subParsers/parseLoop.d.ts +4 -0
  41. package/dist/cli/src/parser/subParsers/parseNumber.d.ts +3 -0
  42. package/dist/cli/src/parser/subParsers/parseObject.d.ts +3 -0
  43. package/dist/cli/src/parser/subParsers/parseOperand.d.ts +3 -0
  44. package/dist/cli/src/parser/subParsers/parseRegexpShorthand.d.ts +3 -0
  45. package/dist/cli/src/parser/subParsers/parseReservedSymbol.d.ts +3 -0
  46. package/dist/cli/src/parser/subParsers/parseString.d.ts +4 -0
  47. package/dist/cli/src/parser/subParsers/parseSwitch.d.ts +4 -0
  48. package/dist/cli/src/parser/subParsers/parseSymbol.d.ts +3 -0
  49. package/dist/cli/src/parser/subParsers/parseTry.d.ts +4 -0
  50. package/dist/cli/src/parser/types.d.ts +19 -26
  51. package/dist/cli/src/testFramework/index.d.ts +3 -2
  52. package/dist/cli/src/tokenizer/token.d.ts +0 -2
  53. package/dist/cli/src/tokenizer/tokenizers.d.ts +2 -2
  54. package/dist/cli/src/typeGuards/astNode.d.ts +18 -19
  55. package/dist/cli/src/typeGuards/index.d.ts +0 -1
  56. package/dist/cli/src/typeGuards/lits.d.ts +0 -1
  57. package/dist/full.esm.js +1 -1
  58. package/dist/full.esm.js.map +1 -1
  59. package/dist/full.js +1 -1
  60. package/dist/full.js.map +1 -1
  61. package/dist/index.esm.js +1 -1
  62. package/dist/index.esm.js.map +1 -1
  63. package/dist/index.js +1 -1
  64. package/dist/index.js.map +1 -1
  65. package/dist/lits.iife.js +1 -1
  66. package/dist/lits.iife.js.map +1 -1
  67. package/dist/modules/assert.esm.js.map +1 -1
  68. package/dist/modules/assert.js.map +1 -1
  69. package/dist/modules/bitwise.esm.js.map +1 -1
  70. package/dist/modules/bitwise.js.map +1 -1
  71. package/dist/modules/collection.esm.js.map +1 -1
  72. package/dist/modules/collection.js.map +1 -1
  73. package/dist/modules/functional.esm.js.map +1 -1
  74. package/dist/modules/functional.js.map +1 -1
  75. package/dist/modules/grid.esm.js.map +1 -1
  76. package/dist/modules/grid.js.map +1 -1
  77. package/dist/modules/linear-algebra.esm.js.map +1 -1
  78. package/dist/modules/linear-algebra.js.map +1 -1
  79. package/dist/modules/matrix.esm.js.map +1 -1
  80. package/dist/modules/matrix.js.map +1 -1
  81. package/dist/modules/number-theory.esm.js.map +1 -1
  82. package/dist/modules/number-theory.js.map +1 -1
  83. package/dist/modules/random.esm.js.map +1 -1
  84. package/dist/modules/random.js.map +1 -1
  85. package/dist/modules/sequence.esm.js.map +1 -1
  86. package/dist/modules/sequence.js.map +1 -1
  87. package/dist/modules/src/AutoCompleter/AutoCompleter.d.ts +2 -1
  88. package/dist/modules/src/builtin/bindingNode.d.ts +3 -3
  89. package/dist/modules/src/builtin/index.d.ts +0 -1
  90. package/dist/modules/src/builtin/interface.d.ts +3 -4
  91. package/dist/modules/src/builtin/specialExpressionTypes.d.ts +0 -1
  92. package/dist/modules/src/builtin/specialExpressions/and.d.ts +2 -2
  93. package/dist/modules/src/builtin/specialExpressions/array.d.ts +2 -2
  94. package/dist/modules/src/builtin/specialExpressions/block.d.ts +2 -2
  95. package/dist/modules/src/builtin/specialExpressions/cond.d.ts +2 -2
  96. package/dist/modules/src/builtin/specialExpressions/if.d.ts +2 -2
  97. package/dist/modules/src/builtin/specialExpressions/loop.d.ts +2 -2
  98. package/dist/modules/src/builtin/specialExpressions/loops.d.ts +4 -4
  99. package/dist/modules/src/builtin/specialExpressions/object.d.ts +2 -2
  100. package/dist/modules/src/builtin/specialExpressions/or.d.ts +2 -2
  101. package/dist/modules/src/builtin/specialExpressions/qq.d.ts +2 -2
  102. package/dist/modules/src/builtin/specialExpressions/recur.d.ts +2 -2
  103. package/dist/modules/src/builtin/specialExpressions/switch.d.ts +2 -2
  104. package/dist/modules/src/builtin/specialExpressions/throw.d.ts +2 -2
  105. package/dist/modules/src/builtin/specialExpressions/try.d.ts +2 -2
  106. package/dist/modules/src/builtin/specialExpressions/unless.d.ts +2 -2
  107. package/dist/modules/src/builtin/utils.d.ts +2 -2
  108. package/dist/modules/src/evaluator/index.d.ts +2 -2
  109. package/dist/modules/src/evaluator/interface.d.ts +4 -3
  110. package/dist/modules/src/getUndefinedSymbols/index.d.ts +2 -2
  111. package/dist/modules/src/parser/ParserContext.d.ts +20 -0
  112. package/dist/modules/src/parser/helpers.d.ts +19 -0
  113. package/dist/modules/src/parser/index.d.ts +3 -0
  114. package/dist/modules/src/parser/subParsers/getPrecedence.d.ts +3 -0
  115. package/dist/modules/src/parser/subParsers/parseArray.d.ts +3 -0
  116. package/dist/modules/src/parser/subParsers/parseBindingTarget.d.ts +6 -0
  117. package/dist/modules/src/parser/subParsers/parseCond.d.ts +4 -0
  118. package/dist/modules/src/parser/subParsers/parseDo.d.ts +3 -0
  119. package/dist/modules/src/parser/subParsers/parseForOrDoseq.d.ts +4 -0
  120. package/dist/modules/src/parser/subParsers/parseFunction.d.ts +4 -0
  121. package/dist/modules/src/parser/subParsers/parseFunctionCall.d.ts +3 -0
  122. package/dist/modules/src/parser/subParsers/parseIfOrUnless.d.ts +5 -0
  123. package/dist/modules/src/parser/subParsers/parseImplicitBlock.d.ts +5 -0
  124. package/dist/modules/src/parser/subParsers/parseLet.d.ts +4 -0
  125. package/dist/modules/src/parser/subParsers/parseLoop.d.ts +4 -0
  126. package/dist/modules/src/parser/subParsers/parseNumber.d.ts +3 -0
  127. package/dist/modules/src/parser/subParsers/parseObject.d.ts +3 -0
  128. package/dist/modules/src/parser/subParsers/parseOperand.d.ts +3 -0
  129. package/dist/modules/src/parser/subParsers/parseRegexpShorthand.d.ts +3 -0
  130. package/dist/modules/src/parser/subParsers/parseReservedSymbol.d.ts +3 -0
  131. package/dist/modules/src/parser/subParsers/parseString.d.ts +4 -0
  132. package/dist/modules/src/parser/subParsers/parseSwitch.d.ts +4 -0
  133. package/dist/modules/src/parser/subParsers/parseSymbol.d.ts +3 -0
  134. package/dist/modules/src/parser/subParsers/parseTry.d.ts +4 -0
  135. package/dist/modules/src/parser/types.d.ts +19 -26
  136. package/dist/modules/src/testFramework/index.d.ts +3 -2
  137. package/dist/modules/src/tokenizer/token.d.ts +0 -2
  138. package/dist/modules/src/tokenizer/tokenizers.d.ts +2 -2
  139. package/dist/modules/src/typeGuards/astNode.d.ts +18 -19
  140. package/dist/modules/src/typeGuards/index.d.ts +0 -1
  141. package/dist/modules/src/typeGuards/lits.d.ts +0 -1
  142. package/dist/modules/string.esm.js.map +1 -1
  143. package/dist/modules/string.js.map +1 -1
  144. package/dist/modules/vector.esm.js.map +1 -1
  145. package/dist/modules/vector.js.map +1 -1
  146. package/dist/src/AutoCompleter/AutoCompleter.d.ts +2 -1
  147. package/dist/src/builtin/bindingNode.d.ts +3 -3
  148. package/dist/src/builtin/index.d.ts +0 -1
  149. package/dist/src/builtin/interface.d.ts +3 -4
  150. package/dist/src/builtin/specialExpressionTypes.d.ts +0 -1
  151. package/dist/src/builtin/specialExpressions/and.d.ts +2 -2
  152. package/dist/src/builtin/specialExpressions/array.d.ts +2 -2
  153. package/dist/src/builtin/specialExpressions/block.d.ts +2 -2
  154. package/dist/src/builtin/specialExpressions/cond.d.ts +2 -2
  155. package/dist/src/builtin/specialExpressions/if.d.ts +2 -2
  156. package/dist/src/builtin/specialExpressions/loop.d.ts +2 -2
  157. package/dist/src/builtin/specialExpressions/loops.d.ts +4 -4
  158. package/dist/src/builtin/specialExpressions/object.d.ts +2 -2
  159. package/dist/src/builtin/specialExpressions/or.d.ts +2 -2
  160. package/dist/src/builtin/specialExpressions/qq.d.ts +2 -2
  161. package/dist/src/builtin/specialExpressions/recur.d.ts +2 -2
  162. package/dist/src/builtin/specialExpressions/switch.d.ts +2 -2
  163. package/dist/src/builtin/specialExpressions/throw.d.ts +2 -2
  164. package/dist/src/builtin/specialExpressions/try.d.ts +2 -2
  165. package/dist/src/builtin/specialExpressions/unless.d.ts +2 -2
  166. package/dist/src/builtin/utils.d.ts +2 -2
  167. package/dist/src/evaluator/index.d.ts +2 -2
  168. package/dist/src/evaluator/interface.d.ts +4 -3
  169. package/dist/src/getUndefinedSymbols/index.d.ts +2 -2
  170. package/dist/src/parser/ParserContext.d.ts +20 -0
  171. package/dist/src/parser/helpers.d.ts +19 -0
  172. package/dist/src/parser/index.d.ts +3 -0
  173. package/dist/src/parser/subParsers/getPrecedence.d.ts +3 -0
  174. package/dist/src/parser/subParsers/parseArray.d.ts +3 -0
  175. package/dist/src/parser/subParsers/parseBindingTarget.d.ts +6 -0
  176. package/dist/src/parser/subParsers/parseCond.d.ts +4 -0
  177. package/dist/src/parser/subParsers/parseDo.d.ts +3 -0
  178. package/dist/src/parser/subParsers/parseForOrDoseq.d.ts +4 -0
  179. package/dist/src/parser/subParsers/parseFunction.d.ts +4 -0
  180. package/dist/src/parser/subParsers/parseFunctionCall.d.ts +3 -0
  181. package/dist/src/parser/subParsers/parseIfOrUnless.d.ts +5 -0
  182. package/dist/src/parser/subParsers/parseImplicitBlock.d.ts +5 -0
  183. package/dist/src/parser/subParsers/parseLet.d.ts +4 -0
  184. package/dist/src/parser/subParsers/parseLoop.d.ts +4 -0
  185. package/dist/src/parser/subParsers/parseNumber.d.ts +3 -0
  186. package/dist/src/parser/subParsers/parseObject.d.ts +3 -0
  187. package/dist/src/parser/subParsers/parseOperand.d.ts +3 -0
  188. package/dist/src/parser/subParsers/parseRegexpShorthand.d.ts +3 -0
  189. package/dist/src/parser/subParsers/parseReservedSymbol.d.ts +3 -0
  190. package/dist/src/parser/subParsers/parseString.d.ts +4 -0
  191. package/dist/src/parser/subParsers/parseSwitch.d.ts +4 -0
  192. package/dist/src/parser/subParsers/parseSymbol.d.ts +3 -0
  193. package/dist/src/parser/subParsers/parseTry.d.ts +4 -0
  194. package/dist/src/parser/types.d.ts +19 -26
  195. package/dist/src/testFramework/index.d.ts +3 -2
  196. package/dist/src/tokenizer/token.d.ts +0 -2
  197. package/dist/src/tokenizer/tokenizers.d.ts +2 -2
  198. package/dist/src/typeGuards/astNode.d.ts +18 -19
  199. package/dist/src/typeGuards/index.d.ts +0 -1
  200. package/dist/src/typeGuards/lits.d.ts +0 -1
  201. package/dist/testFramework.esm.js +1 -1
  202. package/dist/testFramework.esm.js.map +1 -1
  203. package/dist/testFramework.js +1 -1
  204. package/dist/testFramework.js.map +1 -1
  205. package/package.json +1 -1
  206. package/dist/cli/src/parser/Parser.d.ts +0 -58
  207. package/dist/modules/src/parser/Parser.d.ts +0 -58
  208. package/dist/src/parser/Parser.d.ts +0 -58
@@ -1 +1 @@
1
- {"version":3,"file":"sequence.js","sources":["../../src/utils/debug/getCodeMarker.ts","../../src/errors.ts","../../src/constants/constants.ts","../../src/utils/symbols.ts","../../src/utils/debug/debugTools.ts","../../src/utils/debug/getSourceCodeInfo.ts","../../src/utils/getAssertionError.ts","../../src/typeGuards/array.ts","../../src/typeGuards/index.ts","../../src/typeGuards/litsFunction.ts","../../src/typeGuards/lits.ts","../../src/typeGuards/number.ts","../../src/typeGuards/string.ts","../../src/utils/index.ts","../../src/utils/arity.ts","../../src/builtin/modules/sequence/index.ts"],"sourcesContent":["import type { SourceCodeInfo } from '../../tokenizer/token'\n\nexport function getCodeMarker(sourceCodeInfo: SourceCodeInfo): string {\n if (!sourceCodeInfo.position || !sourceCodeInfo.code)\n return ''\n\n const leftPadding = sourceCodeInfo.position.column - 1\n const rightPadding = sourceCodeInfo.code.length - leftPadding - 1\n return `${' '.repeat(Math.max(leftPadding, 0))}^${' '.repeat(Math.max(rightPadding, 0))}`\n}\n","import { getCodeMarker } from '../src/utils/debug/getCodeMarker'\nimport type { Arr } from './interface'\nimport type { SourceCodeInfo } from './tokenizer/token'\n\nfunction getLitsErrorMessage(message: string, sourceCodeInfo?: SourceCodeInfo) {\n if (!sourceCodeInfo) {\n return message\n }\n const location = `${sourceCodeInfo.position.line}:${sourceCodeInfo.position.column}`\n const filePathLine = sourceCodeInfo.filePath\n ? `\\n${sourceCodeInfo.filePath}:${location}`\n : `\\nLocation ${location}`\n const codeLine = `\\n${sourceCodeInfo.code}`\n const codeMarker = `\\n${getCodeMarker(sourceCodeInfo)}`\n return `${message}${filePathLine}${codeLine}${codeMarker}`\n}\n\nexport class RecurSignal extends Error {\n public params: Arr\n constructor(params: Arr) {\n super(`recur, params: ${params}`)\n Object.setPrototypeOf(this, RecurSignal.prototype)\n this.name = 'RecurSignal'\n this.params = params\n }\n}\n\nexport class LitsError extends Error {\n public readonly sourceCodeInfo?: SourceCodeInfo\n public readonly shortMessage: string\n constructor(err: unknown, sourceCodeInfo: SourceCodeInfo | undefined) {\n const message = err instanceof Error\n ? err.message\n : `${err}`\n\n super(getLitsErrorMessage(message, sourceCodeInfo))\n this.shortMessage = message\n this.sourceCodeInfo = sourceCodeInfo\n Object.setPrototypeOf(this, LitsError.prototype)\n this.name = 'LitsError'\n }\n\n public getCodeMarker(): string | undefined {\n return this.sourceCodeInfo && getCodeMarker(this.sourceCodeInfo)\n }\n}\n\nexport class UserDefinedError extends LitsError {\n public userMessage: string\n constructor(message: string, sourceCodeInfo?: SourceCodeInfo) {\n super(message, sourceCodeInfo)\n this.userMessage = message\n Object.setPrototypeOf(this, UserDefinedError.prototype)\n this.name = 'UserDefinedError'\n }\n}\n\nexport class AssertionError extends LitsError {\n constructor(message: string | Error, sourceCodeInfo?: SourceCodeInfo) {\n super(message, sourceCodeInfo)\n Object.setPrototypeOf(this, AssertionError.prototype)\n this.name = 'AssertionError'\n }\n}\n\nexport class UndefinedSymbolError extends LitsError {\n public symbol: string\n constructor(symbolName: string, sourceCodeInfo?: SourceCodeInfo) {\n const message = `Undefined symbol '${symbolName}'.`\n super(message, sourceCodeInfo)\n this.symbol = symbolName\n Object.setPrototypeOf(this, UndefinedSymbolError.prototype)\n this.name = 'UndefinedSymbolError'\n }\n}\n\nexport function isLitsError(error: unknown): error is LitsError {\n return error instanceof LitsError\n}\n","export const NodeTypes = {\n Number: 1,\n String: 2,\n NormalExpression: 3,\n SpecialExpression: 4,\n UserDefinedSymbol: 5,\n NormalBuiltinSymbol: 6,\n SpecialBuiltinSymbol: 7,\n ReservedSymbol: 8,\n Binding: 9,\n Spread: 10,\n} as const\n\nconst NodeTypesSet = new Set(Object.values(NodeTypes))\n\nexport type NodeType = typeof NodeTypes[keyof typeof NodeTypes]\n\nexport function getNodeTypeName(type: NodeType): keyof typeof NodeTypes {\n return Object.keys(NodeTypes).find(key => NodeTypes[key as keyof typeof NodeTypes] === type) as keyof typeof NodeTypes\n}\n\n// TODO, is this needed?\nexport function isNodeType(type: unknown): type is NodeType {\n return typeof type === 'number' && NodeTypesSet.has(type as NodeType)\n}\n\nconst functionTypes = [\n 'UserDefined',\n 'Partial',\n 'Comp',\n 'Constantly',\n 'Juxt',\n 'Complement',\n 'EveryPred',\n 'SomePred',\n 'Fnull',\n 'Builtin',\n 'SpecialBuiltin',\n 'NativeJsFunction',\n 'Module',\n] as const\n\nconst functionTypeSet = new Set(functionTypes)\n\nexport type FunctionType = typeof functionTypes[number]\n\nexport function isFunctionType(type: unknown): type is FunctionType {\n return typeof type === 'string' && functionTypeSet.has(type as FunctionType)\n}\n","export const FUNCTION_SYMBOL = '^^fn^^'\nexport const REGEXP_SYMBOL = '^^re^^'\n","import { getNodeTypeName, isFunctionType, isNodeType } from '../../constants/constants'\nimport type { LitsFunction, Node } from '../../parser/types'\nimport { FUNCTION_SYMBOL } from '../symbols'\n\nfunction isLitsFunction(func: unknown): func is LitsFunction {\n if (func === null || typeof func !== 'object')\n return false\n\n return FUNCTION_SYMBOL in func && 'functionType' in func && isFunctionType(func.functionType)\n}\n\nfunction isNode(value: unknown): value is Node {\n if (!Array.isArray(value) || value.length < 2)\n return false\n return isNodeType(value[0])\n}\n\nexport function valueToString(value: unknown): string {\n if (isLitsFunction(value))\n // eslint-disable-next-line ts/no-unsafe-member-access\n return `<function ${(value as any).name || '\\u03BB'}>`\n\n if (isNode(value))\n return `${getNodeTypeName(value[0])}-node`\n\n if (value === null)\n return 'null'\n\n if (typeof value === 'object' && value instanceof RegExp)\n return `${value}`\n\n if (typeof value === 'object' && value instanceof Error)\n return value.toString()\n\n return JSON.stringify(value)\n}\n","import type { SourceCodeInfo } from '../../tokenizer/token'\n\nexport function getSourceCodeInfo(anyValue: any, sourceCodeInfo: SourceCodeInfo | undefined): SourceCodeInfo | undefined {\n // eslint-disable-next-line ts/no-unsafe-return, ts/no-unsafe-member-access\n return anyValue?.sourceCodeInfo ?? sourceCodeInfo\n}\n","import { LitsError } from '../errors'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { valueToString } from './debug/debugTools'\nimport { getSourceCodeInfo } from './debug/getSourceCodeInfo'\n\nexport function getAssertionError(typeName: string, value: unknown, sourceCodeInfo?: SourceCodeInfo): LitsError {\n return new LitsError(`Expected ${typeName}, got ${valueToString(value)}.`, getSourceCodeInfo(value, sourceCodeInfo))\n}\n","import 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 { 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 { LitsError } from '../errors'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { valueToString } from '../utils/debug/debugTools'\nimport { getSourceCodeInfo } from '../utils/debug/getSourceCodeInfo'\n\ntype SignOptions =\n | {\n positive?: true\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: true\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: true\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: true\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: true\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: true\n }\n\ntype GtOptions =\n | {\n gt?: number\n gte?: never\n }\n | {\n gt?: never\n gte?: number\n }\n\ntype LtOptions =\n | {\n lt?: number\n lte?: never\n }\n | {\n lt?: never\n lte?: number\n }\n\ntype NumberOptions = {\n integer?: true\n finite?: true\n} & SignOptions &\nGtOptions &\nLtOptions\n\nfunction getRangeString(options: NumberOptions): string {\n const hasUpperAndLowerBound\n = (typeof options.gt === 'number' || typeof options.gte === 'number')\n && (typeof options.lt === 'number' || typeof options.lte === 'number')\n if (hasUpperAndLowerBound) {\n return `${typeof options.gt === 'number' ? `${options.gt} < n ` : `${options.gte} <= n `}${\n typeof options.lt === 'number' ? `< ${options.lt}` : `<= ${options.lte}`\n }`\n }\n else if (typeof options.gt === 'number' || typeof options.gte === 'number') {\n return `${typeof options.gt === 'number' ? `n > ${options.gt}` : `n >= ${options.gte}`}`\n }\n else if (typeof options.lt === 'number' || typeof options.lte === 'number') {\n return `${typeof options.lt === 'number' ? `n < ${options.lt}` : `n <= ${options.lte}`}`\n }\n else { return '' }\n}\n\nfunction getSignString(options: NumberOptions): string {\n return options.positive\n ? 'positive'\n : options.negative\n ? 'negative'\n : options.nonNegative\n ? 'non negative'\n : options.nonPositive\n ? 'non positive'\n : options.nonZero\n ? 'non zero'\n : ''\n}\n\nfunction getNumberTypeName(options: NumberOptions): string {\n if (options.zero)\n return 'zero'\n\n const sign = getSignString(options)\n const numberType = options.integer ? 'integer' : 'number'\n const finite = options.finite ? 'finite' : ''\n const range = getRangeString(options)\n\n return [sign, finite, numberType, range].filter(x => !!x).join(' ')\n}\n\nexport function isNumber(value: unknown, options: NumberOptions = {}): value is number {\n if (typeof value !== 'number')\n return false\n\n if (Number.isNaN(value))\n return false\n\n if (options.integer && !Number.isInteger(value))\n return false\n\n if (options.finite && !Number.isFinite(value))\n return false\n\n if (options.zero && value !== 0)\n return false\n\n if (options.nonZero && value === 0)\n return false\n\n if (options.positive && value <= 0)\n return false\n\n if (options.negative && value >= 0)\n return false\n\n if (options.nonPositive && value > 0)\n return false\n\n if (options.nonNegative && value < 0)\n return false\n\n if (typeof options.gt === 'number' && value <= options.gt)\n return false\n\n if (typeof options.gte === 'number' && value < options.gte)\n return false\n\n if (typeof options.lt === 'number' && value >= options.lt)\n return false\n\n if (typeof options.lte === 'number' && value > options.lte)\n return false\n\n return true\n}\n\nexport function assertNumber(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n options: NumberOptions = {},\n): asserts value is number {\n if (!isNumber(value, options)) {\n throw new LitsError(\n `Expected ${getNumberTypeName(options)}, got ${valueToString(value)}.`,\n getSourceCodeInfo(value, sourceCodeInfo),\n )\n }\n}\n\nexport function asNumber(\n value: unknown,\n sourceCodeInfo: SourceCodeInfo | undefined,\n options: NumberOptions = {},\n): number {\n assertNumber(value, sourceCodeInfo, options)\n return value\n}\n","import type { 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 { 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 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"],"names":["getCodeMarker","sourceCodeInfo","position","code","leftPadding","column","rightPadding","length","repeat","Math","max","LitsError","Error","shortMessage","constructor","err","message","super","location","line","filePath","getLitsErrorMessage","this","Object","setPrototypeOf","prototype","name","NodeTypes","Number","String","NormalExpression","SpecialExpression","UserDefinedSymbol","NormalBuiltinSymbol","SpecialBuiltinSymbol","ReservedSymbol","Binding","Spread","NodeTypesSet","Set","values","functionTypeSet","FUNCTION_SYMBOL","isLitsFunction","func","type","functionType","has","isNode","value","Array","isArray","valueToString","keys","find","key","RegExp","toString","JSON","stringify","getSourceCodeInfo","anyValue","getAssertionError","typeName","assertArray","assertCharArray","every","v","isCharArray","isUnknownRecord","asAny","assertAny","undefined","isAny","isSeq","asSeq","assertSeq","isColl","isRegularExpression","isObj","regexp","assertFunctionLike","isFunctionLike","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","assertString","nonEmpty","char","isString","asString","assertStringOrNumber","isStringOrNumber","collHasKey","coll","getOwnPropertyDescriptor","compare","a","b","deepEqual","epsilon","EPSILON","diff","abs","absA","absB","approxEqual","i","s","f","aKeys","bKeys","toNonNegativeInteger","num","ceil","toFixedArity","arity","min","partitionHelper","n","step","seq","pad","isStringSeq","result","start","outer","innerArr","padIndex","push","map","sequenceUtilsModule","functions","evaluate","fn","contextStack","executeFunction","index","split","findIndex","elem","docs","category","returns","args","fun","variants","argumentNames","description","seeAlso","examples","lastIndexOf","findLastIndex","item","shift","substring","copy","splice","params","deleteCount","rest","from","slice","forEach","items","keyfn","defaultComparer","comparer","sort","aKey","bKey","compareValue","take","input","array","drop","charArray","unshift","distinct","some","existingItem","remove","at","_","pos","seqIsArray","frequencies","reduce","val","partition","asArray","oldValue","acc","str","search","endsWith","suffix","startsWith","prefix","interleave","seqs","seqsArr","maxLength","interpose","separator"],"mappings":"aAEM,SAAUA,EAAcC,GAC5B,IAAKA,EAAeC,WAAaD,EAAeE,KAC9C,MAAO,GAET,MAAMC,EAAcH,EAAeC,SAASG,OAAS,EAC/CC,EAAeL,EAAeE,KAAKI,OAASH,EAAc,EAChE,MAAO,GAAG,IAAII,OAAOC,KAAKC,IAAIN,EAAa,OAAO,IAAII,OAAOC,KAAKC,IAAIJ,EAAc,KACtF,CCkBM,MAAOK,UAAkBC,MACbX,eACAY,aAChB,WAAAC,CAAYC,EAAcd,GACxB,MAAMe,EAAUD,aAAeH,MAC3BG,EAAIC,QACJ,GAAGD,IAEPE,MA/BJ,SAA6BD,EAAiBf,GAC5C,IAAKA,EACH,OAAOe,EAET,MAAME,EAAW,GAAGjB,EAAeC,SAASiB,QAAQlB,EAAeC,SAASG,SAM5E,MAAO,GAAGW,IALWf,EAAem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IjB,EAAI,EAAGA,EAAIc,EAAI3I,OAAS,EAAG6H,GAAK,EACvCiB,EAAOK,KAAKR,EAAId,GAAIiG,GAGtB,OADAhF,EAAOK,KAAKR,EAAIA,EAAI3I,OAAS,IACtB8I,GAETR,MAAOD,EAAa,GACpB0B,KAAM,CACJC,SAAU,WACVC,QAAS,CAAE3H,KAAM,YACjB4H,KAAM,CACJ/C,EAAG,CAAE7E,KAAM,YACX8E,EAAG,CAAE9E,KAAM,OACXqG,IAAK,CAAErG,KAAM,YACbwL,UAAW,CAAExL,KAAM,QAErB8H,SAAU,CAAC,CAAEC,cAAe,CAAC,MAAO,eACpCC,YAAa,2HACbC,QAAS,CAAC,sBAAuB,QACjCC,SAAU,CACR,2DACA,kEACA,+EACA"}
1
+ {"version":3,"file":"sequence.js","sources":["../../src/utils/debug/getCodeMarker.ts","../../src/errors.ts","../../src/constants/constants.ts","../../src/utils/symbols.ts","../../src/utils/debug/debugTools.ts","../../src/utils/debug/getSourceCodeInfo.ts","../../src/utils/getAssertionError.ts","../../src/typeGuards/array.ts","../../src/typeGuards/index.ts","../../src/typeGuards/litsFunction.ts","../../src/typeGuards/lits.ts","../../src/typeGuards/number.ts","../../src/typeGuards/string.ts","../../src/utils/index.ts","../../src/utils/arity.ts","../../src/builtin/modules/sequence/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 { AstNode, LitsFunction } 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 AstNode {\n if (!Array.isArray(value) || value.length < 2)\n return false\n return isNodeType(value[0])\n}\n\nexport function valueToString(value: unknown): string {\n if (isLitsFunction(value))\n // eslint-disable-next-line ts/no-unsafe-member-access\n return `<function ${(value as any).name || '\\u03BB'}>`\n\n if (isNode(value))\n return `${getNodeTypeName(value[0])}-node`\n\n if (value === null)\n return 'null'\n\n if (typeof value === 'object' && value instanceof RegExp)\n return `${value}`\n\n if (typeof value === 'object' && value instanceof Error)\n return value.toString()\n\n return JSON.stringify(value)\n}\n","import type { SourceCodeInfo } from '../../tokenizer/token'\n\nexport function getSourceCodeInfo(anyValue: any, sourceCodeInfo: SourceCodeInfo | undefined): SourceCodeInfo | undefined {\n // eslint-disable-next-line ts/no-unsafe-return, ts/no-unsafe-member-access\n return anyValue?.sourceCodeInfo ?? sourceCodeInfo\n}\n","import { LitsError } from '../errors'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { valueToString } from './debug/debugTools'\nimport { getSourceCodeInfo } from './debug/getSourceCodeInfo'\n\nexport function getAssertionError(typeName: string, value: unknown, sourceCodeInfo?: SourceCodeInfo): LitsError {\n return new LitsError(`Expected ${typeName}, got ${valueToString(value)}.`, getSourceCodeInfo(value, sourceCodeInfo))\n}\n","import 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 { 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\nfunction 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\nfunction 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 { LitsError } from '../errors'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { valueToString } from '../utils/debug/debugTools'\nimport { getSourceCodeInfo } from '../utils/debug/getSourceCodeInfo'\n\ntype SignOptions =\n | {\n positive?: true\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: true\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: true\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: true\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: true\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: true\n }\n\ntype GtOptions =\n | {\n gt?: number\n gte?: never\n }\n | {\n gt?: never\n gte?: number\n }\n\ntype LtOptions =\n | {\n lt?: number\n lte?: never\n }\n | {\n lt?: never\n lte?: number\n }\n\ntype NumberOptions = {\n integer?: true\n finite?: true\n} & SignOptions &\nGtOptions &\nLtOptions\n\nfunction getRangeString(options: NumberOptions): string {\n const hasUpperAndLowerBound\n = (typeof options.gt === 'number' || typeof options.gte === 'number')\n && (typeof options.lt === 'number' || typeof options.lte === 'number')\n if (hasUpperAndLowerBound) {\n return `${typeof options.gt === 'number' ? `${options.gt} < n ` : `${options.gte} <= n `}${\n typeof options.lt === 'number' ? `< ${options.lt}` : `<= ${options.lte}`\n }`\n }\n else if (typeof options.gt === 'number' || typeof options.gte === 'number') {\n return `${typeof options.gt === 'number' ? `n > ${options.gt}` : `n >= ${options.gte}`}`\n }\n else if (typeof options.lt === 'number' || typeof options.lte === 'number') {\n return `${typeof options.lt === 'number' ? `n < ${options.lt}` : `n <= ${options.lte}`}`\n }\n else { return '' }\n}\n\nfunction getSignString(options: NumberOptions): string {\n return options.positive\n ? 'positive'\n : options.negative\n ? 'negative'\n : options.nonNegative\n ? 'non negative'\n : options.nonPositive\n ? 'non positive'\n : options.nonZero\n ? 'non zero'\n : ''\n}\n\nfunction getNumberTypeName(options: NumberOptions): string {\n if (options.zero)\n return 'zero'\n\n const sign = getSignString(options)\n const numberType = options.integer ? 'integer' : 'number'\n const finite = options.finite ? 'finite' : ''\n const range = getRangeString(options)\n\n return [sign, finite, numberType, range].filter(x => !!x).join(' ')\n}\n\nexport function isNumber(value: unknown, options: NumberOptions = {}): value is number {\n if (typeof value !== 'number')\n return false\n\n if (Number.isNaN(value))\n return false\n\n if (options.integer && !Number.isInteger(value))\n return false\n\n if (options.finite && !Number.isFinite(value))\n return false\n\n if (options.zero && value !== 0)\n return false\n\n if (options.nonZero && value === 0)\n return false\n\n if (options.positive && value <= 0)\n return false\n\n if (options.negative && value >= 0)\n return false\n\n if (options.nonPositive && value > 0)\n return false\n\n if (options.nonNegative && value < 0)\n return false\n\n if (typeof options.gt === 'number' && value <= options.gt)\n return false\n\n if (typeof options.gte === 'number' && value < options.gte)\n return false\n\n if (typeof options.lt === 'number' && value >= options.lt)\n return false\n\n if (typeof options.lte === 'number' && value > options.lte)\n return false\n\n return true\n}\n\nexport function assertNumber(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n options: NumberOptions = {},\n): asserts value is number {\n if (!isNumber(value, options)) {\n throw new LitsError(\n `Expected ${getNumberTypeName(options)}, got ${valueToString(value)}.`,\n getSourceCodeInfo(value, sourceCodeInfo),\n )\n }\n}\n\nexport function asNumber(\n value: unknown,\n sourceCodeInfo: SourceCodeInfo | undefined,\n options: NumberOptions = {},\n): number {\n assertNumber(value, sourceCodeInfo, options)\n return value\n}\n","import type { 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 { 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 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"],"names":["getCodeMarker","sourceCodeInfo","position","code","leftPadding","column","rightPadding","length","repeat","Math","max","LitsError","Error","shortMessage","constructor","err","message","super","location","line","filePath","getLitsErrorMessage","this","Object","setPrototypeOf","prototype","name","NodeTypes","Number","String","NormalExpression","SpecialExpression","UserDefinedSymbol","NormalBuiltinSymbol","SpecialBuiltinSymbol","ReservedSymbol","Binding","Spread","NodeTypesSet","Set","values","functionTypeSet","FUNCTION_SYMBOL","isLitsFunction","func","type","functionType","has","isNode","value","Array","isArray","valueToString","keys","find","key","RegExp","toString","JSON","stringify","getSourceCodeInfo","anyValue","getAssertionError","typeName","assertArray","assertCharArray","every","v","isCharArray","isUnknownRecord","asAny","assertAny","undefined","isAny","isSeq","asSeq","assertSeq","isColl","isRegularExpression","isObj","regexp","assertFunctionLike","isFunctionLike","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","assertString","nonEmpty","char","isString","asString","assertStringOrNumber","isStringOrNumber","collHasKey","coll","getOwnPropertyDescriptor","compare","a","b","deepEqual","epsilon","EPSILON","diff","abs","absA","absB","approxEqual","i","s","f","aKeys","bKeys","toNonNegativeInteger","num","ceil","toFixedArity","arity","min","partitionHelper","n","step","seq","pad","isStringSeq","result","start","outer","innerArr","padIndex","push","map","sequenceUtilsModule","functions","evaluate","fn","contextStack","executeFunction","index","split","findIndex","elem","docs","category","returns","args","fun","variants","argumentNames","description","seeAlso","examples","lastIndexOf","findLastIndex","item","shift","substring","copy","splice","params","deleteCount","rest","from","slice","forEach","items","keyfn","defaultComparer","comparer","sort","aKey","bKey","compareValue","take","input","array","drop","charArray","unshift","distinct","some","existingItem","remove","at","_","pos","seqIsArray","frequencies","reduce","val","partition","asArray","oldValue","acc","str","search","endsWith","suffix","startsWith","prefix","interleave","seqs","seqsArr","maxLength","interpose","separator"],"mappings":"aAEM,SAAUA,EAAcC,GAC5B,IAAKA,EAAeC,WAAaD,EAAeE,KAC9C,MAAO,GAET,MAAMC,EAAcH,EAAeC,SAASG,OAAS,EAC/CC,EAAeL,EAAeE,KAAKI,OAASH,EAAc,EAChE,MAAO,GAAG,IAAII,OAAOC,KAAKC,IAAIN,EAAa,OAAO,IAAII,OAAOC,KAAKC,IAAIJ,EAAc,KACtF,CCkBM,MAAOK,UAAkBC,MACbX,eACAY,aAChB,WAAAC,CAAYC,EAAcd,GACxB,MAAMe,EAAUD,aAAeH,MAC3BG,EAAIC,QACJ,GAAGD,IAEPE,MA/BJ,SAA6BD,EAAiBf,GAC5C,IAAKA,EACH,OAAOe,EAET,MAAME,EAAW,GAAGjB,EAAeC,SAASiB,QAAQlB,EAAeC,SAASG,SAM5E,MAAO,GAAGW,IALWf,EAAemB,SAChC,KAAKnB,EAAemB,YAAYF,IAChC,cAAcA,QACIjB,EAAeE,SACbH,EAAcC,IAExC,CAoBUoB,CAAoBL,EAASf,IACnCqB,KAAKT,aAAeG,EACpBM,KAAKrB,eAAiBA,EACtBsB,OAAOC,eAAeF,KAAMX,EAAUc,WACtCH,KAAKI,KAAO,WACb,CAEM,aAAA1B,GACL,OAAOsB,KAAKrB,gBAAkBD,EAAcsB,KAAKrB,eAClD,EC5CI,MAAM0B,EAAY,CACvBC,OAAQ,EACRC,OAAQ,EACRC,iBA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KAAM,QAErB8H,SAAU,CAAC,CAAEC,cAAe,CAAC,MAAO,eACpCC,YAAa,2HACbC,QAAS,CAAC,sBAAuB,QACjCC,SAAU,CACR,2DACA,kEACA,+EACA"}
@@ -1,5 +1,5 @@
1
1
  import type { ContextParams, Lits } from '../Lits/Lits';
2
- export type AutoCompleteSuggestion = {
2
+ type AutoCompleteSuggestion = {
3
3
  program: string;
4
4
  position: number;
5
5
  };
@@ -22,3 +22,4 @@ export declare class AutoCompleter {
22
22
  private generateSuggestions;
23
23
  private generateWithPredicate;
24
24
  }
25
+ export {};
@@ -1,5 +1,5 @@
1
1
  import type { Any } from '../interface';
2
- import { type BindingTarget, type Node } from '../parser/types';
3
- export declare function walkDefaults(bindingTarget: BindingTarget, onDefault: (Node: Node) => void): void;
4
- export declare function evaluateBindingNodeValues(target: BindingTarget, value: Any, evaluate: (Node: Node) => Any): Record<string, Any>;
2
+ import { type AstNode, type BindingTarget } from '../parser/types';
3
+ export declare function walkDefaults(bindingTarget: BindingTarget, onDefault: (Node: AstNode) => void): void;
4
+ export declare function evaluateBindingNodeValues(target: BindingTarget, value: Any, evaluate: (Node: AstNode) => Any): Record<string, Any>;
5
5
  export declare function getAllBindingTargetNames(bindingTarget: BindingTarget): Record<string, true>;
@@ -11,4 +11,3 @@ export type SpecialExpressionType = typeof specialExpressionTypes[SpecialExpress
11
11
  export declare const builtin: Builtin;
12
12
  export declare const normalExpressionKeys: string[];
13
13
  export declare const specialExpressionKeys: string[];
14
- export declare const specialExpressionNameSet: Set<string>;
@@ -74,8 +74,7 @@ export interface CustomDocs {
74
74
  }
75
75
  export type SpecialExpressionDocs = FunctionDocs | CustomDocs;
76
76
  export declare function isFunctionDocs(docs: SpecialExpressionDocs): docs is FunctionDocs;
77
- export declare function isCustomDocs(docs: SpecialExpressionDocs): docs is CustomDocs;
78
- export type NormalExpressionEvaluator<T> = (params: Arr, sourceCodeInfo: SourceCodeInfo | undefined, contextStack: ContextStack, { executeFunction }: {
77
+ type NormalExpressionEvaluator<T> = (params: Arr, sourceCodeInfo: SourceCodeInfo | undefined, contextStack: ContextStack, { executeFunction }: {
79
78
  executeFunction: ExecuteFunction;
80
79
  }) => T;
81
80
  export interface BuiltinNormalExpression<T> {
@@ -85,8 +84,8 @@ export interface BuiltinNormalExpression<T> {
85
84
  docs?: FunctionDocs;
86
85
  }
87
86
  export type BuiltinNormalExpressions = Record<string, BuiltinNormalExpression<Any>>;
88
- export type BuiltinAllNormalExpressions = BuiltinNormalExpression<Any>[];
89
- export interface EvaluateHelpers {
87
+ type BuiltinAllNormalExpressions = BuiltinNormalExpression<Any>[];
88
+ interface EvaluateHelpers {
90
89
  evaluateNode: EvaluateNode;
91
90
  builtin: Builtin;
92
91
  getUndefinedSymbols: GetUndefinedSymbols;
@@ -20,4 +20,3 @@ export declare const specialExpressionTypes: {
20
20
  readonly try: 18;
21
21
  readonly unless: 19;
22
22
  };
23
- export type SpecialExpressionTypes = typeof specialExpressionTypes;
@@ -1,6 +1,6 @@
1
1
  import type { Any } from '../../interface';
2
- import type { Node, SpecialExpressionNode } from '../../parser/types';
2
+ import type { AstNode, SpecialExpressionNode } from '../../parser/types';
3
3
  import type { BuiltinSpecialExpression } from '../interface';
4
4
  import type { specialExpressionTypes } from '../specialExpressionTypes';
5
- export type AndNode = SpecialExpressionNode<[typeof specialExpressionTypes['&&'], Node[]]>;
5
+ export type AndNode = SpecialExpressionNode<[typeof specialExpressionTypes['&&'], AstNode[]]>;
6
6
  export declare const andSpecialExpression: BuiltinSpecialExpression<Any, AndNode>;
@@ -1,6 +1,6 @@
1
1
  import type { Any } from '../../interface';
2
- import type { Node, SpecialExpressionNode } from '../../parser/types';
2
+ import type { AstNode, SpecialExpressionNode } from '../../parser/types';
3
3
  import type { BuiltinSpecialExpression } from '../interface';
4
4
  import type { specialExpressionTypes } from '../specialExpressionTypes';
5
- export type ArrayNode = SpecialExpressionNode<[typeof specialExpressionTypes['array'], Node[]]>;
5
+ export type ArrayNode = SpecialExpressionNode<[typeof specialExpressionTypes['array'], AstNode[]]>;
6
6
  export declare const arraySpecialExpression: BuiltinSpecialExpression<Any, ArrayNode>;
@@ -1,6 +1,6 @@
1
1
  import type { Any } from '../../interface';
2
- import type { Node, SpecialExpressionNode } from '../../parser/types';
2
+ import type { AstNode, SpecialExpressionNode } from '../../parser/types';
3
3
  import type { BuiltinSpecialExpression } from '../interface';
4
4
  import type { specialExpressionTypes } from '../specialExpressionTypes';
5
- export type DoNode = SpecialExpressionNode<[typeof specialExpressionTypes['block'], Node[]]>;
5
+ export type DoNode = SpecialExpressionNode<[typeof specialExpressionTypes['block'], AstNode[]]>;
6
6
  export declare const doSpecialExpression: BuiltinSpecialExpression<Any, DoNode>;