Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Common Lisp style loops in Clojure

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 README
Octocat-spinner-32 cl-loop.clj
Octocat-spinner-32 lessons.markdown
README
[Excuse me while I get the hang of this Github thing.]

v0.1 ALPHA. The API may change at any time.


 *   cl-loop
 *   Copyright (c) Tayssir John Gabbour. All rights reserved.
 *   The use and distribution terms for this software are covered by the
 *   Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
 *   which can be found in the file epl-v10.html at the root of this distribution.
 *   By using this software in any fashion, you are agreeing to be bound by
 *    the terms of this license.
 *   You must not remove this notice, or any other, from this software.



Simple examples:

(cl-loop for x [1 2 3]
         collect x)
=> [1 2 3]


(cl-loop for [k v] {:a 1, :b 2}
         set v2 (inc v)
         concat [k v2])
=> [:a 2 :b 3]



Wilder examples:

(cl-loop for letters     [:a :b :c :d :e :f]
         for whole-nums  (iterate inc 1)
         set mults-of-10 (* 10 whole-nums)
         (if (odd? whole-nums)
           (if (odd? whole-nums)
             [collect letters]
             [collect mults-of-10])
           (if true
             (if (even? whole-nums)
               [collect mults-of-10]
               [collect letters]))))
=> [:a 20 :c 40 :e 60]
Something went wrong with that request. Please try again.