Fork me on GitHub
#clojure
<
2018-09-27
>
seancorfield00:09:12

I haven't tried it. We're used to SQL so I haven't had much interest in trying datalog-over-JDBC.

lilactown00:09:09

I'm mostly interested in it because 1. I'm a SQL neophyte 2. We're writing a GraphQL service, so being able to compose queries easily is going to be important

seancorfield00:09:38

Cool. Let us know how walkable works out once you've tried it! πŸ™‚

jaawerth00:09:40

oooh, I generally prefer composable query builders but walkable looks really neat

stijn13:09:06

is there a command in the cli tools to only retrieve dependencies and not start the repl? (it's for running on a build server)

mpenet13:09:39

with clj not sure

stijn13:09:53

yes, I mean with clj indeed

stijn13:09:14

ok -Spath seems to work

jeff.terrell16:09:37

If I want to have namespaces com.a.b.c, com.a.b.d, and com.a.b.e (etc.), do they have to live in a com/a/b/ directory on the classpath or can I collapse the unnecessarily nested directories, e.g. com.a.b/{c,d,e}.clj? I tried the latter just now and I'm getting the exception below, but I'm not sure if I'm hitting a JVM limitation or just doing something wrong. > Could not locate com/a/b/c__init.class or com/a/b/c.clj on classpath.

lilactown16:09:28

the JVM expects the folder hierarchy to match the namespace hierarchy

jeff.terrell16:09:57

OK. No way around that, huh? 😞 Thanks for the info.

joelsanchez16:09:34

@lilactown @jeff.terrell that'd be Clojure, not the JVM. look at clojure.core/root-resource, clojure.core/load and of course RT/load

user=> (#'clojure.core/root-resource 'my.great.namespace)
"/my/great/namespace"

πŸ‘ 4
andy.fingerhut16:09:37

To be hyper-precise, I've seen Stuart Halloway describe this as "convention" -- you could technically put all code in one big file with (ns name ...) every so often, with namespaces honoring any dependency ordering between them, and call (load-file "filename.clj"). I've never seen anyone do that for anything, and the resource name "convention" is necessary if you use load, require, etc.

the2bears17:09:16

As per the JVM, it's the classloader that expects the bytes in a certain spot. For example, if you want to load the class 'com.foo.bar' the classloader is coded to look in that directory structure. It is, as far as I can tell, a convenience and a convention. You ask the classloader to load a class, it thinks, "Where might I find the bytes for this?"

noisesmith18:09:19

right, but clojure namespaces can be loaded without using a classloader, via load-string or load-file for example

noisesmith18:09:07

but once you use require or load, you need the ns file to be in a predictable place based on a classloader

the2bears18:09:25

Yes, just pointing out the legacy reasons for the class path structure mirroring the directory structure (for Java).

jstaab18:09:46

Hi there, I'm trying to figure our how to reload my code by calling clojure.tools.namespace.repl/refresh from a file watcher invoked from the repl, but I keep getting java.lang.IllegalStateException: Can't set!: *ns* from non-binding thread. I think this is because the file watcher I'm using (juxt.dirwatch) runs in a different thread and does the callback from there. Is there any way I can force the callback to happen in the repl/caller's own thread?

noisesmith18:09:17

@jstaab how do you create the thread that is calling refresh?

jstaab18:09:07

(defn watch [] (juxt.dirwatch/watch-dir (fn [_] (refresh)) ( "src")))

jstaab18:09:13

Then I call (watch) from the repl

jstaab19:09:58

It looks like dirwatch uses an agent and send-off, which I'm not really familiar with

seancorfield19:09:23

@jstaab Try using bound-fn instead of fn in that.

πŸ‘ 4
jstaab19:09:07

Nice! I think that did the trick. Thanks!

sufaber20:09:46

Has anybody integrated Algolia in a clj application? We have postgres as db