clojure-bay-area

kt 2021-02-10T04:19:43.001900Z

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

ghosttoaster 2021-02-10T04:24:14.002500Z

Zach's YouTube Channel: https://www.youtube.com/user/zachoakes/videos

sekao 2021-02-10T05:16:05.004900Z

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

❀️ 2
πŸ˜‚ 1
πŸ™ 1
quantisan 2021-02-10T05:43:09.006900Z

@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.

Young-il Choo 2021-02-10T20:49:47.012400Z

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))))))

quantisan 2021-02-10T23:52:41.012600Z

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?

Young-il Choo 2021-02-11T04:30:10.012800Z

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 ->?

quantisan 2021-02-11T07:36:36.013Z

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!

Young-il Choo 2021-02-11T19:31:54.013300Z

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.

2021-02-10T06:10:50.008Z

@sekao That was a very interesting talk which made it clear that a rule engine is very useful in the front end.

2021-02-10T06:11:02.008200Z

Thank you !

ghosttoaster 2021-02-10T16:33:10.012200Z

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.

πŸ‘ 1