This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-04-09
Channels
- # beginners (41)
- # boot (4)
- # cider (36)
- # cljsrn (9)
- # clojure (365)
- # clojure-dev (1)
- # clojure-dusseldorf (1)
- # clojure-nl (1)
- # clojure-russia (3)
- # clojure-spain (1)
- # clojure-spec (19)
- # clojure-uk (1)
- # clojurescript (159)
- # code-reviews (7)
- # core-async (51)
- # cursive (2)
- # datascript (1)
- # datomic (1)
- # emacs (5)
- # figwheel (3)
- # hoplon (18)
- # incanter (1)
- # lein-figwheel (1)
- # leiningen (3)
- # lumo (145)
- # off-topic (26)
- # onyx (21)
- # re-frame (2)
- # reagent (45)
- # rum (4)
- # uncomplicate (10)
- # untangled (23)
- # yada (6)
(sorry, it had to be done 😉 )
@mpenet: is `(alia/execute session "CREATE KEYSPACE alia WITH replication = {'class': 'SimpleStrategy', 'replication_factor' : 3};")` idiomatic alia? I was expecting edn and got strings
Some prefer one or the other, or just maps or java-driver Statement instances, execute supports all of them
This seems consistant across runtimes..... but why? (@_@) EDIT: Oh stack 0verflow answered my question.
why are you stringifying functions?
it's because in clojure you get a unique object id for each call to constantly, in js you get some javascript - the same javascript string for every call to constantly
+user=> (constantly :a)
#object[clojure.core$constantly$fn__6687 0xb1712f3 "clojure.core$constantly$fn__6687@b1712f3"]
+user=> (constantly :b)
#object[clojure.core$constantly$fn__6687 0x74eb909f "clojure.core$constantly$fn__6687@74eb909f"]
+cljs.user=> (constantly :a)
#object[b "function (b){if(0<arguments.length){for(var c=0,e=Array(arguments.length-0);c<e.length;)e[c]=arguments[c+0],++c;new cljs.core.IndexedSeq(e,0)}return a}"]
+cljs.user=> (constantly :b)
#object[b "function (b){if(0<arguments.length){for(var c=0,e=Array(arguments.length-0);c<e.length;)e[c]=arguments[c+0],++c;new cljs.core.IndexedSeq(e,0)}return a}"]
@pesterhazy I was doing some ill-advised black magic with repls and webworkers. Seeing how far I could get.
The lesson is that you can't lean on the string representation of an object to recover it's implementation (or identity)
yeah it looks like the string representation doesn't include the vars captured in the closure
it has their binding name, a
which doesn't do you much good haha