This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-01-10
Channels
- # babashka (17)
- # beginners (57)
- # calva (19)
- # cider (1)
- # clj-kondo (21)
- # clojure (36)
- # clojure-austin (15)
- # clojure-australia (1)
- # clojure-china (1)
- # clojure-europe (35)
- # clojure-filipino (1)
- # clojure-hk (1)
- # clojure-indonesia (1)
- # clojure-japan (1)
- # clojure-korea (2)
- # clojure-my (1)
- # clojure-nl (1)
- # clojure-norway (5)
- # clojure-sg (1)
- # clojure-spec (6)
- # clojure-taiwan (1)
- # clojure-uk (3)
- # clojurescript (7)
- # clr (9)
- # community-development (5)
- # cursive (14)
- # datalevin (1)
- # emacs (5)
- # events (5)
- # exercism (2)
- # figwheel-main (2)
- # fulcro (6)
- # funcool (3)
- # introduce-yourself (2)
- # joyride (7)
- # leiningen (4)
- # london-clojurians (9)
- # malli (3)
- # membrane (1)
- # missionary (54)
- # music (1)
- # nbb (2)
- # pathom (5)
- # pedestal (55)
- # rdf (13)
- # re-frame (10)
- # reitit (3)
- # shadow-cljs (17)
- # vim (58)
- # web-security (12)
Lets say I have ClojureScript data for example a Map. Is there an idiomatic way to transfer that data to a Clojure project / repl where I have access to some libraries not available in ClojureScript? So I need to use ClojureScript for getting the data, and I want to use Clojure for transforming that data. How would I go about this?
To transfer when running the applications, add an API to the Clojure application (using reitit or compojure) and call the API from the ClojureScript application
🤯 I just can’t figure out which setting in vscode is giving me the “bad indentation” highlighting here 👇 By any chance, does someone know the knob to turn? I’m not using many extensions…
Assuming you are using #calva, check http://calva.io/formatting out.
I’m using calva, and it does work, too; but since I know these indentation warnings from other languages, I thought it was generic VSCode thing that’s interfering. but I’ll have another look at the docs, thank you!
😅 this is really annoying
That looks like the indent rainbow extension https://marketplace.visualstudio.com/items?itemName=oderwat.indent-rainbow
yes!!! thank you so much. the one I suspected the least tbh. that’s on me. Thanks again.
I set the coloring for that extension to be transparent shades of grey or shades of my theme's main background color, increasing in darkness/opacity with further indents. And disable the warning color for Clojure.
thanks, disabled that for clojure, too. that’s the best of both worlds. 🥳
Is there a https://hoogle.haskell.org/ analogue for Clojure, where I can look up function definitions?
💭 How does that work without types? Don’t all n-ary functions look the same, except for function/arg names?
Hoogle allows you to search via type signatures and find functions that fit those types sure. I meant in a more general sense is there a preferred site to simplify looking up clojure functions and their definitions.
http://clojuredocs.org has a look up for Clojure core, includes a link to the source code of each function
^^ give it arg /returns, leverages specs to find the function
@U03EK3XB4S3, I'm curious what type of search you're trying to do. I started working on a similar thing for clojure, but couldn't figure out what kind of searches might be useful.
thanks for the above suggestions. I think you guys are over-thinking what I was looking for. I was looking for a more centralisalised documentation wiki for major clojure functions. Nothing involving any pattern matching magic! 🙂 I also found which just redirects to other pages, but is useful: https://www.clojure-toolbox.com/
If you're trying to find relevant libraries, I recently released https://phronmophobic.github.io/dewey/search.html and have found it useful. There's also https://cljdoc.org/ #C8V0BQ0M6
Nice 😄
Perhaps not exactly what you are looking for, but I think one super power of Clojure is the queryable runtime:
apropos
, find-doc
, doc
, and source
among others
perfect @U11BV7MTK, thanks
Noob question. In reagent leiningen template, some code like this is written: (defn page-for [route] (case route :index #'home-page :about #'about-page :items #'items-page :item #'item-page)) Why is the #' used? I removed this symbol and the page still works. Looks a bit Common Lisp/Lisp 2 using a special notation to refer to functions...
Make a visible change to the implementation of home-page (or any of the others), reevaluate it and reload the page. Do you see the change with the symbol? How about without it?
#'
is the var quote: https://clojure.org/reference/reader#_dispatch
The last example on clojuredocs showcases its usefulness: https://clojuredocs.org/clojure.core/var
still works, I'm using shadow-cljs
with your help I got some useful answer on stackoverflow: https://stackoverflow.com/questions/14763301/calling-clojure-functions-using-var-quote-syntax
thanks!
Hi, I'm going through the lacinia tutorial and they reference dev-resources/user.clj https://lacinia.readthedocs.io/en/stable/tutorial/init-schema.html . But I don't understand how that works. And I cant find any references on google. Does anybody know what they mean?
> We can add a bit of scaffolding to the user
namespace, specific to our needs in this project. When you launch a REPL, it always starts in this namespace.
yes, but what does that mean?
When you start a REPL it has to always be in a namespace. By default is the namespace user
Clojure at runtime looks for user.clj
on the classpath and will use this to define the namespace if found
okay, so I can put the user.clj in the src/ folder?
you could, but then it would always be present. It’s preferrable to put it somewhere so it is conditionally on the classpath
that’s why they are using dev-resources. When doing dev this will be on the classpath but this (presumably) won’t be added to any artifacts you make
> We can define the user namespace in the dev-resources
folder; this ensures that it is not included with the rest of our application when we eventually package and deploy the application.
allright, so i would add dev-resources to sources in project file?
developer build
just fyi, "By default is the namespace user
" is not necessarily true - this is up to the repl implementation and there are repls that do other things. Loading user.clj is special in the Clojure runtime and independent from whatever choice is made in how the repl starts (and whether there even is a repl)
okay, im using vanilla lein
thanks, now I understand
for lein
you’ll want to use the profiles and add it in a profile that won’t be in effect when building your artifacts
Why doesn't it loop indefinitely? Because clojure is lazy?
(loop [i 0]
(when (< i 5)
(println i)
(recur (inc i)); loop i will take this value
))
the only way it continues loop is when the recur
form is invoked. And that only happens when (< i 5)
Each time you recur you increment i
and it will eventually be greater than 5. So the when
form returns nil rather than evaluating the println and recur
ahh yes! that when closing ) is very important 🙂
yeah if you were to barf the recur out of the when you would get 5 prints to your output and a very warm computer 🙂
just did it ...
"ahh yes! that when closing ) is very important 🙂" Slippery little devils, those (s and )s. I ignore them, look at the indentation. Mind you. I hit the "re-indent" key chord mode than I write code.