This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-11-22
Channels
- # beginners (122)
- # boot (217)
- # cider (14)
- # cljs-dev (74)
- # cljsrn (22)
- # clojure (101)
- # clojure-nl (4)
- # clojure-russia (22)
- # clojure-taiwan (5)
- # clojurescript (87)
- # cursive (4)
- # datavis (2)
- # editors (3)
- # hoplon (2)
- # jobs (2)
- # ldnclj (1)
- # lein-figwheel (1)
- # luminus (1)
- # off-topic (1)
- # om (105)
- # onyx (37)
- # reagent (2)
- # spacemacs (2)
a detailed explanation of how Om Next remotes work - demonstrates where core.async is actually useful
Is there something that someone can point me to that gives me a concise explanation of the difference between om and om.next? (in my case..: I'm fairly fluent in react, and I've basic usage of om, but I'm completely out of date on the current developments)
There is an #C06DT2YSY channel just fyi. Om next is more of a framework than Om now. It incorporates ideas from Netflix’s Falcor and Facebook’s Relay libraries and tries to provide a complete solution for managing syncing data between the client and the server.
Ah, I didn't realise it had its own channel. I think you've given me enough of a base to not-so-blindly start looking into it myself, thanks
Not since the first releases
If there's an Om next talk that you'd recommend then link me and I'll watch it
Otherwise, I can alway google
His recent talk from the conj is probably a great place to start to get an idea of where he’s coming from. The docs are sparse and things are moving fast right now.
Awesome, thank you very much 😄
I’m excited about a macro I’ve experimented with tonight, and want to share how it is helping me to understand FP. It’s very similar to letfn
, but focuses on syntactic sugar rather than mutual recursion, relying upon function literals #()
:
(let# [life (+ 4 %)
universe (* % 10)
everything (-> % inc inc)]
(-> 0 life universe everything))
It’s just a wrapper of a macro, but I’ve found that let
puts me in an imperative mindset, and let#
puts me in a functional mindset. As I refactored three or four functions with the macro, I found patters in my usage of let
. Then I found patterns within those patterns. Eventually, my functions became small and discrete, resembling those lego-block pieces I’ve always thought FP would lead me to, but could never quite get to!
(let [life #(+ 4 %)
universe #(* % 10)
everything #(-> % inc inc)]
(-> 0 life universe everything))
@wildermuthn: if you write it like this you are not restricted to using functions 😛
Ah! But that’s what I found so helpful. I was forced to write functions, and it was easier to do so too.
@wildermuthn: there's also letfn:
(letfn [(life [x] (* 4 x))
(universe [x] (* 10 x))]
(-> 5 life universe)) ;; 200
@borkdude, thanks! I did start out using letfn
, but found the extra parens and required params to too much overhead. I tried @thheller’s model next, but I found the code too messy and the typing of #
onerous. A little bit of syntactic sugar helps me to focus on the purity of composing functions. But that’s me!
@wildermuthn: take note that the first rule of macro club is: don't write macros
@borkdude, have to disagree with the conventional wisdom there. If that was true, we’d wouldn’t have let, if-let, when-let, letfn, etc. I’m on board with reader macros being toxic to the ecosystem, but I think it’s good to experiment. For me, that’s one of the best parts about lisp. I think conventional thinking is better left to conventional languages.
@wildermuthn: sure, as a mind-expanding exercise, it's cool 😉
I usually don't even use letfn
, because I have to look up the syntax. let
usually does the job just fine
I come from a common lisp background, so I might be biased!
@wildermuthn: I think in Clojure there is a shift from macros towards data. For example, some routing libraries use macros to define routes, but as time went on people understood that expression those routes using just data was a better idea.
One of the problems with macros is that they don't compose (can't take the value of a macro)
@dnolen, @borkdude, no disagreement here, on either overuse or with using data when possible. But I’m happy to use small simple macros that make my life easier. I get into trouble when I make big complex macros that only seem to do so.
I can see going down a rabbit-hole with sugar-y macros.
In my experience, macros mostly come from libraries (clojure.core, core.async -> go, etc), but as a consumer of those libraries I don't have many occasions when I really need to roll my own.
is there some cljs.core helper to convert a seq into an JS array? clj->js is not a good fit, because I don’t want a deep conversion
@darwin: write a macro?
Kidding.
I just tested it here and it worked. http://clojurescript.net/
I looked in the cljs.core sources and I saw "core/defmacro array …”, am I missing some other version which is a function? or why this works?
@borkdude: now it makes more sense I got puzzled because intellij started showing me clojure sources, not clojurescripts’s while I was writing macros, that’s why I wasn’t able to find anything familiar
most people are confused and don’t realize ClojureScript has a unique macro system that is very different from Clojure's
@dnolen: thanks for explanation, so when I have both macro and function with the same name, how compiler knows which one to use? it tries macro first? in case of apply
macro cannot be used, so it uses function instead?
aha, so apply works with macros, they just cannot be passed as parameters, makes sense, now. I thought macros and apply does not work at all
@darwin: in the case of apply, I think the first argument always has to be a function
hi all! just pushed out my node/npm clojurescript package https://www.npmjs.com/package/clojurescript
i am really excited to use clojurescript in node-only environments, like Electron or embedded platforms, and this is a first step in that direction
@nasser: Nice!! Trying it out
replumb candidate 😄
@nasser, this is really exciting for getting ClojureScript apps distributed via npm!