Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (use '[clojure.string :only (split)])
- (def lunch-string "Juice: 1.15, Sandwich: 4.65, Banana: 0.99")
- (defn lunch []
- (partition 2
- (map #(.trim %)
- (split lunch-string #"[:,]"))))
- ;; first case
- (println (for [[item cost] (lunch)] item))
- ;; second case
- (for [[item cost] (lunch)] (println item))
Advertisement
Add Comment
Please, Sign In to add comment