Fork me on GitHub

Writing a library that is mostly environment agnostic, using deps.edn, and planning for publishing to just mean tagging a git commit as a release. Currently in clj file, but want to make it cljc. How would you go about setting up a lib project for minimalist access to ClojureScript, just for testing cljs reader conditionals?

Slacki ng00:11:14

minimal cljs? you could try: for deps.edn: Directory tree: hello-world ├─ dev.cljs.edn ├─ deps.edn └─ src └─ hello_world └─ core.cljs In deps.edn {:deps {com.bhauman/figwheel-main {:mvn/version "0.2.17"} org.clojure/clojure {:mvn/version "1.10.0"} org.clojure/clojurescript {:mvn/version "1.11.4"} ;; add rebel-readline for advanced REPL readline editing com.bhauman/rebel-readline-cljs {:mvn/version "0.1.4"}} :paths ["src" "target" "resources"]} In dev.cljs.edn: {:main hello-world.core} In src/hello_world/core.cljs: (ns hello-world.core) (println "hazzah") Now you can start an auto-building / hot-reloading process. $ clojure -m figwheel.main -b dev -r


HoneySQL is all .cljc and runs tests for Clojure and ClojureScript so maybe you'll get some ideas from


@U04V70XH6 Not at all clear to me how you are verifying the cljs parts of the code in HoneySQL. I don't even see ClojureScript as a dependency in your deps.edn. ---- fyi: Found a todo on line 180 of, which you should be able to take care of using


@U90R0EPHA The cljs-test-runner brings in ClojureScript and the build script runs both the documentation tests and the code tests against ClojureScript and multiple versions of Clojure


Thanks @U04V70XH6. I think I'm following. Do you have this integrated into your Calva workflow in some way? Or do you need to step out and run the build script to get feedback for changes that affect cljs?


I don't currently have it integrated into Calva because I don't do any cljs -- so it's just via clojure -T:build ci (and the GH workflows) or clojure -T:build test :aliases '[:cljs]' if I want to run just the ClojureScript tests.


