JulioHerrlein Posted March 9, 2021 Share Posted March 9, 2021 Dear All, I'm searching ways of making lists of lists. I tried all this because I was wanting to call materials from an array, like this: (setf mat1 '(c4 d4 ds7)) (setf mat2 '(d4 e4 c5)) (setf mat3 '(d4 eb4 cs5)) (setf mat4 '(d4 f4 c5)) (setf mat5 '(d4 g4 c5)) (setf mat6 '(d4 a4 c5)) (setf mat7 '(e4 a4 c5)) (setf mat8 '(f4 a4 c5)) (setf mat9 '(g4 a4 c5)) (setf mat10 '(a4 a4 c5)) (setf mat11 '(b4 a4 c5)) (setf array (build-array '((mat0 mat1 mat2 mat3) (mat4 mat5 mat6 mat7) (mat8 mat9 mat10 mat11)))) ;;;GET-ARRAY : (ROW COLUMN SIZE ARRAY &KEY DIRECTION (get-array 0 1 2 array :direction 'down) (setf listmat (get-array 0 1 2 array :direction 'down)) (list listmat) ; this does not work ; the result should be (list mat1 mat5) ((c4 d4 ds7) (d4 g4 c5)) What I did wrong ? Thanks in advance Quote Link to comment Share on other sites More sharing options...
JulioHerrlein Posted March 9, 2021 Author Share Posted March 9, 2021 Apply-Eval is the solution... (apply-eval listmat) Quote Link to comment Share on other sites More sharing options...
opmo Posted March 9, 2021 Share Posted March 9, 2021 (setf mat0 '(c4 d4 cs5)) (setf mat1 '(c4 db4 ds7)) (setf mat2 '(d4 e4 c5)) (setf mat3 '(d4 eb4 cs5)) (setf mat4 '(d4 f4 c5)) (setf mat5 '(d4 g4 c5)) (setf mat6 '(d4 a4 c5)) (setf mat7 '(e4 a4 c5)) (setf mat8 '(f4 a4 c5)) (setf mat9 '(g4 a4 c5)) (setf mat10 '(a4 a4 c5)) (setf mat11 '(b4 a4 c5)) (setf array (build-array (list (assemble-seq mat0 mat1 mat2 mat3) (assemble-seq mat4 mat5 mat6 mat7) (assemble-seq mat8 mat9 mat10 mat11)))) (get-array 0 1 2 array :direction 'down) => ((c4 db4 ds7) (d4 g4 c5)) In your variables mat0 was missing. JulioHerrlein 1 Quote Link to comment Share on other sites More sharing options...
JulioHerrlein Posted March 9, 2021 Author Share Posted March 9, 2021 Dear Janusz, Thank you ! Yes, I noticed it later. But it was not that error. It was the apply eval thing. Thank you ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.