16af3ae9fc
This commit updates all example files to use `assert_eq!` for verifying output, replacing the previous `Output:` comments. This change makes the examples more robust and self-testing. The benchmark results in some examples have also been slightly adjusted, reflecting minor performance variations after the refactoring. Additionally, a runtime panic handling mechanism has been introduced in the VM for function calls, which improves error reporting for unexpected panics.
20 lines
656 B
Plaintext
20 lines
656 B
Plaintext
;; Benchmark: 2.4us
|
|
;; Benchmark-Repeat: 785
|
|
;; Demonstration of N-dimensional Tuples, Vectors, and Matrices
|
|
;; Based on docs/Tupel 1.md
|
|
;;
|
|
;; This test verifies that the literals are correctly parsed and represented.
|
|
;; Type inference is verified via internal compiler unit tests.
|
|
|
|
(do
|
|
(def tpl [1, 3.14, "text"])
|
|
(def v [10 20 30 40])
|
|
(def mat2d [[1 2], [3 4]])
|
|
(def mat3d [[[1 2] [3 4]] [[5 6] [7 8]]])
|
|
(def mixed [[1 2] [3 4 5]])
|
|
(def rec {:x 1, :y 0.3})
|
|
|
|
(assert-eq [[1 3.14 "text"] [10 20 30 40] [[1 2] [3 4]] [[[1 2] [3 4]] [[5 6] [7 8]]] [[1 2] [3 4 5]] {:x 1 :y 0.3}]
|
|
[tpl v mat2d mat3d mixed rec])
|
|
)
|