Why does unquoting not work for ,`'predicate` in the binding for clause? I'm looking for result (<<- (foo nil nil)), given symbol foo as an input. exorcise.core> (let [predicate 'foo clause (~'predicate nil nil)]` (<<- ~clause))` (exorcise.core/<<- (predicate nil nil))


~ is unquote, but ' is quote


you are unquoting then immediately quoting


Ok. Fixed using function instead of macro. 🙂 Thanks!


Is there a core function to do something like this? Ideally that works well with lazy (but not infinite) sequences?

(??? [:n :item] [1 2 3] [:foo :bar :baz] )
   => [{:n 1 :item :foo} {:n 2 :item :bar} {:n 3 :item :baz}]

Ben Sless11:11:52

The function map can take more than one collection. You can pass it the second and third collections. Does this help?


Oh yes, that makes this easy. Had no idea map could take more than one collection


(map (fn [n item]
       {:n n :item item}) [1 2 3] [:foo :bar :baz])
Thanks @UK0810AQ2


You can make it more dynamic if you want an arbitrary number of vectors (as long as your ks is the same size):

(map (fn [ks & xs] (zipmap ks xs)) (repeat [:n :item]) [1 2 3] [:foo :bar :baz])


(map (fn [ks & xs] (zipmap ks xs))
       (repeat [:n :item :item2])
       [1 2 3]
       [:foo :bar :baz]
       [:foo2 :bar2 :baz2])
;;=> ({:n 1, :item :foo, :item2 :foo2} {:n 2, :item :bar, :item2 :bar2} {:n 3, :item :baz, :item2 :baz2})


Someone recommended me doom emacs. Is there any intro somewhere on Clojure code editing + file management + navigation and anything else related on doom? Any screencast?


There are a great many videos on Doom Emacs (and Emacs in general) I’ve only created Clojure (although its largely the same from a usage point of view - some differences in key bindings. There is also a book Maybe there is something similar for Doom Emacs ?

👍 1

@U05254DQM I went through your tutorials sometime back when I tried spacemacs. After a while I gave up. But this time I will probably see this through.

practicalli-john17:11:03 is in early stages, but a nice alternative to Emacs potentially. Depends on a persons experience.

👍 1
practicalli-john17:11:57 has a brief guide to many of the Clojure aware editors if anyone is curious.


@U05254DQM I will try neovim out too. Why not


As long as you're trying things out, Calva is great choice too. Pez puts out videos on and pairs up sometimes with, like this in depth look at how editor<-->repl connections work in Calva;t=3162s

👍 1

@U90R0EPHA I have been using calva for some time now and it's where I do Clojure and I really love it and am very comfortable in it. I have a few reasons I'm interested in emacs though: 1. Some people swear by it. 2. When I last tried Spacemacs some time ago, I loved org mode. Just having org mode in my editor made me a better programmer (simply because I have trouble with focus and attention). I tried org mode in VSCode but it's not up to the task. 3. Everytime I use mouse, I feel a little guilty. I am familiar with Vim and I do like the evil mode. Last time I tried Spacemacs, I fell back on VSCode after a while. I guess I can always go back to it. Perhaps NeoVim might be a better fit - I don't know. I will try these out I guess.


One main developer experience distinction between Calva (VSCode actually) and Emacs/Neovim is that the latter are both completely keyboard driven. I had some success with VSpaceCode which makes VSCode mostly keyboard driven and so I added Calva key bindings to that project. So if using a mouse is okay then Calva (or even Cursive) are options, If keyboard focused, then Emacs/Neovim are hard to beat.


One challenge I have experienced with Calva is the lack of direct support for Clojure CLI user level aliases (maybe that has changed since I last tried. The user level aliases just work in Cider (Emacs/Spacemacs), so its strange they are not supported in Calva. Whist its fairly easy to select aliases from the project deps.edn file, user level aliases had to be mapped into the calva configuration manually. That configuration didnt support qualified keys, so unless things have changed the practicalli/clojure-deps-edn aliases are not usable in calva. I would really like to make more use of the Live Share feature of VSCode with Calva, it is a joyful experience, but the other hurdles mentioned are detrimental to my workflow unfortunately (perhaps time for a review during the winter holidays).


I disagree with the claim that VS Code is not good for a keyboard driven workflow (especially in Clojure with the help of Paredit). Code has a Command Palette (Ctrl-Shift-P on Win/Linux) with fuzzy search of all available commands that is quite good. Usually by typing less than one word, I can locate a command of interest with a descriptive name and the currently assigned shortcut next to it (including shortcuts I assigned myself). I can just search for occasionally used commands and quickly discover/rediscover shortcuts I don't know/remember. Additionally the shortcuts that are semi-standardized across numerous modern applications are much more likely to align with similar commands in Code than in any variant of Emacs or Vim. So even though the potential total power of a keyboard driven workflow is lower in Code, it is way easier to maximize usage of the power that is there, with reduced context switching when moving to other apps.


User aliases in Calva are currently only supported by manually listing the ones you want available in the VS Code config. Not ideal, but easy enough to work around. It has been at the back of my mind to look into improving that at some point. I think @U0ETXRFEW said at the time he implemented it, he wasn't sure how to locate the user conf file, but I think I should be able to solve that. (There is one benefit manually mapping user aliases: It is easy to exclude showing aliases that don't make sense to use in the editor. But I still think automatic discovery would be better.) All my user level aliases are namespace qualified, and work as expected after listing them in the config.


I'm unclear how you can drive everything in VSCode from the command pallet and never use a mouse. I wasn't aware that you can drive all the UI elements of VSCode via the command pallet. If so, then that is a major improvement and would mean no need for a project like VSpaceCode anymore. Something to test. I manage a Clojure CLI user level configuration of around 50 aliases. It's curious the only way I can use them is to write additional config. I agree that I would rather have automatic discovery or even just to be able to type in an alias that is not in the config. I assume this is related to how Calva populates a drop-down list of aliases. Pleased to hear that qualified alias names now work though. Thanks.


Hmm, it seems that you can't drive everything in VSCode with commands, disappointing.


I like that they focus on creating their own UI and don’t get caught up in trying to beat other editors on their strengths.


> I'm unclear how you can drive everything in VSCode from the command pallet and never use a mouse. I meant "keyboard driven" in that the mouse is only used selectively, in comparison to how most people use computers with a mouse driven workflow. I do think it would be possible to never use a mouse in VS Code. But the experience would be rather painful, requiring a lot of configuration and likely some extensions, still probably leave some bits of the interactivity inaccessible, and still lack the potential power of something like the Emacs ring buffer. I have pretty substantial experience with neovim. It was extremely frustrating needing to learn a keyboard shortcut for every possible interaction (other than highlighting). In many cases using the mouse to point somewhere could have been fast and satisfying. But instead there are many things I just never learned how to do, because I only have so much time and space in my brain to deal with the editor when I am trying to work on something else. --- I'm pretty sure there is not any inherent problem preventing discovery of user aliases. It just needs someone to have time to implement it that way.


Are there in other values in core that satisfy empty? besides [] () {} #{} "" nil ?

Alex Miller (Clojure team)17:11:54

there are lots of other cases that would "satisfy" empty? that are not those literals

Alex Miller (Clojure team)17:11:45

so depends why you're asking exactly


Making a test.check generator for empty values, want to cover as many cases as possible.

Alex Miller (Clojure team)17:11:14

any lazy seq that happens to contain no values

Alex Miller (Clojure team)17:11:31

Java iterables (where the source has no values)

Alex Miller (Clojure team)17:11:27

it's defined (through 1.11) per seqability so seqable? is a good guide (really implemented in RT/canSeq)


Great. Thank you. I'll probably skip a few of those for now, but record this list to fill in as much as I can later.

Alex Miller (Clojure team)17:11:33

as of 1.12, it also expands to cover anything counted? (per

Alex Miller (Clojure team)17:11:43

which is probably not that different of a set


The list goes on and on... 😄


I wonder if there is a good way to work from the other direction of gen/any? Obviously runs quickly into the problem of too many tries to find an empty value, and I think max-tries would need to be raised outrageously high to expect a fairly complete collection.


Does gen/any? even generate Java collections?


I guess that's not surprising.