Fork me on GitHub
Martynas Maciulevičius10:02:39

How does one install sci as an external dependency? I try to run tests of malli and they fail with this error: :malli.core/sci-not-available


Include org.babashka/sci {:mvn/version "0.3.0"}

Martynas Maciulevičius10:02:40

What should be the file? ~/.clojure/deps.edn?


The deps.edn in your project. But if you are running malli's tests from the malli repo, it's likely that you'll have to include some alias. Ask in #malli


If you are working on malli, maybe you can also upgrade SCI, it has some performance boosts in 0.3.0.

Martynas Maciulevičius10:02:21

Unfortunately I only want to fix one bug 🙂


Can I add core.halt-when in user space?


@benjamin.schwerdtner halt-when is added on master, available in the next release. you can download a master snapshot from or install using

bash <(curl ) --version 0.7.5-SNAPSHOT --dir .

catjam 2

but you could also add it in user space using (intern 'clojure.core (fn ...))


nice thanks

Martynas Maciulevičius15:02:08

Hey. Is there a way to use muuntaja in babashka? It says that it can't find java.util.concurrent.ConcurrentHashMap.


Can you explain what you are doing?


muuntaja is unlikely to work with babashka since babashka doesn't support deftype .

Martynas Maciulevičius16:02:01

I want to parse JSON input. But it crashes for some reason.

bash scripts/ 
----- Error --------------------------------------------------------------------
Type:     java.lang.Exception
Message:  Unable to resolve classname: java.util.concurrent.ConcurrentHashMap
Location: muuntaja/parse.clj:3:3

----- Context ------------------------------------------------------------------
1: (ns muuntaja.parse
2:   (:require [clojure.string :as str])
3:   (:import (java.util.concurrent ConcurrentHashMap)))
     ^--- Unable to resolve classname: java.util.concurrent.ConcurrentHashMap
5: ;;
6: ;; Cache
7: ;;

----- Stack trace --------------------------------------------------------------
muuntaja.parse                   - muuntaja/parse.clj:3:3
muuntaja.core                    - muuntaja/core.clj:3:3
user                             - <expr>:1:10

Martynas Maciulevičius16:02:33

Also this: [metosin/muuntaja "0.6.8"] Maybe it's an old version?


Why do you need muuntaja for parsing json?


Also, again: even if we added that class, muuntaja wouldn't work because of deftype

Martynas Maciulevičius16:02:04

Well the project's original author was parsing JSON this way. So I thought that I don't want to add cheshire as I should reuse the same lib. But well... it doesn't work.


but muuntaja also uses cheshire.


you can use cheshire directly in babashka


don't use a complex library for something which should be simple

Martynas Maciulevičius16:02:22

I know. And I used it this way. But JAR build failed because I didn't include cheshire into the project's lein dependencies. Which meant that I have to not use cheshire for that namespace (import failed).

Martynas Maciulevičius16:02:53

I think you're right. And that means that the library wasn't used properly in the first place.

Martynas Maciulevičius16:02:51

Yep. I didn't even know that muuntaja uses cheshire. Thanks.

Martynas Maciulevičius08:02:20

This says that muuntaja uses jsonista by default and cheshire is one possible adapter that could be used:


Ok, makes sense. But if you want to parse JSON in bb, you don't need this library. Just use Cheshire

Martynas Maciulevičius08:02:12

Yes but that means that I would need to include the cheshire into the project's dependencies even if I would use jsonista . Because if I import cheshire then JAR doesn't want to build. I may use profiles for that but it's more cumbersome. Or then I'd need to move out the babashka-main namespace. I don't yet know what would be the best pattern for that.


You could also use reader conditionals for this or a .bb file which is prioritized over .clj


Or even a macro that checks if you are in bb or not

Martynas Maciulevičius08:02:47

Does bb have a reader conditional? Also I can't return from namespace evaluation once I detect that I can't run it. It's probably my best bet if I'd include both libraries into the project.


Yes, see the book and search for reader conditionals


You don't have to include Cheshire for bb, it's built in


If your code is public then I could have a look

Martynas Maciulevičius11:02:54

Nah, my code is not public. But it's fine. I figured it out. I'll use the conditionals in multiple places and I'll have cljc file. 🙂


That works. You can also isolate the change in one place in a function and then call that json function throughout the rest of your code.

Martynas Maciulevičius11:02:52

Yes. This is what I ended up with.

👍 1
Martynas Maciulevičius11:02:29

I have a conditional in imports and then I have a conditional in encode/decode functions. I don't yet know what I'll do if I'll need a InputStream or OutputStream as output but that's fine for now.


is that a built-in java class?

Martynas Maciulevičius11:02:27

No, I think IOStream is something that I made up in my mind. I think it could come from C++... Java has InputStream and OutputStream.


those are available in bb

Martynas Maciulevičius11:02:24

No, that's fine. I was thinking about JSON parsing into a Java stream. But cheshire should do it just fine. I'll only need to add a function that does this.


how should I remove babashka options from command-line-args. E.g. "--parallel" will be an arg I was misspelling the arg that's why 🙈 all good


naively I just (remove #{"--paralles"} args)


hmm, --parallel should not end up in *command-line-args* , might be a bug.


you are right. It was because I misspelled it so the misspelled one showed up :thumbsup:


great, thanks :)