This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-12-16
Channels
- # bangalore-clj (8)
- # beginners (78)
- # boot (68)
- # cljs-dev (32)
- # cljsrn (43)
- # clojars (2)
- # clojure (147)
- # clojure-italy (4)
- # clojure-nl (2)
- # clojure-quebec (1)
- # clojure-russia (19)
- # clojure-spec (17)
- # clojure-uk (25)
- # clojurescript (98)
- # clr (2)
- # core-async (14)
- # cursive (5)
- # datascript (1)
- # datomic (23)
- # emacs (4)
- # hoplon (8)
- # jobs (4)
- # kekkonen (1)
- # lein-figwheel (9)
- # off-topic (2)
- # om (2)
- # om-next (9)
- # onyx (4)
- # planck (2)
- # re-frame (14)
- # ring-swagger (3)
- # untangled (18)
I always thought a straightforward reimplementation of core.async to async/await would not be possible (await returns one value, but channel is continuous stream of values). But if there ever was any kind of rewrite plan, I would like to assist. I’d like the new design to consider adding some dev-time debugging capabilities: https://github.com/binaryage/dirac/issues/36
Yay clojurescript!
@ashnur what really helps with keeping your parens balanced in spacemacs is using lisp-mode: http://spacemacs.org/doc/DOCUMENTATION.html#lisp-key-bindings
how about the code i shared? yesterday i was ignored again all day, i am starting to think it depends on the weather. on rainy days i am ignored, on clear days i am not 😄
Hmm. I'm looking at the output of :advanced
compilation and I see many of my string constants are duplicated in the resulting code (e.g. they appear twice in JavaScript). I don't think this is good.
@jrychter That's on purpose, actually google closure used to assign them to variables and reference them but then went the other way, it turns out there is little savings after gzip
@rauh: oh! Good to know. And now I feel ashamed for not having checked the FAQ first.
Yeah I assign global variable R
to React.createElement
only to realized that I saved 400(!) bytes after gzip 😞
I do a sanity check from time to time, as my app grows. I am at 1.94MB uncompressed, 487kB compressed right now.
@jrychter I automatically gzip the data after an advanced compile. See :watch-fn
compiler option that gets invoked after cljs compiler is done
I will take this occasion to thank everyone for the mindblowing awesomeness of ClojureScript. I can write apps with isomorphic rendering that load and work blazingly fast, and easily maintain complex functionality because Clojure and ClojureScript do not require a lot of code. And the best part — every once in a while I stumble upon an article with "X ways to make sure your React app is fast", and then discover that none of the advice applies to me: all the hard work has already been done for me. So, thank you!
I'd like to restrict the input of a text field in a reagent form to a subset of the alphabet. (one letter abbreviations for amino acids, for the curious). i'm sure this is simple, but i'm at a loss. Does anyone here have any suggestions?
@dbsgtk in a controlled component you can just refuse updates that include disallowed characters, can't you?
@pesterhazy I'm sure that's the case. 🙂 My embarrassment should be evident; this is my first reagent app.
check the example here: https://reagent-project.github.io/ (search for on-change)
if you choose not to reset! the atom, the input field will refuse the keystroke
@jrychter I collect my boot tasks related to minification there: https://github.com/nha/boot-uglify
@pesterhazy thanks. I was using reagent-forms
, but maybe I won't for that component.
@dbsgtk may be a good idea to start with simple reagent so you know what's the fault of specific libraries
I had to made a change to the goog.dom.fullscreen.js file, and as suggested by @thheller I put it into my cljs sourcepath. But cljsbuild don't compile it or copy it to the correct folder. How could I use this file, so it gets correctly resolved by goog.require?
@danielgrosse it needs to be on the java classpath. if you have a seperate src/cljs
or so for cljsbuild
that won't work
I put it into the directory src/clj/goog/dom/fullscreen.js and the repl returns the correct file. But cljsbuild don't copy it into the goog/dom directory
I might actually be wrong about cljsbuild then, I know this works in shadow-build cause I have done that several times
so, i realized i probably shouldn't be using vectors because i have to check if there is a value in it and it seems they are not very good at this
@thheller I will try it later.
is there a beginners channel specifically for clojurescript? i have not seen in the list but maybe it's not public or something
Would like to have some feedback. I need to filter and return an array in ClojureScript. Is this good enough?
(to-array (filter #(…) the-array)
if it works it works!
did you mean into-array
?
and it seems to be well supported now: http://caniuse.com/#feat=es5
@borkdude By using (filter #(...) the-array)
instead of the JS interop .filter
your code will be more portable to CLJC. Not sure if that matters to you or not.
In general I try to use the core library as much as possible over JS interop.
1.5 years ago i had to use ext.js that also has .filter, but no reduce http://docs.sencha.com/extjs/4.0.7/#!/api/Ext.Array
couldn't convince my colleagues to use it though. they preferred the usual multiple nested levels of fors and ifs
This made me wonder a little bit: https://gist.github.com/borkdude/5d552116ed1e7192429d9562277ff8f8
I think it is just for some historical reasons. They should do the same thing I believe. to-array
it closer to bare-metal and generates more straightforward javascript code.
@darwin The generated JS looks remarkably similar: https://www.dropbox.com/s/47l6s8bjnr6rnek/Screenshot%202016-12-16%2018.18.28.png?dl=0
ok, good point, I take my words back, I thought reduce will add chunking, like doseq does
btw. to play with well with dead code elimination I had to implement another version: https://github.com/binaryage/cljs-oops/blob/d530a3cdf8cbab39bd2699c36caded4414224c50/src/lib/oops/helpers.cljs#L26 but unfortunately I don’t remember the details… the problem was related to protocols
or maybe this is not the case I vaguely remember, once I had to drop protocol dynamic checks to get proper DCE
@borkdude I skimmed the cljs.core sources just briefly and it seems reduce does not do chunking, so it should generate similar code, maybe with some extra varargs handling
but from your screenshot it looks like into-array is actually more efficient code, cljs.core.first and cljs.core.next do protocol checks
I'm working on porting a clj lib to cljs and it uses multimethods with special characters on some methods
the compiler seems unhappy with this https://puu.sh/sRHsS/6c43382081.png
^ Just to add to this
It seems particularly sad when we expand a macro that emits a defmethod
(Sidenote @angusiguess : get nick in here 😛 )
(defmacro unary
[type f & [e-parse]]
(let [e-parse (or e-parse identity)]
`(defmethod expression ~type [[_# exp1# & extra#]]
(if (seq extra#)
(throw (parse-exception "%s only accepts 1 argument. Provided: %s" (name ~type) (vec (cons exp1# extra#))))
(if exp1#
(fn [x#]
(~f (~e-parse ((expression exp1#) x#))))
(throw (parse-exception "%s requires 1 argument. Provided: %s" (name ~type) exp1#)))))))
@samueldev doesn’t seem necessarily to have anything to do with the compiler at this point
@samueldev technically that’s not even a valid keyword far as I can tell
one alternative I had suggested (did nick try it @angusiguess?) is simply to write plain-english versions of those multimethod identifiers with no special characters
(unary :not not)
isn't compiling either?
It may just be that we're not requiring the macros properly.
Beginner question: I'm trying to get into clojurescript development, am I confused in thinking that neither boot-cljs nor lein-cljsbuild support clojurescript > 1.7.2? And therefore neither supports clojure.spec? If so are clojurescript developers running custom scripts to compile their code? Not doing spec? Or am I missing something? Thanks for your help.
has anyone done om/reagent with webcomponents like https://x-tag.github.io/?
@cdimara ClojureScript is just a library, so I think you may have come to the wrong conclusion here
Okay. I saw Clojurescript is listed as an out of date dependency on the boot-cljs homepage but that must not mean what I think it means: https://jarkeeper.com/adzerk/boot-cljs
Ah I'm just getting into om + cljs and, coming from a brief clojure+ring background, I just gotta say thanks!!!