From 490b9c94fba16f484be3bb58b8a4a4880b9396bc Mon Sep 17 00:00:00 2001 From: Kai Stevenson Date: Thu, 6 Nov 2025 00:18:26 -0800 Subject: implement recursion properly with closures --- test/test.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test.ts b/test/test.ts index 5e884ab..4b281b1 100644 --- a/test/test.ts +++ b/test/test.ts @@ -1,4 +1,4 @@ -import { _Evaluate, createFn } from "../src"; +import { _Evaluate, createFn, evaluate, lex, parse } from "../src"; const KS_boolToBin = "fn(b, ?(b, 1, 0))"; @@ -11,5 +11,9 @@ const factorial = createFn<[number]>()( ); const res = factorial(6); +console.log(res); -// console.log(factorial(2)); +const closureTest = createFn<[number]>()(`fn(n, call(fn(m, add(m,n)), n))`); + +const res2 = closureTest(5); +console.log(res2); -- cgit v1.2.3-70-g09d2