Next: , Previous: Finders, Up: Gathering Clauses

2.3.4 Boolean Tests

— Clause: first-iteration-p

Returns t in the first cycle of the loop, otherwise nil.

— Clause: first-time-p

Returns t the first time the expression is evaluated, and then nil forever. This clause comes handy when printing (optional) elements separated by a comma:

       (iter (for el in '(nil 1 2 nil 3))
             (when el
               (unless (first-time-p)
                 (princ ", "))
               (princ el)))

produces "1, 2, 3".