ClojureDocs

导航

命名空间

for

clojure.core

自 1.0 起已推出 (资源)
  • (for seq-exprs body-expr)
List comprehension. Takes a vector of one or more
 binding-form/collection-expr pairs, each followed by zero or more
 modifiers, and yields a lazy sequence of evaluations of expr.
 Collections are iterated in a nested fashion, rightmost fastest,
 and nested coll-exprs can refer to bindings created in prior
 binding-forms.  Supported modifiers are: :let [binding-form expr ...],
 :while test, :when test.
 (take 100 (for [x (range 100000000) y (range 1000000) :while (< y x)] [x y]))