Skip to content

Instantly share code, notes, and snippets.

View rauhs's full-sized avatar

Andre W. rauhs

  • Bavaria, Germany
View GitHub Profile

Currently:

    cljs.core.complement = (function cljs$core$complement(f) {
        return (function() {
            var G__10928 = null;
            var G__10928__0 = //impl
            var G__10928__1 = //impl
            var G__10928__2 = //impl
            var G__10928__3 = (function() {

Tricky, we can NOT:

var fxy = gen_dispatcher(fxy)
var fxy.IFn ....

Since otherwise we loose (to be tested) GCC's DCE.

Thoug this should work:

for i in $(ls *.JPG); do convert -resize 2048x $i s2048_$i; done;
;; No ticket yet. Idea:
(defn spread-n
"arr will be mutated!!
Puts n more items into arr and the rest of xs as the last element.
Returns the array arr."
[arr n xs]
(loop [s (seq xs)
i (dec n)]
(if (pos? i)
Note: apply-old includes the optimized to-array of CLJS-2100
"Datastructure: Set"
(apply-old f args), 1000000 runs, 716 msecs
(apply f args), 1000000 runs, 225 msecs
(apply-old f args), 1000000 runs, 641 msecs
(apply f args), 1000000 runs, 184 msecs
"Single arity fn, like JS fn"
(apply-old f 1 2 3 4 args), 1000000 runs, 903 msecs
(apply f 1 2 3 4 args), 1000000 runs, 358 msecs
@rauhs
rauhs / Makefile
Last active March 23, 2020 21:40
################################################################################
# Vars
# $< Dependency (right)
# $@ Target (left)
CLJ_NREPL_PORT:=22340
FIGWHEEL_PORT:=22345
LEIN_NREPL_PORT:=22350
CLJ_NREPL_PORT_TRY:=22355
(defn class-loaded?
[^String c]
(let [m (doto (.getDeclaredMethod ClassLoader "findLoadedClass" (into-array [String]))
(.setAccessible true))
cl (ClassLoader/getSystemClassLoader)]
(.invoke m cl (into-array Object [c]))))
(def ^:const c0 23.2)
(def ^:const c1 23)
(def ^:const c2 (+ c0 c1))
(defn const-expr []
c2)

Synopsis

Problem: Omegawiki's database layout ( http://www.omegawiki.org/Help:OmegaWiki_database_layout ) is incredibly complex and makes it tough to query the db.

This quick'n'dirty script imports the data into datomic. It aims to fully connect them with refs so that you can walk along the entities just like clojure maps.

Once in Datomic the entire db is in memory and it's very easy to explore the db and also very fast.

(declare pull)
(defn- pull-map
[patterns from]
(reduce-kv
(fn [out key sub-pat]
(assert (vector? sub-pat) "map value must be vector")
(let [sub (get from key)]
;; sub is now either a set or another entity
(some->>