Videos recorded from last meetup Jan 12th: Re frame firebase with ClojureScript: https://youtu.be/kxWdua4N7a8 Girouette Semantic CSS for Clojure and ClojureScript by Vincent Cantin: https://youtu.be/Tnv6SvZM6tg
Zach's YouTube Channel: https://www.youtube.com/user/zachoakes/videos
hey all, i just woke up :D 6am in oslo. if you're interested, here are the slides from the talk https://github.com/oakes/bay-area-odoyle i couldn't be bothered to use slide software like a normal person so i made it in the form of a play-cljc game
@youngil if you have a chance, could you post an example of what you meant about functional style looking like a graph tree (sorry, paraphrasing maybe incorrectly)? I'm interested in different styles of Clojure code/thinking.
Sure. I mean something like: (f1 (f2 x (f4 y)) (f3 (f5 a b) (f6 c d))) which doesn't have a simple rewrite using ->, as opposed to (f1 (f2 (f3 (f4 (f5 (f6 x))))))
I see. This happens all the time. Taking (f5 a b)
as a simplistic example, I would in-line that with (partial f5 a b)
such that the whole block can be rewritten as a ->
. Thoughts?
Not sure what is achieved by (partial f5 a b).
Would you mind reformulating my
(f1 (f2 x (f4 y)) (f3 (f5 a b) (f6 c d)))
using the ->
?
oh my bad, I misread. which does highlight why that is hard to read though. π
here's my attempt to make it clearer,
I'm a fan of descriptive fn name and arguments. So first step is to wrap the whole thing with a descriptive fn name and name each of the args in a map. Using a map as the arg here so we don't need to remember the arity and positions.
And then making use of let
to name results of f2 and f3.
(defn f1-with-clear-name
[{a-named :a
b-named :b
c-named :c
d-named :d
x-named :x
y-named :y}]
(let [named-f3 (f3 (f5 a-name b-name) (f6 c-name d-name))
named-f2 (f2 x-named (f4 y-named))]
(f1 named-f2 named-f3)))
Which goes back to what you were saying about imperative style isn't necessarily bad. Took me a bit to realize what you were saying. But thanks!Agreed that nesting of function calls is harder to read. So, naming the arguments in a let is fine. The only down side is that it does make it look like sequential actions even though it may not be. It may be a matter of getting used to the nested expressions, but I realize that the Clojure convention is to prefer not to nest deeply.
@sekao That was a very interesting talk which made it clear that a rule engine is very useful in the front end.
Thank you !
https://github.com/oakes/odoyle-rules this morning and am brimming with ideas for static blogs and games. Canβt wait to try it out.