Posted January 2Jan 2 I'm stuck. Why does the first example work but not the second? Thanks! (setf v1 '((-w h a4 d4) (h f4 e4 d4 q a4 g4) (q f4 g4 e a4 bb4 c5 a4 q bb4 h a4 q g4) (h a4 bb4 w a4))) First example: (loop for n from 1 to 4 collect (get-events '(1 2 (2..4)) v1)) ;; "works" Second example: (loop for n from 1 to 4 collect (get-events '(1 n (2..4)) v1)) ;; doesn't work, why? This is the error message: Error: In 1- of (n) arguments should be of type number. 1 (continue) Return a value to use. 2 Supply a new argument. 3 (abort) Return to top loop level 0.
January 2Jan 2 ;;asign 3 variables a, b, and c to 1, 2 and 3 (setf a 1 b 2 c 3) (list a b c) =>(1 2 3) '(a b c) =>(a b c) Jesper
January 2Jan 2 29 minutes ago, jesele said: Yes, but macros and backquote are a bit harder to understand. Jesper indeed, you are right. I agree for macros but this simple example of use of backquotes list and comma to evaluate is not too difficult I think and very elegant.
Create an account or sign in to comment