Guest User

Untitled

a guest
Jan 22nd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. (defmacro do1 [expr1 & exprs]
  2. "Evaluates expr1 and then exprs and returns the value of expr1.
  3. Similar to Common Lisp's prog1."
  4. `(let [first-form-val# ~first-form]
  5. (do ~@forms) first-form-val#))
  6.  
  7. (defn make-counter [init]
  8. (let [count (atom init)]
  9. (fn [n] (do1 @count (swap! count + n)))))
Add Comment
Please, Sign In to add comment