This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-05-19
Channels
- # announcements (5)
- # beginners (7)
- # boot (1)
- # calva (1)
- # cider (7)
- # circleci (2)
- # clara (5)
- # clj-kondo (1)
- # clojure (19)
- # clojure-chicago (1)
- # clojure-dev (3)
- # clojure-europe (1)
- # clojure-spec (1)
- # clojure-sweden (5)
- # clojure-uk (25)
- # clojurescript (4)
- # cursive (2)
- # data-science (1)
- # datomic (44)
- # graphql (9)
- # hoplon (2)
- # klipse (2)
- # luminus (1)
- # nrepl (1)
- # off-topic (38)
- # planck (1)
- # precept (1)
- # quil (1)
- # re-frame (3)
- # reagent (5)
- # shadow-cljs (12)
- # spacemacs (13)
- # sql (2)
- # xtdb (10)
Just watched this fun little Clojure/north talk on making quick scripts using cljs and Lumo. https://www.youtube.com/watch?v=dzXZVnfp2TA How exactly would I start trying this out? I see the small little bash script command at the top, right. !#/usr/bin/env lumo
. Do I just put this in a standalone cljs file or is it still a whole project thing like using lein new app ...
still. How would I actually run it? $: ./my_script.cljs
?
Think I got it! Use chmod to give myself permission first and then run it like a normal script. very cool!
For those of you who are also reading "Programming Clojure" 3rd edition I strongly recommend to download the examples code and run the examples code in repl. E.g. My first impression when reading example code in pages 46-47:
(defn indexed [coll] (map-indexed vector coll))
(defn index-filter [pred coll]
(when pred
(for [[idx elt] (indexed coll) :when (pred elt)] idx)))
was: 😧 (emoji: anguished = experiencing or expressing severe mental or physical pain or suffering)
But once I diced and sliced those expressions bit by bit in repl (actually in a scratch file and sending the expressions to repl), and learning what map-indexed
does and that you can use sets as functions to test if parameter is in the set etc. I finally managed to understand the example. And then happened something amazing. Now when I understand what individual expressions do in isolation I can look at the example and somehow "see" how for
sequence comprehension travels the (indexed coll)
and takes the indexes if the character is in the predicate (set). Amazing.But it took time. Maybe some 30 minutes. I think I read the book so that I try all example code in repl unless I'm able to comprehend the example code just by reading the code.
This is going to take many evenings. Well, I have time. 🙂
Not sure if I've ever downloaded the code for a book. My theory is that I get it into my brain and muscle memory by typing it out.