This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-04-20
Channels
- # announcements (3)
- # babashka (7)
- # beginners (36)
- # calva (71)
- # cider (25)
- # clj-commons (5)
- # cljdoc (19)
- # cljs-dev (5)
- # clojure (223)
- # clojure-austin (2)
- # clojure-bay-area (1)
- # clojure-europe (31)
- # clojure-france (6)
- # clojure-nl (2)
- # clojure-norway (19)
- # clojure-spec (13)
- # clojure-uk (7)
- # clojurescript (127)
- # core-logic (2)
- # cursive (21)
- # datalevin (53)
- # datomic (9)
- # emacs (37)
- # events (1)
- # graphql (8)
- # jobs (12)
- # lsp (8)
- # off-topic (92)
- # pathom (49)
- # pedestal (1)
- # polylith (3)
- # re-frame (25)
- # releases (2)
- # sci (11)
- # shadow-cljs (13)
- # vim (10)
Yesterday, I used Calva to help a non-technical businessperson. And now they also want to learn it! Here’s a tiny success story 🙂


Haha, yeah—Me too when it happened. It’s easy for us to forget how little “outsiders” understand programming in general and how easily impressed people are by things we might consider trivialities. It dawned on me yesterday that, ironically, it might be easier to “sell” Clojure via Visual Studio Code and Calva to non-technical business people than to software developers in our IT department.
By the way, before this person approached me yesterday, they had been trying in vain to do the same thing in Excel.
At the job where I first met Clojure. The lead dev was always explaining trivial and complex (we where building a bank) calculations using the Clojure REPL. He was using Emacs, and didn't know about the eval-to-point
family of commands, so it didn't get as easy to follow as with your example. But anyway, very effective and I am sure it helped with the management buy-in on Clojure.
That lead dev, btw: @UQY3M3F6D. I'm forever grateful for his patience with me when I was learning Clojure.

Most people want to solve surface-level problems like the ones in my example. They don’t care about the “deeper” stuff, which we programming language enthusiasts obsess over. I suspect the Clojure community on Slack is influenced by https://en.wikipedia.org/wiki/Survivorship_bias. “In here,” we engage in meta-discussions about the tools themselves, while others “out there” are busy using the tools to solve business problems and build stuff. I wonder how many Clojure users exist “out there” who are not engaged in meta-discussions, library development, etc. Are we the “vocal minority” in this situation? :man-shrugging:
We certainly are. I think Clojure attracts people who primarily want to solve problems in a larger share than most languages do. Clojure is extremely practical and lets you go straight at your problem w/o interfering. And your solutions get to be almost 1:1 matches of the problem they solve.
I'm curious why you get that floating point intermediate results. Had to try it myself, and the results are then as I would expect them to be...
Also a somewhat funny definition of response-rate. I'd say that that is 3/446
. 😃
;; First, we need to find the response rate.
(defn get-response-rate [surveys responses]
(/ responses surveys))
;; Then, we can use the response rate to figure out how many surveys you need to send.
(defn get-required-surveys [response-rate desired-responses]
(/ desired-responses response-rate))
;; When we combine those steps with your numbers, we find the answer.
(-> (get-response-rate 223000 1500) ; => 3/446
(get-required-surveys 250) ; => 111500/3
(float) ; => 37166.668
(int)) ; => 37166
However, displaying things in fractions can distract in this case, so maybe quickly move to floating points:
(-> (get-response-rate 223000 1500) ; => 3/446
(float) ; => 0.0067264573
(get-required-surveys 250) ; => 37166.668
(int)) ; => 37166
Ah! An astute observation. I made a copy/paste error in the comment I added behind that line. When I evaluate the line (get-required-surveys 250)
, it also shows the fraction 111500/3
(not the decimal number). Sorry for adding confusion. And I agree that 3/446
makes more sense than 446/3
, but Clojure outputs the latter. It certainly reads more naturally in English to say, “3 out of 446 customers responded to the survey.” As for the line (get-required-surveys 250)
, I think it’s more intuitive for humans to read it as a decimal number than a fraction. And I believe fractions, in most situations, are more intuitive than percentages. I love the fact that Clojure has first-class support for fractions!
> but Clojure outputs the latter
Well, as you can see in my example, if you ask Clojure to output the ”correct” ratio, then ask it to do so. You were dividing surveys/responses
and got that. 😃
My non calva version of this story - one of my friends from high school needed a laptop for school for a month and I loaned them my non-work one. I left Visual Studio code open with a little note and a folder for them to put stuff. Apparently a normal text editor with basic stuff like tab to indent and matching indent when you start a newline is a revolutionary tool for them to take notes
In https://www.youtube.com/watch?v=_-G9EKaAyuI @borkdude says: > We should have a JavaScript to ClojureScript converter And @danielamber2 agrees. Turns out that @mauricio.szabo has created one! I've been playing with it today and it looks like so in my dev Calva now. A bit orthogonal to Calva, maybe, but I will include it! 😃 I'm going to need it when writing the tons of #nbb scripts I am planning to write.

