Skip to content

Commit b50613f

Browse files
committed
iteration: about nconcing to return a flat list
1 parent f207476 commit b50613f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

iteration.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,16 @@ See also [with-hash-table-iterator](http://www.lispworks.com/documentation/Hyper
419419
;; ((A 1) (B 2) (C 3))
420420
~~~
421421

422+
To return a flat list, use `nconcing` instead of `collect`:
423+
424+
~~~lisp
425+
(loop for x in '(a b c)
426+
for y in '(1 2 3)
427+
nconcing (list x y))
428+
(A 1 B 2 C 3)
429+
~~~
430+
431+
422432
#### mapcar
423433
~~~lisp
424434
(mapcar (lambda (x y)
@@ -485,6 +495,8 @@ Return a flat list:
485495
;; ((1) (1 2) (1 2 3))
486496
~~~
487497

498+
To return a flat list, use `nconcing` instead of the first `collect`.
499+
488500
#### iterate
489501

490502
~~~lisp

0 commit comments

Comments
 (0)