Permalink
Browse files

Changing to use new locations

  • Loading branch information...
1 parent bb9884c commit 30195f038af4f28d02b9fc944026f6a883859279 @fogus committed Jul 25, 2013
View
10 resources/public/index.html
@@ -10,11 +10,11 @@
<html>
<head>
- <script type="text/javascript" src="javascript/jquery-1.4.2.min.js"></script>
- <script type="text/javascript" src="javascript/jquery.console.js"></script>
- <script type="text/javascript" src="out/goog/base.js"></script>
- <script type="text/javascript" src="con.js"></script>
- <script type="text/javascript" src="repl.js"></script>
+ <script type="text/javascript" src="vendor/jquery-1.4.2.min.js"></script>
+ <script type="text/javascript" src="vendor/jquery.console.js"></script>
+<!-- <script type="text/javascript" src="out/goog/base.js"></script> -->
+<!-- <script type="text/javascript" src="con.js"></script> -->
+ <script type="text/javascript" src="js/repl.js"></script>
<script type="text/javascript">
goog.require('himera.client.repl');
</script>
View
7,476 resources/public/js/cljs/core.cljs
7,476 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
22,055 resources/public/js/cljs/core.js
22,055 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
569 resources/public/js/cljs/reader.cljs
@@ -0,0 +1,569 @@
+; Copyright (c) Rich Hickey. All rights reserved.
+; The use and distribution terms for this software are covered by the
+; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
+; which can be found in the file epl-v10.html at the root of this distribution.
+; By using this software in any fashion, you are agreeing to be bound by
+; the terms of this license.
+; You must not remove this notice, or any other, from this software.
+
+(ns cljs.reader
+ (:require [goog.string :as gstring]))
+
+(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"))
+
+; Using two atoms is less idomatic, but saves the repeat overhead of map creation
+(deftype StringPushbackReader [s index-atom buffer-atom]
+ PushbackReader
+ (read-char [reader]
+ (if (empty? @buffer-atom)
+ (let [idx @index-atom]
+ (swap! index-atom inc)
+ (aget s idx))
+ (let [buf @buffer-atom]
+ (swap! buffer-atom rest)
+ (first buf))))
+ (unread [reader ch] (swap! buffer-atom #(cons ch %))))
+
+(defn push-back-reader [s]
+ "Creates a StringPushbackReader from a given string"
+ (StringPushbackReader. s (atom 0) (atom nil)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; predicates
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defn- ^boolean whitespace?
+ "Checks whether a given character is whitespace"
+ [ch]
+ (or (gstring/isBreakingWhitespace ch) (identical? \, ch)))
+
+(defn- ^boolean numeric?
+ "Checks whether a given character is numeric"
+ [ch]
+ (gstring/isNumeric ch))
+
+(defn- ^boolean comment-prefix?
+ "Checks whether the character begins a comment."
+ [ch]
+ (identical? \; ch))
+
+(defn- ^boolean number-literal?
+ "Checks whether the reader is at the start of a number literal"
+ [reader initch]
+ (or (numeric? initch)
+ (and (or (identical? \+ initch) (identical? \- initch))
+ (numeric? (let [next-ch (read-char reader)]
+ (unread reader next-ch)
+ next-ch)))))
+
+(declare read macros dispatch-macros)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; read helpers
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+
+; later will do e.g. line numbers...
+(defn reader-error
+ [rdr & msg]
+ (throw (js/Error. (apply str msg))))
+
+(defn ^boolean macro-terminating? [ch]
+ (and (not (identical? ch "#"))
+ (not (identical? ch \'))
+ (not (identical? ch ":"))
+ (macros ch)))
+
+(defn read-token
+ [rdr initch]
+ (loop [sb (gstring/StringBuffer. initch)
+ ch (read-char rdr)]
+ (if (or (nil? ch)
+ (whitespace? ch)
+ (macro-terminating? ch))
+ (do (unread rdr ch) (. sb (toString)))
+ (recur (do (.append sb ch) sb) (read-char rdr)))))
+
+(defn skip-line
+ "Advances the reader to the end of a line. Returns the reader"
+ [reader _]
+ (loop []
+ (let [ch (read-char reader)]
+ (if (or (identical? ch \n) (identical? ch \r) (nil? ch))
+ reader
+ (recur)))))
+
+(def int-pattern (re-pattern "([-+]?)(?:(0)|([1-9][0-9]*)|0[xX]([0-9A-Fa-f]+)|0([0-7]+)|([1-9][0-9]?)[rR]([0-9A-Za-z]+)|0[0-9]+)(N)?"))
+(def ratio-pattern (re-pattern "([-+]?[0-9]+)/([0-9]+)"))
+(def float-pattern (re-pattern "([-+]?[0-9]+(\\.[0-9]*)?([eE][-+]?[0-9]+)?)(M)?"))
+(def symbol-pattern (re-pattern "[:]?([^0-9/].*/)?([^0-9/][^/]*)"))
+
+(defn- re-find*
+ [re s]
+ (let [matches (.exec re s)]
+ (when-not (nil? matches)
+ (if (== (alength matches) 1)
+ (aget matches 0)
+ matches))))
+
+(defn- match-int
+ [s]
+ (let [groups (re-find* int-pattern s)
+ group3 (aget groups 2)]
+ (if-not (or (nil? group3)
+ (< (alength group3) 1))
+ 0
+ (let [negate (if (identical? "-" (aget groups 1)) -1 1)
+ a (cond
+ (aget groups 3) (array (aget groups 3) 10)
+ (aget groups 4) (array (aget groups 4) 16)
+ (aget groups 5) (array (aget groups 5) 8)
+ (aget groups 7) (array (aget groups 7) (js/parseInt (aget groups 7)))
+ :default (array nil nil))
+ n (aget a 0)
+ radix (aget a 1)]
+ (if (nil? n)
+ nil
+ (* negate (js/parseInt n radix)))))))
+
+
+(defn- match-ratio
+ [s]
+ (let [groups (re-find* ratio-pattern s)
+ numinator (aget groups 1)
+ denominator (aget groups 2)]
+ (/ (js/parseInt numinator) (js/parseInt denominator))))
+
+(defn- match-float
+ [s]
+ (js/parseFloat s))
+
+(defn- re-matches*
+ [re s]
+ (let [matches (.exec re s)]
+ (when (and (not (nil? matches))
+ (identical? (aget matches 0) s))
+ (if (== (alength matches) 1)
+ (aget matches 0)
+ matches))))
+
+(defn- match-number
+ [s]
+ (cond
+ (re-matches* int-pattern s) (match-int s)
+ (re-matches* ratio-pattern s) (match-ratio s)
+ (re-matches* float-pattern s) (match-float s)))
+
+(defn escape-char-map [c]
+ (cond
+ (identical? c \t) "\t"
+ (identical? c \r) "\r"
+ (identical? c \n) "\n"
+ (identical? c \\) \\
+ (identical? c \") \"
+ (identical? c \b) "\b"
+ (identical? c \f) "\f"
+ :else nil))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; unicode
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defn read-2-chars [reader]
+ (.toString
+ (gstring/StringBuffer.
+ (read-char reader)
+ (read-char reader))))
+
+(defn read-4-chars [reader]
+ (.toString
+ (gstring/StringBuffer.
+ (read-char reader)
+ (read-char reader)
+ (read-char reader)
+ (read-char reader))))
+
+(def unicode-2-pattern (re-pattern "[0-9A-Fa-f]{2}"))
+(def unicode-4-pattern (re-pattern "[0-9A-Fa-f]{4}"))
+
+(defn validate-unicode-escape [unicode-pattern reader escape-char unicode-str]
+ (if (re-matches unicode-pattern unicode-str)
+ unicode-str
+ (reader-error reader "Unexpected unicode escape \\" escape-char unicode-str)))
+
+(defn make-unicode-char [code-str]
+ (let [code (js/parseInt code-str 16)]
+ (.fromCharCode js/String code)))
+
+(defn escape-char
+ [buffer reader]
+ (let [ch (read-char reader)
+ mapresult (escape-char-map ch)]
+ (if mapresult
+ mapresult
+ (cond
+ (identical? ch \x)
+ (->> (read-2-chars reader)
+ (validate-unicode-escape unicode-2-pattern reader ch)
+ (make-unicode-char))
+
+ (identical? ch \u)
+ (->> (read-4-chars reader)
+ (validate-unicode-escape unicode-4-pattern reader ch)
+ (make-unicode-char))
+
+ (numeric? ch)
+ (.fromCharCode js/String ch)
+
+ :else
+ (reader-error reader "Unexpected unicode escape \\" ch )))))
+
+(defn read-past
+ "Read until first character that doesn't match pred, returning
+ char."
+ [pred rdr]
+ (loop [ch (read-char rdr)]
+ (if (pred ch)
+ (recur (read-char rdr))
+ ch)))
+
+(defn read-delimited-list
+ [delim rdr recursive?]
+ (loop [a (transient [])]
+ (let [ch (read-past whitespace? rdr)]
+ (when-not ch (reader-error rdr "EOF while reading"))
+ (if (identical? delim ch)
+ (persistent! a)
+ (if-let [macrofn (macros ch)]
+ (let [mret (macrofn rdr ch)]
+ (recur (if (identical? mret rdr) a (conj! a mret))))
+ (do
+ (unread rdr ch)
+ (let [o (read rdr true nil recursive?)]
+ (recur (if (identical? o rdr) a (conj! a o))))))))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; data structure readers
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defn not-implemented
+ [rdr ch]
+ (reader-error rdr "Reader for " ch " not implemented yet"))
+
+(declare maybe-read-tagged-type)
+
+(defn read-dispatch
+ [rdr _]
+ (let [ch (read-char rdr)
+ dm (dispatch-macros ch)]
+ (if dm
+ (dm rdr _)
+ (if-let [obj (maybe-read-tagged-type rdr ch)]
+ obj
+ (reader-error rdr "No dispatch macro for " ch)))))
+
+(defn read-unmatched-delimiter
+ [rdr ch]
+ (reader-error rdr "Unmached delimiter " ch))
+
+(defn read-list
+ [rdr _]
+ (apply list (read-delimited-list ")" rdr true)))
+
+(def read-comment skip-line)
+
+(defn read-vector
+ [rdr _]
+ (read-delimited-list "]" rdr true))
+
+(defn read-map
+ [rdr _]
+ (let [l (read-delimited-list "}" rdr true)]
+ (when (odd? (count l))
+ (reader-error rdr "Map literal must contain an even number of forms"))
+ (apply hash-map l)))
+
+(defn read-number
+ [reader initch]
+ (loop [buffer (gstring/StringBuffer. initch)
+ ch (read-char reader)]
+ (if (or (nil? ch) (whitespace? ch) (macros ch))
+ (do
+ (unread reader ch)
+ (let [s (. buffer (toString))]
+ (or (match-number s)
+ (reader-error reader "Invalid number format [" s "]"))))
+ (recur (do (.append buffer ch) buffer) (read-char reader)))))
+
+(defn read-string*
+ [reader _]
+ (loop [buffer (gstring/StringBuffer.)
+ ch (read-char reader)]
+ (cond
+ (nil? ch) (reader-error reader "EOF while reading")
+ (identical? "\\" ch) (recur (do (.append buffer (escape-char buffer reader)) buffer)
+ (read-char reader))
+ (identical? \" ch) (. buffer (toString))
+ :default (recur (do (.append buffer ch) buffer) (read-char reader)))))
+
+(defn special-symbols [t not-found]
+ (cond
+ (identical? t "nil") nil
+ (identical? t "true") true
+ (identical? t "false") false
+ :else not-found))
+
+(defn read-symbol
+ [reader initch]
+ (let [token (read-token reader initch)]
+ (if (gstring/contains token "/")
+ (symbol (subs token 0 (.indexOf token "/"))
+ (subs token (inc (.indexOf token "/")) (.-length token)))
+ (special-symbols token (symbol token)))))
+
+(defn read-keyword
+ [reader initch]
+ (let [token (read-token reader (read-char reader))
+ a (re-matches* symbol-pattern token)
+ token (aget a 0)
+ ns (aget a 1)
+ name (aget a 2)]
+ (if (or (and (not (undefined? ns))
+ (identical? (. ns (substring (- (.-length ns) 2) (.-length ns))) ":/"))
+ (identical? (aget name (dec (.-length name))) ":")
+ (not (== (.indexOf token "::" 1) -1)))
+ (reader-error reader "Invalid token: " token)
+ (if (and (not (nil? ns)) (> (.-length ns) 0))
+ (keyword (.substring ns 0 (.indexOf ns "/")) name)
+ (keyword token)))))
+
+(defn desugar-meta
+ [f]
+ (cond
+ (symbol? f) {:tag f}
+ (string? f) {:tag f}
+ (keyword? f) {f true}
+ :else f))
+
+(defn wrapping-reader
+ [sym]
+ (fn [rdr _]
+ (list sym (read rdr true nil true))))
+
+(defn throwing-reader
+ [msg]
+ (fn [rdr _]
+ (reader-error rdr msg)))
+
+(defn read-meta
+ [rdr _]
+ (let [m (desugar-meta (read rdr true nil true))]
+ (when-not (map? m)
+ (reader-error rdr "Metadata must be Symbol,Keyword,String or Map"))
+ (let [o (read rdr true nil true)]
+ (if (satisfies? IWithMeta o)
+ (with-meta o (merge (meta o) m))
+ (reader-error rdr "Metadata can only be applied to IWithMetas")))))
+
+(defn read-set
+ [rdr _]
+ (set (read-delimited-list "}" rdr true)))
+
+(defn read-regex
+ [rdr ch]
+ (-> (read-string* rdr ch) re-pattern))
+
+(defn read-discard
+ [rdr _]
+ (read rdr true nil true)
+ rdr)
+
+(defn macros [c]
+ (cond
+ (identical? c \") read-string*
+ (identical? c \:) read-keyword
+ (identical? c \;) not-implemented ;; never hit this
+ (identical? c \') (wrapping-reader 'quote)
+ (identical? c \@) (wrapping-reader 'deref)
+ (identical? c \^) read-meta
+ (identical? c \`) not-implemented
+ (identical? c \~) not-implemented
+ (identical? c \() read-list
+ (identical? c \)) read-unmatched-delimiter
+ (identical? c \[) read-vector
+ (identical? c \]) read-unmatched-delimiter
+ (identical? c \{) read-map
+ (identical? c \}) read-unmatched-delimiter
+ (identical? c \\) read-char
+ (identical? c \%) not-implemented
+ (identical? c \#) read-dispatch
+ :else nil))
+
+;; omitted by design: var reader, eval reader
+(defn dispatch-macros [s]
+ (cond
+ (identical? s "{") read-set
+ (identical? s "<") (throwing-reader "Unreadable form")
+ (identical? s "\"") read-regex
+ (identical? s"!") read-comment
+ (identical? s "_") read-discard
+ :else nil))
+
+(defn read
+ "Reads the first object from a PushbackReader. Returns the object read.
+ If EOF, throws if eof-is-error is true. Otherwise returns sentinel."
+ [reader eof-is-error sentinel is-recursive]
+ (let [ch (read-char reader)]
+ (cond
+ (nil? ch) (if eof-is-error (reader-error reader "EOF while reading") sentinel)
+ (whitespace? ch) (recur reader eof-is-error sentinel is-recursive)
+ (comment-prefix? ch) (recur (read-comment reader ch) eof-is-error sentinel is-recursive)
+ :else (let [f (macros ch)
+ res
+ (cond
+ f (f reader ch)
+ (number-literal? reader ch) (read-number reader ch)
+ :else (read-symbol reader ch))]
+ (if (identical? res reader)
+ (recur reader eof-is-error sentinel is-recursive)
+ res)))))
+
+(defn read-string
+ "Reads one object from the string s"
+ [s]
+ (let [r (push-back-reader s)]
+ (read r true nil false)))
+
+
+;; read instances
+
+(defn ^:private zero-fill-right [s width]
+ (cond (= width (count s)) s
+ (< width (count s)) (.substring s 0 width)
+ :else (loop [b (gstring/StringBuffer. s)]
+ (if (< (.getLength b) width)
+ (recur (.append b \0))
+ (.toString b)))))
+
+(defn ^:private divisible?
+ [num div]
+ (zero? (mod num div)))
+
+(defn ^:private indivisible?
+ [num div]
+ (not (divisible? num div)))
+
+(defn ^:private leap-year?
+ [year]
+ (and (divisible? year 4)
+ (or (indivisible? year 100)
+ (divisible? year 400))))
+
+(def ^:private days-in-month
+ (let [dim-norm [nil 31 28 31 30 31 30 31 31 30 31 30 31]
+ dim-leap [nil 31 29 31 30 31 30 31 31 30 31 30 31]]
+ (fn [month leap-year?]
+ (get (if leap-year? dim-leap dim-norm) month))))
+
+(def ^:private parse-and-validate-timestamp
+ (let [timestamp #"(\d\d\d\d)(?:-(\d\d)(?:-(\d\d)(?:[T](\d\d)(?::(\d\d)(?::(\d\d)(?:[.](\d+))?)?)?)?)?)?(?:[Z]|([-+])(\d\d):(\d\d))?"
+ check (fn [low n high msg]
+ (assert (<= low n high) (str msg " Failed: " low "<=" n "<=" high))
+ n)]
+ (fn [ts]
+ (when-let [[[_ years months days hours minutes seconds milliseconds] [_ _ _] :as V]
+ (->> ts
+ (re-matches timestamp)
+ (split-at 8)
+ (map vec))]
+ (let [[[_ y mo d h m s ms] [offset-sign offset-hours offset-minutes]]
+ (->> V
+ (map #(update-in %2 [0] %)
+ [(constantly nil) #(if (= % "-") "-1" "1")])
+ (map (fn [v] (map #(js/parseInt % 10) v))))
+ offset (* offset-sign (+ (* offset-hours 60) offset-minutes))]
+ [(if-not years 1970 y)
+ (if-not months 1 (check 1 mo 12 "timestamp month field must be in range 1..12"))
+ (if-not days 1 (check 1 d (days-in-month mo (leap-year? y)) "timestamp day field must be in range 1..last day in month"))
+ (if-not hours 0 (check 0 h 23 "timestamp hour field must be in range 0..23"))
+ (if-not minutes 0 (check 0 m 59 "timestamp minute field must be in range 0..59"))
+ (if-not seconds 0 (check 0 s (if (= m 59) 60 59) "timestamp second field must be in range 0..60"))
+ (if-not milliseconds 0 (check 0 ms 999 "timestamp millisecond field must be in range 0..999"))
+ offset])))))
+
+(defn parse-timestamp
+ [ts]
+ (if-let [[years months days hours minutes seconds ms offset]
+ (parse-and-validate-timestamp ts)]
+ (js/Date.
+ (- (.UTC js/Date years (dec months) days hours minutes seconds ms)
+ (* offset 60 1000)))
+ (reader-error nil (str "Unrecognized date/time syntax: " ts))))
+
+(defn ^:private read-date
+ [s]
+ (if (string? s)
+ (parse-timestamp s)
+ (reader-error nil "Instance literal expects a string for its timestamp.")))
+
+
+(defn ^:private read-queue
+ [elems]
+ (if (vector? elems)
+ (into cljs.core.PersistentQueue/EMPTY elems)
+ (reader-error nil "Queue literal expects a vector for its elements.")))
+
+
+(defn ^:private read-uuid
+ [uuid]
+ (if (string? uuid)
+ (UUID. uuid)
+ (reader-error nil "UUID literal expects a string as its representation.")))
+
+(def *tag-table* (atom {"inst" read-date
+ "uuid" read-uuid
+ "queue" read-queue}))
+
+(def *default-data-reader-fn*
+ (atom nil))
+
+(defn maybe-read-tagged-type
+ [rdr initch]
+ (let [tag (read-symbol rdr initch)
+ pfn (get @*tag-table* (str tag))
+ dfn @*default-data-reader-fn*]
+ (cond
+ pfn (pfn (read rdr true nil false))
+ dfn (dfn tag (read rdr true nil false))
+ :else (reader-error rdr
+ "Could not find tag parser for " (str tag)
+ " in " (pr-str (keys @*tag-table*))))))
+
+(defn register-tag-parser!
+ [tag f]
+ (let [tag (str tag)
+ old-parser (get @*tag-table* tag)]
+ (swap! *tag-table* assoc tag f)
+ old-parser))
+
+(defn deregister-tag-parser!
+ [tag]
+ (let [tag (str tag)
+ old-parser (get @*tag-table* tag)]
+ (swap! *tag-table* dissoc tag)
+ old-parser))
+
+(defn register-default-tag-parser!
+ [f]
+ (let [old-parser @*default-data-reader-fn*]
+ (swap! *default-data-reader-fn* (fn [_] f))
+ old-parser))
+
+(defn deregister-default-tag-parser!
+ []
+ (let [old-parser @*default-data-reader-fn*]
+ (swap! *default-data-reader-fn* (fn [_] nil))
+ old-parser))
View
1,086 resources/public/js/cljs/reader.js
@@ -0,0 +1,1086 @@
+goog.provide('cljs.reader');
+goog.require('cljs.core');
+goog.require('goog.string');
+cljs.reader.PushbackReader = {};
+cljs.reader.read_char = (function read_char(reader){
+if((function (){var and__3941__auto__ = reader;
+if(and__3941__auto__)
+{return reader.cljs$reader$PushbackReader$read_char$arity$1;
+} else
+{return and__3941__auto__;
+}
+})())
+{return reader.cljs$reader$PushbackReader$read_char$arity$1(reader);
+} else
+{var x__2906__auto__ = (((reader == null))?null:reader);
+return (function (){var or__3943__auto__ = (cljs.reader.read_char[goog.typeOf(x__2906__auto__)]);
+if(or__3943__auto__)
+{return or__3943__auto__;
+} else
+{var or__3943__auto____$1 = (cljs.reader.read_char["_"]);
+if(or__3943__auto____$1)
+{return or__3943__auto____$1;
+} else
+{throw cljs.core.missing_protocol.call(null,"PushbackReader.read-char",reader);
+}
+}
+})().call(null,reader);
+}
+});
+cljs.reader.unread = (function unread(reader,ch){
+if((function (){var and__3941__auto__ = reader;
+if(and__3941__auto__)
+{return reader.cljs$reader$PushbackReader$unread$arity$2;
+} else
+{return and__3941__auto__;
+}
+})())
+{return reader.cljs$reader$PushbackReader$unread$arity$2(reader,ch);
+} else
+{var x__2906__auto__ = (((reader == null))?null:reader);
+return (function (){var or__3943__auto__ = (cljs.reader.unread[goog.typeOf(x__2906__auto__)]);
+if(or__3943__auto__)
+{return or__3943__auto__;
+} else
+{var or__3943__auto____$1 = (cljs.reader.unread["_"]);
+if(or__3943__auto____$1)
+{return or__3943__auto____$1;
+} else
+{throw cljs.core.missing_protocol.call(null,"PushbackReader.unread",reader);
+}
+}
+})().call(null,reader,ch);
+}
+});
+goog.provide('cljs.reader.StringPushbackReader');
+
+/**
+* @constructor
+*/
+cljs.reader.StringPushbackReader = (function (s,index_atom,buffer_atom){
+this.s = s;
+this.index_atom = index_atom;
+this.buffer_atom = buffer_atom;
+})
+cljs.reader.StringPushbackReader.cljs$lang$type = true;
+cljs.reader.StringPushbackReader.cljs$lang$ctorStr = "cljs.reader/StringPushbackReader";
+cljs.reader.StringPushbackReader.cljs$lang$ctorPrWriter = (function (this__2847__auto__,writer__2848__auto__,opt__2849__auto__){
+return cljs.core._write.call(null,writer__2848__auto__,"cljs.reader/StringPushbackReader");
+});
+cljs.reader.StringPushbackReader.prototype.cljs$reader$PushbackReader$ = true;
+cljs.reader.StringPushbackReader.prototype.cljs$reader$PushbackReader$read_char$arity$1 = (function (reader){
+var self__ = this;
+if(cljs.core.empty_QMARK_.call(null,cljs.core.deref.call(null,self__.buffer_atom)))
+{var idx = cljs.core.deref.call(null,self__.index_atom);
+cljs.core.swap_BANG_.call(null,self__.index_atom,cljs.core.inc);
+return (self__.s[idx]);
+} else
+{var buf = cljs.core.deref.call(null,self__.buffer_atom);
+cljs.core.swap_BANG_.call(null,self__.buffer_atom,cljs.core.rest);
+return cljs.core.first.call(null,buf);
+}
+});
+cljs.reader.StringPushbackReader.prototype.cljs$reader$PushbackReader$unread$arity$2 = (function (reader,ch){
+var self__ = this;
+return cljs.core.swap_BANG_.call(null,self__.buffer_atom,(function (p1__4692_SHARP_){
+return cljs.core.cons.call(null,ch,p1__4692_SHARP_);
+}));
+});
+cljs.reader.__GT_StringPushbackReader = (function __GT_StringPushbackReader(s,index_atom,buffer_atom){
+return (new cljs.reader.StringPushbackReader(s,index_atom,buffer_atom));
+});
+cljs.reader.push_back_reader = (function push_back_reader(s){
+return (new cljs.reader.StringPushbackReader(s,cljs.core.atom.call(null,0),cljs.core.atom.call(null,null)));
+});
+/**
+* Checks whether a given character is whitespace
+*/
+cljs.reader.whitespace_QMARK_ = (function whitespace_QMARK_(ch){
+var or__3943__auto__ = goog.string.isBreakingWhitespace(ch);
+if(cljs.core.truth_(or__3943__auto__))
+{return or__3943__auto__;
+} else
+{return ("," === ch);
+}
+});
+/**
+* Checks whether a given character is numeric
+*/
+cljs.reader.numeric_QMARK_ = (function numeric_QMARK_(ch){
+return goog.string.isNumeric(ch);
+});
+/**
+* Checks whether the character begins a comment.
+*/
+cljs.reader.comment_prefix_QMARK_ = (function comment_prefix_QMARK_(ch){
+return (";" === ch);
+});
+/**
+* Checks whether the reader is at the start of a number literal
+*/
+cljs.reader.number_literal_QMARK_ = (function number_literal_QMARK_(reader,initch){
+var or__3943__auto__ = cljs.reader.numeric_QMARK_.call(null,initch);
+if(or__3943__auto__)
+{return or__3943__auto__;
+} else
+{var and__3941__auto__ = (function (){var or__3943__auto____$1 = ("+" === initch);
+if(or__3943__auto____$1)
+{return or__3943__auto____$1;
+} else
+{return ("-" === initch);
+}
+})();
+if(cljs.core.truth_(and__3941__auto__))
+{return cljs.reader.numeric_QMARK_.call(null,(function (){var next_ch = cljs.reader.read_char.call(null,reader);
+cljs.reader.unread.call(null,reader,next_ch);
+return next_ch;
+})());
+} else
+{return and__3941__auto__;
+}
+}
+});
+/**
+* @param {...*} var_args
+*/
+cljs.reader.reader_error = (function() {
+var reader_error__delegate = function (rdr,msg){
+throw (new Error(cljs.core.apply.call(null,cljs.core.str,msg)));
+};
+var reader_error = function (rdr,var_args){
+var msg = null;
+if (arguments.length > 1) {
+ msg = cljs.core.array_seq(Array.prototype.slice.call(arguments, 1),0);
+}
+return reader_error__delegate.call(this, rdr, msg);
+};
+reader_error.cljs$lang$maxFixedArity = 1;
+reader_error.cljs$lang$applyTo = (function (arglist__4693){
+var rdr = cljs.core.first(arglist__4693);
+var msg = cljs.core.rest(arglist__4693);
+return reader_error__delegate(rdr, msg);
+});
+reader_error.cljs$core$IFn$_invoke$arity$variadic = reader_error__delegate;
+return reader_error;
+})()
+;
+cljs.reader.macro_terminating_QMARK_ = (function macro_terminating_QMARK_(ch){
+var and__3941__auto__ = !((ch === "#"));
+if(and__3941__auto__)
+{var and__3941__auto____$1 = !((ch === "'"));
+if(and__3941__auto____$1)
+{var and__3941__auto____$2 = !((ch === ":"));
+if(and__3941__auto____$2)
+{return cljs.reader.macros.call(null,ch);
+} else
+{return and__3941__auto____$2;
+}
+} else
+{return and__3941__auto____$1;
+}
+} else
+{return and__3941__auto__;
+}
+});
+cljs.reader.read_token = (function read_token(rdr,initch){
+var sb = (new goog.string.StringBuffer(initch));
+var ch = cljs.reader.read_char.call(null,rdr);
+while(true){
+if((function (){var or__3943__auto__ = (ch == null);
+if(or__3943__auto__)
+{return or__3943__auto__;
+} else
+{var or__3943__auto____$1 = cljs.reader.whitespace_QMARK_.call(null,ch);
+if(or__3943__auto____$1)
+{return or__3943__auto____$1;
+} else
+{return cljs.reader.macro_terminating_QMARK_.call(null,ch);
+}
+}
+})())
+{cljs.reader.unread.call(null,rdr,ch);
+return sb.toString();
+} else
+{{
+var G__4694 = (function (){sb.append(ch);
+return sb;
+})();
+var G__4695 = cljs.reader.read_char.call(null,rdr);
+sb = G__4694;
+ch = G__4695;
+continue;
+}
+}
+break;
+}
+});
+/**
+* Advances the reader to the end of a line. Returns the reader
+*/
+cljs.reader.skip_line = (function skip_line(reader,_){
+while(true){
+var ch = cljs.reader.read_char.call(null,reader);
+if((function (){var or__3943__auto__ = (ch === "n");
+if(or__3943__auto__)
+{return or__3943__auto__;
+} else
+{var or__3943__auto____$1 = (ch === "r");
+if(or__3943__auto____$1)
+{return or__3943__auto____$1;
+} else
+{return (ch == null);
+}
+}
+})())
+{return reader;
+} else
+{{
+continue;
+}
+}
+break;
+}
+});
+cljs.reader.int_pattern = cljs.core.re_pattern.call(null,"([-+]?)(?:(0)|([1-9][0-9]*)|0[xX]([0-9A-Fa-f]+)|0([0-7]+)|([1-9][0-9]?)[rR]([0-9A-Za-z]+)|0[0-9]+)(N)?");
+cljs.reader.ratio_pattern = cljs.core.re_pattern.call(null,"([-+]?[0-9]+)/([0-9]+)");
+cljs.reader.float_pattern = cljs.core.re_pattern.call(null,"([-+]?[0-9]+(\\.[0-9]*)?([eE][-+]?[0-9]+)?)(M)?");
+cljs.reader.symbol_pattern = cljs.core.re_pattern.call(null,"[:]?([^0-9/].*/)?([^0-9/][^/]*)");
+cljs.reader.re_find_STAR_ = (function re_find_STAR_(re,s){
+var matches = re.exec(s);
+if((matches == null))
+{return null;
+} else
+{if((matches.length === 1))
+{return (matches[0]);
+} else
+{return matches;
+}
+}
+});
+cljs.reader.match_int = (function match_int(s){
+var groups = cljs.reader.re_find_STAR_.call(null,cljs.reader.int_pattern,s);
+var group3 = (groups[2]);
+if(!((function (){var or__3943__auto__ = (group3 == null);
+if(or__3943__auto__)
+{return or__3943__auto__;
+} else
+{return (group3.length < 1);
+}
+})()))
+{return 0;
+} else
+{var negate = ((("-" === (groups[1])))?-1:1);
+var a = (cljs.core.truth_((groups[3]))?[(groups[3]),10]:(cljs.core.truth_((groups[4]))?[(groups[4]),16]:(cljs.core.truth_((groups[5]))?[(groups[5]),8]:(cljs.core.truth_((groups[7]))?[(groups[7]),parseInt((groups[7]))]:(("\uFDD0:default")?[null,null]:null)))));
+var n = (a[0]);
+var radix = (a[1]);
+if((n == null))
+{return null;
+} else
+{return (negate * parseInt(n,radix));
+}
+}
+});
+cljs.reader.match_ratio = (function match_ratio(s){
+var groups = cljs.reader.re_find_STAR_.call(null,cljs.reader.ratio_pattern,s);
+var numinator = (groups[1]);
+var denominator = (groups[2]);
+return (parseInt(numinator) / parseInt(denominator));
+});
+cljs.reader.match_float = (function match_float(s){
+return parseFloat(s);
+});
+cljs.reader.re_matches_STAR_ = (function re_matches_STAR_(re,s){
+var matches = re.exec(s);
+if((function (){var and__3941__auto__ = !((matches == null));
+if(and__3941__auto__)
+{return ((matches[0]) === s);
+} else
+{return and__3941__auto__;
+}
+})())
+{if((matches.length === 1))
+{return (matches[0]);
+} else
+{return matches;
+}
+} else
+{return null;
+}
+});
+cljs.reader.match_number = (function match_number(s){
+if(cljs.core.truth_(cljs.reader.re_matches_STAR_.call(null,cljs.reader.int_pattern,s)))
+{return cljs.reader.match_int.call(null,s);
+} else
+{if(cljs.core.truth_(cljs.reader.re_matches_STAR_.call(null,cljs.reader.ratio_pattern,s)))
+{return cljs.reader.match_ratio.call(null,s);
+} else
+{if(cljs.core.truth_(cljs.reader.re_matches_STAR_.call(null,cljs.reader.float_pattern,s)))
+{return cljs.reader.match_float.call(null,s);
+} else
+{return null;
+}
+}
+}
+});
+cljs.reader.escape_char_map = (function escape_char_map(c){
+if((c === "t"))
+{return "\t";
+} else
+{if((c === "r"))
+{return "\r";
+} else
+{if((c === "n"))
+{return "\n";
+} else
+{if((c === "\\"))
+{return "\\";
+} else
+{if((c === "\""))
+{return "\"";
+} else
+{if((c === "b"))
+{return "\b";
+} else
+{if((c === "f"))
+{return "\f";
+} else
+{if("\uFDD0:else")
+{return null;
+} else
+{return null;
+}
+}
+}
+}
+}
+}
+}
+}
+});
+cljs.reader.read_2_chars = (function read_2_chars(reader){
+return (new goog.string.StringBuffer(cljs.reader.read_char.call(null,reader),cljs.reader.read_char.call(null,reader))).toString();
+});
+cljs.reader.read_4_chars = (function read_4_chars(reader){
+return (new goog.string.StringBuffer(cljs.reader.read_char.call(null,reader),cljs.reader.read_char.call(null,reader),cljs.reader.read_char.call(null,reader),cljs.reader.read_char.call(null,reader))).toString();
+});
+cljs.reader.unicode_2_pattern = cljs.core.re_pattern.call(null,"[0-9A-Fa-f]{2}");
+cljs.reader.unicode_4_pattern = cljs.core.re_pattern.call(null,"[0-9A-Fa-f]{4}");
+cljs.reader.validate_unicode_escape = (function validate_unicode_escape(unicode_pattern,reader,escape_char,unicode_str){
+if(cljs.core.truth_(cljs.core.re_matches.call(null,unicode_pattern,unicode_str)))
+{return unicode_str;
+} else
+{return cljs.reader.reader_error.call(null,reader,"Unexpected unicode escape \\",escape_char,unicode_str);
+}
+});
+cljs.reader.make_unicode_char = (function make_unicode_char(code_str){
+var code = parseInt(code_str,16);
+return String.fromCharCode(code);
+});
+cljs.reader.escape_char = (function escape_char(buffer,reader){
+var ch = cljs.reader.read_char.call(null,reader);
+var mapresult = cljs.reader.escape_char_map.call(null,ch);
+if(cljs.core.truth_(mapresult))
+{return mapresult;
+} else
+{if((ch === "x"))
+{return cljs.reader.make_unicode_char.call(null,cljs.reader.validate_unicode_escape.call(null,cljs.reader.unicode_2_pattern,reader,ch,cljs.reader.read_2_chars.call(null,reader)));
+} else
+{if((ch === "u"))
+{return cljs.reader.make_unicode_char.call(null,cljs.reader.validate_unicode_escape.call(null,cljs.reader.unicode_4_pattern,reader,ch,cljs.reader.read_4_chars.call(null,reader)));
+} else
+{if(cljs.reader.numeric_QMARK_.call(null,ch))
+{return String.fromCharCode(ch);
+} else
+{if("\uFDD0:else")
+{return cljs.reader.reader_error.call(null,reader,"Unexpected unicode escape \\",ch);
+} else
+{return null;
+}
+}
+}
+}
+}
+});
+/**
+* Read until first character that doesn't match pred, returning
+* char.
+*/
+cljs.reader.read_past = (function read_past(pred,rdr){
+var ch = cljs.reader.read_char.call(null,rdr);
+while(true){
+if(cljs.core.truth_(pred.call(null,ch)))
+{{
+var G__4696 = cljs.reader.read_char.call(null,rdr);
+ch = G__4696;
+continue;
+}
+} else
+{return ch;
+}
+break;
+}
+});
+cljs.reader.read_delimited_list = (function read_delimited_list(delim,rdr,recursive_QMARK_){
+var a = cljs.core.transient$.call(null,cljs.core.PersistentVector.EMPTY);
+while(true){
+var ch = cljs.reader.read_past.call(null,cljs.reader.whitespace_QMARK_,rdr);
+if(cljs.core.truth_(ch))
+{} else
+{cljs.reader.reader_error.call(null,rdr,"EOF while reading");
+}
+if((delim === ch))
+{return cljs.core.persistent_BANG_.call(null,a);
+} else
+{var temp__4090__auto__ = cljs.reader.macros.call(null,ch);
+if(cljs.core.truth_(temp__4090__auto__))
+{var macrofn = temp__4090__auto__;
+var mret = macrofn.call(null,rdr,ch);
+{
+var G__4697 = (((mret === rdr))?a:cljs.core.conj_BANG_.call(null,a,mret));
+a = G__4697;
+continue;
+}
+} else
+{cljs.reader.unread.call(null,rdr,ch);
+var o = cljs.reader.read.call(null,rdr,true,null,recursive_QMARK_);
+{
+var G__4698 = (((o === rdr))?a:cljs.core.conj_BANG_.call(null,a,o));
+a = G__4698;
+continue;
+}
+}
+}
+break;
+}
+});
+cljs.reader.not_implemented = (function not_implemented(rdr,ch){
+return cljs.reader.reader_error.call(null,rdr,"Reader for ",ch," not implemented yet");
+});
+cljs.reader.read_dispatch = (function read_dispatch(rdr,_){
+var ch = cljs.reader.read_char.call(null,rdr);
+var dm = cljs.reader.dispatch_macros.call(null,ch);
+if(cljs.core.truth_(dm))
+{return dm.call(null,rdr,_);
+} else
+{var temp__4090__auto__ = cljs.reader.maybe_read_tagged_type.call(null,rdr,ch);
+if(cljs.core.truth_(temp__4090__auto__))
+{var obj = temp__4090__auto__;
+return obj;
+} else
+{return cljs.reader.reader_error.call(null,rdr,"No dispatch macro for ",ch);
+}
+}
+});
+cljs.reader.read_unmatched_delimiter = (function read_unmatched_delimiter(rdr,ch){
+return cljs.reader.reader_error.call(null,rdr,"Unmached delimiter ",ch);
+});
+cljs.reader.read_list = (function read_list(rdr,_){
+return cljs.core.apply.call(null,cljs.core.list,cljs.reader.read_delimited_list.call(null,")",rdr,true));
+});
+cljs.reader.read_comment = cljs.reader.skip_line;
+cljs.reader.read_vector = (function read_vector(rdr,_){
+return cljs.reader.read_delimited_list.call(null,"]",rdr,true);
+});
+cljs.reader.read_map = (function read_map(rdr,_){
+var l = cljs.reader.read_delimited_list.call(null,"}",rdr,true);
+if(cljs.core.odd_QMARK_.call(null,cljs.core.count.call(null,l)))
+{cljs.reader.reader_error.call(null,rdr,"Map literal must contain an even number of forms");
+} else
+{}
+return cljs.core.apply.call(null,cljs.core.hash_map,l);
+});
+cljs.reader.read_number = (function read_number(reader,initch){
+var buffer = (new goog.string.StringBuffer(initch));
+var ch = cljs.reader.read_char.call(null,reader);
+while(true){
+if(cljs.core.truth_((function (){var or__3943__auto__ = (ch == null);
+if(or__3943__auto__)
+{return or__3943__auto__;
+} else
+{var or__3943__auto____$1 = cljs.reader.whitespace_QMARK_.call(null,ch);
+if(or__3943__auto____$1)
+{return or__3943__auto____$1;
+} else
+{return cljs.reader.macros.call(null,ch);
+}
+}
+})()))
+{cljs.reader.unread.call(null,reader,ch);
+var s = buffer.toString();
+var or__3943__auto__ = cljs.reader.match_number.call(null,s);
+if(cljs.core.truth_(or__3943__auto__))
+{return or__3943__auto__;
+} else
+{return cljs.reader.reader_error.call(null,reader,"Invalid number format [",s,"]");
+}
+} else
+{{
+var G__4699 = (function (){buffer.append(ch);
+return buffer;
+})();
+var G__4700 = cljs.reader.read_char.call(null,reader);
+buffer = G__4699;
+ch = G__4700;
+continue;
+}
+}
+break;
+}
+});
+cljs.reader.read_string_STAR_ = (function read_string_STAR_(reader,_){
+var buffer = (new goog.string.StringBuffer());
+var ch = cljs.reader.read_char.call(null,reader);
+while(true){
+if((ch == null))
+{return cljs.reader.reader_error.call(null,reader,"EOF while reading");
+} else
+{if(("\\" === ch))
+{{
+var G__4701 = (function (){buffer.append(cljs.reader.escape_char.call(null,buffer,reader));
+return buffer;
+})();
+var G__4702 = cljs.reader.read_char.call(null,reader);
+buffer = G__4701;
+ch = G__4702;
+continue;
+}
+} else
+{if(("\"" === ch))
+{return buffer.toString();
+} else
+{if("\uFDD0:default")
+{{
+var G__4703 = (function (){buffer.append(ch);
+return buffer;
+})();
+var G__4704 = cljs.reader.read_char.call(null,reader);
+buffer = G__4703;
+ch = G__4704;
+continue;
+}
+} else
+{return null;
+}
+}
+}
+}
+break;
+}
+});
+cljs.reader.special_symbols = (function special_symbols(t,not_found){
+if((t === "nil"))
+{return null;
+} else
+{if((t === "true"))
+{return true;
+} else
+{if((t === "false"))
+{return false;
+} else
+{if("\uFDD0:else")
+{return not_found;
+} else
+{return null;
+}
+}
+}
+}
+});
+cljs.reader.read_symbol = (function read_symbol(reader,initch){
+var token = cljs.reader.read_token.call(null,reader,initch);
+if(cljs.core.truth_(goog.string.contains(token,"/")))
+{return cljs.core.symbol.call(null,cljs.core.subs.call(null,token,0,token.indexOf("/")),cljs.core.subs.call(null,token,(token.indexOf("/") + 1),token.length));
+} else
+{return cljs.reader.special_symbols.call(null,token,cljs.core.symbol.call(null,token));
+}
+});
+cljs.reader.read_keyword = (function read_keyword(reader,initch){
+var token = cljs.reader.read_token.call(null,reader,cljs.reader.read_char.call(null,reader));
+var a = cljs.reader.re_matches_STAR_.call(null,cljs.reader.symbol_pattern,token);
+var token__$1 = (a[0]);
+var ns = (a[1]);
+var name = (a[2]);
+if(cljs.core.truth_((function (){var or__3943__auto__ = (function (){var and__3941__auto__ = !((void 0 === ns));
+if(and__3941__auto__)
+{return (ns.substring((ns.length - 2),ns.length) === ":/");
+} else
+{return and__3941__auto__;
+}
+})();
+if(cljs.core.truth_(or__3943__auto__))
+{return or__3943__auto__;
+} else
+{var or__3943__auto____$1 = ((name[(name.length - 1)]) === ":");
+if(or__3943__auto____$1)
+{return or__3943__auto____$1;
+} else
+{return !((token__$1.indexOf("::",1) === -1));
+}
+}
+})()))
+{return cljs.reader.reader_error.call(null,reader,"Invalid token: ",token__$1);
+} else
+{if((function (){var and__3941__auto__ = !((ns == null));
+if(and__3941__auto__)
+{return (ns.length > 0);
+} else
+{return and__3941__auto__;
+}
+})())
+{return cljs.core.keyword.call(null,ns.substring(0,ns.indexOf("/")),name);
+} else
+{return cljs.core.keyword.call(null,token__$1);
+}
+}
+});
+cljs.reader.desugar_meta = (function desugar_meta(f){
+if((f instanceof cljs.core.Symbol))
+{return cljs.core.PersistentArrayMap.fromArray(["\uFDD0:tag",f], true);
+} else
+{if(cljs.core.string_QMARK_.call(null,f))
+{return cljs.core.PersistentArrayMap.fromArray(["\uFDD0:tag",f], true);
+} else
+{if(cljs.core.keyword_QMARK_.call(null,f))
+{return cljs.core.PersistentArrayMap.fromArray([f,true], true);
+} else
+{if("\uFDD0:else")
+{return f;
+} else
+{return null;
+}
+}
+}
+}
+});
+cljs.reader.wrapping_reader = (function wrapping_reader(sym){
+return (function (rdr,_){
+return cljs.core.list.call(null,sym,cljs.reader.read.call(null,rdr,true,null,true));
+});
+});
+cljs.reader.throwing_reader = (function throwing_reader(msg){
+return (function (rdr,_){
+return cljs.reader.reader_error.call(null,rdr,msg);
+});
+});
+cljs.reader.read_meta = (function read_meta(rdr,_){
+var m = cljs.reader.desugar_meta.call(null,cljs.reader.read.call(null,rdr,true,null,true));
+if(cljs.core.map_QMARK_.call(null,m))
+{} else
+{cljs.reader.reader_error.call(null,rdr,"Metadata must be Symbol,Keyword,String or Map");
+}
+var o = cljs.reader.read.call(null,rdr,true,null,true);
+if((function (){var G__4706 = o;
+if(G__4706)
+{if((function (){var or__3943__auto__ = (G__4706.cljs$lang$protocol_mask$partition0$ & 262144);
+if(or__3943__auto__)
+{return or__3943__auto__;
+} else
+{return G__4706.cljs$core$IWithMeta$;
+}
+})())
+{return true;
+} else
+{if((!G__4706.cljs$lang$protocol_mask$partition0$))
+{return cljs.core.type_satisfies_.call(null,cljs.core.IWithMeta,G__4706);
+} else
+{return false;
+}
+}
+} else
+{return cljs.core.type_satisfies_.call(null,cljs.core.IWithMeta,G__4706);
+}
+})())
+{return cljs.core.with_meta.call(null,o,cljs.core.merge.call(null,cljs.core.meta.call(null,o),m));
+} else
+{return cljs.reader.reader_error.call(null,rdr,"Metadata can only be applied to IWithMetas");
+}
+});
+cljs.reader.read_set = (function read_set(rdr,_){
+return cljs.core.set.call(null,cljs.reader.read_delimited_list.call(null,"}",rdr,true));
+});
+cljs.reader.read_regex = (function read_regex(rdr,ch){
+return cljs.core.re_pattern.call(null,cljs.reader.read_string_STAR_.call(null,rdr,ch));
+});
+cljs.reader.read_discard = (function read_discard(rdr,_){
+cljs.reader.read.call(null,rdr,true,null,true);
+return rdr;
+});
+cljs.reader.macros = (function macros(c){
+if((c === "\""))
+{return cljs.reader.read_string_STAR_;
+} else
+{if((c === ":"))
+{return cljs.reader.read_keyword;
+} else
+{if((c === ";"))
+{return cljs.reader.not_implemented;
+} else
+{if((c === "'"))
+{return cljs.reader.wrapping_reader.call(null,new cljs.core.Symbol(null,"quote","quote",-1532577739,null));
+} else
+{if((c === "@"))
+{return cljs.reader.wrapping_reader.call(null,new cljs.core.Symbol(null,"deref","deref",-1545057749,null));
+} else
+{if((c === "^"))
+{return cljs.reader.read_meta;
+} else
+{if((c === "`"))
+{return cljs.reader.not_implemented;
+} else
+{if((c === "~"))
+{return cljs.reader.not_implemented;
+} else
+{if((c === "("))
+{return cljs.reader.read_list;
+} else
+{if((c === ")"))
+{return cljs.reader.read_unmatched_delimiter;
+} else
+{if((c === "["))
+{return cljs.reader.read_vector;
+} else
+{if((c === "]"))
+{return cljs.reader.read_unmatched_delimiter;
+} else
+{if((c === "{"))
+{return cljs.reader.read_map;
+} else
+{if((c === "}"))
+{return cljs.reader.read_unmatched_delimiter;
+} else
+{if((c === "\\"))
+{return cljs.reader.read_char;
+} else
+{if((c === "%"))
+{return cljs.reader.not_implemented;
+} else
+{if((c === "#"))
+{return cljs.reader.read_dispatch;
+} else
+{if("\uFDD0:else")
+{return null;
+} else
+{return null;
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+});
+cljs.reader.dispatch_macros = (function dispatch_macros(s){
+if((s === "{"))
+{return cljs.reader.read_set;
+} else
+{if((s === "<"))
+{return cljs.reader.throwing_reader.call(null,"Unreadable form");
+} else
+{if((s === "\""))
+{return cljs.reader.read_regex;
+} else
+{if((s === "!"))
+{return cljs.reader.read_comment;
+} else
+{if((s === "_"))
+{return cljs.reader.read_discard;
+} else
+{if("\uFDD0:else")
+{return null;
+} else
+{return null;
+}
+}
+}
+}
+}
+}
+});
+/**
+* Reads the first object from a PushbackReader. Returns the object read.
+* If EOF, throws if eof-is-error is true. Otherwise returns sentinel.
+*/
+cljs.reader.read = (function read(reader,eof_is_error,sentinel,is_recursive){
+while(true){
+var ch = cljs.reader.read_char.call(null,reader);
+if((ch == null))
+{if(cljs.core.truth_(eof_is_error))
+{return cljs.reader.reader_error.call(null,reader,"EOF while reading");
+} else
+{return sentinel;
+}
+} else
+{if(cljs.reader.whitespace_QMARK_.call(null,ch))
+{{
+var G__4707 = reader;
+var G__4708 = eof_is_error;
+var G__4709 = sentinel;
+var G__4710 = is_recursive;
+reader = G__4707;
+eof_is_error = G__4708;
+sentinel = G__4709;
+is_recursive = G__4710;
+continue;
+}
+} else
+{if(cljs.reader.comment_prefix_QMARK_.call(null,ch))
+{{
+var G__4711 = cljs.reader.read_comment.call(null,reader,ch);
+var G__4712 = eof_is_error;
+var G__4713 = sentinel;
+var G__4714 = is_recursive;
+reader = G__4711;
+eof_is_error = G__4712;
+sentinel = G__4713;
+is_recursive = G__4714;
+continue;
+}
+} else
+{if("\uFDD0:else")
+{var f = cljs.reader.macros.call(null,ch);
+var res = (cljs.core.truth_(f)?f.call(null,reader,ch):((cljs.reader.number_literal_QMARK_.call(null,reader,ch))?cljs.reader.read_number.call(null,reader,ch):(("\uFDD0:else")?cljs.reader.read_symbol.call(null,reader,ch):null)));
+if((res === reader))
+{{
+var G__4715 = reader;
+var G__4716 = eof_is_error;
+var G__4717 = sentinel;
+var G__4718 = is_recursive;
+reader = G__4715;
+eof_is_error = G__4716;
+sentinel = G__4717;
+is_recursive = G__4718;
+continue;
+}
+} else
+{return res;
+}
+} else
+{return null;
+}
+}
+}
+}
+break;
+}
+});
+/**
+* Reads one object from the string s
+*/
+cljs.reader.read_string = (function read_string(s){
+var r = cljs.reader.push_back_reader.call(null,s);
+return cljs.reader.read.call(null,r,true,null,false);
+});
+cljs.reader.zero_fill_right = (function zero_fill_right(s,width){
+if(cljs.core._EQ_.call(null,width,cljs.core.count.call(null,s)))
+{return s;
+} else
+{if((width < cljs.core.count.call(null,s)))
+{return s.substring(0,width);
+} else
+{if("\uFDD0:else")
+{var b = (new goog.string.StringBuffer(s));
+while(true){
+if((b.getLength() < width))
+{{
+var G__4719 = b.append("0");
+b = G__4719;
+continue;
+}
+} else
+{return b.toString();
+}
+break;
+}
+} else
+{return null;
+}
+}
+}
+});
+cljs.reader.divisible_QMARK_ = (function divisible_QMARK_(num,div){
+return (cljs.core.mod.call(null,num,div) === 0);
+});
+cljs.reader.indivisible_QMARK_ = (function indivisible_QMARK_(num,div){
+return cljs.core.not.call(null,cljs.reader.divisible_QMARK_.call(null,num,div));
+});
+cljs.reader.leap_year_QMARK_ = (function leap_year_QMARK_(year){
+var and__3941__auto__ = cljs.reader.divisible_QMARK_.call(null,year,4);
+if(cljs.core.truth_(and__3941__auto__))
+{var or__3943__auto__ = cljs.reader.indivisible_QMARK_.call(null,year,100);
+if(cljs.core.truth_(or__3943__auto__))
+{return or__3943__auto__;
+} else
+{return cljs.reader.divisible_QMARK_.call(null,year,400);
+}
+} else
+{return and__3941__auto__;
+}
+});
+cljs.reader.days_in_month = (function (){var dim_norm = cljs.core.PersistentVector.fromArray([null,31,28,31,30,31,30,31,31,30,31,30,31], true);
+var dim_leap = cljs.core.PersistentVector.fromArray([null,31,29,31,30,31,30,31,31,30,31,30,31], true);
+return (function (month,leap_year_QMARK_){
+return cljs.core.get.call(null,(cljs.core.truth_(leap_year_QMARK_)?dim_leap:dim_norm),month);
+});
+})();
+cljs.reader.parse_and_validate_timestamp = (function (){var timestamp = /(\d\d\d\d)(?:-(\d\d)(?:-(\d\d)(?:[T](\d\d)(?::(\d\d)(?::(\d\d)(?:[.](\d+))?)?)?)?)?)?(?:[Z]|([-+])(\d\d):(\d\d))?/;
+var check = ((function (timestamp){
+return (function (low,n,high,msg){
+if((function (){var and__3941__auto__ = (low <= n);
+if(and__3941__auto__)
+{return (n <= high);
+} else
+{return and__3941__auto__;
+}
+})())
+{} else
+{throw (new Error([cljs.core.str("Assert failed: "),cljs.core.str([cljs.core.str(msg),cljs.core.str(" Failed: "),cljs.core.str(low),cljs.core.str("<="),cljs.core.str(n),cljs.core.str("<="),cljs.core.str(high)].join('')),cljs.core.str("\n"),cljs.core.str(cljs.core.pr_str.call(null,cljs.core.list(new cljs.core.Symbol(null,"<=","<=",-1640529606,null),new cljs.core.Symbol(null,"low","low",-1640424179,null),new cljs.core.Symbol(null,"n","n",-1640531417,null),new cljs.core.Symbol(null,"high","high",-1637329061,null))))].join('')));
+}
+return n;
+});})(timestamp))
+;
+return (function (ts){
+var temp__4092__auto__ = cljs.core.map.call(null,cljs.core.vec,cljs.core.split_at.call(null,8,cljs.core.re_matches.call(null,timestamp,ts)));
+if(cljs.core.truth_(temp__4092__auto__))
+{var vec__4724 = temp__4092__auto__;
+var vec__4725 = cljs.core.nth.call(null,vec__4724,0,null);
+var _ = cljs.core.nth.call(null,vec__4725,0,null);
+var years = cljs.core.nth.call(null,vec__4725,1,null);
+var months = cljs.core.nth.call(null,vec__4725,2,null);
+var days = cljs.core.nth.call(null,vec__4725,3,null);
+var hours = cljs.core.nth.call(null,vec__4725,4,null);
+var minutes = cljs.core.nth.call(null,vec__4725,5,null);
+var seconds = cljs.core.nth.call(null,vec__4725,6,null);
+var milliseconds = cljs.core.nth.call(null,vec__4725,7,null);
+var vec__4726 = cljs.core.nth.call(null,vec__4724,1,null);
+var ___$1 = cljs.core.nth.call(null,vec__4726,0,null);
+var ___$2 = cljs.core.nth.call(null,vec__4726,1,null);
+var ___$3 = cljs.core.nth.call(null,vec__4726,2,null);
+var V = vec__4724;
+var vec__4727 = cljs.core.map.call(null,(function (v){
+return cljs.core.map.call(null,(function (p1__4723_SHARP_){
+return parseInt(p1__4723_SHARP_,10);
+}),v);
+}),cljs.core.map.call(null,(function (p1__4721_SHARP_,p2__4720_SHARP_){
+return cljs.core.update_in.call(null,p2__4720_SHARP_,cljs.core.PersistentVector.fromArray([0], true),p1__4721_SHARP_);
+}),cljs.core.PersistentVector.fromArray([cljs.core.constantly.call(null,null),(function (p1__4722_SHARP_){
+if(cljs.core._EQ_.call(null,p1__4722_SHARP_,"-"))
+{return "-1";
+} else
+{return "1";
+}
+})], true),V));
+var vec__4728 = cljs.core.nth.call(null,vec__4727,0,null);
+var ___$4 = cljs.core.nth.call(null,vec__4728,0,null);
+var y = cljs.core.nth.call(null,vec__4728,1,null);
+var mo = cljs.core.nth.call(null,vec__4728,2,null);
+var d = cljs.core.nth.call(null,vec__4728,3,null);
+var h = cljs.core.nth.call(null,vec__4728,4,null);
+var m = cljs.core.nth.call(null,vec__4728,5,null);
+var s = cljs.core.nth.call(null,vec__4728,6,null);
+var ms = cljs.core.nth.call(null,vec__4728,7,null);
+var vec__4729 = cljs.core.nth.call(null,vec__4727,1,null);
+var offset_sign = cljs.core.nth.call(null,vec__4729,0,null);
+var offset_hours = cljs.core.nth.call(null,vec__4729,1,null);
+var offset_minutes = cljs.core.nth.call(null,vec__4729,2,null);
+var offset = (offset_sign * ((offset_hours * 60) + offset_minutes));
+return cljs.core.PersistentVector.fromArray([((cljs.core.not.call(null,years))?1970:y),((cljs.core.not.call(null,months))?1:check.call(null,1,mo,12,"timestamp month field must be in range 1..12")),((cljs.core.not.call(null,days))?1:check.call(null,1,d,cljs.reader.days_in_month.call(null,mo,cljs.reader.leap_year_QMARK_.call(null,y)),"timestamp day field must be in range 1..last day in month")),((cljs.core.not.call(null,hours))?0:check.call(null,0,h,23,"timestamp hour field must be in range 0..23")),((cljs.core.not.call(null,minutes))?0:check.call(null,0,m,59,"timestamp minute field must be in range 0..59")),((cljs.core.not.call(null,seconds))?0:check.call(null,0,s,((cljs.core._EQ_.call(null,m,59))?60:59),"timestamp second field must be in range 0..60")),((cljs.core.not.call(null,milliseconds))?0:check.call(null,0,ms,999,"timestamp millisecond field must be in range 0..999")),offset], true);
+} else
+{return null;
+}
+});
+})();
+cljs.reader.parse_timestamp = (function parse_timestamp(ts){
+var temp__4090__auto__ = cljs.reader.parse_and_validate_timestamp.call(null,ts);
+if(cljs.core.truth_(temp__4090__auto__))
+{var vec__4731 = temp__4090__auto__;
+var years = cljs.core.nth.call(null,vec__4731,0,null);
+var months = cljs.core.nth.call(null,vec__4731,1,null);
+var days = cljs.core.nth.call(null,vec__4731,2,null);
+var hours = cljs.core.nth.call(null,vec__4731,3,null);
+var minutes = cljs.core.nth.call(null,vec__4731,4,null);
+var seconds = cljs.core.nth.call(null,vec__4731,5,null);
+var ms = cljs.core.nth.call(null,vec__4731,6,null);
+var offset = cljs.core.nth.call(null,vec__4731,7,null);
+return (new Date((Date.UTC(years,(months - 1),days,hours,minutes,seconds,ms) - ((offset * 60) * 1000))));
+} else
+{return cljs.reader.reader_error.call(null,null,[cljs.core.str("Unrecognized date/time syntax: "),cljs.core.str(ts)].join(''));
+}
+});
+cljs.reader.read_date = (function read_date(s){
+if(cljs.core.string_QMARK_.call(null,s))
+{return cljs.reader.parse_timestamp.call(null,s);
+} else
+{return cljs.reader.reader_error.call(null,null,"Instance literal expects a string for its timestamp.");
+}
+});
+cljs.reader.read_queue = (function read_queue(elems){
+if(cljs.core.vector_QMARK_.call(null,elems))
+{return cljs.core.into.call(null,cljs.core.PersistentQueue.EMPTY,elems);
+} else
+{return cljs.reader.reader_error.call(null,null,"Queue literal expects a vector for its elements.");
+}
+});
+cljs.reader.read_uuid = (function read_uuid(uuid){
+if(cljs.core.string_QMARK_.call(null,uuid))
+{return (new cljs.core.UUID(uuid));
+} else
+{return cljs.reader.reader_error.call(null,null,"UUID literal expects a string as its representation.");
+}
+});
+cljs.reader._STAR_tag_table_STAR_ = cljs.core.atom.call(null,cljs.core.PersistentArrayMap.fromArray(["inst",cljs.reader.read_date,"uuid",cljs.reader.read_uuid,"queue",cljs.reader.read_queue], true));
+cljs.reader._STAR_default_data_reader_fn_STAR_ = cljs.core.atom.call(null,null);
+cljs.reader.maybe_read_tagged_type = (function maybe_read_tagged_type(rdr,initch){
+var tag = cljs.reader.read_symbol.call(null,rdr,initch);
+var pfn = cljs.core.get.call(null,cljs.core.deref.call(null,cljs.reader._STAR_tag_table_STAR_),[cljs.core.str(tag)].join(''));
+var dfn = cljs.core.deref.call(null,cljs.reader._STAR_default_data_reader_fn_STAR_);
+if(cljs.core.truth_(pfn))
+{return pfn.call(null,cljs.reader.read.call(null,rdr,true,null,false));
+} else
+{if(cljs.core.truth_(dfn))
+{return dfn.call(null,tag,cljs.reader.read.call(null,rdr,true,null,false));
+} else
+{if("\uFDD0:else")
+{return cljs.reader.reader_error.call(null,rdr,"Could not find tag parser for ",[cljs.core.str(tag)].join('')," in ",cljs.core.pr_str.call(null,cljs.core.keys.call(null,cljs.core.deref.call(null,cljs.reader._STAR_tag_table_STAR_))));
+} else
+{return null;
+}
+}
+}
+});
+cljs.reader.register_tag_parser_BANG_ = (function register_tag_parser_BANG_(tag,f){
+var tag__$1 = [cljs.core.str(tag)].join('');
+var old_parser = cljs.core.get.call(null,cljs.core.deref.call(null,cljs.reader._STAR_tag_table_STAR_),tag__$1);
+cljs.core.swap_BANG_.call(null,cljs.reader._STAR_tag_table_STAR_,cljs.core.assoc,tag__$1,f);
+return old_parser;
+});
+cljs.reader.deregister_tag_parser_BANG_ = (function deregister_tag_parser_BANG_(tag){
+var tag__$1 = [cljs.core.str(tag)].join('');
+var old_parser = cljs.core.get.call(null,cljs.core.deref.call(null,cljs.reader._STAR_tag_table_STAR_),tag__$1);
+cljs.core.swap_BANG_.call(null,cljs.reader._STAR_tag_table_STAR_,cljs.core.dissoc,tag__$1);
+return old_parser;
+});
+cljs.reader.register_default_tag_parser_BANG_ = (function register_default_tag_parser_BANG_(f){
+var old_parser = cljs.core.deref.call(null,cljs.reader._STAR_default_data_reader_fn_STAR_);
+cljs.core.swap_BANG_.call(null,cljs.reader._STAR_default_data_reader_fn_STAR_,(function (_){
+return f;
+}));
+return old_parser;
+});
+cljs.reader.deregister_default_tag_parser_BANG_ = (function deregister_default_tag_parser_BANG_(){
+var old_parser = cljs.core.deref.call(null,cljs.reader._STAR_default_data_reader_fn_STAR_);
+cljs.core.swap_BANG_.call(null,cljs.reader._STAR_default_data_reader_fn_STAR_,(function (_){
+return null;
+}));
+return old_parser;
+});
View
162 resources/public/js/clojure/set.cljs
@@ -0,0 +1,162 @@
+; Copyright (c) Rich Hickey. All rights reserved.
+; The use and distribution terms for this software are covered by the
+; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
+; which can be found in the file epl-v10.html at the root of this distribution.
+; By using this software in any fashion, you are agreeing to be bound by
+; the terms of this license.
+; You must not remove this notice, or any other, from this software.
+
+(ns ^{:doc "Set operations such as union/intersection."
+ :author "Rich Hickey"}
+ clojure.set)
+
+(defn- bubble-max-key [k coll]
+ "Move a maximal element of coll according to fn k (which returns a number)
+ to the front of coll."
+ (let [max (apply max-key k coll)]
+ (cons max (remove #(identical? max %) coll))))
+
+(defn union
+ "Return a set that is the union of the input sets"
+ ([] #{})
+ ([s1] s1)
+ ([s1 s2]
+ (if (< (count s1) (count s2))
+ (reduce conj s2 s1)
+ (reduce conj s1 s2)))
+ ([s1 s2 & sets]
+ (let [bubbled-sets (bubble-max-key count (conj sets s2 s1))]
+ (reduce into (first bubbled-sets) (rest bubbled-sets)))))
+
+(defn intersection
+ "Return a set that is the intersection of the input sets"
+ ([s1] s1)
+ ([s1 s2]
+ (if (< (count s2) (count s1))
+ (recur s2 s1)
+ (reduce (fn [result item]
+ (if (contains? s2 item)
+ result
+ (disj result item)))
+ s1 s1)))
+ ([s1 s2 & sets]
+ (let [bubbled-sets (bubble-max-key #(- (count %)) (conj sets s2 s1))]
+ (reduce intersection (first bubbled-sets) (rest bubbled-sets)))))
+
+(defn difference
+ "Return a set that is the first set without elements of the remaining sets"
+ ([s1] s1)
+ ([s1 s2]
+ (if (< (count s1) (count s2))
+ (reduce (fn [result item]
+ (if (contains? s2 item)
+ (disj result item)
+ result))
+ s1 s1)
+ (reduce disj s1 s2)))
+ ([s1 s2 & sets]
+ (reduce difference s1 (conj sets s2))))
+
+
+(defn select
+ "Returns a set of the elements for which pred is true"
+ [pred xset]
+ (reduce (fn [s k] (if (pred k) s (disj s k)))
+ xset xset))
+
+(defn project
+ "Returns a rel of the elements of xrel with only the keys in ks"
+ [xrel ks]
+ (set (map #(select-keys % ks) xrel)))
+
+(defn rename-keys
+ "Returns the map with the keys in kmap renamed to the vals in kmap"
+ [map kmap]
+ (reduce
+ (fn [m [old new]]
+ (if (and (not= old new)
+ (contains? m old))
+ (-> m (assoc new (get m old)) (dissoc old))
+ m))
+ map kmap))
+
+(defn rename
+ "Returns a rel of the maps in xrel with the keys in kmap renamed to the vals in kmap"
+ [xrel kmap]
+ (set (map #(rename-keys % kmap) xrel)))
+
+(defn index
+ "Returns a map of the distinct values of ks in the xrel mapped to a
+ set of the maps in xrel with the corresponding values of ks."
+ [xrel ks]
+ (reduce
+ (fn [m x]
+ (let [ik (select-keys x ks)]
+ (assoc m ik (conj (get m ik #{}) x))))
+ {} xrel))
+
+(defn map-invert
+ "Returns the map with the vals mapped to the keys."
+ [m] (reduce (fn [m [k v]] (assoc m v k)) {} m))
+
+(defn join
+ "When passed 2 rels, returns the rel corresponding to the natural
+ join. When passed an additional keymap, joins on the corresponding
+ keys."
+ ([xrel yrel] ;natural join
+ (if (and (seq xrel) (seq yrel))
+ (let [ks (intersection (set (keys (first xrel))) (set (keys (first yrel))))
+ [r s] (if (<= (count xrel) (count yrel))
+ [xrel yrel]
+ [yrel xrel])
+ idx (index r ks)]
+ (reduce (fn [ret x]
+ (let [found (idx (select-keys x ks))]
+ (if found
+ (reduce #(conj %1 (merge %2 x)) ret found)
+ ret)))
+ #{} s))
+ #{}))
+ ([xrel yrel km] ;arbitrary key mapping
+ (let [[r s k] (if (<= (count xrel) (count yrel))
+ [xrel yrel (map-invert km)]
+ [yrel xrel km])
+ idx (index r (vals k))]
+ (reduce (fn [ret x]
+ (let [found (idx (rename-keys (select-keys x (keys k)) k))]
+ (if found
+ (reduce #(conj %1 (merge %2 x)) ret found)
+ ret)))
+ #{} s))))
+
+(defn subset?
+ "Is set1 a subset of set2?"
+ [set1 set2]
+ (and (<= (count set1) (count set2))
+ (every? #(contains? set2 %) set1)))
+
+(defn superset?
+ "Is set1 a superset of set2?"
+ [set1 set2]
+ (and (>= (count set1) (count set2))
+ (every? #(contains? set1 %) set2)))
+
+(comment
+(refer 'set)
+(def xs #{{:a 11 :b 1 :c 1 :d 4}
+ {:a 2 :b 12 :c 2 :d 6}
+ {:a 3 :b 3 :c 3 :d 8 :f 42}})
+
+(def ys #{{:a 11 :b 11 :c 11 :e 5}
+ {:a 12 :b 11 :c 12 :e 3}
+ {:a 3 :b 3 :c 3 :e 7 }})
+
+(join xs ys)
+(join xs (rename ys {:b :yb :c :yc}) {:a :a})
+
+(union #{:a :b :c} #{:c :d :e })
+(difference #{:a :b :c} #{:c :d :e})
+(intersection #{:a :b :c} #{:c :d :e})
+
+(index ys [:b]))
+
View
379 resources/public/js/clojure/set.js
@@ -0,0 +1,379 @@
+goog.provide('clojure.set');
+goog.require('cljs.core');
+clojure.set.bubble_max_key = (function bubble_max_key(k,coll){
+var max = cljs.core.apply.call(null,cljs.core.max_key,k,coll);
+return cljs.core.cons.call(null,max,cljs.core.remove.call(null,(function (p1__4732_SHARP_){
+return (max === p1__4732_SHARP_);
+}),coll));
+});
+/**
+* Return a set that is the union of the input sets
+* @param {...*} var_args
+*/
+clojure.set.union = (function() {
+var union = null;
+var union__0 = (function (){
+return cljs.core.PersistentHashSet.EMPTY;
+});
+var union__1 = (function (s1){
+return s1;
+});
+var union__2 = (function (s1,s2){
+if((cljs.core.count.call(null,s1) < cljs.core.count.call(null,s2)))
+{return cljs.core.reduce.call(null,cljs.core.conj,s2,s1);
+} else
+{return cljs.core.reduce.call(null,cljs.core.conj,s1,s2);
+}
+});
+var union__3 = (function() {
+var G__4733__delegate = function (s1,s2,sets){
+var bubbled_sets = clojure.set.bubble_max_key.call(null,cljs.core.count,cljs.core.conj.call(null,sets,s2,s1));
+return cljs.core.reduce.call(null,cljs.core.into,cljs.core.first.call(null,bubbled_sets),cljs.core.rest.call(null,bubbled_sets));
+};
+var G__4733 = function (s1,s2,var_args){
+var sets = null;
+if (arguments.length > 2) {
+ sets = cljs.core.array_seq(Array.prototype.slice.call(arguments, 2),0);
+}
+return G__4733__delegate.call(this, s1, s2, sets);
+};
+G__4733.cljs$lang$maxFixedArity = 2;
+G__4733.cljs$lang$applyTo = (function (arglist__4734){
+var s1 = cljs.core.first(arglist__4734);
+arglist__4734 = cljs.core.next(arglist__4734);
+var s2 = cljs.core.first(arglist__4734);
+var sets = cljs.core.rest(arglist__4734);
+return G__4733__delegate(s1, s2, sets);
+});
+G__4733.cljs$core$IFn$_invoke$arity$variadic = G__4733__delegate;
+return G__4733;
+})()
+;
+union = function(s1,s2,var_args){
+var sets = var_args;
+switch(arguments.length){
+case 0:
+return union__0.call(this);
+case 1:
+return union__1.call(this,s1);
+case 2:
+return union__2.call(this,s1,s2);
+default:
+return union__3.cljs$core$IFn$_invoke$arity$variadic(s1,s2, cljs.core.array_seq(arguments, 2));
+}
+throw(new Error('Invalid arity: ' + arguments.length));
+};
+union.cljs$lang$maxFixedArity = 2;
+union.cljs$lang$applyTo = union__3.cljs$lang$applyTo;
+union.cljs$core$IFn$_invoke$arity$0 = union__0;
+union.cljs$core$IFn$_invoke$arity$1 = union__1;
+union.cljs$core$IFn$_invoke$arity$2 = union__2;
+union.cljs$core$IFn$_invoke$arity$variadic = union__3.cljs$core$IFn$_invoke$arity$variadic;
+return union;
+})()
+;
+/**
+* Return a set that is the intersection of the input sets
+* @param {...*} var_args
+*/
+clojure.set.intersection = (function() {
+var intersection = null;
+var intersection__1 = (function (s1){
+return s1;
+});
+var intersection__2 = (function (s1,s2){
+while(true){
+if((cljs.core.count.call(null,s2) < cljs.core.count.call(null,s1)))
+{{
+var G__4736 = s2;
+var G__4737 = s1;
+s1 = G__4736;
+s2 = G__4737;
+continue;
+}
+} else
+{return cljs.core.reduce.call(null,((function (s1,s2){
+return (function (result,item){
+if(cljs.core.contains_QMARK_.call(null,s2,item))
+{return result;
+} else
+{return cljs.core.disj.call(null,result,item);
+}
+});})(s1,s2))
+,s1,s1);
+}
+break;
+}
+});
+var intersection__3 = (function() {
+var G__4738__delegate = function (s1,s2,sets){
+var bubbled_sets = clojure.set.bubble_max_key.call(null,(function (p1__4735_SHARP_){
+return (- cljs.core.count.call(null,p1__4735_SHARP_));
+}),cljs.core.conj.call(null,sets,s2,s1));
+return cljs.core.reduce.call(null,intersection,cljs.core.first.call(null,bubbled_sets),cljs.core.rest.call(null,bubbled_sets));
+};
+var G__4738 = function (s1,s2,var_args){
+var sets = null;
+if (arguments.length > 2) {
+ sets = cljs.core.array_seq(Array.prototype.slice.call(arguments, 2),0);
+}
+return G__4738__delegate.call(this, s1, s2, sets);
+};
+G__4738.cljs$lang$maxFixedArity = 2;
+G__4738.cljs$lang$applyTo = (function (arglist__4739){
+var s1 = cljs.core.first(arglist__4739);
+arglist__4739 = cljs.core.next(arglist__4739);
+var s2 = cljs.core.first(arglist__4739);
+var sets = cljs.core.rest(arglist__4739);
+return G__4738__delegate(s1, s2, sets);
+});
+G__4738.cljs$core$IFn$_invoke$arity$variadic = G__4738__delegate;
+return G__4738;
+})()
+;
+intersection = function(s1,s2,var_args){
+var sets = var_args;
+switch(arguments.length){
+case 1:
+return intersection__1.call(this,s1);
+case 2:
+return intersection__2.call(this,s1,s2);
+default:
+return intersection__3.cljs$core$IFn$_invoke$arity$variadic(s1,s2, cljs.core.array_seq(arguments, 2));
+}
+throw(new Error('Invalid arity: ' + arguments.length));
+};
+intersection.cljs$lang$maxFixedArity = 2;
+intersection.cljs$lang$applyTo = intersection__3.cljs$lang$applyTo;
+intersection.cljs$core$IFn$_invoke$arity$1 = intersection__1;
+intersection.cljs$core$IFn$_invoke$arity$2 = intersection__2;
+intersection.cljs$core$IFn$_invoke$arity$variadic = intersection__3.cljs$core$IFn$_invoke$arity$variadic;
+return intersection;
+})()
+;
+/**
+* Return a set that is the first set without elements of the remaining sets
+* @param {...*} var_args
+*/
+clojure.set.difference = (function() {
+var difference = null;
+var difference__1 = (function (s1){
+return s1;
+});
+var difference__2 = (function (s1,s2){
+if((cljs.core.count.call(null,s1) < cljs.core.count.call(null,s2)))
+{return cljs.core.reduce.call(null,(function (result,item){
+if(cljs.core.contains_QMARK_.call(null,s2,item))
+{return cljs.core.disj.call(null,result,item);
+} else
+{return result;
+}
+}),s1,s1);
+} else
+{return cljs.core.reduce.call(null,cljs.core.disj,s1,s2);
+}
+});
+var difference__3 = (function() {
+var G__4740__delegate = function (s1,s2,sets){
+return cljs.core.reduce.call(null,difference,s1,cljs.core.conj.call(null,sets,s2));
+};
+var G__4740 = function (s1,s2,var_args){
+var sets = null;
+if (arguments.length > 2) {
+ sets = cljs.core.array_seq(Array.prototype.slice.call(arguments, 2),0);
+}
+return G__4740__delegate.call(this, s1, s2, sets);
+};
+G__4740.cljs$lang$maxFixedArity = 2;
+G__4740.cljs$lang$applyTo = (function (arglist__4741){
+var s1 = cljs.core.first(arglist__4741);
+arglist__4741 = cljs.core.next(arglist__4741);
+var s2 = cljs.core.first(arglist__4741);
+var sets = cljs.core.rest(arglist__4741);
+return G__4740__delegate(s1, s2, sets);
+});
+G__4740.cljs$core$IFn$_invoke$arity$variadic = G__4740__delegate;
+return G__4740;
+})()
+;
+difference = function(s1,s2,var_args){
+var sets = var_args;
+switch(arguments.length){
+case 1:
+return difference__1.call(this,s1);
+case 2:
+return difference__2.call(this,s1,s2);
+default:
+return difference__3.cljs$core$IFn$_invoke$arity$variadic(s1,s2, cljs.core.array_seq(arguments, 2));
+}
+throw(new Error('Invalid arity: ' + arguments.length));
+};
+difference.cljs$lang$maxFixedArity = 2;
+difference.cljs$lang$applyTo = difference__3.cljs$lang$applyTo;
+difference.cljs$core$IFn$_invoke$arity$1 = difference__1;
+difference.cljs$core$IFn$_invoke$arity$2 = difference__2;
+difference.cljs$core$IFn$_invoke$arity$variadic = difference__3.cljs$core$IFn$_invoke$arity$variadic;
+return difference;
+})()
+;
+/**
+* Returns a set of the elements for which pred is true
+*/
+clojure.set.select = (function select(pred,xset){
+return cljs.core.reduce.call(null,(function (s,k){
+if(cljs.core.truth_(pred.call(null,k)))
+{return s;
+} else
+{return cljs.core.disj.call(null,s,k);
+}
+}),xset,xset);
+});
+/**
+* Returns a rel of the elements of xrel with only the keys in ks
+*/
+clojure.set.project = (function project(xrel,ks){
+return cljs.core.set.call(null,cljs.core.map.call(null,(function (p1__4742_SHARP_){
+return cljs.core.select_keys.call(null,p1__4742_SHARP_,ks);
+}),xrel));
+});
+/**
+* Returns the map with the keys in kmap renamed to the vals in kmap
+*/
+clojure.set.rename_keys = (function rename_keys(map,kmap){
+return cljs.core.reduce.call(null,(function (m,p__4745){
+var vec__4746 = p__4745;
+var old = cljs.core.nth.call(null,vec__4746,0,null);
+var new$ = cljs.core.nth.call(null,vec__4746,1,null);
+if((function (){var and__3941__auto__ = cljs.core.not_EQ_.call(null,old,new$);
+if(and__3941__auto__)
+{return cljs.core.contains_QMARK_.call(null,m,old);
+} else
+{return and__3941__auto__;
+}
+})())
+{return cljs.core.dissoc.call(null,cljs.core.assoc.call(null,m,new$,cljs.core.get.call(null,m,old)),old);
+} else
+{return m;
+}
+}),map,kmap);
+});
+/**
+* Returns a rel of the maps in xrel with the keys in kmap renamed to the vals in kmap
+*/
+clojure.set.rename = (function rename(xrel,kmap){
+return cljs.core.set.call(null,cljs.core.map.call(null,(function (p1__4747_SHARP_){
+return clojure.set.rename_keys.call(null,p1__4747_SHARP_,kmap);
+}),xrel));
+});
+/**
+* Returns a map of the distinct values of ks in the xrel mapped to a
+* set of the maps in xrel with the corresponding values of ks.
+*/
+clojure.set.index = (function index(xrel,ks){
+return cljs.core.reduce.call(null,(function (m,x){
+var ik = cljs.core.select_keys.call(null,x,ks);
+return cljs.core.assoc.call(null,m,ik,cljs.core.conj.call(null,cljs.core.get.call(null,m,ik,cljs.core.PersistentHashSet.EMPTY),x));
+}),cljs.core.PersistentArrayMap.EMPTY,xrel);
+});
+/**
+* Returns the map with the vals mapped to the keys.
+*/
+clojure.set.map_invert = (function map_invert(m){
+return cljs.core.reduce.call(null,(function (m__$1,p__4750){
+var vec__4751 = p__4750;
+var k = cljs.core.nth.call(null,vec__4751,0,null);
+var v = cljs.core.nth.call(null,vec__4751,1,null);
+return cljs.core.assoc.call(null,m__$1,v,k);
+}),cljs.core.PersistentArrayMap.EMPTY,m);
+});
+/**
+* When passed 2 rels, returns the rel corresponding to the natural
+* join. When passed an additional keymap, joins on the corresponding
+* keys.
+*/
+clojure.set.join = (function() {
+var join = null;
+var join__2 = (function (xrel,yrel){
+if((function (){var and__3941__auto__ = cljs.core.seq.call(null,xrel);
+if(and__3941__auto__)
+{return cljs.core.seq.call(null,yrel);
+} else
+{return and__3941__auto__;
+}
+})())
+{var ks = clojure.set.intersection.call(null,cljs.core.set.call(null,cljs.core.keys.call(null,cljs.core.first.call(null,xrel))),cljs.core.set.call(null,cljs.core.keys.call(null,cljs.core.first.call(null,yrel))));
+var vec__4758 = (((cljs.core.count.call(null,xrel) <= cljs.core.count.call(null,yrel)))?cljs.core.PersistentVector.fromArray([xrel,yrel], true):cljs.core.PersistentVector.fromArray([yrel,xrel], true));
+var r = cljs.core.nth.call(null,vec__4758,0,null);
+var s = cljs.core.nth.call(null,vec__4758,1,null);
+var idx = clojure.set.index.call(null,r,ks);
+return cljs.core.reduce.call(null,(function (ret,x){
+var found = idx.call(null,cljs.core.select_keys.call(null,x,ks));
+if(cljs.core.truth_(found))
+{return cljs.core.reduce.call(null,(function (p1__4752_SHARP_,p2__4753_SHARP_){
+return cljs.core.conj.call(null,p1__4752_SHARP_,cljs.core.merge.call(null,p2__4753_SHARP_,x));
+}),ret,found);
+} else
+{return ret;
+}
+}),cljs.core.PersistentHashSet.EMPTY,s);
+} else
+{return cljs.core.PersistentHashSet.EMPTY;
+}
+});
+var join__3 = (function (xrel,yrel,km){
+var vec__4759 = (((cljs.core.count.call(null,xrel) <= cljs.core.count.call(null,yrel)))?cljs.core.PersistentVector.fromArray([xrel,yrel,clojure.set.map_invert.call(null,km)], true):cljs.core.PersistentVector.fromArray([yrel,xrel,km], true));
+var r = cljs.core.nth.call(null,vec__4759,0,null);
+var s = cljs.core.nth.call(null,vec__4759,1,null);
+var k = cljs.core.nth.call(null,vec__4759,2,null);
+var idx = clojure.set.index.call(null,r,cljs.core.vals.call(null,k));
+return cljs.core.reduce.call(null,(function (ret,x){
+var found = idx.call(null,clojure.set.rename_keys.call(null,cljs.core.select_keys.call(null,x,cljs.core.keys.call(null,k)),k));
+if(cljs.core.truth_(found))
+{return cljs.core.reduce.call(null,(function (p1__4754_SHARP_,p2__4755_SHARP_){
+return cljs.core.conj.call(null,p1__4754_SHARP_,cljs.core.merge.call(null,p2__4755_SHARP_,x));
+}),ret,found);
+} else
+{return ret;
+}
+}),cljs.core.PersistentHashSet.EMPTY,s);
+});
+join = function(xrel,yrel,km){
+switch(arguments.length){
+case 2:
+return join__2.call(this,xrel,yrel);
+case 3:
+return join__3.call(this,xrel,yrel,km);
+}
+throw(new Error('Invalid arity: ' + arguments.length));
+};
+join.cljs$core$IFn$_invoke$arity$2 = join__2;
+join.cljs$core$IFn$_invoke$arity$3 = join__3;
+return join;
+})()
+;
+/**
+* Is set1 a subset of set2?
+*/
+clojure.set.subset_QMARK_ = (function subset_QMARK_(set1,set2){
+var and__3941__auto__ = (cljs.core.count.call(null,set1) <= cljs.core.count.call(null,set2));
+if(and__3941__auto__)
+{return cljs.core.every_QMARK_.call(null,(function (p1__4760_SHARP_){
+return cljs.core.contains_QMARK_.call(null,set2,p1__4760_SHARP_);
+}),set1);
+} else
+{return and__3941__auto__;
+}
+});
+/**
+* Is set1 a superset of set2?
+*/
+clojure.set.superset_QMARK_ = (function superset_QMARK_(set1,set2){
+var and__3941__auto__ = (cljs.core.count.call(null,set1) >= cljs.core.count.call(null,set2));
+if(and__3941__auto__)
+{return cljs.core.every_QMARK_.call(null,(function (p1__4761_SHARP_){