I'm doing my first project using deps.edn. I've installed http://practicalli.github.io/clojure/clojure-tools/install/install-clojure.html, set up a simple project structure including deps.edn, and created a simple test program:
(ns parser.core
(:require [clj-antlr :as a])
(:gen-class))
(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
https://github.com/aphyr/clj-antlr 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: https://github.com/clojure/clojure-clr/wiki/Specifying-types 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.
We are reserving it as a possible symbol delimiter so Iād recommend not using it in symbols or keywords
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 https://clojuredocs.org/clojure.java.javadoc/*feeling-lucky-url*
(binding [clojure.java.javadoc/*feeling-lucky-url* "<https://duckduckgo.com/?q=>\\"]
(clojure.java.javadoc/javadoc your-class))
However this gives me the following error:
Illegal character in query at index 26: <https://duckduckgo.com/?q=>\...
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?
@jjttjj can you run (clojure.java.browse/browse-url "<http://google.com>")
?
I'm using net.openhft.chronicle.queue.impl.single.SingleChronicleQueue but I believe it will have to be something on your classpath
@dstephens yes
I had never tried clojure.lang.PersistentVector as a class to that before, and was surprised to see it find a relevant page.
I just used
(binding [clojure.java.javadoc/*feeling-lucky-url* "<https://duckduckgo.com/?q=>\\"]
(clojure.java.javadoc/javadoc (type (fn []))))
which worked for medoes 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
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
<https://duckduckgo.com/?q=%5Cclojure/lang/PersistentVector.html>
in your webbrowser it takes you directly to the javadoc without search resultsthat works with the redirect for me from the repl with the original url you posted
I'm on ubuntu though
ok hmmm maybe a windows thing, weird
wait now it's working
Ok this is what I was looking for
(binding [clojure.java.javadoc/*feeling-lucky-url*
(URI. "<https://duckduckgo.com/?q=%5C>")]
(javadoc []))
this works now š thanks!ahh nice, preemtively make it a URI š
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 publicahh, dw, the class itself is package private
thanks for the clarification
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
this is similar to Lisp |foo bar|
would be a symbol with name foo bar