cljrs-stdlib 0.1.51

Built-in standard library namespaces for clojurust (clojure.string, clojure.set, clojure.test, …)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
(ns clojure.rust.io)

(defmacro with-open
  "bindings => [name init ...]

  Evaluates body in a try expression with names bound to the values
  of the inits, and a finally clause that calls (close name) on each
  name in reverse order."
  [bindings & body]
  (if (= (count bindings) 0)
    `(do ~@body)
    (let [name (first bindings)
          init (second bindings)
          rest-bindings (drop 2 bindings)]
      `(let [~name ~init]
         (try
           (with-open ~(vec rest-bindings) ~@body)
           (finally (close ~name)))))))