Fork me on GitHub

As far as query capability is concerned, is there any reason to choose core.logic over datomic for (what I believe) is a constraint logic problem? I'm familiar with both, expert in neither, and I'm trying to figure out when I'd prefer one query model over the other.


Datomic is a whole database, that you need to host and operate or pay for in the cloud. I'd say if all you want is a constraint engine then core.logic is what you want. If you're also looking to persist state, then datomic is what you want.


hi all! I'm a computer engineer and I'm interested in Clojure because of the overtone framework, which seems very good. I'm having troubles in setting up Clojure with Vim. I set up a new project with lein new test. Then cd test and lein repl. I open vim src/test/core.clj from another terminal. I want to use Repl and auto formatting, but I get "FileNotFoundException Could not locate test/core__init.class or test/core.clj on classpath. clojure.lang.RT.load (". My (Neo)Vim configuration looks like this.


There is a #vim channel that may be more useful for you. Also there is #beginners

Vincent Cantin11:11:08

I just met a strange behavior in the Clojure repl: :3d is accepted as a keyword, but :aoeu/3d is not. Bug or feature? RuntimeException Invalid token: :aoeu/3d clojure.lang.Util.runtimeException (


keywords starting with numeric characters will work, and even (keyword "hello there") will work, but should be avoided

Vincent Cantin12:11:13

So the bug looks like :3d being accepted.

Alex Miller (Clojure team)17:11:03

there’s a lot of history on this but we have grand-fathered in keywords that start with a number


is it possible to have multiple implementations of a multimethod for the same dispatch value? ie, i want to catch :foo/bar as a dispatch value in more than one place and handle it differently for each implementation


if you want different dispatch, why not have different values?


if that’s not possible, there is nothing stopping you from having a cond in your multimethod and do more dispatch there, but that kind of defeats the purpose of multimethods


I believe he wants to provide different implementations in different namespaces, such that the "local" or "closest" implementation will be used.


This way, a new namespace could come with its own implementation of a specific method.


ahh, that makes sense


what @the is saying, with one caveat. I want both to run 🙂


oh well… i guess i need to refactor


@emil0r Refactor, or make a macro


its probably buggy because it involves mutable-state, buuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuut


(give me a few minutes to hack something out


(something something global hashmap, taking longer than I thought)


(okay I give up in shame)


I made a quick test in the repl, and to me it looks like later implementations of the same defmethod would overwrite/shadow earlier definitions.

Alex Miller (Clojure team)18:11:51

you can only have one defmethod impl per dispatch value and last one def’ed wins


is there a way to syntax quote a symbol, while already in a syntax quote?


I’m trying to come up with a better example of what I’m trying to do, hold on a sec…

Alex Miller (Clojure team)18:11:48

all symbols within a syntax quote will (deeply) be resolved to qualified symbols


I figured it out. basically, I’m used to doing

to get a namespaced variable, but that doesn’t work if you’re already in a syntax quote

Alex Miller (Clojure team)18:11:20

right, you actually just need foo

Alex Miller (Clojure team)18:11:37

syntax quote resolves all symbols inside it


yes, but in this case the foo is passed in to the macro as a keyword, which means I have to do something like

`~(name the-keyword)
and I couldn’t figure out the right syntax for that 😄

Alex Miller (Clojure team)18:11:07

well that isolation doesn’t need to be in syntax quote at all, but I guess you figured that out


yup 🙂 as an intellectual exercise, is it even possible to do this with the right combination of ` and ~?


so I did (symbol (-> *ns* ns-name name) (name method)) outside of the macro and then unquoted that thing instead


to go from a keyword to a namespaced symbol

Alex Miller (Clojure team)18:11:16

as of latest 1.10, you can just call symbol on a keyword to get the symbol

Alex Miller (Clojure team)18:11:52

although that won’t take care of resolving in the current namespace

Alex Miller (Clojure team)18:11:45

but resolve is probably preferable for that


neat! 🙂

Alex Miller (Clojure team)18:11:34

actually, I guess that gets you to a var which is maybe not what you’re looking for


speaking of, how does one go from a var to the namespaced symbol of the var?

Alex Miller (Clojure team)18:11:49

well, as of latest 1.10, with symbol :)

😄 8
Alex Miller (Clojure team)18:11:04

but otherwise you have to reach into the private fields of clojure.lang.Var


Hi, can anybody help me with this? I have a list of maps with this structure:

({:a 1} {:b 2} {:c 3})
How could I get someting like this?
({:a 1 :b 2 :c 3})


One way is (list (apply merge ms))


Another: (list (reduce conj ms))


What a beauty


It worked! Thanks!! 😍


I would like to write items to a file one a time from multiple concurrent http requests, and would like to ensure that only one write is made at a time. This would be relatively low volume, but would still like it to be efficient. What's the suggested way to handle this in clojure?


a simple way to do it is a dedicated writer thread and a queue for incoming strings

Alex Miller (Clojure team)19:11:07

an agent is a simple way to cover that


Ok, I will look into both of those. Thanks!


@alexmiller is there a good pattern for an agent "owning" an io destination and writing a series of Strings? I think the thing that trips me up is having to pass it a function that returns the new value of the agent which seems clumsy.

Alex Miller (Clojure team)20:11:23

just use nil as the value

Alex Miller (Clojure team)20:11:29

that is, don’t use one

Alex Miller (Clojure team)20:11:47

close over whatever state you need when you make the agent


oh, so just using it for synchronization and not the value itself


nice, I'll have to remember that trick

Alex Miller (Clojure team)20:11:14

there are some clojure loggers that do this

Alex Miller (Clojure team)20:11:28

I’ve used it for other “single writer” patterns too


Thanks Alex that sounds like exactly what I need.


hahahaha… that’s soooo messed up and cool 😄


anyways, if you just want to stack side effects across namespaces, thisll do ya


and now that "could" is answered, we get to the "should"

Lennart Buit20:11:12

your reasoning seems backwards


oh it totally is

Ian Fernandez20:11:32

what happened to Lacinia channel?


I don’t think there was a separate Lacinia channel, just the #graphql channel


how do you run tests with deps.edn instead of project.conf?


Tried :main-opts ["-e" "(require 'clojure.test) (clojure.test/run-all-tests)"] but the result is Exception in thread "main" clojure.lang.LispReader$ReaderException: java.lang.RuntimeException: EOF while reading, starting at line 1


Tried :main-opts ["-m" "clojure.main" "-e" "(require 'clojure.test) (clojure.test/run-all-tests)"] but the result is Exception in thread "main" java.lang.NullPointerException at clojure.main$main_opt.invokeStatic(main.clj:317)


What went wrong with -e?


:main-opts ["-e" "(require,'clojure.test),(clojure.test/run-all-tests)"] 


Because of the way the options are processed by the shell script and written to files and then read back in by the shell script, whitespace breaks things. But because Clojure treats , as whitespace, you can work around that issue.


But, yeah, as Alex suggests, look at the Cognitect test runner -- that's how we run everything at World Singles Networks these days.


Oh, the whitespace surprise is issue .


also, clojure.test isn't going to load your test namespaces, so you'd want to put them in your require or run something that knows how to find and load them


Oh yes - I used :extra-paths in the :test alias.








Alright I have a lib and an app that uses the lib; am converting from Leiningen to tools.deps. I used Leiningen "checkouts" to give the app a symlink to the lib so I would not have to constantly mvn install it. Can I do likewise with tools.deps? There is :classpath-overrides but I am puzzled what to set it to. For example, if I say ../lib/src then how will it find the resources?

Alex Miller (Clojure team)21:11:35

you could use :override-deps with a {:local/root … } dep instead


Isn't that bugged atm? I recall having to use classpath override to do this a while ago

Alex Miller (Clojure team)04:11:45

Oh shoot, I forgot that

Alex Miller (Clojure team)04:11:53

someone should fix that

Alex Miller (Clojure team)21:11:52

{:deps {my/lib {:mvn/version "1.2.3"}}
 :aliases {:dev {:override-deps {my/lib {:local/root "../lib"}}}}}




I often see them as a signal to jump ship out of a shell script and use a "real" programming language.


Which is what a user of deps.edn might in fact have thought they were doing


But it's turtles all the way down, you know


Yes, clj and clojure are right at the boundary between shell and Clojure, and parts of them must live with lowest common denominator I guess.


Let's not make excuses


It isn't clear how I am trying to make an excuse there. bash is what it is, and it isn't going to change fundamentally in the next 10 years, I doubt, nor would I try to.


Oh, right. But 59 well-placed ' and " in the shell script might cure the problem


That sounds to me like you are agreeing you don't like shells as general purpose programming language. If so, we are in violent agreement.


By the way I found your attention to the clojure jira, over the years, very helpful to my understanding.


(bow and scrape). I presume you enjoyed it also.


Cool, glad it helped someone else other than me -- I fear I may have spent more time on that than was mentally healthy for one person to do 🙂


Thats for sure but maybe recovery will be possible


I think I am in progress on that 🙂


I hope your statement above does not mean you feel any need to bow and scrape to me. I certainly don't think there is.

Alex Miller (Clojure team)21:11:42

you’re depending on my/lib, but override that artifact to point to a local project


Thanks Alex


I think I need to declare an alias wholly in /.clojure/deps.edn or wholly in a project's deps.edn; settings within an alias do not merge. For example, I tried putting alias :dev with :override-deps in my /.clojure and alias :dev (same key) with :extra-paths in the project, and the override-deps did not happen.


The doc tries to explain but I evidently misunderstood its merge-with merge

Alex Miller (Clojure team)22:11:22

the merge here is the latter one (and merge replaces)

Alex Miller (Clojure team)22:11:17

that is, what you’re saying is correct, aliases do not combine across different deps.edn files, they will be replaced if the same alias is in more than one