Fork me on GitHub

I'm doing my first project using deps.edn. I've installed, set up a simple project structure including deps.edn, and created a simple test program:

(ns parser.core
  (:require [clj-antlr :as a])

(def p (a/parser "resources\\Cadr.g4"))
(p "caddr")


Here's the contents of my deps.edn:

{:paths ["src"]
 :deps {clj-antlr/clj-antlr {:mvn/version "0.2.6"}}}


When I run clojure -Xproject/find-deps, it seems to download a bunch of stuff and built a .cpcache directory, but when I try to run a repl after that, it complains because it can't find clj_antlr__init on the classpath. What magic incantation do I need to make clojure run a repl with my dependency loaded?


You need to know the correct namespace


The ns form deals in namespaces


The name you put in your deps.edn is the name of the library (technical the artifact and group ids in a macro repo)


The library is composed of some namespaces


You will have to look at the documentation for the library to see what the namespaces are


Then you can use those namespace names in the ns form

hiredman02:10:57 the readme includes some calls to require that show the correct namespace name


And this kind of question really belongs in #beginners


I've actually been using the library for the past couple weeks in a couple of different lein-based projects. I just didn't remember to add the .core to the antlr requirement and since the error message didn't actually say anything about antlr.core (only mentioning the class corresponding to the clj-antlr namespace) and being somewhat unfamiliar with deps.edn-based projects, I figured something was going wrong with loading the dependency. Sorry to have disturbed.


@noisesmith @schmee a bit of a late comment and may be it is known, but iiuc | is used for: in clojure clr. i think i've seen @alexmiller warn people away from using it for symbol names in jvm clojure, but i don't have a reference for that.

Alex Miller (Clojure team)12:10:27

We are reserving it as a possible symbol delimiter so Iā€™d recommend not using it in symbols or keywords


thanks for the clarification

Alex Miller (Clojure team)20:10:16

this is similar to Lisp |foo bar| would be a symbol with name foo bar


I'm trying to set the clojure.javadoc/*feeling-lucky-url* to duckduckgo (the google url that's the default no longer seems to work for automatic redirects. The duckduckgo query should be prepended by a backslash to do the automatic redirect to the first result. I found this example here*feeling-lucky-url*

(binding [*feeling-lucky-url* "\\"]
  ( your-class))
However this gives me the following error:
Illegal character in query at index 26: \...
I also tried using the url encoded backslash "%5C" is there a way to force the slash in the url here?


You may need \\\\


gives the same error


What OS, JDK version, Clojure version are you using? I tried your first expression above replacing your-class with java.lang.Long and it worked. macOS 10.14.6, Oracle JDK 1.8.0_192, Clojure 1.10.1 in my case.


Also worked for me with macOS 10.14.6, AdoptOpenJDK 11.0.4, Clojure 1.10.1


on openjdk 13 on windows


Long will be in the default javadoc urls though and wouldn't trigger the feeling lucky search


(that works for me to). it has to be an unrecognized class to trigger the search


Have an example class you tried that gave the error that I can test with?

Daniel Stephens16:10:00

@U064UGEUQ can you run ( "")?


I'm using net.openhft.chronicle.queue.impl.single.SingleChronicleQueue but I believe it will have to be something on your classpath


I had never tried clojure.lang.PersistentVector as a class to that before, and was surprised to see it find a relevant page.

Daniel Stephens16:10:39

I just used

(binding [*feeling-lucky-url* "\\"]
  ( (type (fn []))))
which worked for me


does it automatically redirect you to the javadoc page? <ine just shows me search results, but I'm trying to get it to automatically redirect


that works to load search results but without the redirect, which I believe is the origianlly intended behavior of the feeling lucky fallback


I also just tried with (type (fn [])) , and it took me to a duckduckgo page in my default Google Chrome browser, with the search box filled with \user$eval153$fn__154.html

šŸ‘ 3

I think the problem might be that ultimately the string is being passed to URI to be browsed, and backslash is invalid but if I encode the backslash it tries to encode it again?


yeah I get that too


if you paste

in your webbrowser it takes you directly to the javadoc without search results

Daniel Stephens16:10:38

that works with the redirect for me from the repl with the original url you posted

Daniel Stephens16:10:46

I'm on ubuntu though


ok hmmm maybe a windows thing, weird


wait now it's working

šŸ˜… 3

Ok this is what I was looking for

(binding [*feeling-lucky-url*
          (URI. "")]
  (javadoc []))
this works now šŸ™‚ thanks!

Daniel Stephens16:10:37

ahh nice, preemtively make it a URI šŸ‘

Daniel Stephens19:10:47

java.lang.IllegalAccessException: Class clojure.lang.Reflector can not access a member of class org.apache.kafka.streams.state.internals.ValueAndTimestampDeserializer with modifiers "public final"
any idea why this happens, I'm just trying to get the value and it's public

Daniel Stephens19:10:32

ahh, dw, the class itself is package private


Is (<!! (async/into [] ch)) the most idiomatic way to extract all values in a channel into a collection? I wasn't sure if I missed a collecting or dumping function