LISP nested Loops perform in parallel. How would one force it to perform sequentially? -
I have been learning Lisp slowly since the last two weeks. I have come in a situation where lisp presents two loops in parallel, and what I am not aiming for. If I understand correctly, what I want to achieve will be classified sequentially. To give you an idea of what happens to you, we can take a look at the following:
(for 'y') (in '(ABCDE)' in the loop ('1 2 3 4 5') ) With this type of coding, one will get:
(A1) (B2) (C3) (D4) (E5)) But what I want is:
(A1) (A2) (A3) (A4 What changes would I need to make with this loop to get the desired result? (A5) (B1) (B2) (B3) and so on I am wrong to use the word "successively", please correct me. I am studying on it, but I have a hard time.
You need a nested loop:
(loop 'x' in 'abcde') nconc (y 'loop' (1 2 3 4) 5) Collect (list xy))
Comments
Post a Comment