Skip to content

Instantly share code, notes, and snippets.

View Bronsa's full-sized avatar

Nicola Mometto Bronsa

View GitHub Profile
(defn merge-methods [[defaults provideds]]
(let [explicitize (fn [[fname args & body]]
[[(meta fname) fname (list (meta args) (map meta args)) args] body])
implicitize (fn [[[_ name _ args] body]]
`(~name ~args ~@body))
defaults (apply hash-map (mapcat explicitize defaults))
provideds (apply hash-map (mapcat explicitize provideds))
methods (merge defaults provideds)]
(map implicitize methods)))
(ns clojure.reader
(:refer-clojure :exclude [read read-line read-string])
(:import (clojure.lang BigInt Numbers PersistentHashMap PersistentHashSet PersistentArrayMap IMeta ISeq
RT IReference Symbol IPersistentList Reflector Var Symbol Keyword IObj
IPersistentCollection IRecord)
(java.util ArrayList regex.Pattern)
java.lang.reflect.Constructor))
(set! *warn-on-reflection* true)
(ns clojure.reader
(:refer-clojure :exclude [read read-line read-string])
(:import (clojure.lang BigInt Numbers PersistentHashMap PersistentHashSet PersistentArrayMap IMeta ISeq
RT IReference Symbol IPersistentList Reflector Var Symbol Keyword IObj)
(java.util ArrayList regex.Pattern)
java.lang.reflect.Constructor))
(set! *warn-on-reflection* true)
(defprotocol PushbackReader
(ns clojure.reader
(:refer-clojure :exclude [read read-line read-string])
(:import (clojure.lang BigInt Numbers PersistentHashMap PersistentHashSet PersistentArrayMap IMeta ISeq
RT IReference Symbol IPersistentList Reflector Var)
(java.util ArrayList regex.Pattern)))
(set! *warn-on-reflection* true)
(defprotocol PushbackReader
(read-char [reader] "Returns the next char from the Reader, nil if the end of stream has been reached")
(ns clojure.reader
(:refer-clojure :exclude [read read-line read-string])
(:import (clojure.lang BigInt Numbers PersistentHashMap PersistentHashSet PersistentArrayMap IMeta ISeq
RT IReference Symbol IPersistentList Reflector Var)
(java.util ArrayList regex.Pattern)))
(set! *warn-on-reflection* true)
(defprotocol PushbackReader
(read-char [reader] "Returns the next char from the Reader, nil if the end of stream has been reached")
(ns clojure.reader
(:refer-clojure :exclude [read read-line])
(:import (clojure.lang BigInt Numbers)))
(set! *warn-on-reflection* true)
(defprotocol PushbackReader
(read-char [reader] "Returns the next char from the Reader, nil if the end of stream has been reached")
(unread [reader ch] "Push back a single character on to the stream"))
(ns clojure.reader
(:refer-clojure :exclude [read read-line])
(:import (clojure.lang BigInt Numbers)))
(set! *warn-on-reflection* true)
(defprotocol PushbackReader
(read-char [reader] "Returns the next char from the Reader, nil if the end of stream has been reached")
(unread [reader ch] "Push back a single character on to the stream"))
(defprotocol PushbackReader
(read-char [reader] "Returns the next char from the Reader, nil if the end of stream has been reached")
(unread [reader ch] "Push back a single character on to the stream"))
(defmacro update! [what f]
(list 'set! what (list f what)))
;;not thread-safe, but i guess i don't care?
(deftype StringPushbackReader
[^:unsynchronized-mutable ^String s ^"[C" buf ^:unsynchronized-mutable len ^:unsynchronized-mutable buf?]
(defprotocol PushbackReader
(read-char [reader] "Returns the next char from the Reader, nil if the end of stream has been reached")
(unread [reader ch] "Push back a single character on to the stream"))
(defmacro update! [what f]
(list 'set! what (list f what)))
;;not thread-safe, but i guess i don't care?
(deftype StringPushbackReader
[^:unsynchronized-mutable ^String s ^"[C" buf ^:unsynchronized-mutable len ^:unsynchronized-mutable buf?]
(defprotocol PushbackReader
(read-char [reader] "Returns the next char from the Reader, nil if the end of stream has been reached")
(unread [reader ch] "Push back a single character on to the stream"))
(defmacro update! [what f]
(list 'set! what (list f what)))
;;not thread-safe, but i guess i don't care?
(deftype StringPushbackReader
[^:unsynchronized-mutable ^String s ^"[C" buf ^:unsynchronized-mutable len ^:unsynchronized-mutable buf?]