This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-02-08
Channels
- # aleph (7)
- # announcements (12)
- # babashka (19)
- # beginners (4)
- # calva (29)
- # cider (20)
- # clj-kondo (20)
- # clojure (66)
- # clojure-austin (4)
- # clojure-europe (11)
- # clojure-nl (1)
- # clojure-norway (42)
- # clojure-uk (4)
- # clojuredesign-podcast (9)
- # conjure (1)
- # cursive (5)
- # datomic (42)
- # etaoin (4)
- # events (10)
- # garden (8)
- # graphql (1)
- # holy-lambda (7)
- # honeysql (3)
- # hyperfiddle (5)
- # missionary (11)
- # music (1)
- # off-topic (12)
- # practicalli (2)
- # re-frame (2)
- # reitit (6)
- # releases (2)
- # vim (2)
- # web-security (1)
- # xtdb (3)
👋 Does anyone know of any free (preferably without signup) clojure/clojurescript/babashka playground environments or REPLs that can easily be parameterised with some code snippets of your choice? I think ideally I’m looking for something light weight like https://tryclojure.org/ but with the ability to preload the REPL with a code snippet e.g. via a query parameter. I basically want to link people to short code snippets for them to evaluate and play with.
e.g. https://www.maria.cloud/local/49b0b627-0277-4928-83db-72be54e1ede5 - CTRL+Enter
to evaluate
oh this looks good… Not sure I want to give it access to my private gists though
@U06HHF230 squint playground: https://squint-cljs.github.io/squint/?src=KHJlcXVpcmUgJ1tjbG9qdXJlLnNldCA6YXMgc2V0XSkKKHNldC9tYXAtaW52ZXJ0IHs6YSAxIDpiIDJ9KQ%3D%3D cherry playground: https://squint-cljs.github.io/cherry/?src=KHJlcXVpcmUgJ1tjbG9qdXJlLnNldCA6YXMgc2V0XSkKKHNldC9tYXAtaW52ZXJ0IHs6YSAxIDpiIDJ9KQ%3D%3D sci.configs playground supports linking a gist: https://babashka.org/sci.configs/?gist=5ff187847756263be17d7c4c19f978b5
@U06HHF230 I didn't login, just visited the page and create a snippet of code
Are those snippets shareable and persistent?
btw, there is https://2.maria.cloud too
@U04V15CAJ: what is the difference?
I want to cache data fetched by an URL:
http:/somedomain.com/path/to/resource?signature=ABC
http:/somedomain.com/path/to/resource?signature=DEF
I have looked at core.cache
and core.memoize
I had assumed I could give the full URL (`http:/somedomain.com/path/to/resource?signature=DEF`)
and use the part without the "signature" as my lookup key, and then the entire URL to fetch the data on miss.
But I can't seem to figure out how to do this without implementing my own CacheProtocol
.
Have I gotten that right or am I overlooking something? (I would like to write and maintain as little of my own code as possible 😄 )
With core.memoize
, you can use :clojure.core.memoize/args-fn
metadata to specify how to derive a cache key from the args.

