From 64848265157738f0a0951a70cf05b88732dbec24 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 21 Sep 2023 16:52:13 -0700 Subject: New functions: nested-vec-of and nested-vec. * eval.c (eval_init): Register nestd-vec-of and nested-vec intrinsics. * lib.[ch] (vec_allocate, vec_own, vec_init): New static functions. (vector, copy_vec): Expressed in terms of new functions. (nested_vec_of_v, nested_vec_v): New functions. * args.[ch] (args_cat_from): New function. * tests/010/vec.tl: New tests. * txr.1: Documented. --- tests/010/vec.tl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests/010') diff --git a/tests/010/vec.tl b/tests/010/vec.tl index c1d435b9..f7b182c1 100644 --- a/tests/010/vec.tl +++ b/tests/010/vec.tl @@ -30,3 +30,24 @@ (fill-vec v3 2 -1) #(1 0 2) (fill-vec v3 3 -3) #(3 3 3)) (fill-vec v3 0 -2 -1) #(3 0 3)) + +(mtest + (nested-vec) nil + (nested-vec-of 0 4) #(0 0 0 0) + (nested-vec-of 0 4 3) #(#(0 0 0) + #(0 0 0) + #(0 0 0) + #(0 0 0)) + (nested-vec-of 'a 4 3 2) #(#(#(a a) #(a a) #(a a)) + #(#(a a) #(a a) #(a a)) + #(#(a a) #(a a) #(a a)) + #(#(a a) #(a a) #(a a))) + (nested-vec-of 'a 1 1 1) #(#(#(a))) + (nested-vec-of 'a 1 1 0) #(#(#())) + (nested-vec-of 'a 1 0 1) #(#()) + (nested-vec-of 'a 1 0) #(#()) + (nested-vec-of 'a 0 1) #() + (nested-vec-of 'a 0) #() + + (nested-vec-of 'a 4 0 1) #(#() #() #() #()) + (nested-vec-of 'a 4 0) #(#() #() #() #())) -- cgit v1.2.3