This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-03-04
Channels
- # beginners (149)
- # cider (1)
- # clara (12)
- # cljs-dev (226)
- # cljsrn (2)
- # clojure (275)
- # clojure-russia (5)
- # clojure-uk (14)
- # clojurescript (57)
- # cursive (23)
- # data-science (15)
- # datomic (1)
- # fulcro (8)
- # hoplon (9)
- # onyx (5)
- # portkey (15)
- # protorepl (1)
- # re-frame (8)
- # reagent (17)
- # shadow-cljs (22)
- # uncomplicate (13)
- # vim (36)
greetings! Is there a way to have reduced
in areduce
? For now I use usual reduce
, but I have an uneasy feeling about this.
Well, it sounded like you were asking whether you could get areduce
to terminate early
I hoped there were some combination of reduced
and some higher level function/macro for reducing arrays and terminating earlier.
@misha If it makes you feel less uneasy, reduce
calls array-reduce
which is a loop/recur
honoring reduced?
yeah, areduce dates back before reduce was optimized like it is today - now it doesn't need to call seq on the last arg
so, there is no point in using areduce
anymore? @noisesmith
I'm not sure of that - but I suspect it
if you have performance problems, make sure you profile, then figure out what actually needs fixing, then benchmark your improvement
too often you see someone make a 70% improvement on something that takes 3% of runtime, while ignoring a simple fix that would fix the thing taking 50% of their runtime...
Yeah, if you are reducing a lot of arrays and you don't need early termination, areduce
might be faster
http://blog.fikesfarm.com/posts/2017-11-18-clojurescript-performance-measurement.html if it helps... (especially with respect to testing :advanced
code in different JS engines)
I am interoping heavily with paper.js right now, and just being in the "as close to js everywhere as possible" mode. Reduces amount of decisions I have to make right now (no performance concerns yet)
"as close to js as possible" is js :/
not saying you should switch to js, just that optimizing before you know what needs to be sped up is not an ideal use of time
@dnolen it makes sense now, when I know reduce
calls array-reduce
under the hood, and saw code of both. thanks!
This WIP for the new Quick Start which is significantly more straight forward than what we had before - please give it a try
you should be able to work through this, we cut a pre-release (1.10.126) so that this Quick Start can be tested
this is how people will build their first impressions so very interested in making this as compelling as possible
I’ve started a thread on http://clojureverse.org for this https://clojureverse.org/t/clojurescript-1-10-x-new-quick-start-feedback-please/1679, feel free to jump in
I have a .clj macro file, it has error. (:require-macros [panaeolus.macros :refer [definstrument]] :reload)
I don't see the :reload working, is this expected? Other ways to reload a macro namespace? I'm useing node repl.
clj -m cljs.main
-- fast and straightforwardlove it!
@bhauman great idea here was to make the browser REPL the default, and then of course I was like why don’t we just open a browser - duh! 🙂
FYI it appears clara rules does not work with 1.10.126, lots of warnings about Wrong number of args (3) passed to MapEntry
and Use of undeclared Var schema.core/MapEntry
in its schema.core
ns. fails at runtime too. if it's just a var that was moved/renamed then i assume itll need to be fixed on their end
for the first error, I bet it's something like this
+cljs.user=> ([:a 0] 2 :not-found)
:not-found
- where the code used to work before proper MapEntry objectsnever mind, not that, that's only two args :/
when i run lein figwheel, it creates the package.json and also npm packages under node_modules
however when i would like to require the libs, this is what i get: https://gist.github.com/mengu/78f4220ef19f7892af2867635b39582c
Hopefully someone can help you with this, but I have never had any luck with that feature and I have found it hard to debug what’s wrong. I’d suggest either using foreign-libs or shadow-cljs.
@U8ES68TGX well, i just realized that the packages i want to use are already in CLJSJS repo. but i'm still going to try this as a means of helping
@U4P01L831 here are my thoughts on this issue to date. i’m not an expert, and this is an incomplete and probably inaccurate take on things, so take this with a grain of salt. but maybe you find this helpful. https://gist.github.com/jmlsf/f41b46c43a31224f46a41b361356f04d
Question: in clj it's easy to extend a protocol to all types of maps (ArrayMap, HashMap...) by extending it to the interface java.util.Map. That's nice because it spares you the hassle of extending it to each map type separately. As far as I can tell, I can't do the same in cljs by extending the protocol to cljs.core/IMap, because there's not a reified interface for cljs protocols. Is that correct? And is there any other way to do the equivalent in cljs?
Has anyone come across errors like Caused by: java.lang.RuntimeException: Unable to find static field: STRING_KEY in class com.google.javascript.rhino.Token
?