Created
December 27, 2011 00:06
-
-
Save greghelton/1522322 to your computer and use it in GitHub Desktop.
Clojure: add several rows or records or structs then print singly then in loop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def account-info (hash-set | |
{:username "zak" | |
:balance 13.59 | |
:member-since "2009-02-01"} | |
{:username "mak" | |
:balance 12.59 | |
:member-since "2011-02-02"} | |
{:username "jak" | |
:balance 11.59 | |
:member-since "2009-12-02"})) | |
(prn (first account-info)) | |
(prn (first (rest account-info))) | |
(prn (first (next (rest account-info)))) | |
(prn (type (first (next (rest account-info))))) | |
(defn loop-thru [n] | |
(if-not (empty? n) | |
(do (prn (first n)) | |
(recur (rest n))))) | |
(loop-thru account-info) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment