Add positional_count field to Lambda

This field is used for static optimization, determining if parameters
are purely positional.
This commit is contained in:
Michael Schimmel
2026-02-20 14:40:56 +01:00
parent 56d6c3bbde
commit 4e812c1afb
11 changed files with 361 additions and 62 deletions
+25
View File
@@ -0,0 +1,25 @@
;; Comprehensive Destructuring Test
;; Covers: Nested tuples, mixed params, dynamic passing
(do
;; 1. Deeply nested
(def deep (fn [[a [[b c] d]]] (+ a (+ b (+ c d)))))
;; 2. Mixed: Tuple and Single
(def mixed (fn [[x y] z] (+ (+ x y) z)))
;; 3. Dynamic: Passing a list variable
(def call-dynamic (fn [f data] (f data)))
(def data [10 [20 30]])
;; Validation
(if (= (deep [1 [[2 3] 4]]) 10)
(if (= (mixed [1 2] 3) 6)
(if (= (call-dynamic (fn [[a [b c]]] (+ a (+ b c))) data) 60)
"PASS"
"FAIL-DYNAMIC")
"FAIL-MIXED")
"FAIL-DEEP"))
;; Output: "PASS"