do-whileGBBopen ToolsdosublistsdosequenceGoTo Top

dosequence   (var sequence-form [result-form]) declaration* {tag | form}* => result*or nil[Macro]

Purpose
A generalized dolist-style iterator for any sequence.

Package   :gbbopen-tools

Module   :gbbopen-tools

Arguments and values

var     A variable symbol
sequence-form     A form that evaluates to a sequence
result-form     A form
declarations     A declare expression (not evaluated)
tag     A go tag (not evaluated)
form     A form
results     The values returned by evaluating the last form

Returns
If a return or return-from form is executed, then the values passed from that form are returned; otherwise, the values returned by evaluating the result-form are returned, or nil if there is no result-form.

Description
The body of dosequence is like a tagbody. Dosequence evaluates sequence-form, which should produce a sequence. It then executes the body once for each element in the sequence, with var bound to the element.

The scope of the binding of var does not include the sequence-form, but it does include the result-form.

See also
    dosublists

Examples

  > (dosequence (elt #(1 2 3)) (print elt))
  1 
  2 
  3 
  nil
  > (dosequence (char "abc") (print char))
  #\a 
  #\b 
  #\c
  nil
  >


The GBBopen Project


do-whileGBBopen ToolsdosublistsdosequenceGoTo Top