Fork me on GitHub

@harsjoshi1614 To augment the great resources above, here's hands-on material that drills the REPL-oriented habit (among other things important for newcomers): (I'm the primary author of the workshop. We teach it at IN/Clojure every year.)

gratitude 4
👀 2
❤️ 2

That's a lovely and wonderful README! I have completely missed this resource. Will give it a spin!

gratitude 2

Thanks! I love Calva, by the way. It's become my go-to choice for absolute newcomers, because it's so lightweight to set up out of the box, and ... smooth ... especially with the inline eval + display of results. It makes me not miss LightTable any more. The very first avatar of our workshop used LT for similar reasons. Personally, I'm firmly in the Emacs world. You'll have to pry it from my cold dead hands, but overall I love how far Clojure IDEs have come. It's awesome! IntelliJ + Cursive, VSCode + Calva, and Emacs + CIDER (+EVIL for Vimmers) is the holy trinity for me. I use all three with my Emacs keybindings :)

calva 2
Harshit Joshi08:09:54

@U051MHSEK thanks i will check this out too !

😎 2

Has anyone looked at the Learn Reagent, Learn Re-frame, and Learn Reitit courses? Are they worth recommending to someone who wants to jump in quickly?


I can only speak from my own experience. As a beginner I spent a long time just learning clojure first. Once you have wrapped your head around clojure, reagent or other frameworks are easier... IMHO!! I started with the usual books Clojure for the brave, etc. Then after a lot of experimentation got my head around reagent. I am not brave enought to start with Re-frame or reitit yet... best of luck to you!!


Actually, it’s not for me. I have a decent understanding of Clojure, have been toying with it for several years as a research tool. It’s just that a fellow company is exploring quick learning opportunities related to “full stack Clojure”.


They all seem very high quality courses, although I suggest some general experience of Clojure first will make them easier to understand. I don't believe they are ment to teach Clojure, outside the specific needs of their subject. So yes, if someone want to know the specific topic quickly, they seem very good.

👍 2

is there a way to check using clojure.spec if an entity is a function?


I'm not sure what you mean by entity but there is the ifn? predicate


Thanks Alex. By entity I mean the variable?... value? we are checking in spec... (s/valid? ::function <entity>)


then yes, ifn? is the best predicate for that


is it possible to add a path to the clj repl invocation without using -Sdeps? i can say clj -Sdeps {:example {:extra-paths ["test"]}} -M:example, but that’s much more verbose than something like clj -Spaths ["test"] or similar


to be clear, i want to add to the existing :paths vector that already exists in the deps.edn, not replace


the reason i ask is because i have an alias :test {:extra-deps {lambdaisland/kaocha {:mvn/version "1.0.861"}} :extra-paths ["test"] :main-opts ["-m" "kaocha.runner"]} , and the :main-opts is run when i use clj -M:test, when what i’m looking for is to just pull in the deps and path


@UEENNMX0T Do you mean "I just want to pull down the deps and not run anything" or "I want to pull down the deps and run something other than Kaocha's --main` function"?


First one. I don’t want to run anything, just pull in the deps and paths


The former can be done using the -P option (before -M).


Oh, I’m sorry, I mean that the repl loads


“Run something other” yes, the repl lol


You have to separate out the :main-opts to another alias like :runner

👍 2

Eventually -A will stop running :main-opts and will just start a REPL. Right @U064X3EF3?


eventually, yes


it's still better to separate out your aliases imo


I tend to use -X to run most stuff now, so when I use -A it "does the right thing" because there's no :main-opts anymore. I don't know if Kaocha has an exec fn entry point tho'?


Oh yeah, I forgot about exec-fn. That isn’t run when using -M, right? Just -X. That’s a good way to handle this


A quick clarification on specs and instrumentation. Am I correct if I'm under the assumption that instrumentation means that all used functions get their inputs validated and no other checks are generated?


if I understand you correctly, yes, but there can be surprises, eg. an arg that is a function can get called with generated args to verify it has the expected type


a-huh.. hence the problems with higher-order-functions

Adam Stokes21:09:36

Hi all, does support not having short flags? I couldn't find any reference of anyone doing something like that

Adam Stokes21:09:07

(def cli-opts
  [["-d", "--boot-disk-size SIZE", "Size of boot disk (format: 150GB)"]
   ["-b", "--boot-disk-type TYPE", "Type of disk (eg. pd-ssd)"]
   ["-n", "--name NAME", "Name of instance"]
   ["-t", "--machine-type TYPE", "Type of instance"]
   ["-i", "--image-family IMAGE", "Name of OS image to boot"]
   ["-z", "--zone ZONE", "Region to boot instance"]
   ["-x", "--no-address", "No address?"]
   ["-h", "--help", "Display help"]])
I'd like to do away with those short flags if possible


> Option specifications are a sequence of vectors with the following format: > [short-opt long-opt-with-required-description description > :property value] > The first three string parameters in an option spec are positional and > optional, and may be nil in order to specify a later parameter.


sounds like you must include the position but can make it nil

Adam Stokes21:09:51

ah! great thank you @dpsutton

Franco Gasperino22:09:11

Is it common to assign a global binding with def when performing interactive / repl development, even if it's intended to be assigned with a defonce? Is this the preferred route during iteration to avoid restarting the jvm?


the principled version is something like component / integrant / mount

☝️ 2

but using def to bind in the repl is a normal thing yes

☝️ 2

i do lots of (comment (def foo ...)) all the time

👍 2
Brandon Olivier23:09:38

I’m trying to work with Playwright in CLojure and they have a Java line that looks like this

Browser browser = chromium.launch(new BrowserType.LaunchOptions()  .setIgnoreDefaultArgs(Arrays.asList("--mute-audio")));
How would I translate that to Clojure?

Brandon Olivier23:09:30

I think I have something. I can import it with


Brandon Olivier23:09:42

Then I can instantiate it w/ the name BrowserType$LaunchOptions


(.launch chromium (-> (BrowserType$LaunchOptions.)
                      (.setIgnoreDefaultArgs ["--mute-audio])) 


something like that