(memoize/lru (with-meta fetch-from-url
{::memoize/args-fn #(remove-sig-from-url (first %))})
:lru/threshold 1000)
Nice ❤️ thanks
May I ask for your advice? I give a talk at a Go meetup in my company in April. And the topic is main ideas of the functional programming world. The audience is software developers of various levels the vast majority of which have no first-hand experience seriously using any functional language, most are typical PHP/Python/Java/C# guys who started to use Go not long ago. My plan (for now) is to mostly retell core ideas of Rich Hickey talks (also Stuart Halloway's) like • the value of values • what is PLOP, the danger of it with examples how it hurts us across different domains • how thinking in values naturally brings us to pure functions • how objects are lacking and bring complexity • X-as-a-Code vs X-as-a-Data with the ultimate example of LISP (Code-as-Data) • Data Model > API > DSL (this one is from Stuart Halloway) So I would appreciate you giving advice on all that. Isn't it too much for 40 minutes? Or maybe I'm missing some valuable ideas (not necessarily from Clojure/LISP world bt functional programming in general)?
I also had to look it up... I came to the conclusion it stands for: Principle Of Least Privilege
I highly recommend to watch this talk in full (and all others done by him) but here is a link with timecode to the description of PLOP https://youtu.be/-6BsiVyC1kM?t=243&si=TxQNtydII_P_KUz_
It is a very worthwhile topic indeed, and I don't think 40 minutes is too much 😄 Time flies when people are having a good time. I guess whether 40 mins is enough or too little depends on your experience - how many times you have explained these things before e.g. in smaller groups or 1-1 Choosing the right words matters to get the points across with as little confusion as possible. The size and composition of the group can also play a part (how many questions/interruptions during the talk) I would order the topics in a way that allows you to skip stuff at the end if times become an issue. Put down a foundation and build up understanding from there (without relying too much on something you should get back to at the end) Also don't be "different" just to be different. Copy what you see works, and add to it where you see fit. I found that immutable data structures are A LOT more important to me than I expected, and I didn't realize this until several years into my Clojure career.
I would go with a multi-part approach if you feel it's too much content. Have a series of talks related to the main ideas. But nevertheless, prepare for more material, and cut it afterwards. Also, having live coding is a nice touch to any programming presentation ⌨️ The Clojure REPL is too cool not to showcase everywhere.
I, too, needed to look up PLOP and have no patience for YouTube videos. Google was not helpful, neither was https://en.wikipedia.org/wiki/Plop The most computer-sciencey meaning I found is that PLOP = Pattern Languages of Programs (https://en.wikipedia.org/wiki/Pattern_Languages_of_Programs) and I found no explanation (outside of the video) why it would hurt across different domains. Edit: even the acronym finder did not have Hickey's meaning for PLOP: https://www.acronymfinder.com/PLOP.html
Can you send the link/reference for your point *data model > api > DSL?
I would be interested in this
there are 3 Rich Hickey talks, which mention PLace Oriented Programming
:
https://github.com/search?q=repo%3Amatthiasn%2Ftalk-transcripts+%22place+oriented+programming%22&type=code
you may start watching at 8:05 but the whole talk is brilliant https://youtu.be/LEZv-kQUSi4?si=ORxy3ZqiDSkehIEZ
I've watched those talks also a lot and have come to the conclusion that some of the remarks are too highlevel (or philosophical/ideological, in a sense) to immediately be obvious and you can talk about each individual one for much longer. Those in Value of values in particular. Imho you will also have to know whether those people already code functionally by convention, or if there actually is rampant mutation present in their programs that VoV was trying to adress.
@U05N15QDUHX yes, I have the same feeling. Actually my idea was to go over a fictional Go code example showing how we have to read code in order to understand what went wrong with mutable state passed by pointers in place. Essentially we're doing BFS in a graph.
it was inspired by this diagram in "Narcissistic design" and I would like to make it palpable
I need to release a java library to maven central soon. I do have a sonatype account. I've never released to maven central before, but I have released to clojars... Can I get some advice or a good tutorial to help me out with this? (I've looked at it before and releasing to maven central seemed pretty intense compared to releasing libs in other languages...)
I think I never tried, but shouldn't it be the same as Clojars? like :
mvn deploy:deploy-file -Dfile=my-lib.jar -DrepositoryId=maven -DpomFile=pom.xml -Durl=
having your settings like :
cat ~/.m2/settings.xml
maven
YOUR_USER_NAME
YOUR_PASS
nvm, I did some reading and I see there are a couple of other steps involved like signing and then login into Sonatype Nexus Repository Manager
@U0739PUFQ well what did you read? Might be of help...
just asked gpt-4 https://chat.openai.com/share/18d163f8-45ac-404f-a9ac-42fe79186869
I do this with one of my libraries and I have written about putting your credentials into your .m2/settings.xml and how to generate a valid GPG key and make it public. See https://github.com/wardle/hermes-api
Sorry just noticed this was from 8 days ago, so presumably you've sorted already.
Hi Mark. I don't have it sorted yet. Mind if I DM you if I need to?
Of course - or in this thread is fine too.
Trying out new 1.12.0-alpha6
following the amazing announcement in https://clojurians.slack.com/archives/C06MAR553/p1707431025302139 . Running into an issue starting up metabase. Details in thread 🧵
metabase on master [$!?] via ☕ v21.0.2 on ☁️ metabase-query took 20s
❯ echo $ALIASES
dev:ee:ee-dev:drivers:drivers-dev:alpha:socket:morse:reveal
metabase on master [$!?] via ☕ v21.0.2 on ☁️ metabase-query
❯ clj -M:"$ALIASES"
Warning: environ value /Users/dan/.sdkman/candidates/java/current for key :java-home has been overwritten with /Users/dan/.sdkman/candidates/java/21.0.2-tem
WARNING: abs already refers to: #'clojure.core/abs in namespace: clojure.algo.generic.math-functions, being replaced by: #'clojure.algo.generic.math-functions/abs
operator.clj:172 recur arg for primitive local: sum is not matching primitive, had: Object, needed: long
Auto-boxing loop arg: sum
Exception in thread "main" Syntax error macroexpanding at (core.clj:348:14).
and then it hits the stacktrace from above.
Running on
❯ java -version
openjdk version "21.0.2" 2024-01-16 LTS
OpenJDK Runtime Environment Temurin-21.0.2+13 (build 21.0.2+13-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.2+13 (build 21.0.2+13-LTS, mixed mode)
. Works without issue when dropping back to 1.12.0-alpha5
i’ll dig in some more. The base stacktrace quits listing frames right where it gets good it seems. > ... 234 more
from the stack trace, looks like pointing to metabase.util.i18n.plural ?
I guess your first error points to operator.clj loop/recur on sum
That’s a warning about type mismatch in the recur. Preexisting and (presumably) not related to this issue
info on how to repro?
repro:
❯ git clone [email protected]:metabase/metabase.git
❯ cd metabase
❯ clj -M:dev:alpha
Warning: environ value /Users/dan/.sdkman/candidates/java/current for key :java-home has been overwritten with /Users/dan/.sdkman/candidates/java/21.0.2-tem
WARNING: abs already refers to: #'clojure.core/abs in namespace: clojure.algo.generic.math-functions, being replaced by: #'clojure.algo.generic.math-functions/abs
operator.clj:172 recur arg for primitive local: sum is not matching primitive, had: Object, needed: long
Auto-boxing loop arg: sum
Exception in thread "main" Syntax error macroexpanding at (core.clj:348:14).
at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:4076)
:dev
provided by repo
:alpha
is :alpha {:extra-deps {org.clojure/clojure {:mvn/version "1.12.0-alpha6"}}}
I see Caused by: java.net.URISyntaxException: Illegal character in path at index 10: whitespace = #'\s+' maybe from https://clojure.atlassian.net/browse/CLJ-2783 change to use a non-deprecated path to make URIs
plural.clj loads an instaparse grammar, seems like the string "whitespace = #'\s+'" is ending up getting parsed as an uri (not sure exactly how yet)
thank you for looking into it. i’ll continue now as well. agree i’m not seeing anything “uri”y in there
❯ clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.12.0-alpha6"} instaparse/instaparse {:mvn/version "1.4.12"}}}'
Clojure 1.12.0-alpha6
user=> (require 'instaparse.core)
Execution error (URISyntaxException) at java.net.URI$Parser/fail (URI.java:2995).
Illegal character in path at index 10: whitespace = #'\s+'
user=>
and there it’s doing
(def ^:private standard-whitespace-parsers
{:standard (parser "whitespace = #'\\s+'")
:comma (parser "whitespace = #'[,\\s]+'")})
and the parser
function handles lots of different args, including URIsI think it just tries slurping the string to see if it works
(try (let [spec (slurp grammar-specification)]
(build-parser spec output-format))
(catch java.io.FileNotFoundException e
(build-parser grammar-specification output-format)))
which doesn’t seem like the greatest strategybut if we've changed the behavior of slurp, certainly that was not our intent
and indeed, changing that strategy to also catch the uri exception allows metabase to startup
(try (let [spec (slurp grammar-specification)]
(build-parser spec output-format))
(catch java.io.FileNotFoundException e
(build-parser grammar-specification output-format))
(catch java.net.URISyntaxException e
(build-parser grammar-specification output-format)))
in https://github.com/Engelberg/instaparse/blob/master/src/instaparse/core.cljc#L228-L231we will likely just revert CLJ-2783 for now and release an alpha7
thank you for looking into this with me. And glad was able to give some alpha feedback
a good one for “just remove some deprecated uses. what implications could that have”
well, we knew about this implication, just didn't mitigate for it enough apparently
(not that yall hadn’t throught it through. more for enlightening others how much work goes into even a simple seeming change)
Came to report the same issue. Glad you're already on it.
1.12.0-alpha7 is now available