Nice, but is it possible to convert import to (ns ... (:require ...))
or just (require ..)
? :)
Anyway, good progress :) @mauricio.szabo is there also a web version available? this will be quite nice for general usage
Dear Calva friends: https://github.com/BetterThanTomorrow/calva/releases/tag/v2.0.269 • https://github.com/BetterThanTomorrow/calva/issues/1687 The How to use #nbb with Calva docs are updated. https://calva.io/nbb/ Not sure where in the docs it fits otherwise, I will have to figure.
As a Clojure-first self-learner, I actually need this quite often when trying to port things

Thanks for pointing me at this converter, @U8LB00QMD!
And before @mauricio.szabo who wrote this as a tinkering project knew it, it was running in prod ;)
I think that project should also allow my April fool's joke in a way: https://twitter.com/borkdude/status/1509933579937226759
(.log console "Hello," who)
Is js/
not required before console? It seems to be in my react native repl, but maybe it’s different in the browser?
I think you might be right. You want an issue about it, @mauricio.szabo? It's not the end of the world to fix it after the conversion.
yes, it is required, but the translator is probably not aware of what "console" means
Hahaha, yeah, I was using it at prod.
About console, maybe I can add some "reserved words" that are common in JS world, like console
, document
, window
, fetch
, etc...
The only trouble is that it's quite hard to map all of these. I was thinking about adding some kind of "automatic detector" - something like "if a var is not on local scope and was not part of js/require
, then prefix it with js/
. But for now, a list of words will do 🙂
I used some clj-suitable internals to enumerate the js/window
object. Maybe this map can be cleaned up and be of use?
Here's the code I used. All of it just snitched from https://github.com/clojure-emacs/clj-suitable/blob/master/src/main/suitable/js_introspection.cljs
Dear Calva friends: https://github.com/BetterThanTomorrow/calva/releases/tag/v2.0.269 • https://github.com/BetterThanTomorrow/calva/issues/1687 The How to use #nbb with Calva docs are updated. https://calva.io/nbb/ Not sure where in the docs it fits otherwise, I will have to figure.
Are there any Calva friends that would like to huddle a bit next Wednesday (April 27)? I will be able to do it form most of the ”work”-day here (putting in quotes because it will be a Calva day for me and that really does not feel like work for me). I'm thinking we can just chat and share screens. Showing each other Calva bugs, tricks, ideas, whatever. I live in Stockholm Sweden, which is CET. We would just start the huddle and then see who wants to join. A bit like that Gather room we used a few times back. (Which resulted in some super great sessions, but it is a bit detached, in a way that huddles aren't.) Huddles are mostly about voice and screen sharing, so not so much of a video call as in zoom. For better or for worse. Just slap any emoji on this post if you think it is interesting (no obligation to actually join).

Yes, that too. Though right now it is a bit broken I think. Unless the VS Code team has fixed it since I last checked.
The vsls.getApi()
promise misbehaves for some users. Me included. https://github.com/MicrosoftDocs/live-share/issues/4551
It's why I added a setting to enable the LiveShare support, because it hangs the repl connection when it happens. https://github.com/BetterThanTomorrow/calva/issues/1629
How does that work? Is it neovim's paredit engine that is used then, or does Calva's Paredit edits/navigations somehow get sent to neovim?
idk, haven't gotten that far yet. i tried invoking a couple of calva's paredit functions and it didn't seem to work yet
maybe i'll try neovim's paredit/sexp plugins so i can use it in normal mode with neovims text selection
OK, so that indicates that Calva's paredit was used, right? If you didn't have neovim plugin for it installed, I mean.
in insert mode, i can invoke e.g. ctrl-shift-right
, then cmd-x
to cut and cmd-v
to paste
hmm i'm worried that adding the vim-sexp plugin is going to end up with conflict based on what it says it does in insert mode
> Vim-sexp does intelligent bracket and double quote insertion like http://www.emacswiki.org/emacs/ParEdit. Unlike ParEdit, deletion of brackets that would cause an imbalance is not prevented, except in the limited case of <BS>
below.
You can set Calva's Paredit keymap to none
. Then you shouldn't get any conflict, I think.
I tried with Neovim now. I can do cmd+c
and cmd+v
also in command mode. Maybe there is something special with ctrl+c
...
ctrl+w
is bound by the neovim extension. Bring up the keyboard shortcuts editor and rebinding it should work. Or rebind Calva's grow selection command.