Files
RustAst/examples/destructuring.myc
T
Michael Schimmel 9222fb5bc8 Update benchmark results
The benchmark results in several example files have been updated. This
commit reflects slight variations in performance measurements for
various test cases, including closure scope, data structures,
destructuring, higher-order functions, macros, and tuple operations.
2026-02-21 15:16:36 +01:00

28 lines
691 B
Plaintext

;; Benchmark: 2.3us
;; Benchmark-Repeat: 880
;; 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"