8787 (or (apply <= a-seq) (apply >= a-seq)))
8888
8989(defn toggle [a-set elem]
90- (if (contains? a-set elem )
90+ (if (contains? a-set elem)
9191 (disj a-set elem)
9292 (conj a-set elem)))
9393
103103 (contains? (:authors book) author))
104104
105105(defn authors [books]
106- :- )
106+ ( set ( apply concat ( map :authors books))) )
107107
108108(defn all-author-names [books]
109- :- )
109+ ( set ( map :name ( authors books))) )
110110
111111(defn author->string [author]
112- :- )
112+ (let [life-info
113+ (fn [author] (if (or (:birth-year author) (:death-year author))
114+ (str " (" (:birth-year author) " - " (:death-year author) " )" )))]
115+ (apply str (:name author) (life-info author))))
113116
114117(defn authors->string [authors]
115118 :- )
137140
138141; %________%
139142(comment
140- (print " coucou" ))
143+ (def china {:name " China Miéville" , :birth-year 1972 })
144+ (def octavia {:name " Octavia E. Butler"
145+ :birth-year 1947
146+ :death-year 2006 })
147+ (def friedman {:name " Daniel Friedman" :birth-year 1944 })
148+ (def felleisen {:name " Matthias Felleisen" })
149+
150+ (def cities {:title " The City and the City" :authors #{china}})
151+ (def wild-seed {:title " Wild Seed" , :authors #{octavia}})
152+ (def embassytown {:title " Embassytown" , :authors #{china}})
153+ (def little-schemer {:title " The Little Schemer"
154+ :authors #{friedman, felleisen}})
155+
156+ (def books [cities, wild-seed, embassytown, little-schemer]))
0 commit comments