Skip to content

Commit

Permalink
version 6.4.0 - cache core.match
Browse files Browse the repository at this point in the history
  • Loading branch information
viebel committed Jan 19, 2017
1 parent 7f03faf commit b005c17
Show file tree
Hide file tree
Showing 8 changed files with 116 additions and 112 deletions.
6 changes: 4 additions & 2 deletions contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,15 @@ lumo scripts/generate-clojure-spec-cache.cljs

For #2, you need to:

1. run `lein deps
0. `cd docs/cache-cljs`

1. run `lein deps`

2. open lumo with the appropriate cache folder and class path:

```bash
export cp=`lein classpath`
lumo -k docs/cache-cljs -c $cp
lumo -k . -c $cp
```

3. inside lumo, you need to require your namespaces, and the cache will be stored inder `docs/cache-cljs` e.g.:
Expand Down
6 changes: 3 additions & 3 deletions dist/klipse_plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3524,7 +3524,7 @@ gadjett.core_fn.sort_history=function(a){return cljs.core.sort_by.cljs$core$IFn$
gadjett.core_fn.the_history=function(a){for(var b=[],c=arguments.length,d=0;;)if(d<c)b.push(arguments[d]),d+=1;else break;switch(b.length){case 1:return gadjett.core_fn.the_history.cljs$core$IFn$_invoke$arity$1(arguments[0]);case 0:return gadjett.core_fn.the_history.cljs$core$IFn$_invoke$arity$0();default:throw Error([cljs.core.str("Invalid arity: "),cljs.core.str(b.length)].join(""));}};
gadjett.core_fn.the_history.cljs$core$IFn$_invoke$arity$1=function(a){return cljs.core.get.cljs$core$IFn$_invoke$arity$2(cljs.core.deref.cljs$core$IFn$_invoke$arity$1?cljs.core.deref.cljs$core$IFn$_invoke$arity$1(gadjett.core_fn.history):cljs.core.deref.call(null,gadjett.core_fn.history),a)};
gadjett.core_fn.the_history.cljs$core$IFn$_invoke$arity$0=function(){return gadjett.core_fn.sort_history(cljs.core.deref.cljs$core$IFn$_invoke$arity$1?cljs.core.deref.cljs$core$IFn$_invoke$arity$1(gadjett.core_fn.history):cljs.core.deref.call(null,gadjett.core_fn.history))};gadjett.core_fn.the_history.cljs$lang$maxFixedArity=1;
gadjett.core_fn.function_call_err_msg=function(a,b){return[cljs.core.str(a),cljs.core.str(" was called too much over the last "),cljs.core.str(cljs.core.cst$kw$timeslot_DASH_function_DASH_calls_DASH_msec.cljs$core$IFn$_invoke$arity$1(gadjett.core_fn.settings)),cljs.core.str(" msec: "),cljs.core.str(a)].join("")};var klipse={core:{}};cljs.core.enable_console_print_BANG_();gadjett.core_fn.settings_BANG_.cljs$core$IFn$_invoke$arity$variadic(cljs.core.array_seq([cljs.core.cst$kw$max_DASH_function_DASH_calls,100],0));klipse.core.version="6.3.0";console.info("Klipse ",klipse.core.version);console.info("Clojurescript ",cljs.core._STAR_clojurescript_version_STAR_);cljs.core.async={};cljs.core.async.impl={};cljs.core.async.impl.protocols={};cljs.core.async.impl.protocols.MAX_QUEUE_SIZE=1024;cljs.core.async.impl.protocols.ReadPort=function(){};
gadjett.core_fn.function_call_err_msg=function(a,b){return[cljs.core.str(a),cljs.core.str(" was called too much over the last "),cljs.core.str(cljs.core.cst$kw$timeslot_DASH_function_DASH_calls_DASH_msec.cljs$core$IFn$_invoke$arity$1(gadjett.core_fn.settings)),cljs.core.str(" msec: "),cljs.core.str(a)].join("")};var klipse={core:{}};cljs.core.enable_console_print_BANG_();gadjett.core_fn.settings_BANG_.cljs$core$IFn$_invoke$arity$variadic(cljs.core.array_seq([cljs.core.cst$kw$max_DASH_function_DASH_calls,100],0));klipse.core.version="6.4.0";console.info("Klipse ",klipse.core.version);console.info("Clojurescript ",cljs.core._STAR_clojurescript_version_STAR_);cljs.core.async={};cljs.core.async.impl={};cljs.core.async.impl.protocols={};cljs.core.async.impl.protocols.MAX_QUEUE_SIZE=1024;cljs.core.async.impl.protocols.ReadPort=function(){};
cljs.core.async.impl.protocols.take_BANG_=function(a,b){if(null!=a&&null!=a.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2)return a.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2(a,b);var c=cljs.core.async.impl.protocols.take_BANG_[goog.typeOf(null==a?null:a)];if(null!=c)return c.cljs$core$IFn$_invoke$arity$2?c.cljs$core$IFn$_invoke$arity$2(a,b):c.call(null,a,b);c=cljs.core.async.impl.protocols.take_BANG_._;if(null!=c)return c.cljs$core$IFn$_invoke$arity$2?c.cljs$core$IFn$_invoke$arity$2(a,
b):c.call(null,a,b);throw cljs.core.missing_protocol("ReadPort.take!",a);};cljs.core.async.impl.protocols.WritePort=function(){};
cljs.core.async.impl.protocols.put_BANG_=function(a,b,c){if(null!=a&&null!=a.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3)return a.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3(a,b,c);var d=cljs.core.async.impl.protocols.put_BANG_[goog.typeOf(null==a?null:a)];if(null!=d)return d.cljs$core$IFn$_invoke$arity$3?d.cljs$core$IFn$_invoke$arity$3(a,b,c):d.call(null,a,b,c);d=cljs.core.async.impl.protocols.put_BANG_._;if(null!=d)return d.cljs$core$IFn$_invoke$arity$3?d.cljs$core$IFn$_invoke$arity$3(a,
Expand Down Expand Up @@ -13847,8 +13847,8 @@ cljs.core.str(".js")].join(""),v=[cljs.core.str(t),cljs.core.str(g),cljs.core.st
e[11],y=e[2],q=klipse.lang.clojure.io.cache_buster_QMARK_(),q=klipse.lang.clojure.io.filename_of(v,q),t=cljs.core.PersistentHashMap.fromArrays([cljs.core.cst$kw$with_DASH_credentials_QMARK_],[!1]),q=cljs_http.client.get.cljs$core$IFn$_invoke$arity$variadic(q,cljs.core.array_seq([t],0));e[12]=y;return cljs.core.async.impl.ioc_helpers.take_BANG_(e,6,q)}if(6===f){var g=e[7],h=e[8],y=e[12],z=e[13],k=e[9],v=e[11],r=e[10],B=e[2],q=function(){return function(a,b,c,d,e,f,g,h,k,l,m,n,p,r,q,t,u){return function(a){return cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(200,
a)}}(g,k,h,r,v,y,B,g,h,y,z,k,v,r,B,f,d)}(),t=cljs.core.PersistentVector.EMPTY_NODE,u=cljs.core.cst$kw$status.cljs$core$IFn$_invoke$arity$1(B),w=cljs.core.cst$kw$status.cljs$core$IFn$_invoke$arity$1(y),t=new cljs.core.PersistentVector(null,2,5,t,[u,w],null),q=cljs.core.every_QMARK_(q,t);e[13]=B;e[1]=q?7:8;return cljs.core.cst$kw$recur}return 7===f?(y=e[12],z=e[13],q=[cljs.core.cst$kw$lang,cljs.core.cst$kw$cache,cljs.core.cst$kw$source],t=cljs.core.cst$kw$body.cljs$core$IFn$_invoke$arity$1(z),t=klipse.lang.clojure.io.edn(t),
u=cljs.core.cst$kw$body.cljs$core$IFn$_invoke$arity$1(y),q=cljs.core.PersistentHashMap.fromArrays(q,[cljs.core.cst$kw$js,t,u]),q=b.cljs$core$IFn$_invoke$arity$1?b.cljs$core$IFn$_invoke$arity$1(q):b.call(null,q),e[2]=q,e[1]=9,cljs.core.cst$kw$recur):8===f?(q=b.cljs$core$IFn$_invoke$arity$1?b.cljs$core$IFn$_invoke$arity$1(null):b.call(null,null),e[2]=q,e[1]=9,cljs.core.cst$kw$recur):9===f?cljs.core.async.impl.ioc_helpers.return_chan(e,e[2]):null}}(d),d)}(),g=function(){var a=e.cljs$core$IFn$_invoke$arity$0?
e.cljs$core$IFn$_invoke$arity$0():e.call(null);a[cljs.core.async.impl.ioc_helpers.USER_START_IDX]=d;return a}();return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(g)}}(d));return d};klipse.lang.clojure.io.cached_macro_ns_regexp=function(){return cljs.core.cst$kw$clojure_cached_macro_ns_regexp.cljs$core$IFn$_invoke$arity$2(klipse.utils.klipse_settings.cljs$core$IFn$_invoke$arity$0?klipse.utils.klipse_settings.cljs$core$IFn$_invoke$arity$0():klipse.utils.klipse_settings.call(null),/cljs\.core\.async.*|clojure\.math\.macros|gadjett\.core|cljs\.test|clojure.test.check.*|reagent\..*|om\..*|cljs\.spec.*/)};
klipse.lang.clojure.io.cached_macro_ns_QMARK_=function(a){return cljs.core.re_matches(klipse.lang.clojure.io.cached_macro_ns_regexp(),""+cljs.core.str(a))};klipse.lang.clojure.io.cached_ns_regexp=function(){return cljs.core.cst$kw$clojure_cached_ns_regexp.cljs$core$IFn$_invoke$arity$2(klipse.utils.klipse_settings.cljs$core$IFn$_invoke$arity$0?klipse.utils.klipse_settings.cljs$core$IFn$_invoke$arity$0():klipse.utils.klipse_settings.call(null),/cljs\.core\.async.*|cljs\.spec.*|clojure.math\.combinatorics|clojure.test.check.*|reagent\..*|om\..*/)};
e.cljs$core$IFn$_invoke$arity$0():e.call(null);a[cljs.core.async.impl.ioc_helpers.USER_START_IDX]=d;return a}();return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(g)}}(d));return d};klipse.lang.clojure.io.cached_macro_ns_regexp=function(){return cljs.core.cst$kw$clojure_cached_macro_ns_regexp.cljs$core$IFn$_invoke$arity$2(klipse.utils.klipse_settings.cljs$core$IFn$_invoke$arity$0?klipse.utils.klipse_settings.cljs$core$IFn$_invoke$arity$0():klipse.utils.klipse_settings.call(null),/cljs\.core\.[async|match].*|clojure\.math\.macros|gadjett\.core|cljs\.test|clojure.test.check.*|reagent\..*|om\..*|cljs\.spec.*/)};
klipse.lang.clojure.io.cached_macro_ns_QMARK_=function(a){return cljs.core.re_matches(klipse.lang.clojure.io.cached_macro_ns_regexp(),""+cljs.core.str(a))};klipse.lang.clojure.io.cached_ns_regexp=function(){return cljs.core.cst$kw$clojure_cached_ns_regexp.cljs$core$IFn$_invoke$arity$2(klipse.utils.klipse_settings.cljs$core$IFn$_invoke$arity$0?klipse.utils.klipse_settings.cljs$core$IFn$_invoke$arity$0():klipse.utils.klipse_settings.call(null),/cljs\.core\.[async|match].*|cljs\.spec.*|clojure.math\.combinatorics|clojure.test.check.*|reagent\..*|om\..*/)};
klipse.lang.clojure.io.cached_cljs_ns_QMARK_=function(a){return cljs.core.re_matches(klipse.lang.clojure.io.cached_ns_regexp(),""+cljs.core.str(a))};
klipse.lang.clojure.io.load_ns.cljs$core$IMultiFn$_add_method$arity$3(null,cljs.core.cst$kw$macro,function(a,b,c){var d=null!=b&&(b.cljs$lang$protocol_mask$partition0$&64||cljs.core.PROTOCOL_SENTINEL===b.cljs$core$ISeq$)?cljs.core.apply.cljs$core$IFn$_invoke$arity$2(cljs.core.hash_map,b):b;b=cljs.core.get.cljs$core$IFn$_invoke$arity$2(d,cljs.core.cst$kw$name);d=cljs.core.get.cljs$core$IFn$_invoke$arity$2(d,cljs.core.cst$kw$path);if(cljs.core.truth_(klipse.utils.verbose_QMARK_())){var e=""+cljs.core.str(b);
console.info("load-ns :macro :",e)}if(cljs.core.truth_(klipse.lang.clojure.io.skip_ns_macros.cljs$core$IFn$_invoke$arity$1?klipse.lang.clojure.io.skip_ns_macros.cljs$core$IFn$_invoke$arity$1(b):klipse.lang.clojure.io.skip_ns_macros.call(null,b)))return cljs.core.truth_(klipse.utils.verbose_QMARK_())&&(a=""+cljs.core.str(b),console.info("load-ns :macro skipping:",a)),a=new cljs.core.PersistentArrayMap(null,2,[cljs.core.cst$kw$lang,cljs.core.cst$kw$clj,cljs.core.cst$kw$source,""],null),c.cljs$core$IFn$_invoke$arity$1?
Expand Down
2 changes: 1 addition & 1 deletion dist/klipse_plugin.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -11798,7 +11798,7 @@ if ("undefined" === typeof op) {
a.B = b;
return a;
}(), pp = R([Al, 100], 0), qp = null != pp && (pp.w & 64 || q === pp.M) ? Vf(pg, pp) : pp, op = Ai.B(R([op, qp], 0));
console.info("Klipse ", "6.3.0");
console.info("Klipse ", "6.4.0");
console.info("Clojurescript ", "1.9.293");
var rp, sp, tp, up = function up(b, c) {
if (null != b && null != b.Ce) {
Expand Down
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject klipse "6.3.0"
(defproject klipse "6.4.0"
:description "Embeddable multi-language WEB REPL"
:dependencies [[org.clojure/clojure "1.8.0"]
[org.clojure/clojurescript "1.9.293"]
Expand Down
2 changes: 1 addition & 1 deletion resources/public/index-dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</div>
<div id="compiler" style="height: 100%;"></div>
<script async defer id="github-bjs" src="https://buttons.github.io/buttons.js"></script>
<script src="dev/js/klipse.js?version=6.3.0"></script>
<script src="dev/js/klipse.js?version=6.4.0"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
Expand Down
204 changes: 103 additions & 101 deletions resources/public/require-dbg.html
Original file line number Diff line number Diff line change
@@ -1,139 +1,141 @@
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>KLIPSE: a simple and elegant online cljs compiler and evaluator</title>
<link rel='shortcut icon' type='image/x-icon' href='img/klipse.png' />
<link rel="stylesheet" type="text/css" href="css/codemirror.css">
</head>
<body>

<pre><code class="clojure">
(ns my.ns)

(def a "hello")
(def b ::foo)
</code></pre>
<pre><code class="clojure">
(require 'cljsjs.highcharts)
(count (js->clj js/Highcharts))
</code></pre>
<pre><code class="clojure" data-external-libs="https://raw.githubusercontent.com/viebel/original-lisp/64fcf67146c3af9d7d136ea50c886d87ba32ce28/src/">
(require '[original-lisp.core :as lisp :refer [l-eval]])
(l-eval '((lambda (x y) (cons x (cdr y)))
'a
'(b c d))
'())
<head lang="en">
<meta charset="UTF-8">
<title>KLIPSE: a simple and elegant online cljs compiler and evaluator</title>
<link rel='shortcut icon' type='image/x-icon' href='img/klipse.png' />
<link rel="stylesheet" type="text/css" href="css/codemirror.css">
</head>
<body>
<pre><code class="clojure">
(ns my.match
(:require [cljs.core.match :refer-macros [match]]))
</code></pre>
<pre><code class="clojure">
(ns my.spec
(:require [clojure.spec :as s]))
<pre><code class="clojure">
(ns my.ns)

(s/def ::a integer?)
(s/conform ::a 12)
</code></pre>
(def a "hello")
(def b ::foo)
</code></pre>
<pre><code class="clojure">
(require 'cljsjs.highcharts)
(count (js->clj js/Highcharts))
</code></pre>
<pre><code class="clojure" data-external-libs="https://raw.githubusercontent.com/viebel/original-lisp/64fcf67146c3af9d7d136ea50c886d87ba32ce28/src/">
(require '[original-lisp.core :as lisp :refer [l-eval]])
(l-eval '((lambda (x y) (cons x (cdr y)))
'a
'(b c d))
'())
</code></pre>
<pre><code class="clojure">
(ns my.spec
(:require [clojure.spec :as s]))

(s/def ::a integer?)
(s/conform ::a 12)
</code></pre>


This one with <code>dbg </code> is not transpiled:
<br>
<pre><code class="clojure">
(require-macros '[gadjett.core :refer [dbg]])
(dbg [1 2 3 "hello"])
</code></pre>
This one with <code>dbg </code> is not transpiled:
<br>
<pre><code class="clojure">
(require-macros '[gadjett.core :refer [dbg]])
(dbg [1 2 3 "hello"])
</code></pre>

<pre><code class="clojure">
(ns my.ns
(:import [goog.string StringBuffer]))
<pre><code class="clojure">
(ns my.ns
(:import [goog.string StringBuffer]))

(StringBuffer. "aa")
</code></pre>
(StringBuffer. "aa")
</code></pre>

<pre><code class="clojure">
(ns my.test
(:require
[cljs.pprint :as pp :refer [pprint]]))
(with-out-str (pprint (for [x (range 10)] (range x))))
</code></pre>
<pre><code class="clojure">
(ns my.test
(:require
[cljs.pprint :as pp :refer [pprint]]))
(with-out-str (pprint (for [x (range 10)] (range x))))
</code></pre>


<pre><code class="clojure">
(require '[clojure.math.combinatorics :refer [permutations]])
(require '[clojure.math.combinatorics :refer [permutations]])

(permutations [1 2 3])
(permutations [1 2 3])
</code></pre>



This one with core.async doesn't transpile yet:
<br>
<pre><code class="clojure" data-gist-id="viebel/820f672dd176169fd831c7748e6f3cd3">
</code></pre>
<pre><code class="clojure" data-gist-id="viebel/820f672dd176169fd831c7748e6f3cd3">
</code></pre>


<pre><code class="clojure">
(ns my.test (:require [clojure.test.check :as tc]
[clojure.test.check.generators :as gen]
[clojure.test.check.properties :as prop :include-macros true]))
(def sort-idempotent-prop
(prop/for-all [v (gen/vector gen/int)]
(= (sort v) (sort (sort v)))))
<pre><code class="clojure">
(ns my.test (:require [clojure.test.check :as tc]
[clojure.test.check.generators :as gen]
[clojure.test.check.properties :as prop :include-macros true]))
(def sort-idempotent-prop
(prop/for-all [v (gen/vector gen/int)]
(= (sort v) (sort (sort v)))))

(tc/quick-check 100 sort-idempotent-prop)
(tc/quick-check 100 sort-idempotent-prop)

</code></pre>
</code></pre>

<pre><code class="clojure">
(ns my.spec
(:require [clojure.spec :as s]))
<pre><code class="clojure">
(ns my.spec
(:require [clojure.spec :as s]))

(s/def ::a integer?)
(s/conform ::a 12)
</code></pre>
(s/def ::a integer?)
(s/conform ::a 12)
</code></pre>


<pre><code class="clojure">
(ns my.cljs
(:require [cljs.js :as cljs :refer [eval-str]]))
<pre><code class="clojure">
(ns my.cljs
(:require [cljs.js :as cljs :refer [eval-str]]))

(eval-str (cljs.js/empty-state) "(+ 1 2)" 'cljs.me {:eval cljs.js/js-eval} identity)
(eval-str (cljs.js/empty-state) "(+ 1 2)" 'cljs.me {:eval cljs.js/js-eval} identity)


</code></pre>
</code></pre>

<pre><code class="clojure">
(ns my.walk
(:require [clojure.walk :refer [postwalk]]))
(postwalk identity {:a 1})
</code></pre>
<pre><code class="clojure">
(ns my.walk
(:require [clojure.walk :refer [postwalk]]))
(postwalk identity {:a 1})
</code></pre>



<pre><code class="clojure">
(ns my.ns
(:require [clojure.string :as string :refer [lower-case]]))
(lower-case "AbsCs")
<pre><code class="clojure">
(ns my.ns
(:require [clojure.string :as string :refer [lower-case]]))
(lower-case "AbsCs")
</code></pre>

<script>
window.klipse_settings = {
codemirror_options_in: {
lineWrapping: true,
lineNumbers: true,
autoCloseBrackets: true
},
codemirror_options_out: {
lineWrapping: true
},
};
<script>
window.klipse_settings = {
codemirror_options_in: {
lineWrapping: true,
lineNumbers: true,
autoCloseBrackets: true
},
codemirror_options_out: {
lineWrapping: true
},
};

if(window.location.search.match(/transpile=1/)) {
window.klipse_settings.selector_js = '.clojure';
} else {
window.klipse_settings.selector = '.clojure';
}
</script>

<script src="lib/mirror_extensions.js"></script>
<script src="fig/js/klipse.fig.js"></script>
</body>
</html>
window.klipse_settings.selector_js = '.clojure';
} else {
window.klipse_settings.selector = '.clojure';
}
</script>

<script src="fig/js/klipse.fig.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion src/klipse/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
(enable-console-print!)
(gadjett/settings! :max-function-calls 100)

(def version "6.3.0")
(def version "6.4.0")
(js/console.info "Klipse " version)
(js/console.info "Clojurescript " *clojurescript-version*)

4 changes: 2 additions & 2 deletions src/klipse/lang/clojure/io.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,13 @@
(src-cb nil)))))

(defn cached-macro-ns-regexp []
(:clojure_cached_macro_ns_regexp (klipse-settings) #"cljs\.core\.async.*|clojure\.math\.macros|gadjett\.core|cljs\.test|clojure.test.check.*|reagent\..*|om\..*|cljs\.spec.*"))
(:clojure_cached_macro_ns_regexp (klipse-settings) #"cljs\.core\.[async|match].*|clojure\.math\.macros|gadjett\.core|cljs\.test|clojure.test.check.*|reagent\..*|om\..*|cljs\.spec.*"))

(defn cached-macro-ns? [name]
(re-matches (cached-macro-ns-regexp) (str name)))

(defn cached-ns-regexp []
(:clojure_cached_ns_regexp (klipse-settings) #"cljs\.core\.async.*|cljs\.spec.*|clojure.math\.combinatorics|clojure.test.check.*|reagent\..*|om\..*"))
(:clojure_cached_ns_regexp (klipse-settings) #"cljs\.core\.[async|match].*|cljs\.spec.*|clojure.math\.combinatorics|clojure.test.check.*|reagent\..*|om\..*"))

(defn cached-cljs-ns? [name]
(re-matches (cached-ns-regexp) (str name)))
Expand Down

0 comments on commit b005c17

Please sign in to comment.