diff options
-rw-r--r-- | clojurescript/avoid-java-in-boot.patch | 312 | ||||
-rw-r--r-- | clojurescript/boot.js | 2243 | ||||
-rw-r--r-- | clojurescript/clj.js | 143 | ||||
-rw-r--r-- | clojurescript/tojs.clj | 28 |
4 files changed, 1336 insertions, 1390 deletions
diff --git a/clojurescript/avoid-java-in-boot.patch b/clojurescript/avoid-java-in-boot.patch new file mode 100644 index 00000000..ca1e01a4 --- /dev/null +++ b/clojurescript/avoid-java-in-boot.patch @@ -0,0 +1,312 @@ +diff --git a/src/clj/clojure/boot.clj b/src/clj/clojure/boot.clj +index 68cb448..e09191a 100644 +--- a/src/clj/clojure/boot.clj ++++ b/src/clj/clojure/boot.clj +@@ -315,7 +315,7 @@ + ([#^Object x] + (if (nil? x) "" (. x (toString)))) + ([x & ys] +- (loop [sb (new StringBuilder #^String (str x)) more ys] ++ (loop [sb (clojure.lang.RT/makeStringBuilder (str x)) more ys] + (if more + (recur (. sb (append (str (first more)))) (rest more)) + (str sb))))) +@@ -532,7 +532,7 @@ + {:inline (fn [x y] `(. clojure.lang.Numbers (add ~x ~y))) + :inline-arities #{2}} + ([] 0) +- ([x] (cast Number x)) ++ ([x] (clojure.lang.RT/numberCast x)) + ([x y] (. clojure.lang.Numbers (add x y))) + ([x y & more] + (reduce + (+ x y) more))) +@@ -542,7 +542,7 @@ + {:inline (fn [x y] `(. clojure.lang.Numbers (multiply ~x ~y))) + :inline-arities #{2}} + ([] 1) +- ([x] (cast Number x)) ++ ([x] (clojure.lang.RT/numberCast x)) + ([x y] (. clojure.lang.Numbers (multiply x y))) + ([x y & more] + (reduce * (* x y) more))) +@@ -1018,7 +1018,7 @@ + ([state] (new clojure.lang.Agent state)) + ([state validate-fn] (new clojure.lang.Agent state validate-fn))) + +-(defn ! [& args] (throw (new Exception "! is now send. See also send-off"))) ++(defn ! [& args] (throw (clojure.lang.RT/makeException "! is now send. See also send-off"))) + + (defn send + "Dispatch an action to an agent. Returns the agent immediately. +@@ -1330,10 +1330,10 @@ + (defn range + "Returns a lazy seq of nums from start (inclusive) to end + (exclusive), by step, where start defaults to 0 and step to 1." +- ([end] (if (and (> end 0) (< end (. Integer MAX_VALUE))) ++ ([end] (if (and (> end 0) (< end clojure.lang.RT/IntegerMaxValue)) + (new clojure.lang.Range 0 end) + (take end (iterate inc 0)))) +- ([start end] (if (and (< start end) (< end (. Integer MAX_VALUE))) ++ ([start end] (if (and (< start end) (< end clojure.lang.RT/IntegerMaxValue)) + (new clojure.lang.Range start end) + (take (- end start) (iterate inc start)))) + ([start end step] +@@ -1397,7 +1397,7 @@ + ([#^java.util.Comparator comp #^java.util.Collection coll] + (when (and coll (not (. coll (isEmpty)))) + (let [a (. coll (toArray))] +- (. java.util.Arrays (sort a comp)) ++ (clojure.lang.RT/sortArray a comp) + (seq a))))) + + (defn sort-by +@@ -1427,8 +1427,8 @@ + ~@body) + (recur (rest list#))))) + +-(defn scan [& args] (throw (new Exception "scan is now called dorun"))) +-(defn touch [& args] (throw (new Exception "touch is now called doall"))) ++(defn scan [& args] (throw (clojure.lang.RT/makeException "scan is now called dorun"))) ++(defn touch [& args] (throw (clojure.lang.RT/makeException "touch is now called doall"))) + + (defn dorun + "When lazy sequences are produced via functions that have side +@@ -1463,7 +1463,7 @@ + occurred." + [& agents] + (when *agent* +- (throw (new Exception "Can't await in agent action"))) ++ (throw (clojure.lang.RT/makeException "Can't await in agent action"))) + (let [latch (new java.util.concurrent.CountDownLatch (count agents)) + count-down (fn [agent] (. latch (countDown)) agent)] + (doseq agent agents +@@ -1482,7 +1482,7 @@ + to timeout, non-nil otherwise." + [timeout-ms & agents] + (when *agent* +- (throw (new Exception "Can't await in agent action"))) ++ (throw (clojure.lang.RT/makeException "Can't await in agent action"))) + (let [latch (new java.util.concurrent.CountDownLatch (count agents)) + count-down (fn [agent] (. latch (countDown)) agent)] + (doseq agent agents +@@ -1514,6 +1514,8 @@ + (. ns (importClass c (. Class (forName (str pkg "." c)))))) ) + (apply import (rest import-lists)))) + ++(import '(clojure.lang RT)) ++ + (defn into-array + "Returns an array of the type of the first element in coll, + containing the contents of coll, which must be of a compatible +@@ -1728,7 +1730,7 @@ + {:inline (fn [a i] `(. clojure.lang.RT (aget ~a ~i))) + :inline-arities #{2}} + ([array idx] +- (. Array (get array idx))) ++ (RT/aget array idx)) + ([array idx & idxs] + (apply aget (aget array idx) idxs))) + +@@ -1738,7 +1740,7 @@ + {:inline (fn [a i v] `(. clojure.lang.RT (aset ~a ~i ~v))) + :inline-arities #{3}} + ([array idx val] +- (. Array (set array idx val)) ++ (RT/aset array idx val) + val) + ([array idx idx2 & idxv] + (apply aset (aget array idx) idx2 idxv))) +@@ -1906,6 +1908,10 @@ + "Returns a set of the distinct elements of coll." + [coll] (apply hash-set coll)) + ++(defn class? ++ "Returns true if x is an instance of Class" ++ [x] (instance? Class x)) ++ + (defn #^{:private true} + filter-key [keyfn pred amap] + (loop [ret {} es (seq amap)] +@@ -1938,7 +1944,7 @@ + the-ns [x] + (if (instance? clojure.lang.Namespace x) + x +- (or (find-ns x) (throw (Exception. (str "No namespace: " x " found")))))) ++ (or (find-ns x) (throw (RT/makeException (str "No namespace: " x " found")))))) + + (defn ns-name + "Returns the name of the namespace, a symbol." +@@ -1971,7 +1977,7 @@ + (defn ns-imports + "Returns a map of the import mappings for the namespace." + [ns] +- (filter-key val (partial instance? Class) (ns-map ns))) ++ (filter-key val class? (ns-map ns))) + + (defn refer + "refers to all public vars of ns, subject to filters. +@@ -1989,7 +1995,8 @@ + to a symbol different from the var's name, in order to prevent + clashes. Use :use in the ns macro in preference to calling this directly." + [ns-sym & filters] +- (let [ns (or (find-ns ns-sym) (throw (new Exception (str "No namespace: " ns-sym)))) ++ (let [ns (or (find-ns ns-sym) ++ (throw (RT/makeException (str "No namespace: " ns-sym)))) + fs (apply hash-map filters) + nspublics (ns-publics ns) + rename (or (:rename fs) {}) +@@ -2125,7 +2132,7 @@ + true) + (= firstb :as) (pb ret (second bs) gvec) + :else (if seen-rest? +- (throw (new Exception "Unsupported binding form, only :as can follow & parameter")) ++ (throw (RT/makeException "Unsupported binding form, only :as can follow & parameter")) + (recur (pb ret firstb (list `nth gvec n nil)) + (inc n) + (rest bs) +@@ -2156,7 +2163,7 @@ + (symbol? b) (-> bvec (conj b) (conj v)) + (vector? b) (pvec bvec b v) + (map? b) (pmap bvec b v) +- :else (throw (new Exception (str "Unsupported binding form: " b)))))) ++ :else (throw (RT/makeException (str "Unsupported binding form: " b)))))) + process-entry (fn [bvec b] (pb bvec (key b) (val b)))] + (if (every? symbol? (keys bmap)) + bindings +@@ -2293,7 +2300,7 @@ + StringWriter. Returns the string created by any nested printing + calls." + [& body] +- `(let [s# (new java.io.StringWriter)] ++ `(let [s# (RT/makeStringWriter)] + (binding [*out* s#] + ~@body + (str s#)))) +@@ -2339,7 +2346,7 @@ + logical true." + [x] + `(when-not ~x +- (throw (new Exception (str "Assert failed: " (pr-str '~x)))))) ++ (throw (RT/makeException (str "Assert failed: " (pr-str '~x)))))) + + (defn test + "test [v] finds fn at key :test in var metadata and calls it, +@@ -2411,7 +2418,7 @@ + (defn rand + "Returns a random floating point number between 0 (inclusive) and + 1 (exclusive)." +- ([] (. Math (random))) ++ ([] (RT/random)) + ([n] (* n (rand)))) + + (defn rand-int +@@ -2521,7 +2528,7 @@ + "Reads the file named by f into a string and returns it." + [#^String f] + (with-open r (new java.io.BufferedReader (new java.io.FileReader f)) +- (let [sb (new StringBuilder)] ++ (let [sb (RT/makeStringBuilder)] + (loop [c (. r (read))] + (if (neg? c) + (str sb) +@@ -2805,10 +2812,6 @@ + (send-off agt fill) + (drain)))) + +-(defn class? +- "Returns true if x is an instance of Class" +- [x] (instance? Class x)) +- + (defn alter-var-root + "Atomically alters the root binding of var v by applying f to its + current value plus any args" +@@ -2893,7 +2896,7 @@ + relationships." + ([tag] (descendants global-hierarchy tag)) + ([h tag] (if (class? tag) +- (throw (java.lang.UnsupportedOperationException. "Can't get descendants of classes")) ++ (throw (RT/makeUnsupportedException "Can't get descendants of classes")) + (not-empty (get (:descendants h) tag))))) + + (defn derive +@@ -2920,9 +2923,9 @@ + (or + (when-not (contains? (tp tag) parent) + (when (contains? (ta tag) parent) +- (throw (Exception. (print-str tag "already has" parent "as ancestor")))) ++ (throw (RT/makeException (print-str tag "already has" parent "as ancestor")))) + (when (contains? (ta parent) tag) +- (throw (Exception. (print-str "Cyclic derivation:" parent "has" tag "as ancestor")))) ++ (throw (RT/makeException (print-str "Cyclic derivation:" parent "has" tag "as ancestor")))) + {:parents (assoc (:parents h) tag (conj (get tp tag #{}) parent)) + :ancestors (tf (:ancestors h) tag td parent ta) + :descendants (tf (:descendants h) parent ta tag td)}) +@@ -3049,7 +3052,7 @@ + [pred fmt & args] + (when pred + (let [message (apply format fmt args) +- exception (Exception. message) ++ exception (RT/makeException message) + raw-trace (.getStackTrace exception) + boring? #(not= (.getMethodName %) "doInvoke") + trace (into-array (drop 2 (drop-while boring? raw-trace)))] +diff --git a/src/jvm/clojure/lang/RT.java b/src/jvm/clojure/lang/RT.java +index 2a01ab3..18d4007 100644 +--- a/src/jvm/clojure/lang/RT.java ++++ b/src/jvm/clojure/lang/RT.java +@@ -30,6 +30,8 @@ public class RT{ + static final public Boolean T = Boolean.TRUE;//Keyword.intern(Symbol.create(null, "t")); + static final public Boolean F = Boolean.FALSE;//Keyword.intern(Symbol.create(null, "t")); + ++static final public Integer IntegerMaxValue = Integer.MAX_VALUE; ++ + //simple-symbol->class + final static IPersistentMap DEFAULT_IMPORTS = map( + // Symbol.create("RT"), "clojure.lang.RT", +@@ -959,6 +961,10 @@ static public double doubleCast(double x){ + return x; + } + ++static public Number numberCast(Object x){ ++ return (Number)x; ++} ++ + static public IPersistentMap map(Object... init){ + if(init != null && init.length == 2) + return new PersistentArrayMap(init); +@@ -1642,4 +1648,35 @@ static public int alength(Object xs){ + return Array.getLength(xs); + } + ++ ++////////////// ClojureScript support ///////////////////////////////// ++ ++static public StringBuilder makeStringBuilder(){ ++ return new StringBuilder(); ++} ++ ++static public StringBuilder makeStringBuilder(String x){ ++ return new StringBuilder(x); ++} ++ ++static public StringWriter makeStringWriter(){ ++ return new StringWriter(); ++} ++ ++static public Exception makeException(String msg){ ++ return new Exception(msg); ++} ++ ++static public Exception makeUnsupportedException(String msg){ ++ return new UnsupportedOperationException(msg); ++} ++ ++static public void sortArray(Object[] a, Comparator c){ ++ Arrays.sort(a, c); ++} ++ ++static public double random(){ ++ return Math.random(); ++} ++ + } diff --git a/clojurescript/boot.js b/clojurescript/boot.js index 4d673c87..3faa9362 100644 --- a/clojurescript/boot.js +++ b/clojurescript/boot.js @@ -2,28 +2,28 @@ //====== //(in-ns (quote clojure)) //--- -(function __tmp_fn_2662(){ +(function __tmp_fn_2665(){ return (clojure.in_ns.apply(null,["'clojure"]))}).apply(null,[]); //====== //(def list (. clojure.lang.PersistentList creator)) //--- -(function __clojure_fn_2671(){ +(function __clojure_fn_2674(){ return (clojure.JS.def(clojure,"list",clojure.lang.PersistentList.creator))}).apply(null,[]); //====== //(def cons (fn* cons [x seq] (. clojure.lang.RT (cons x seq)))) //--- -(function __clojure_fn_2679(){ -return (clojure.JS.def(clojure,"cons",(function __clojure_fn_2679_cons_2681(x_1,seq_2){ +(function __clojure_fn_2682(){ +return (clojure.JS.def(clojure,"cons",(function __clojure_fn_2682_cons_2684(x_1,seq_2){ var cons_0=arguments.callee; return (clojure.lang.RT.cons(x_1,seq_2))})))}).apply(null,[]); //====== //(def conj (fn conj ([coll x] (. clojure.lang.RT (conj coll x))) ([coll x & xs] (if xs (recur (conj coll x) (first xs) (rest xs)) (conj coll x))))) //--- -(function __clojure_fn_2714(){ -return (clojure.JS.def(clojure,"conj",clojure.JS.variadic(2,(function __clojure_fn_2714_conj_2716(coll_1,x_2){switch(arguments.length){ +(function __clojure_fn_2717(){ +return (clojure.JS.def(clojure,"conj",clojure.JS.variadic(2,(function __clojure_fn_2717_conj_2719(coll_1,x_2){switch(arguments.length){ case 2:var conj_0=arguments.callee; return (clojure.lang.RT.conj(coll_1,x_2))} var _cnt,_rtn,xs_3,conj_0=arguments.callee,xs_3=clojure.JS.rest_args(this,arguments,2); @@ -33,80 +33,72 @@ do{_cnt=0;_rtn=((xs_3)?((_cnt=1,_rtn=[conj_0.apply(null,[coll_1,x_2]),clojure.fi //====== //(def second (fn second [x] (first (rest x)))) //--- -(function __clojure_fn_2724(){ -return (clojure.JS.def(clojure,"second",(function __clojure_fn_2724_second_2726(x_1){ +(function __clojure_fn_2727(){ +return (clojure.JS.def(clojure,"second",(function __clojure_fn_2727_second_2729(x_1){ var second_0=arguments.callee; return (clojure.first.apply(null,[clojure.rest.apply(null,[x_1])]))})))}).apply(null,[]); //====== //(def ffirst (fn ffirst [x] (first (first x)))) //--- -(function __clojure_fn_2734(){ -return (clojure.JS.def(clojure,"ffirst",(function __clojure_fn_2734_ffirst_2736(x_1){ +(function __clojure_fn_2737(){ +return (clojure.JS.def(clojure,"ffirst",(function __clojure_fn_2737_ffirst_2739(x_1){ var ffirst_0=arguments.callee; return (clojure.first.apply(null,[clojure.first.apply(null,[x_1])]))})))}).apply(null,[]); //====== //(def rfirst (fn rfirst [x] (rest (first x)))) //--- -(function __clojure_fn_2744(){ -return (clojure.JS.def(clojure,"rfirst",(function __clojure_fn_2744_rfirst_2746(x_1){ +(function __clojure_fn_2747(){ +return (clojure.JS.def(clojure,"rfirst",(function __clojure_fn_2747_rfirst_2749(x_1){ var rfirst_0=arguments.callee; return (clojure.rest.apply(null,[clojure.first.apply(null,[x_1])]))})))}).apply(null,[]); //====== //(def frest (fn frest [x] (first (rest x)))) //--- -(function __clojure_fn_2754(){ -return (clojure.JS.def(clojure,"frest",(function __clojure_fn_2754_frest_2756(x_1){ +(function __clojure_fn_2757(){ +return (clojure.JS.def(clojure,"frest",(function __clojure_fn_2757_frest_2759(x_1){ var frest_0=arguments.callee; return (clojure.first.apply(null,[clojure.rest.apply(null,[x_1])]))})))}).apply(null,[]); //====== //(def rrest (fn rrest [x] (rest (rest x)))) //--- -(function __clojure_fn_2764(){ -return (clojure.JS.def(clojure,"rrest",(function __clojure_fn_2764_rrest_2766(x_1){ +(function __clojure_fn_2767(){ +return (clojure.JS.def(clojure,"rrest",(function __clojure_fn_2767_rrest_2769(x_1){ var rrest_0=arguments.callee; return (clojure.rest.apply(null,[clojure.rest.apply(null,[x_1])]))})))}).apply(null,[]); //====== //(def seq? (fn seq? [x] (instance? clojure.lang.ISeq x))) //--- -(function __clojure_fn_2784(){ -return (clojure.JS.def(clojure,"seq_QMARK_",(function __clojure_fn_2784_seq_QMARK_2786(x_1){ +(function __clojure_fn_2787(){ +return (clojure.JS.def(clojure,"seq_QMARK_",(function __clojure_fn_2787_seq_QMARK_2789(x_1){ var seq_QMARK__0=arguments.callee; return (clojure.instance_QMARK_.apply(null,[clojure.lang.ISeq,x_1]))})))}).apply(null,[]); //====== -//(def string? (fn string? [x] (instance? String x))) -//--- -(function __clojure_fn_2794(){ -return (clojure.JS.def(clojure,"string_QMARK_",(function __clojure_fn_2794_string_QMARK_2796(x_1){ -var string_QMARK__0=arguments.callee; -return (clojure.instance_QMARK_.apply(null,[java.lang.String,x_1]))})))}).apply(null,[]); - -//====== //(def map? (fn map? [x] (instance? clojure.lang.IPersistentMap x))) //--- -(function __clojure_fn_2804(){ -return (clojure.JS.def(clojure,"map_QMARK_",(function __clojure_fn_2804_map_QMARK_2806(x_1){ +(function __clojure_fn_2802(){ +return (clojure.JS.def(clojure,"map_QMARK_",(function __clojure_fn_2802_map_QMARK_2804(x_1){ var map_QMARK__0=arguments.callee; return (clojure.instance_QMARK_.apply(null,[clojure.lang.IPersistentMap,x_1]))})))}).apply(null,[]); //====== //(def vector? (fn vector? [x] (instance? clojure.lang.IPersistentVector x))) //--- -(function __clojure_fn_2814(){ -return (clojure.JS.def(clojure,"vector_QMARK_",(function __clojure_fn_2814_vector_QMARK_2816(x_1){ +(function __clojure_fn_2812(){ +return (clojure.JS.def(clojure,"vector_QMARK_",(function __clojure_fn_2812_vector_QMARK_2814(x_1){ var vector_QMARK__0=arguments.callee; return (clojure.instance_QMARK_.apply(null,[clojure.lang.IPersistentVector,x_1]))})))}).apply(null,[]); //====== //(def sigs (fn [fdecl] (if (seq? (first fdecl)) (loop [ret [] fdecl fdecl] (if fdecl (recur (conj ret (first (first fdecl))) (rest fdecl)) (seq ret))) (list (first fdecl))))) //--- -(function __clojure_fn_2825(){ -return (clojure.JS.def(clojure,"sigs",(function __clojure_fn_2825_sigs_2827(fdecl_1){ +(function __clojure_fn_2823(){ +return (clojure.JS.def(clojure,"sigs",(function __clojure_fn_2823_sigs_2825(fdecl_1){ var ret_2,fdecl_3; return (((clojure.seq_QMARK_.apply(null,[clojure.first.apply(null,[fdecl_1])]))?(((function __loop(){var _rtn,_cnt;(ret_2=clojure.lang.PersistentVector.EMPTY), (fdecl_3=fdecl_1);do{_cnt=0; @@ -115,24 +107,24 @@ _rtn=((fdecl_3)?((_cnt=1,_rtn=[clojure.conj.apply(null,[ret_2,clojure.first.appl //====== //(def meta (fn meta [x] (if (instance? clojure.lang.IObj x) (. x (meta))))) //--- -(function __clojure_fn_2841(){ -return (clojure.JS.def(clojure,"meta",(function __clojure_fn_2841_meta_2843(x_1){ +(function __clojure_fn_2839(){ +return (clojure.JS.def(clojure,"meta",(function __clojure_fn_2839_meta_2841(x_1){ var meta_0=arguments.callee; return (((clojure.instance_QMARK_.apply(null,[clojure.lang.IObj,x_1]))?((x_1).meta()):(null)))})))}).apply(null,[]); //====== //(def with-meta (fn with-meta [x m] (. x (withMeta m)))) //--- -(function __clojure_fn_2851(){ -return (clojure.JS.def(clojure,"with_meta",(function __clojure_fn_2851_with_meta_2853(x_1,m_2){ +(function __clojure_fn_2849(){ +return (clojure.JS.def(clojure,"with_meta",(function __clojure_fn_2849_with_meta_2851(x_1,m_2){ var with_meta_0=arguments.callee; return ((x_1).withMeta(m_2))})))}).apply(null,[]); //====== //(def last (fn last [s] (if (rest s) (recur (rest s)) (first s)))) //--- -(function __clojure_fn_2861(){ -return (clojure.JS.def(clojure,"last",(function __clojure_fn_2861_last_2863(s_1){ +(function __clojure_fn_2859(){ +return (clojure.JS.def(clojure,"last",(function __clojure_fn_2859_last_2861(s_1){ var _cnt,_rtn,last_0=arguments.callee; do{_cnt=0;_rtn=((clojure.rest.apply(null,[s_1]))?((_cnt=1,_rtn=[clojure.rest.apply(null,[s_1])],s_1=_rtn[0])):(clojure.first.apply(null,[s_1]))) }while(_cnt);return _rtn;})))}).apply(null,[]); @@ -140,9 +132,9 @@ do{_cnt=0;_rtn=((clojure.rest.apply(null,[s_1]))?((_cnt=1,_rtn=[clojure.rest.app //====== //(def butlast (fn butlast [s] (loop [ret [] s s] (if (rest s) (recur (conj ret (first s)) (rest s)) (seq ret))))) //--- -(function __clojure_fn_2871(){ -return (clojure.JS.def(clojure,"butlast",(function __clojure_fn_2871_butlast_2873(s_1){ -var ret_2,s_3,butlast_0=arguments.callee; +(function __clojure_fn_2869(){ +return (clojure.JS.def(clojure,"butlast",(function __clojure_fn_2869_butlast_2871(s_1){ +var s_3,ret_2,butlast_0=arguments.callee; return (((function __loop(){var _rtn,_cnt;(ret_2=clojure.lang.PersistentVector.EMPTY), (s_3=s_1);do{_cnt=0; _rtn=((clojure.rest.apply(null,[s_3]))?((_cnt=1,_rtn=[clojure.conj.apply(null,[ret_2,clojure.first.apply(null,[s_3])]),clojure.rest.apply(null,[s_3])],ret_2=_rtn[0],s_3=_rtn[1])):(clojure.seq.apply(null,[ret_2])))}while(_cnt);return _rtn;})()))})))}).apply(null,[]); @@ -150,22 +142,22 @@ _rtn=((clojure.rest.apply(null,[s_3]))?((_cnt=1,_rtn=[clojure.conj.apply(null,[r //====== //(defn cast "Throws a ClassCastException if x is not a c, else returns x." [c x] (. c (cast x))) //--- -(function __clojure_fn_2890(){ -return (clojure.JS.def(clojure,"cast",(function __clojure_fn_2890_cast_2892(c_1,x_2){ +(function __clojure_fn_2888(){ +return (clojure.JS.def(clojure,"cast",(function __clojure_fn_2888_cast_2890(c_1,x_2){ return ((c_1).cast(x_2))})))}).apply(null,[]); //====== //(defn to-array "Returns an array of Objects containing the contents of coll, which\n can be any Collection. Maps to java.util.Collection.toArray()." [coll] (. clojure.lang.RT (toArray coll))) //--- -(function __clojure_fn_2902(){ -return (clojure.JS.def(clojure,"to_array",(function __clojure_fn_2902_to_array_2904(coll_1){ +(function __clojure_fn_2900(){ +return (clojure.JS.def(clojure,"to_array",(function __clojure_fn_2900_to_array_2902(coll_1){ return (clojure.lang.RT.toArray(coll_1))})))}).apply(null,[]); //====== //(defn vector "Creates a new vector containing the args." ([] []) ([& args] (. clojure.lang.LazilyPersistentVector (create args)))) //--- -(function __clojure_fn_2915(){ -return (clojure.JS.def(clojure,"vector",clojure.JS.variadic(0,(function __clojure_fn_2915_vector_2917(){switch(arguments.length){ +(function __clojure_fn_2913(){ +return (clojure.JS.def(clojure,"vector",clojure.JS.variadic(0,(function __clojure_fn_2913_vector_2915(){switch(arguments.length){ case 0:return (clojure.lang.PersistentVector.EMPTY)} var args_1,args_1=clojure.JS.rest_args(this,arguments,0); return (clojure.lang.LazilyPersistentVector.create(args_1))}))))}).apply(null,[]); @@ -173,15 +165,15 @@ return (clojure.lang.LazilyPersistentVector.create(args_1))}))))}).apply(null,[] //====== //(defn vec "Creates a new vector containing the contents of coll." ([coll] (. clojure.lang.LazilyPersistentVector (createOwning (to-array coll))))) //--- -(function __clojure_fn_2928(){ -return (clojure.JS.def(clojure,"vec",(function __clojure_fn_2928_vec_2930(coll_1){ +(function __clojure_fn_2926(){ +return (clojure.JS.def(clojure,"vec",(function __clojure_fn_2926_vec_2928(coll_1){ return (clojure.lang.LazilyPersistentVector.createOwning(clojure.to_array.apply(null,[coll_1])))})))}).apply(null,[]); //====== //(defn hash-set "Returns a new hash set with supplied keys." ([] #{}) ([& keys] (. clojure.lang.PersistentHashSet (create keys)))) //--- -(function __clojure_fn_2948(){ -return (clojure.JS.def(clojure,"hash_set",clojure.JS.variadic(0,(function __clojure_fn_2948_hash_set_2950(){switch(arguments.length){ +(function __clojure_fn_2946(){ +return (clojure.JS.def(clojure,"hash_set",clojure.JS.variadic(0,(function __clojure_fn_2946_hash_set_2948(){switch(arguments.length){ case 0:return (clojure.lang.PersistentHashSet.EMPTY)} var keys_1,keys_1=clojure.JS.rest_args(this,arguments,0); return (clojure.lang.PersistentHashSet.create(keys_1))}))))}).apply(null,[]); @@ -189,72 +181,72 @@ return (clojure.lang.PersistentHashSet.create(keys_1))}))))}).apply(null,[]); //====== //(defn sorted-map "keyval => key val\n Returns a new sorted map with supplied mappings." ([& keyvals] (. clojure.lang.PersistentTreeMap (create keyvals)))) //--- -(function __clojure_fn_2961(){ -return (clojure.JS.def(clojure,"sorted_map",clojure.JS.variadic(0,(function __clojure_fn_2961_sorted_map_2963(){ +(function __clojure_fn_2959(){ +return (clojure.JS.def(clojure,"sorted_map",clojure.JS.variadic(0,(function __clojure_fn_2959_sorted_map_2961(){ var keyvals_1,keyvals_1=clojure.JS.rest_args(this,arguments,0); return (clojure.lang.PersistentTreeMap.create(keyvals_1))}))))}).apply(null,[]); //====== //(defn sorted-set "Returns a new sorted set with supplied keys." ([& keys] (. clojure.lang.PersistentTreeSet (create keys)))) //--- -(function __clojure_fn_2973(){ -return (clojure.JS.def(clojure,"sorted_set",clojure.JS.variadic(0,(function __clojure_fn_2973_sorted_set_2975(){ +(function __clojure_fn_2971(){ +return (clojure.JS.def(clojure,"sorted_set",clojure.JS.variadic(0,(function __clojure_fn_2971_sorted_set_2973(){ var keys_1,keys_1=clojure.JS.rest_args(this,arguments,0); return (clojure.lang.PersistentTreeSet.create(keys_1))}))))}).apply(null,[]); //====== //(defn sorted-map-by "keyval => key val\n Returns a new sorted map with supplied mappings, using the supplied comparator." ([comparator & keyvals] (. clojure.lang.PersistentTreeMap (create comparator keyvals)))) //--- -(function __clojure_fn_2985(){ -return (clojure.JS.def(clojure,"sorted_map_by",clojure.JS.variadic(1,(function __clojure_fn_2985_sorted_map_by_2987(comparator_1){ +(function __clojure_fn_2983(){ +return (clojure.JS.def(clojure,"sorted_map_by",clojure.JS.variadic(1,(function __clojure_fn_2983_sorted_map_by_2985(comparator_1){ var keyvals_2,keyvals_2=clojure.JS.rest_args(this,arguments,1); return (clojure.lang.PersistentTreeMap.create(comparator_1,keyvals_2))}))))}).apply(null,[]); //====== //(defn nil? "Returns true if x is nil, false otherwise." {:tag Boolean} [x] (identical? x nil)) //--- -(function __clojure_fn_3018(){ -return (clojure.JS.def(clojure,"nil_QMARK_",(function __clojure_fn_3018_nil_QMARK_3020(x_1){ +(function __clojure_fn_3016(){ +return (clojure.JS.def(clojure,"nil_QMARK_",(function __clojure_fn_3016_nil_QMARK_3018(x_1){ return (clojure.identical_QMARK_.apply(null,[x_1,null]))})))}).apply(null,[]); //====== //(defn false? "Returns true if x is the value false, false otherwise." {:tag Boolean} [x] (identical? x false)) //--- -(function __clojure_fn_3030(){ -return (clojure.JS.def(clojure,"false_QMARK_",(function __clojure_fn_3030_false_QMARK_3032(x_1){ +(function __clojure_fn_3028(){ +return (clojure.JS.def(clojure,"false_QMARK_",(function __clojure_fn_3028_false_QMARK_3030(x_1){ return (clojure.identical_QMARK_.apply(null,[x_1,false]))})))}).apply(null,[]); //====== //(defn true? "Returns true if x is the value true, false otherwise." {:tag Boolean} [x] (identical? x true)) //--- -(function __clojure_fn_3042(){ -return (clojure.JS.def(clojure,"true_QMARK_",(function __clojure_fn_3042_true_QMARK_3044(x_1){ +(function __clojure_fn_3040(){ +return (clojure.JS.def(clojure,"true_QMARK_",(function __clojure_fn_3040_true_QMARK_3042(x_1){ return (clojure.identical_QMARK_.apply(null,[x_1,true]))})))}).apply(null,[]); //====== //(defn not "Returns true if x is logical false, false otherwise." {:tag Boolean} [x] (if x false true)) //--- -(function __clojure_fn_3054(){ -return (clojure.JS.def(clojure,"not",(function __clojure_fn_3054_not_3056(x_1){ +(function __clojure_fn_3052(){ +return (clojure.JS.def(clojure,"not",(function __clojure_fn_3052_not_3054(x_1){ return (((x_1)?(false):(true)))})))}).apply(null,[]); //====== -//(defn str "With no args, returns the empty string. With one arg x, returns\n x.toString(). (str nil) returns the empty string. With more than\n one arg, returns the concatenation of the str values of the args." {:tag String} ([] "") ([x] (if (nil? x) "" (. x (toString)))) ([x & ys] (loop [sb (new StringBuilder (str x)) more ys] (if more (recur (. sb (append (str (first more)))) (rest more)) (str sb))))) +//(defn str "With no args, returns the empty string. With one arg x, returns\n x.toString(). (str nil) returns the empty string. With more than\n one arg, returns the concatenation of the str values of the args." {:tag String} ([] "") ([x] (if (nil? x) "" (. x (toString)))) ([x & ys] (loop [sb (clojure.lang.RT/makeStringBuilder (str x)) more ys] (if more (recur (. sb (append (str (first more)))) (rest more)) (str sb))))) //--- -(function __clojure_fn_3068(){ -return (clojure.JS.def(clojure,"str",clojure.JS.variadic(1,(function __clojure_fn_3068_str_3070(x_1){switch(arguments.length){ +(function __clojure_fn_3066(){ +return (clojure.JS.def(clojure,"str",clojure.JS.variadic(1,(function __clojure_fn_3066_str_3068(x_1){switch(arguments.length){ case 1:return (((clojure.nil_QMARK_.apply(null,[x_1]))?(""):((x_1).toString()))) case 0:return ("")} -var more_4,ys_2,sb_3,ys_2=clojure.JS.rest_args(this,arguments,1); -return (((function __loop(){var _rtn,_cnt;(sb_3=(new java.lang.StringBuilder(clojure.str.apply(null,[x_1])))), +var more_4,sb_3,ys_2,ys_2=clojure.JS.rest_args(this,arguments,1); +return (((function __loop(){var _rtn,_cnt;(sb_3=clojure.lang.RT.makeStringBuilder(clojure.str.apply(null,[x_1]))), (more_4=ys_2);do{_cnt=0; _rtn=((more_4)?((_cnt=1,_rtn=[(sb_3).append(clojure.str.apply(null,[clojure.first.apply(null,[more_4])])),clojure.rest.apply(null,[more_4])],sb_3=_rtn[0],more_4=_rtn[1])):(clojure.str.apply(null,[sb_3])))}while(_cnt);return _rtn;})()))}))))}).apply(null,[]); //====== //(defn symbol "Returns a Symbol with the given namespace and name." ([name] (. clojure.lang.Symbol (intern name))) ([ns name] (. clojure.lang.Symbol (intern ns name)))) //--- -(function __clojure_fn_3083(){ -return (clojure.JS.def(clojure,"symbol",(function __clojure_fn_3083_symbol_3085(ns_1,name_2){switch(arguments.length){ +(function __clojure_fn_3081(){ +return (clojure.JS.def(clojure,"symbol",(function __clojure_fn_3081_symbol_3083(ns_1,name_2){switch(arguments.length){ case 1:var name_1=arguments[0]; return (clojure.lang.Symbol.intern(name_1))} return (clojure.lang.Symbol.intern(ns_1,name_2))})))}).apply(null,[]); @@ -262,8 +254,8 @@ return (clojure.lang.Symbol.intern(ns_1,name_2))})))}).apply(null,[]); //====== //(defn keyword "Returns a Keyword with the given namespace and name. Do not use :\n in the keyword strings, it will be added automatically." ([name] (. clojure.lang.Keyword (intern nil name))) ([ns name] (. clojure.lang.Keyword (intern ns name)))) //--- -(function __clojure_fn_3097(){ -return (clojure.JS.def(clojure,"keyword",(function __clojure_fn_3097_keyword_3099(ns_1,name_2){switch(arguments.length){ +(function __clojure_fn_3095(){ +return (clojure.JS.def(clojure,"keyword",(function __clojure_fn_3095_keyword_3097(ns_1,name_2){switch(arguments.length){ case 1:var name_1=arguments[0]; return (clojure.lang.Keyword.intern(null,name_1))} return (clojure.lang.Keyword.intern(ns_1,name_2))})))}).apply(null,[]); @@ -271,78 +263,78 @@ return (clojure.lang.Keyword.intern(ns_1,name_2))})))}).apply(null,[]); //====== //(defn gensym "Returns a new symbol with a unique name. If a prefix string is\n supplied, the name is prefix# where # is some unique number. If\n prefix is not supplied, the prefix is 'G'." ([] (gensym "G__")) ([prefix-string] (. clojure.lang.Symbol (intern (str prefix-string (str (. clojure.lang.RT (nextID)))))))) //--- -(function __clojure_fn_3111(){ -return (clojure.JS.def(clojure,"gensym",(function __clojure_fn_3111_gensym_3113(prefix_string_1){switch(arguments.length){ +(function __clojure_fn_3109(){ +return (clojure.JS.def(clojure,"gensym",(function __clojure_fn_3109_gensym_3111(prefix_string_1){switch(arguments.length){ case 0:return (clojure.gensym.apply(null,["G__"]))} return (clojure.lang.Symbol.intern(clojure.str.apply(null,[prefix_string_1,clojure.str.apply(null,[clojure.lang.RT.nextID()])])))})))}).apply(null,[]); //====== //(defn spread {:private true} [arglist] (cond (nil? arglist) nil (nil? (rest arglist)) (seq (first arglist)) :else (cons (first arglist) (spread (rest arglist))))) //--- -(function __clojure_fn_3130(){ -return (clojure.JS.def(clojure,"spread",(function __clojure_fn_3130_spread_3132(arglist_1){ +(function __clojure_fn_3128(){ +return (clojure.JS.def(clojure,"spread",(function __clojure_fn_3128_spread_3130(arglist_1){ return (((clojure.nil_QMARK_.apply(null,[arglist_1]))?(null):(((clojure.nil_QMARK_.apply(null,[clojure.rest.apply(null,[arglist_1])]))?(clojure.seq.apply(null,[clojure.first.apply(null,[arglist_1])])):(((clojure.keyword("","else"))?(clojure.cons.apply(null,[clojure.first.apply(null,[arglist_1]),clojure.spread.apply(null,[clojure.rest.apply(null,[arglist_1])])])):(null)))))))})))}).apply(null,[]); //====== //(defn list* "Creates a new list containing the item prepended to more." [item & more] (spread (cons item more))) //--- -(function __clojure_fn_3148(){ -return (clojure.JS.def(clojure,"list_STAR_",clojure.JS.variadic(1,(function __clojure_fn_3148_list_STAR_3150(item_1){ +(function __clojure_fn_3146(){ +return (clojure.JS.def(clojure,"list_STAR_",clojure.JS.variadic(1,(function __clojure_fn_3146_list_STAR_3148(item_1){ var more_2,more_2=clojure.JS.rest_args(this,arguments,1); return (clojure.spread.apply(null,[clojure.cons.apply(null,[item_1,more_2])]))}))))}).apply(null,[]); //====== //(defn delay? "returns true if x is a Delay created with delay" [x] (instance? clojure.lang.Delay x)) //--- -(function __clojure_fn_3166(){ -return (clojure.JS.def(clojure,"delay_QMARK_",(function __clojure_fn_3166_delay_QMARK_3168(x_1){ +(function __clojure_fn_3164(){ +return (clojure.JS.def(clojure,"delay_QMARK_",(function __clojure_fn_3164_delay_QMARK_3166(x_1){ return (clojure.instance_QMARK_.apply(null,[clojure.lang.Delay,x_1]))})))}).apply(null,[]); //====== //(defn force "If x is a Delay, returns the (possibly cached) value of its expression, else returns x" [x] (. clojure.lang.Delay (force x))) //--- -(function __clojure_fn_3178(){ -return (clojure.JS.def(clojure,"force",(function __clojure_fn_3178_force_3180(x_1){ +(function __clojure_fn_3176(){ +return (clojure.JS.def(clojure,"force",(function __clojure_fn_3176_force_3178(x_1){ return (clojure.lang.Delay.force(x_1))})))}).apply(null,[]); //====== //(defn fnseq "Returns a seq object whose first is first and whose rest is the\n value produced by calling restfn with no arguments. restfn will be\n called at most once per step in the sequence, e.g. calling rest\n repeatedly on the head of the seq calls restfn once - the value it\n yields is cached." [first restfn] (new clojure.lang.FnSeq first restfn)) //--- -(function __clojure_fn_3190(){ -return (clojure.JS.def(clojure,"fnseq",(function __clojure_fn_3190_fnseq_3192(first_1,restfn_2){ +(function __clojure_fn_3188(){ +return (clojure.JS.def(clojure,"fnseq",(function __clojure_fn_3188_fnseq_3190(first_1,restfn_2){ return ((new clojure.lang.FnSeq(first_1,restfn_2)))})))}).apply(null,[]); //====== //(defn cache-seq "Given a seq s, returns a lazy seq that will touch each element of s\n at most once, caching the results." [s] (when s (clojure.lang.CachedSeq. s))) //--- -(function __clojure_fn_3208(){ -return (clojure.JS.def(clojure,"cache_seq",(function __clojure_fn_3208_cache_seq_3210(s_1){ +(function __clojure_fn_3206(){ +return (clojure.JS.def(clojure,"cache_seq",(function __clojure_fn_3206_cache_seq_3208(s_1){ return (((s_1)?((new clojure.lang.CachedSeq(s_1))):(null)))})))}).apply(null,[]); //====== //(defn concat "Returns a lazy seq representing the concatenation of\tthe elements in the supplied colls." ([] nil) ([x] (seq x)) ([x y] (if (seq x) (lazy-cons (first x) (concat (rest x) y)) (seq y))) ([x y & zs] (let [cat (fn cat [xys zs] (if (seq xys) (lazy-cons (first xys) (cat (rest xys) zs)) (when zs (recur (first zs) (rest zs)))))] (cat (concat x y) zs)))) //--- -(function __clojure_fn_3235(){ -return (clojure.JS.def(clojure,"concat",clojure.JS.variadic(2,(function __clojure_fn_3235_concat_3237(x_1,y_2){switch(arguments.length){ -case 2:return (((clojure.seq.apply(null,[x_1]))?((new clojure.lang.LazyCons((function __clojure_fn_3235_concat_3237_fn_3242(G__3241_1){switch(arguments.length){ +(function __clojure_fn_3233(){ +return (clojure.JS.def(clojure,"concat",clojure.JS.variadic(2,(function __clojure_fn_3233_concat_3235(x_1,y_2){switch(arguments.length){ +case 2:return (((clojure.seq.apply(null,[x_1]))?((new clojure.lang.LazyCons((function __clojure_fn_3233_concat_3235_fn_3240(G__3239_1){switch(arguments.length){ case 0:return (clojure.first.apply(null,[x_1]))} return (clojure.concat.apply(null,[clojure.rest.apply(null,[x_1]),y_2]))})))):(clojure.seq.apply(null,[y_2])))) case 1:return (clojure.seq.apply(null,[x_1])) case 0:return (null)} var cat_4,zs_3,zs_3=clojure.JS.rest_args(this,arguments,2); -return (((cat_4=(function __clojure_fn_3235_concat_3237_cat_3247(xys_1,zs_2){ +return (((cat_4=(function __clojure_fn_3233_concat_3235_cat_3245(xys_1,zs_2){ var _cnt,_rtn,cat_0=arguments.callee; -do{_cnt=0;_rtn=((clojure.seq.apply(null,[xys_1]))?((new clojure.lang.LazyCons((function __clojure_fn_3235_concat_3237_cat_3247_fn_3249(G__3248_1){switch(arguments.length){ +do{_cnt=0;_rtn=((clojure.seq.apply(null,[xys_1]))?((new clojure.lang.LazyCons((function __clojure_fn_3233_concat_3235_cat_3245_fn_3247(G__3246_1){switch(arguments.length){ case 0:return (clojure.first.apply(null,[xys_1]))} return (cat_0.apply(null,[clojure.rest.apply(null,[xys_1]),zs_2]))})))):(((zs_2)?((_cnt=1,_rtn=[clojure.first.apply(null,[zs_2]),clojure.rest.apply(null,[zs_2])],xys_1=_rtn[0],zs_2=_rtn[1])):(null)))) }while(_cnt);return _rtn;})), cat_4.apply(null,[clojure.concat.apply(null,[x_1,y_2]),zs_3])))}))))}).apply(null,[]); //====== -//(defn = "Equality. Returns true if x equals y, false if not. Same as\n Java x.equals(y) except it also works for nil, and compares\n numbers in a type-independent manner. Clojure's immutable data\n structures define equals() (and thus =) as a value, not an identity,\n comparison." {:inline (fn [x y] (clojure/concat (clojure/list (quote .)) (clojure/list (quote clojure.lang.Util)) (clojure/list (quote clojure/equal)) (clojure/list x) (clojure/list y))), :inline-arities #{2}, :tag Boolean} ([x] true) ([x y] (. clojure.lang.Util (equal x y))) ([x y & more] (if (= x y) (if (rest more) (recur y (first more) (rest more)) (= y (first more))) false))) +//(defn = "Equality. Returns true if x equals y, false if not. Same as\n Java x.equals(y) except it also works for nil, and compares\n numbers in a type-independent manner. Clojure's immutable data\n structures define equals() (and thus =) as a value, not an identity,\n comparison." {:tag Boolean, :inline-arities #{2}, :inline (fn [x y] (clojure/concat (clojure/list (quote .)) (clojure/list (quote clojure.lang.Util)) (clojure/list (quote clojure/equal)) (clojure/list x) (clojure/list y)))} ([x] true) ([x y] (. clojure.lang.Util (equal x y))) ([x y & more] (if (= x y) (if (rest more) (recur y (first more) (rest more)) (= y (first more))) false))) //--- -(function __clojure_fn_3267(){ -return (clojure.JS.def(clojure,"_EQ_",clojure.JS.variadic(2,(function __clojure_fn_3267_EQ_3272(x_1,y_2){switch(arguments.length){ +(function __clojure_fn_3265(){ +return (clojure.JS.def(clojure,"_EQ_",clojure.JS.variadic(2,(function __clojure_fn_3265_EQ_3270(x_1,y_2){switch(arguments.length){ case 2:return (clojure.lang.Util.equal(x_1,y_2)) case 1:return (true)} var _cnt,_rtn,more_3,more_3=clojure.JS.rest_args(this,arguments,2); @@ -352,31 +344,31 @@ do{_cnt=0;_rtn=((clojure.lang.Util.equal(x_1,y_2))?(((clojure.rest.apply(null,[m //====== //(defn not= "Same as (not (= obj1 obj2))" {:tag Boolean} ([x] false) ([x y] (not (= x y))) ([x y & more] (not (apply = x y more)))) //--- -(function __clojure_fn_3286(){ -return (clojure.JS.def(clojure,"not_EQ_",clojure.JS.variadic(2,(function __clojure_fn_3286_not_EQ_3288(x_1,y_2){switch(arguments.length){ +(function __clojure_fn_3284(){ +return (clojure.JS.def(clojure,"not_EQ_",clojure.JS.variadic(2,(function __clojure_fn_3284_not_EQ_3286(x_1,y_2){switch(arguments.length){ case 2:return (clojure.not.apply(null,[clojure.lang.Util.equal(x_1,y_2)])) case 1:return (false)} var more_3,more_3=clojure.JS.rest_args(this,arguments,2); return (clojure.not.apply(null,[clojure.apply.apply(null,[clojure._EQ_,x_1,y_2,more_3])]))}))))}).apply(null,[]); //====== -//(defn compare "Comparator. Returns 0 if x equals y, -1 if x is logically 'less\n than' y, else 1. Same as Java x.compareTo(y) except it also works\n for nil, and compares numbers in a type-independent manner. x must\n implement Comparable" {:inline (fn [x y] (clojure/concat (clojure/list (quote .)) (clojure/list (quote clojure.lang.Util)) (clojure/list (quote clojure/compare)) (clojure/list x) (clojure/list y))), :tag Integer} [x y] (. clojure.lang.Util (compare x y))) +//(defn compare "Comparator. Returns 0 if x equals y, -1 if x is logically 'less\n than' y, else 1. Same as Java x.compareTo(y) except it also works\n for nil, and compares numbers in a type-independent manner. x must\n implement Comparable" {:tag Integer, :inline (fn [x y] (clojure/concat (clojure/list (quote .)) (clojure/list (quote clojure.lang.Util)) (clojure/list (quote clojure/compare)) (clojure/list x) (clojure/list y)))} [x y] (. clojure.lang.Util (compare x y))) //--- -(function __clojure_fn_3303(){ -return (clojure.JS.def(clojure,"compare",(function __clojure_fn_3303_compare_3308(x_1,y_2){ +(function __clojure_fn_3301(){ |