diff options
author | Chouser <chouser@n01se.net> | 2009-01-21 04:31:47 +0000 |
---|---|---|
committer | Chouser <chouser@n01se.net> | 2009-01-21 04:31:47 +0000 |
commit | 3054d8e76eacdb5a6b7885e528405b6fac877c4e (patch) | |
tree | d9ad9f208b3b805924981b256a7c089140927d0e /clojurescript | |
parent | a896cc837716e11cb7c8fd3d24a5217efc05ff52 (diff) |
Remove remote server for repl in favor of compiler applet. Incomplete support for new IMeta structure.
Diffstat (limited to 'clojurescript')
-rw-r--r-- | clojurescript/MANIFEST.MF | 3 | ||||
-rw-r--r-- | clojurescript/README.txt | 7 | ||||
-rw-r--r-- | clojurescript/src/clojure/contrib/clojurescript.clj | 49 | ||||
-rw-r--r-- | clojurescript/src/clojure/contrib/clojurescript/applet.clj | 29 | ||||
-rw-r--r-- | clojurescript/src/clojure/contrib/clojurescript/cli.clj | 30 | ||||
-rw-r--r-- | clojurescript/src/clojure/contrib/clojurescript/core.js | 2312 | ||||
-rw-r--r-- | clojurescript/src/clojure/contrib/clojurescript/repl/repl.cljs | 94 | ||||
-rw-r--r-- | clojurescript/src/clojure/contrib/clojurescript/repl/repl.html | 4 | ||||
-rw-r--r-- | clojurescript/src/clojure/contrib/clojurescript/repl/repl.js | 116 | ||||
-rw-r--r-- | clojurescript/support-for-clojurescript.patch | 84 |
10 files changed, 1346 insertions, 1382 deletions
diff --git a/clojurescript/MANIFEST.MF b/clojurescript/MANIFEST.MF new file mode 100644 index 00000000..1c70dac6 --- /dev/null +++ b/clojurescript/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0
+Main-Class: clojure.contrib.clojurescript.applet
+Class-Path: .
diff --git a/clojurescript/README.txt b/clojurescript/README.txt index 8b38a2aa..a87a7baa 100644 --- a/clojurescript/README.txt +++ b/clojurescript/README.txt @@ -19,6 +19,13 @@ Now that you've got the .js file, you can test using Rhino: -f src/clojure/contrib/clojurescript/core.js \ -f t03.js +To build the applet from the compiled .class files, don't forget to: + +- Extract clojure code into the classes dir + (cd classes; jar -x < ~/build/clojure/clojure.jar) +- Produce the jar: + jar cmf MANIFEST.MF clojurescript-applet.jar -C classes . + There's plenty more to do. If you'd like to help, contact the Clojure Google group: clojure@googlegroups.com diff --git a/clojurescript/src/clojure/contrib/clojurescript.clj b/clojurescript/src/clojure/contrib/clojurescript.clj index 66e7eac3..1b8d696a 100644 --- a/clojurescript/src/clojure/contrib/clojurescript.clj +++ b/clojurescript/src/clojure/contrib/clojurescript.clj @@ -304,30 +304,31 @@ (defn formtojs [f] (when-not (and (coll? f) (= 'definline (first f))) - (binding [*allow-unresolved-vars* true - *private-compiler-loader* (clojure.lang.RT/makeClassLoader)] - (let [expr (Compiler/analyze Compiler$C/STATEMENT `((fn [] ~f))) - mainexpr (-> expr .fexpr .methods first .body .exprs first) - defmacro? (and (instance? Compiler$BodyExpr mainexpr) - (instance? Compiler$DefExpr (first (.exprs mainexpr))) - (instance? Compiler$InstanceMethodExpr (second (.exprs mainexpr))) - (= "setMacro" (.methodName (second (.exprs mainexpr)))))] - (if defmacro? - (when *eval-defmacro* - (eval f) - nil) - (when-not (or (and (instance? Compiler$DefExpr mainexpr) - (skip-def (:name ^(.var mainexpr)))) - (and (instance? Compiler$InstanceMethodExpr mainexpr) - (or (= "setMacro" (.methodName mainexpr)) - (and (= "addMethod" (.methodName mainexpr)) - (skip-method (tojs (first (.args mainexpr)) - nil))))) - (and (instance? Compiler$BodyExpr mainexpr) - (instance? Compiler$DefExpr (first (.exprs mainexpr))) - (instance? Compiler$InstanceMethodExpr (second (.exprs mainexpr))) - (= "setMacro" (.methodName (second (.exprs mainexpr)))))) - (tojs expr {:localmap {}}))))))) + (let [expr (binding [*allow-unresolved-vars* true + *compiler-analyze-only* true + *private-compiler-loader* (clojure.lang.RT/baseLoader)] + (Compiler/analyze Compiler$C/STATEMENT `((fn [] ~f)))) + mainexpr (-> expr .fexpr .methods first .body .exprs first) + defmacro? (and (instance? Compiler$BodyExpr mainexpr) + (instance? Compiler$DefExpr (first (.exprs mainexpr))) + (instance? Compiler$InstanceMethodExpr (second (.exprs mainexpr))) + (= "setMacro" (.methodName (second (.exprs mainexpr)))))] + (if defmacro? + (when *eval-defmacro* + (eval f) + nil) + (when-not (or (and (instance? Compiler$DefExpr mainexpr) + (skip-def (:name ^(.var mainexpr)))) + (and (instance? Compiler$InstanceMethodExpr mainexpr) + (or (= "setMacro" (.methodName mainexpr)) + (and (= "addMethod" (.methodName mainexpr)) + (skip-method (tojs (first (.args mainexpr)) + nil))))) + (and (instance? Compiler$BodyExpr mainexpr) + (instance? Compiler$DefExpr (first (.exprs mainexpr))) + (instance? Compiler$InstanceMethodExpr (second (.exprs mainexpr))) + (= "setMacro" (.methodName (second (.exprs mainexpr)))))) + (tojs expr {:localmap {}})))))) (defn filetojs [filename & optseq] (let [reader (java.io.PushbackReader. (ds/reader filename)) diff --git a/clojurescript/src/clojure/contrib/clojurescript/applet.clj b/clojurescript/src/clojure/contrib/clojurescript/applet.clj new file mode 100644 index 00000000..953fa9dd --- /dev/null +++ b/clojurescript/src/clojure/contrib/clojurescript/applet.clj @@ -0,0 +1,29 @@ +; Copyright (c) Chris Houser, Jan 2009. 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. + +; Applet that provides Clojure-to-JavaScript functionality to a browser + +(ns clojure.contrib.clojurescript.applet + (:import (java.io PrintWriter StringReader)) + (:gen-class + :extends java.applet.Applet + :methods [[tojs [String] Object]]) + (:use [clojure.contrib.clojurescript :only (formtojs filetojs)]) + (:require [clojure.contrib.duck-streams :as ds])) + +(defn -tojs [this cljstr] + (try + ["js" (with-out-str (filetojs (StringReader. cljstr) + :debug-fn-names false + :debug-comments false + :eval-defmacro true))] + (catch Throwable e + (if (= (.getMessage e) "EOF while reading") + ["incomplete"] + ["err" (with-out-str (.printStackTrace e (PrintWriter. *out*)))])))) + diff --git a/clojurescript/src/clojure/contrib/clojurescript/cli.clj b/clojurescript/src/clojure/contrib/clojurescript/cli.clj index da823b75..b3a5b1bc 100644 --- a/clojurescript/src/clojure/contrib/clojurescript/cli.clj +++ b/clojurescript/src/clojure/contrib/clojurescript/cli.clj @@ -15,34 +15,6 @@ [clojure.contrib.clojurescript :only (formtojs filetojs)]) (:require [clojure.contrib.duck-streams :as ds])) -(defn start-server [port] - ;(println "Opening port" port) - (loop [server (java.net.ServerSocket. port)] ; TODO bind only to 127.0.0.1 - (send-off (agent (.accept server)) - (fn [socket] - (with-open [socket socket] - (binding [*out* (-> socket .getOutputStream ds/writer)] - (try - (print "HTTP/1.0 200 OK\nContent-Type: text/javascript\n\n") - (let [line1 (-> socket .getInputStream ds/reader .readLine) - [_ url] (re-find #"^GET /\?(.*?) HTTP" line1) - codestr (URLDecoder/decode url) - js (with-out-str (filetojs (StringReader. codestr) - :debug-fn-names false - :debug-comments false - :eval-defmacro false))] - (println "jsrepl.state('compiled');try{") - (println "jsrepl.lastval=" js ) - (println "jsrepl.state('done');}catch(e){jsrepl.err(e)};")) - (catch Exception e - (if (= (.getMessage e) "EOF while reading") - (println "jsrepl.state('incomplete');") - (let [trace (with-out-str - (.printStackTrace e (PrintWriter. *out*)))] - (println "jsrepl.state('error',\"" - (.replace trace "\n" "\\n") "\");"))))))))) - (recur server))) - (defn mkcore [] (binding [*out* (ds/writer "core.js")] (doseq [file ["clojure/core.clj" "clojure/core_print.clj"]] @@ -83,13 +55,11 @@ (with-command-line *command-line-args* "clojurescript.cli -- Compile ClojureScript to JavaScript" [[simple? "Runs some simple built-in tests"] - [serve "Starts a repl server on the given port" 8081] [mkcore? "Generates a core.js file"] [v? "Includes extra fn names and comments in js"] filenames] (cond simple? (simple-tests) - serve (start-server (Integer/parseInt serve)) mkcore? (mkcore) :else (doseq [filename filenames] (filetojs filename :debug-fn-names v? :debug-comments v?))))) diff --git a/clojurescript/src/clojure/contrib/clojurescript/core.js b/clojurescript/src/clojure/contrib/clojurescript/core.js index 7726b43f..5e521f7c 100644 --- a/clojurescript/src/clojure/contrib/clojurescript/core.js +++ b/clojurescript/src/clojure/contrib/clojurescript/core.js @@ -2,19 +2,19 @@ //====== //(ns clojure.core) //--- -(function __user_fn_538(){ +(function __user_fn_520(){ return (clojure.core.in_ns.apply(null,[clojure.core.symbol("clojure.core")]))}).apply(null,[]); //====== //(def unquote) //--- -(function __clojure_core_fn_544(){ +(function __clojure_core_fn_526(){ return (clojure.JS.def(clojure.core,"unquote",null))}).apply(null,[]); //====== //(def list (. clojure.lang.PersistentList creator)) //--- -(function __clojure_core_fn_547(){ +(function __clojure_core_fn_529(){ return (clojure.JS.def(clojure.core,"list",clojure.JS.getOrRun(clojure.lang.PersistentList,"creator")))}).apply(null,[]); // Skipping: (def cons (fn* cons [x seq] (. clojure.lang.RT (cons x seq)))) // Skipping: (def let (fn* let [& decl] (cons (quote let*) decl))) @@ -26,8 +26,8 @@ return (clojure.JS.def(clojure.core,"list",clojure.JS.getOrRun(clojure.lang.Pers //====== //(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_core_fn_580(){ -return (clojure.JS.def(clojure.core,"conj",clojure.JS.variadic(2,(function __clojure_core_fn_580_conj_582(coll_1,x_2){switch(arguments.length){ +(function __clojure_core_fn_562(){ +return (clojure.JS.def(clojure.core,"conj",clojure.JS.variadic(2,(function __clojure_core_fn_562_conj_564(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,conj_0=arguments.callee,xs_3=clojure.JS.rest_args(this,arguments,2); @@ -37,40 +37,40 @@ do{_cnt=0;_rtn=((xs_3)?((_cnt=1,_rtn=[conj_0.apply(null,[coll_1,x_2]),clojure.co //====== //(def second (fn second [x] (first (rest x)))) //--- -(function __clojure_core_fn_585(){ -return (clojure.JS.def(clojure.core,"second",(function __clojure_core_fn_585_second_587(x_1){ +(function __clojure_core_fn_567(){ +return (clojure.JS.def(clojure.core,"second",(function __clojure_core_fn_567_second_569(x_1){ var second_0=arguments.callee; return (clojure.core.first.apply(null,[clojure.core.rest.apply(null,[x_1])]))})))}).apply(null,[]); //====== //(def ffirst (fn ffirst [x] (first (first x)))) //--- -(function __clojure_core_fn_590(){ -return (clojure.JS.def(clojure.core,"ffirst",(function __clojure_core_fn_590_ffirst_592(x_1){ +(function __clojure_core_fn_572(){ +return (clojure.JS.def(clojure.core,"ffirst",(function __clojure_core_fn_572_ffirst_574(x_1){ var ffirst_0=arguments.callee; return (clojure.core.first.apply(null,[clojure.core.first.apply(null,[x_1])]))})))}).apply(null,[]); //====== //(def rfirst (fn rfirst [x] (rest (first x)))) //--- -(function __clojure_core_fn_595(){ -return (clojure.JS.def(clojure.core,"rfirst",(function __clojure_core_fn_595_rfirst_597(x_1){ +(function __clojure_core_fn_577(){ +return (clojure.JS.def(clojure.core,"rfirst",(function __clojure_core_fn_577_rfirst_579(x_1){ var rfirst_0=arguments.callee; return (clojure.core.rest.apply(null,[clojure.core.first.apply(null,[x_1])]))})))}).apply(null,[]); //====== //(def frest (fn frest [x] (first (rest x)))) //--- -(function __clojure_core_fn_600(){ -return (clojure.JS.def(clojure.core,"frest",(function __clojure_core_fn_600_frest_602(x_1){ +(function __clojure_core_fn_582(){ +return (clojure.JS.def(clojure.core,"frest",(function __clojure_core_fn_582_frest_584(x_1){ var frest_0=arguments.callee; return (clojure.core.first.apply(null,[clojure.core.rest.apply(null,[x_1])]))})))}).apply(null,[]); //====== //(def rrest (fn rrest [x] (rest (rest x)))) //--- -(function __clojure_core_fn_605(){ -return (clojure.JS.def(clojure.core,"rrest",(function __clojure_core_fn_605_rrest_607(x_1){ +(function __clojure_core_fn_587(){ +return (clojure.JS.def(clojure.core,"rrest",(function __clojure_core_fn_587_rrest_589(x_1){ var rrest_0=arguments.callee; return (clojure.core.rest.apply(null,[clojure.core.rest.apply(null,[x_1])]))})))}).apply(null,[]); // Skipping: (def seq (fn seq [coll] (. clojure.lang.RT (seq coll)))) @@ -79,8 +79,8 @@ return (clojure.core.rest.apply(null,[clojure.core.rest.apply(null,[x_1])]))}))) //====== //(def seq? (fn seq? [x] (instance? clojure.lang.ISeq x))) //--- -(function __clojure_core_fn_620(){ -return (clojure.JS.def(clojure.core,"seq_QMARK_",(function __clojure_core_fn_620_seq_QMARK_622(x_1){ +(function __clojure_core_fn_602(){ +return (clojure.JS.def(clojure.core,"seq_QMARK_",(function __clojure_core_fn_602_seq_QMARK_604(x_1){ var seq_QMARK__0=arguments.callee; return (clojure.core.instance_QMARK_.apply(null,[clojure.lang.ISeq,x_1]))})))}).apply(null,[]); // Skipping: (def string? (fn string? [x] (instance? String x))) @@ -88,24 +88,24 @@ return (clojure.core.instance_QMARK_.apply(null,[clojure.lang.ISeq,x_1]))})))}). //====== //(def map? (fn map? [x] (instance? clojure.lang.IPersistentMap x))) //--- -(function __clojure_core_fn_630(){ -return (clojure.JS.def(clojure.core,"map_QMARK_",(function __clojure_core_fn_630_map_QMARK_632(x_1){ +(function __clojure_core_fn_612(){ +return (clojure.JS.def(clojure.core,"map_QMARK_",(function __clojure_core_fn_612_map_QMARK_614(x_1){ var map_QMARK__0=arguments.callee; return (clojure.core.instance_QMARK_.apply(null,[clojure.lang.IPersistentMap,x_1]))})))}).apply(null,[]); //====== //(def vector? (fn vector? [x] (instance? clojure.lang.IPersistentVector x))) //--- -(function __clojure_core_fn_635(){ -return (clojure.JS.def(clojure.core,"vector_QMARK_",(function __clojure_core_fn_635_vector_QMARK_637(x_1){ +(function __clojure_core_fn_617(){ +return (clojure.JS.def(clojure.core,"vector_QMARK_",(function __clojure_core_fn_617_vector_QMARK_619(x_1){ var vector_QMARK__0=arguments.callee; return (clojure.core.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_core_fn_640(){ -return (clojure.JS.def(clojure.core,"sigs",(function __clojure_core_fn_640_sigs_642(fdecl_1){ +(function __clojure_core_fn_622(){ +return (clojure.JS.def(clojure.core,"sigs",(function __clojure_core_fn_622_sigs_624(fdecl_1){ var ret_2,fdecl_3; return (((clojure.core.seq_QMARK_.apply(null,[clojure.core.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 +115,24 @@ _rtn=((fdecl_3)?((_cnt=1,_rtn=[clojure.core.conj.apply(null,[ret_2,clojure.core. //====== //(def meta (fn meta [x] (if (instance? clojure.lang.IMeta x) (. x (meta))))) //--- -(function __clojure_core_fn_651(){ -return (clojure.JS.def(clojure.core,"meta",(function __clojure_core_fn_651_meta_653(x_1){ +(function __clojure_core_fn_633(){ +return (clojure.JS.def(clojure.core,"meta",(function __clojure_core_fn_633_meta_635(x_1){ var meta_0=arguments.callee; return (((clojure.core.instance_QMARK_.apply(null,[clojure.lang.IMeta,x_1]))?((x_1).meta()):(null)))})))}).apply(null,[]); //====== //(def with-meta (fn with-meta [x m] (. x (withMeta m)))) //--- -(function __clojure_core_fn_656(){ -return (clojure.JS.def(clojure.core,"with_meta",(function __clojure_core_fn_656_with_meta_658(x_1,m_2){ +(function __clojure_core_fn_638(){ +return (clojure.JS.def(clojure.core,"with_meta",(function __clojure_core_fn_638_with_meta_640(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_core_fn_661(){ -return (clojure.JS.def(clojure.core,"last",(function __clojure_core_fn_661_last_663(s_1){ +(function __clojure_core_fn_643(){ +return (clojure.JS.def(clojure.core,"last",(function __clojure_core_fn_643_last_645(s_1){ var _cnt,_rtn,last_0=arguments.callee; do{_cnt=0;_rtn=((clojure.core.rest.apply(null,[s_1]))?((_cnt=1,_rtn=[clojure.core.rest.apply(null,[s_1])],s_1=_rtn[0])):(clojure.core.first.apply(null,[s_1]))) }while(_cnt);return _rtn;})))}).apply(null,[]); @@ -140,8 +140,8 @@ do{_cnt=0;_rtn=((clojure.core.rest.apply(null,[s_1]))?((_cnt=1,_rtn=[clojure.cor //====== //(def butlast (fn butlast [s] (loop [ret [] s s] (if (rest s) (recur (conj ret (first s)) (rest s)) (seq ret))))) //--- -(function __clojure_core_fn_666(){ -return (clojure.JS.def(clojure.core,"butlast",(function __clojure_core_fn_666_butlast_668(s_1){ +(function __clojure_core_fn_648(){ +return (clojure.JS.def(clojure.core,"butlast",(function __clojure_core_fn_648_butlast_650(s_1){ var ret_2,s_3,butlast_0=arguments.callee; return (((function __loop(){var _rtn,_cnt;(ret_2=clojure.lang.PersistentVector.EMPTY), (s_3=s_1);do{_cnt=0; @@ -152,16 +152,16 @@ _rtn=((clojure.core.rest.apply(null,[s_3]))?((_cnt=1,_rtn=[clojure.core.conj.app //====== //(defn cast "Throws a ClassCastException if x is not a c, else returns x." [c x] (. c (cast x))) //--- -(function __clojure_core_fn_679(){ -return (clojure.JS.def(clojure.core,"cast",(function __clojure_core_fn_679_cast_681(c_1,x_2){ +(function __clojure_core_fn_661(){ +return (clojure.JS.def(clojure.core,"cast",(function __clojure_core_fn_661_cast_663(c_1,x_2){ return ((c_1).cast(x_2))})))}).apply(null,[]); // Skipping: (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))) //====== //(defn vector "Creates a new vector containing the args." ([] []) ([& args] (. clojure.lang.LazilyPersistentVector (create args)))) //--- -(function __clojure_core_fn_691(){ -return (clojure.JS.def(clojure.core,"vector",clojure.JS.variadic(0,(function __clojure_core_fn_691_vector_693(){switch(arguments.length){ +(function __clojure_core_fn_673(){ +return (clojure.JS.def(clojure.core,"vector",clojure.JS.variadic(0,(function __clojure_core_fn_673_vector_675(){switch(arguments.length){ case 0:return (clojure.lang.PersistentVector.EMPTY)} var args_1=clojure.JS.rest_args(this,arguments,0); return (clojure.lang.LazilyPersistentVector.create(args_1))}))))}).apply(null,[]); @@ -169,16 +169,16 @@ 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_core_fn_698(){ -return (clojure.JS.def(clojure.core,"vec",(function __clojure_core_fn_698_vec_700(coll_1){ +(function __clojure_core_fn_680(){ +return (clojure.JS.def(clojure.core,"vec",(function __clojure_core_fn_680_vec_682(coll_1){ return (clojure.lang.LazilyPersistentVector.createOwning(clojure.core.to_array.apply(null,[coll_1])))})))}).apply(null,[]); // Skipping: (defn hash-map "keyval => key val\n Returns a new hash map with supplied mappings." ([] {}) ([& keyvals] (. clojure.lang.PersistentHashMap (create keyvals)))) //====== //(defn hash-set "Returns a new hash set with supplied keys." ([] #{}) ([& keys] (. clojure.lang.PersistentHashSet (create keys)))) //--- -(function __clojure_core_fn_711(){ -return (clojure.JS.def(clojure.core,"hash_set",clojure.JS.variadic(0,(function __clojure_core_fn_711_hash_set_713(){switch(arguments.length){ +(function __clojure_core_fn_693(){ +return (clojure.JS.def(clojure.core,"hash_set",clojure.JS.variadic(0,(function __clojure_core_fn_693_hash_set_695(){switch(arguments.length){ case 0:return (clojure.lang.PersistentHashSet.EMPTY)} var keys_1=clojure.JS.rest_args(this,arguments,0); return (clojure.lang.PersistentHashSet.create(keys_1))}))))}).apply(null,[]); @@ -186,24 +186,24 @@ 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_core_fn_718(){ -return (clojure.JS.def(clojure.core,"sorted_map",clojure.JS.variadic(0,(function __clojure_core_fn_718_sorted_map_720(){ +(function __clojure_core_fn_700(){ +return (clojure.JS.def(clojure.core,"sorted_map",clojure.JS.variadic(0,(function __clojure_core_fn_700_sorted_map_702(){ var 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_core_fn_724(){ -return (clojure.JS.def(clojure.core,"sorted_set",clojure.JS.variadic(0,(function __clojure_core_fn_724_sorted_set_726(){ +(function __clojure_core_fn_706(){ +return (clojure.JS.def(clojure.core,"sorted_set",clojure.JS.variadic(0,(function __clojure_core_fn_706_sorted_set_708(){ var 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_core_fn_730(){ -return (clojure.JS.def(clojure.core,"sorted_map_by",clojure.JS.variadic(1,(function __clojure_core_fn_730_sorted_map_by_732(comparator_1){ +(function __clojure_core_fn_712(){ +return (clojure.JS.def(clojure.core,"sorted_map_by",clojure.JS.variadic(1,(function __clojure_core_fn_712_sorted_map_by_714(comparator_1){ var keyvals_2=clojure.JS.rest_args(this,arguments,1); return (clojure.lang.PersistentTreeMap.create(comparator_1,keyvals_2))}))))}).apply(null,[]); // Skipping: (def defmacro (fn [name & args] (list (quote do) (cons (quote clojure.core/defn) (cons name args)) (list (quote .) (list (quote var) name) (quote (setMacro)))))) @@ -214,40 +214,40 @@ return (clojure.lang.PersistentTreeMap.create(comparator_1,keyvals_2))}))))}).ap //====== //(defn nil? "Returns true if x is nil, false otherwise." {:tag Boolean} [x] (identical? x nil)) //--- -(function __clojure_core_fn_763(){ -return (clojure.JS.def(clojure.core,"nil_QMARK_",(function __clojure_core_fn_763_nil_QMARK_765(x_1){ +(function __clojure_core_fn_745(){ +return (clojure.JS.def(clojure.core,"nil_QMARK_",(function __clojure_core_fn_745_nil_QMARK_747(x_1){ return (clojure.core.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_core_fn_769(){ -return (clojure.JS.def(clojure.core,"false_QMARK_",(function __clojure_core_fn_769_false_QMARK_771(x_1){ +(function __clojure_core_fn_751(){ +return (clojure.JS.def(clojure.core,"false_QMARK_",(function __clojure_core_fn_751_false_QMARK_753(x_1){ return (clojure.core.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_core_fn_775(){ -return (clojure.JS.def(clojure.core,"true_QMARK_",(function __clojure_core_fn_775_true_QMARK_777(x_1){ +(function __clojure_core_fn_757(){ +return (clojure.JS.def(clojure.core,"true_QMARK_",(function __clojure_core_fn_757_true_QMARK_759(x_1){ return (clojure.core.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_core_fn_781(){ -return (clojure.JS.def(clojure.core,"not",(function __clojure_core_fn_781_not_783(x_1){ +(function __clojure_core_fn_763(){ +return (clojure.JS.def(clojure.core,"not",(function __clojure_core_fn_763_not_765(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] ((fn [sb more] (if more (recur (. sb (append (str (first more)))) (rest more)) (str sb))) (clojure.lang.RT/makeStringBuilder (str x)) ys))) //--- -(function __clojure_core_fn_787(){ -return (clojure.JS.def(clojure.core,"str",clojure.JS.variadic(1,(function __clojure_core_fn_787_str_789(x_1){switch(arguments.length){ +(function __clojure_core_fn_769(){ +return (clojure.JS.def(clojure.core,"str",clojure.JS.variadic(1,(function __clojure_core_fn_769_str_771(x_1){switch(arguments.length){ case 0:return ("") case 1:return (((clojure.core.nil_QMARK_.apply(null,[x_1]))?(""):((x_1).toString())))} var ys_2=clojure.JS.rest_args(this,arguments,1); -return ((function __clojure_core_fn_787_str_789_fn_793(sb_1,more_2){ +return ((function __clojure_core_fn_769_str_771_fn_775(sb_1,more_2){ var _cnt,_rtn; do{_cnt=0;_rtn=((more_2)?((_cnt=1,_rtn=[(sb_1).append(clojure.core.str.apply(null,[clojure.core.first.apply(null,[more_2])])),clojure.core.rest.apply(null,[more_2])],sb_1=_rtn[0],more_2=_rtn[1])):(clojure.core.str.apply(null,[sb_1]))) }while(_cnt);return _rtn;}).apply(null,[clojure.lang.RT.makeStringBuilder(clojure.core.str.apply(null,[x_1])),ys_2]))}))))}).apply(null,[]); @@ -255,15 +255,15 @@ do{_cnt=0;_rtn=((more_2)?((_cnt=1,_rtn=[(sb_1).append(clojure.core.str.apply(nul //====== //(defn symbol? "Return true if x is a Symbol" [x] (instance? clojure.lang.Symbol x)) //--- -(function __clojure_core_fn_798(){ -return (clojure.JS.def(clojure.core,"symbol_QMARK_",(function __clojure_core_fn_798_symbol_QMARK_800(x_1){ +(function __clojure_core_fn_780(){ +return (clojure.JS.def(clojure.core,"symbol_QMARK_",(function __clojure_core_fn_780_symbol_QMARK_782(x_1){ return (clojure.core.instance_QMARK_.apply(null,[clojure.lang.Symbol,x_1]))})))}).apply(null,[]); //====== //(defn keyword? "Return true if x is a Keyword" [x] (instance? clojure.lang.Keyword x)) //--- -(function __clojure_core_fn_804(){ -return (clojure.JS.def(clojure.core,"keyword_QMARK_",(function __clojure_core_fn_804_keyword_QMARK_806(x_1){ +(function __clojure_core_fn_786(){ +return (clojure.JS.def(clojure.core,"keyword_QMARK_",(function __clojure_core_fn_786_keyword_QMARK_788(x_1){ return (clojure.core.instance_QMARK_.apply(null,[clojure.lang.Keyword,x_1]))})))}).apply(null,[]); // Skipping: (defn symbol "Returns a Symbol with the given namespace and name." ([name] (if (symbol? name) name (. clojure.lang.Symbol (intern name)))) ([ns name] (. clojure.lang.Symbol (intern ns name)))) // Skipping: (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] (if (keyword? name) name (. clojure.lang.Keyword (intern nil name)))) ([ns name] (. clojure.lang.Keyword (intern ns name)))) @@ -271,8 +271,8 @@ return (clojure.core.instance_QMARK_.apply(null,[clojure.lang.Keyword,x_1]))}))) //====== //(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_core_fn_824(){ -return (clojure.JS.def(clojure.core,"gensym",(function __clojure_core_fn_824_gensym_826(prefix_string_1){switch(arguments.length){ +(function __clojure_core_fn_806(){ +return (clojure.JS.def(clojure.core,"gensym",(function __clojure_core_fn_806_gensym_808(prefix_string_1){switch(arguments.length){ case 0:return (clojure.core.gensym.apply(null,["G__"]))} return (clojure.lang.Symbol.intern(clojure.core.str.apply(null,[prefix_string_1,clojure.core.str.apply(null,[clojure.lang.RT.nextID()])])))})))}).apply(null,[]); // Skipping: (defmacro cond "Takes a set of test/expr pairs. It evaluates each test one at a\n time. If a test returns logical true, cond evaluates and returns\n the value of the corresponding expr and doesn't evaluate any of the\n other tests or exprs. (cond) returns nil." [& clauses] (when clauses (list (quote if) (first clauses) (if (rest clauses) (second clauses) (throw (IllegalArgumentException. "cond requires an even number of forms"))) (cons (quote clojure.core/cond) (rest (rest clauses)))))) @@ -280,16 +280,16 @@ return (clojure.lang.Symbol.intern(clojure.core.str.apply(null,[prefix_string_1, //====== //(defn spread {:private true} [arglist] (cond (nil? arglist) nil (nil? (rest arglist)) (seq (first arglist)) :else (cons (first arglist) (spread (rest arglist))))) //--- -(function __clojure_core_fn_840(){ -return (clojure.JS.def(clojure.core,"spread",(function __clojure_core_fn_840_spread_842(arglist_1){ +(function __clojure_core_fn_822(){ +return (clojure.JS.def(clojure.core,"spread",(function __clojure_core_fn_822_spread_824(arglist_1){ return (((clojure.core.nil_QMARK_.apply(null,[arglist_1]))?(null):(((clojure.core.nil_QMARK_.apply(null,[clojure.core.rest.apply(null,[arglist_1])]))?(clojure.core.seq.apply(null,[clojure.core.first.apply(null,[arglist_1])])):(((clojure.core.keyword("","else"))?(clojure.core.cons.apply(null,[clojure.core.first.apply(null,[arglist_1]),clojure.core.spread.apply(null,[clojure.core.rest.apply(null,[arglist_1])])])):(null)))))))})))}).apply(null,[]); // Skipping: (defn apply "Applies fn f to the argument list formed by prepending args to argseq." {:arglists (quote ([f args* argseq]))} [f & args] (. f (applyTo (spread args)))) //====== //(defn list* "Creates a new list containing the item prepended to more." [item & more] (spread (cons item more))) //--- -(function __clojure_core_fn_852(){ -return (clojure.JS.def(clojure.core,"list_STAR_",clojure.JS.variadic(1,(function __clojure_core_fn_852_list_STAR_854(item_1){ +(function __clojure_core_fn_834(){ +return (clojure.JS.def(clojure.core,"list_STAR_",clojure.JS.variadic(1,(function __clojure_core_fn_834_list_STAR_836(item_1){ var more_2=clojure.JS.rest_args(this,arguments,1); return (clojure.core.spread.apply(null,[clojure.core.cons.apply(null,[item_1,more_2])]))}))))}).apply(null,[]); // Skipping: (defmacro delay "Takes a body of expressions and yields a Delay object that will\n invoke the body only the first time it is forced (with force), and\n will cache the result and return it on all subsequent force calls" [& body] (list (quote new) (quote clojure.lang.Delay) (list* (quote clojure.core/fn) [] body))) @@ -297,46 +297,46 @@ return (clojure.core.spread.apply(null,[clojure.core.cons.apply(null,[item_1,mor //====== //(defn delay? "returns true if x is a Delay created with delay" [x] (instance? clojure.lang.Delay x)) //--- -(function __clojure_core_fn_867(){ -return (clojure.JS.def(clojure.core,"delay_QMARK_",(function __clojure_core_fn_867_delay_QMARK_869(x_1){ +(function __clojure_core_fn_849(){ +return (clojure.JS.def(clojure.core,"delay_QMARK_",(function __clojure_core_fn_849_delay_QMARK_851(x_1){ return (clojure.core.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_core_fn_873(){ -return (clojure.JS.def(clojure.core,"force",(function __clojure_core_fn_873_force_875(x_1){ +(function __clojure_core_fn_855(){ +return (clojure.JS.def(clojure.core,"force",(function __clojure_core_fn_855_force_857(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_core_fn_879(){ -return (clojure.JS.def(clojure.core,"fnseq",(function __clojure_core_fn_879_fnseq_881(first_1,restfn_2){ +(function __clojure_core_fn_861(){ +return (clojure.JS.def(clojure.core,"fnseq",(function __clojure_core_fn_861_fnseq_863(first_1,restfn_2){ return ((new clojure.lang.FnSeq(first_1,restfn_2)))})))}).apply(null,[]); // Skipping: (defmacro lazy-cons "Expands to code which produces a seq object whose first is\n first-expr and whose rest is rest-expr, neither of which is\n evaluated until first/rest is called. Each expr will be evaluated at most\n once per step in the sequence, e.g. calling first/rest repeatedly on the\n same node of the seq evaluates first/rest-expr once - the values they yield are\n cached." [first-expr & rest-expr] (list (quote new) (quote clojure.lang.LazyCons) (list (quote clojure.core/fn) (list [] first-expr) (list* [(gensym)] rest-expr)))) //====== //(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_core_fn_894(){ -return (clojure.JS.def(clojure.core,"cache_seq",(function __clojure_core_fn_894_cache_seq_896(s_1){ +(function __clojure_core_fn_876(){ +return (clojure.JS.def(clojure.core,"cache_seq",(function __clojure_core_fn_876_cache_seq_878(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_core_fn_900(){ -return (clojure.JS.def(clojure.core,"concat",clojure.JS.variadic(2,(function __clojure_core_fn_900_concat_902(x_1,y_2){switch(arguments.length){ +(function __clojure_core_fn_882(){ +return (clojure.JS.def(clojure.core,"concat",clojure.JS.variadic(2,(function __clojure_core_fn_882_concat_884(x_1,y_2){switch(arguments.length){ case 0:return (null) case 1:return (clojure.core.seq.apply(null,[x_1])) -case 2:return (((clojure.core.seq.apply(null,[x_1]))?((new clojure.lang.LazyCons((function __clojure_core_fn_900_concat_902_fn_907(G__906_1){switch(arguments.length){ +case 2:return (((clojure.core.seq.apply(null,[x_1]))?((new clojure.lang.LazyCons((function __clojure_core_fn_882_concat_884_fn_889(G__888_1){switch(arguments.length){ case 0:return (clojure.core.first.apply(null,[x_1]))} return (clojure.core.concat.apply(null,[clojure.core.rest.apply(null,[x_1]),y_2]))})))):(clojure.core.seq.apply(null,[y_2]))))} var cat_4,zs_3=clojure.JS.rest_args(this,arguments,2); -return (((cat_4=(function __clojure_core_fn_900_concat_902_cat_912(xys_1,zs_2){ +return (((cat_4=(function __clojure_core_fn_882_concat_884_cat_894(xys_1,zs_2){ var _cnt,_rtn,cat_0=arguments.callee; -do{_cnt=0;_rtn=((clojure.core.seq.apply(null,[xys_1]))?((new clojure.lang.LazyCons((function __clojure_core_fn_900_concat_902_cat_912_fn_914(G__913_1){switch(arguments.length){ +do{_cnt=0;_rtn=((clojure.core.seq.apply(null,[xys_1]))?((new clojure.lang.LazyCons((function __clojure_core_fn_882_concat_884_cat_894_fn_896(G__895_1){switch(arguments.length){ case 0:return (clojure.core.first.apply(null,[xys_1]))} return (cat_0.apply(null,[clojure.core.rest.apply(null,[xys_1]),zs_2]))})))):(((zs_2)?((_cnt=1,_rtn=[clojure.core.first.apply(null,[zs_2]),clojure.core.rest.apply(null,[zs_2])],xys_1=_rtn[0],zs_2=_rtn[1])):(null)))) }while(_cnt);return _rtn;})), @@ -344,46 +344,46 @@ cat_4.apply(null,[clojure.core.concat.apply(null,[x_1,y_2]),zs_3])))}))))}).appl // Skipping: (defmacro if-not "Evaluates test. If logical false, evaluates and returns then expr, otherwise else expr, if supplied, else nil." ([test then] (clojure.core/concat (clojure.core/list (quote clojure.core/if-not)) (clojure.core/list test) (clojure.core/list then) (clojure.core/list (quote nil)))) ([test then else] (clojure.core/concat (clojure.core/list (quote if)) (clojure.core/list (clojure.core/concat (clojure.core/list (quote clojure.core/not)) (clojure.core/list test))) (clojure.core/list then) (clojure.core/list else)))) //====== -//(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 (fn [x y] (clojure.core/concat (clojure.core/list (quote .)) (clojure.core/list (quote clojure.lang.Util)) (clojure.core/list (quote clojure.core/equal)) (clojure.core/list x) (clojure.core/list y))), :inline-arities #{2}} ([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 and collections 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 (fn [x y] (clojure.core/concat (clojure.core/list (quote .)) (clojure.core/list (quote clojure.lang.Util)) (clojure.core/list (quote clojure.core/equiv)) (clojure.core/list x) (clojure.core/list y))), :inline-arities #{2}} ([x] true) ([x y] (clojure.lang.Util/equiv x y)) ([x y & more] (if (= x y) (if (rest more) (recur y (first more) (rest more)) (= y (first more))) false))) //--- -(function __clojure_core_fn_932(){ -return (clojure.JS.def(clojure.core,"_EQ_",clojure.JS.variadic(2,(function __clojure_core_fn_932_EQ_937(x_1,y_2){switch(arguments.length){ +(function __clojure_core_fn_914(){ +return (clojure.JS.def(clojure.core,"_EQ_",clojure.JS.variadic(2,(function __clojure_core_fn_914_EQ_919(x_1,y_2){switch(arguments.length){ case 1:return (true) -case 2:return (clojure.lang.Util.equal(x_1,y_2))} +case 2:return (clojure.lang.Util.equiv(x_1,y_2))} var _cnt,_rtn,more_3=clojure.JS.rest_args(this,arguments,2); -do{_cnt=0;_rtn=((clojure.lang.Util.equal(x_1,y_2))?(((clojure.core.rest.apply(null,[more_3]))?((_cnt=1,_rtn=[y_2,clojure.core.first.apply(null,[more_3]),clojure.core.rest.apply(null,[more_3])],x_1=_rtn[0],y_2=_rtn[1],more_3=_rtn[2])):(clojure.lang.Util.equal(y_2,clojure.core.first.apply(null,[more_3]))))):(false)) |