How can I eval a function in repl?

… without additional manual deps and require.

Let’s pretend for a sec that I’m in the middle of something and have an intent.
A function from the internets looks like a good option to eval, to try.

The best way I’ve found is to pull and run it (with lucid.package and lucid.core.namespace).

I want (a-lib/a-func & args) for the first call. And (a-func & args) for subsequent call.
Are there any better ways (except my-own-eval for repl) to support my dev process?

Can you explain better what you mean, give a concrete example maybe?

Hi Didier, here is copy/paste from my repl (“you” in my internal dialog):

user=> (def c (chan 1))
CompilerException java.lang.RuntimeException: Unable to resolve symbol: chan
--- ok, you don't know yet know what "chan" i need

user=> (def c (clojure.core.async/chan 1))
CompilerException java.lang.ClassNotFoundException: clojure.core.async
--- how many clojure.core.async/chan are in the world?

user=> (pull '[org.clojure/core.async "0.4.474"])
RESOLVED: org.clojure:core.async:pom:0.4.474
--- you wanted number, take it 0.4.474, let's not pretend that it was wise lib version selection, I've just copied it from async github page
--- btw, next time you can use pull function from zcaudate/lucid.package without additional request

(def c (clojure.core.async/chan 1))
CompilerException java.lang.ClassNotFoundException: clojure.core.async
--- i see, you think i just like to upload libs, just for fun

user=> (require '[clojure.core.async :refer [go chan >! <!!]])
--- amazing

user=> (def c (clojure.core.async/chan 1))
user=> (def ca (chan 1))
--- do you understand concept of suggestion

Oh, I see, ya that would be cool. Actually just looking into pull from lucidity is pretty neat.

I wonder if a nRepl middleware could do the trick.

Something that would automatically handle the classnotfoundexception by doing a search in clojars and then a lucidity pull of the best result, and then re-trying.

Anyway, I don’t know of anything like that currently.