Fork me on GitHub
#beginners
<
2022-04-11
>
Gavin Freeborn03:04:50

Hey everyone, I am new to ClojureScript and am looking to add animations to my website. Specifically, I want a swiping animation for images similar to what you see on Tinder. Since my front-end knowledge is really lacking I am not sure what the best approach would be. I've heard you could do this with CSS but figured I'd ask the clj community what they would use.

dgb2306:04:33

CSS scroll snap and a horizontal scroll bar should het you pretty close with minimal effort.

v3ga08:04:27

How can I write this better? The bottom example is what I try to do but of course if the database is updated the template is still holding on to that initial collection. https://gist.github.com/v3gal0g/ebec5457185ac065186f79871ac69b38

leifericf09:04:07

In Clojure, do we have access to libraries written in other JVM languages, such as Kotlin and Scala, through the same interoperability syntax we have for libraries written in Java?

jumar09:04:43

Do you have an example in mind?

leifericf09:04:33

@U06BE1L6T At first, I thought about Akka, Scala’s actor model implementation. And I found that someone has already written a Clojure wrapper for that. But then I started thinking about it more generally. In the sense that should I see a library written in Scala which satisfies my future needs, ought I use or wrap the Scala library or write my own in Clojure if it doesn't already exist?

Eddie14:04:38

You can interop with the same syntax, but the experience might not be as seemless. It all depend on how the other language structures its compiled bytecode. I have used a lot of Scala code in my Clojure projects. Things are mostly the same as java but if you have trouble it helps to use clojure.reflect or datafy on the Scala class in the REPL to explore around and see the API of each class from the Clojure perspective. I created https://github.com/erp12/fijit to help with Scala-from-Clojure interop. It serves 2 purposes: 1. The functions it provides are useful (at least to me). 2. The source code contains plenty of interop examples for me to reference later when I inevitably forget the more subtle aspects. Any feedback or suggestions on how to improve the library is of course welcome.

👍 1
didibus04:04:25

Yes you can, but some other langs don't play as well with Java, and similarly might be a bit more annoying in Clojure. Like if a Scala collection doesn't implement java.util.List you can't treat it as one for example.

👍 1
Sakib10:04:17

I have created a ring-jetty server. My handler is following.

(defn handler [request]
  (let [params (ring-codec/form-decode (:query-string request))
        str1 (get params "str1")
        str2 (get params "str2")]
    {:status  200
     :headers {"Content-Type" "text/html"}
     :body    (str "Hello, " str1 " and " str2)
     }))
I can successfully run the server from REPL. And request and response are as expected. But I got the following error
2022-04-11 16:51:56.563:INFO:oejs.Server:nRepl-session-1f021268-5d78-4b27-91d7-f29c3b9dc953: jetty-9.4.44.v20210927; built: 2021-09-27T23:02:44.612Z; git: 8da83308eeca865e495e53ef315a249d63ba9332; jvm 11.0.14.1+1-b1751.46
2022-04-11 16:51:56.594:INFO:oejs.AbstractConnector:nRepl-session-1f021268-5d78-4b27-91d7-f29c3b9dc953: Started ServerConnector@5c8bde6{HTTP/1.1, (http/1.1)}{0.0.0.0:3000}
2022-04-11 16:51:56.595:INFO:oejs.Server:nRepl-session-1f021268-5d78-4b27-91d7-f29c3b9dc953: Started @4812ms
2022-04-11 16:51:59.476:WARN:oejs.HttpChannel:qtp2025911030-22: /favicon.ico
java.lang.NullPointerException
	at ring.util.codec$form_decode.invokeStatic(codec.clj:140)
	at ring.util.codec$form_decode.invoke(codec.clj:133)
	at ring.util.codec$form_decode.invokeStatic(codec.clj:138)
	at ring.util.codec$form_decode.invoke(codec.clj:133)
	at scramblies_challenge_flexiana.core$handler.invokeStatic(core.clj:15)
	at scramblies_challenge_flexiana.core$handler.invoke(core.clj:14)
	at ring.adapter.jetty$proxy_handler$fn__484.invoke(jetty.clj:27)
	at ring.adapter.jetty.proxy$org.eclipse.jetty.server.handler.AbstractHandler$ff19274a.handle(Unknown Source)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
	at org.eclipse.jetty.server.Server.handle(Server.java:516)
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:400)
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:645)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:392)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
	at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:137)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
	at java.base/java.lang.Thread.run(Thread.java:829)
Can anyone explain this please?

dgb2311:04:41

Is this your only handler?

dgb2311:04:40

If you are handling anything that doesn’t have a :query-string then you might hit this one here: https://github.com/ring-clojure/ring-codec/blob/master/src/ring/util/codec.clj#L161

dgb2311:04:29

.contains is a string method that explodes if the argument is nil (is my assumption).

dgb2311:04:15

and from the looks of it seems as you are sending the request from a browser that requests a favicon, which might be the trigger here.

gerritjvv12:04:55

(ring-codec/form-decode (:query-string request)
(:query-string request) <-- this will always return nil if :query-string doesn't exist in the request map

gerritjvv12:04:51

try and print out what the request is so you can see the properties. You can easily avoid the null pointer exception by several ways:

gerritjvv13:04:54

1. use if if-let i.e

(if-let [params (:query-string request)] ... )

gerritjvv13:04:37

2. use a default value (:query-string request "")

gerritjvv13:04:15

also if you would like to check "if params, if str1, if str2, check out the some-> macro thttps://clojuredocs.org/clojure.core/some-%3E

pooriaTaj15:04:40

ERROR: Unhandled REPL handler exception processing message {:op stacktrace, :id 10, :session 851414bb-6000-4e18-bcf2-0bbba1e659e6}
java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class io.pedestal.http.ring_middlewares__init
        at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
        at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
        at clojure.core$deref_future.invokeStatic(core.clj:2304)
        at clojure.core$future_call$reify__8477.deref(core.clj:6976)
        at clojure.core$deref.invokeStatic(core.clj:2324)
        at clojure.core$pmap$step__8490$fn__8494.invoke(core.clj:7027)
        at clojure.lang.LazySeq.sval(LazySeq.java:42)
        at clojure.lang.LazySeq.seq(LazySeq.java:51)
        at clojure.lang.RT.seq(RT.java:535)
        at clojure.core$seq__5419.invokeStatic(core.clj:139)
        at clojure.core$map$fn__5888.invoke(core.clj:2761)
        at clojure.lang.LazySeq.sval(LazySeq.java:42)
        at clojure.lang.LazySeq.seq(LazySeq.java:51)
        at clojure.lang.Cons.next(Cons.java:39)
        at clojure.lang.RT.next(RT.java:713)
        at clojure.core$next__5403.invokeStatic(core.clj:64)

        at clojure.core.protocols$fn__8181.invokeStatic(protocols.clj:169)
        at clojure.core.protocols$fn__8181.invoke(protocols.clj:124)
        at clojure.core.protocols$fn__8136$G__8131__8145.invoke(protocols.clj:19)
        at clojure.core.protocols$seq_reduce.invokeStatic(protocols.clj:31)
        at clojure.core.protocols$fn__8168.invokeStatic(protocols.clj:75)

        at clojure.core.protocols$fn__8168.invoke(protocols.clj:75)
        at clojure.core.protocols$fn__8110$G__8105__8123.invoke(protocols.clj:13)
        at clojure.core$reduce.invokeStatic(core.clj:6830)

        at clojure.core$into.invokeStatic(core.clj:6897)
        at clojure.core$mapv.invokeStatic(core.clj:6905)
        at clojure.core$mapv.invoke(core.clj:6905)

        at cider.nrepl.middleware.stacktrace$flag_duplicates.invokeStatic(stacktrace.clj:205)
        at cider.nrepl.middleware.stacktrace$flag_duplicates.invoke(stacktrace.clj:194)
        at cider.nrepl.middleware.stacktrace$analyze_stacktrace.invokeStatic(stacktrace.clj:219)
        at cider.nrepl.middleware.stacktrace$analyze_stacktrace.invoke(stacktrace.clj:213)
        at cider.nrepl.middleware.stacktrace$analyze_cause.invokeStatic(stacktrace.clj:323)
        at cider.nrepl.middleware.stacktrace$analyze_cause.invoke(stacktrace.clj:314)
        at cider.nrepl.middleware.stacktrace$analyze_causes$fn__5279.invoke(stacktrace.clj:348)

        at clojure.core$map$fn__5880$fn__5881.invoke(core.clj:2746)
        at clojure.core$take_while$fn__5931$fn__5932.invoke(core.clj:2905)

        at clojure.lang.Iterate.reduce(Iterate.java:81)
        at clojure.core$transduce.invokeStatic(core.clj:6885)
        at clojure.core$into.invokeStatic(core.clj:6901)
        at clojure.core$into.invoke(core.clj:6889)
        at cider.nrepl.middleware.stacktrace$analyze_causes.invokeStatic(stacktrace.clj:347)
        at cider.nrepl.middleware.stacktrace$analyze_causes.invoke(stacktrace.clj:339)
        at cider.nrepl.middleware.stacktrace$handle_stacktrace.invokeStatic(stacktrace.clj:356)
        at cider.nrepl.middleware.stacktrace$handle_stacktrace.invoke(stacktrace.clj:353)

        at clojure.lang.Var.invoke(Var.java:388)
        at cider.nrepl$wrap_stacktrace$fn__2549.invoke(nrepl.clj:430)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)

        at nrepl.middleware.lookup$wrap_lookup$fn__1854.invoke(lookup.clj:52)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_apropos$fn__2425.invoke(nrepl.clj:127)

        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)

        at nrepl.middleware.interruptible_eval$interruptible_eval$fn__1268.invoke(interruptible_eval.clj:154)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at nrepl.middleware.session$add_stdin$fn__1386.invoke(session.clj:379)

        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_trace$fn__2565.invoke(nrepl.clj:462)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)

        at nrepl.middleware.dynamic_loader$wrap_dynamic_loader$fn__1454.invoke(dynamic_loader.clj:98)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)

        at cider.nrepl$wrap_resource$fn__2533.invoke(nrepl.clj:404)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at nrepl.middleware.load_file$wrap_load_file$fn__1810.invoke(load_file.clj:81)

        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_debug$fn__2451.invoke(nrepl.clj:161)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)

        at cider.nrepl$wrap_xref$fn__2599.invoke(nrepl.clj:512)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_content_type$fn__2409.invoke(nrepl.clj:107)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at nrepl.middleware.completion$wrap_completion$fn__1778.invoke(completion.clj:58)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_undef$fn__2581.invoke(nrepl.clj:491)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_slurp$fn__2417.invoke(nrepl.clj:119)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_spec$fn__2541.invoke(nrepl.clj:414)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_info$fn__2475.invoke(nrepl.clj:206)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_clojuredocs$fn__2607.invoke(
j:527)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_macroexpand$fn__2493.invoke(nrepl.clj:285)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_out$fn__2509.invoke(nrepl.clj:332)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_test$fn__2557.invoke(nrepl.clj:440)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_format$fn__2467.invoke(nrepl.clj:192)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_classpath$fn__2433.invoke(nrepl.clj:135)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_enlighten$fn__2459.invoke(nrepl.clj:188)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at nrepl.middleware.sideloader$wrap_sideloader$fn__1891.invoke(sideloader.clj:108)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_ns$fn__2501.invoke(nrepl.clj:298)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_inspect$fn__2485.invoke(nrepl.clj:225)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at nrepl.middleware.caught$wrap_caught$fn__1201.invoke(caught.clj:97)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_refresh$fn__2525.invoke(nrepl.clj:378)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_tracker$fn__2573.invoke(nrepl.clj:480)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at nrepl.middleware.print$wrap_print$fn__1168.invoke(print.clj:234)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_profile$fn__2517.invoke(nrepl.clj:341)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at nrepl.middleware.session$session$fn__1371.invoke(session.clj:325)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at nrepl.server$default_handler$fn__1939.invoke(server.clj:141)
        at nrepl.server$handle_STAR_.invokeStatic(server.clj:24)
        at nrepl.server$handle_STAR_.invoke(server.clj:21)
        at nrepl.server$handle$fn__1907.invoke(server.clj:41)
        at clojure.core$binding_conveyor_fn$fn__5772.invoke(core.clj:2034)
        at clojure.lang.AFn.call(AFn.java:18)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class io.pedestal.http.ring_middlewares__init
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:398)

        at clojure.lang.RT.classForName(RT.java:2212)
        at clojure.lang.RT.classForName(RT.java:2221)
        at clojure.lang.Compiler.maybeResolveIn(Compiler.java:7442)
        at clojure.core$ns_resolve.invokeStatic(core.clj:4358)
        at clojure.core$ns_resolve.invokeStatic(core.clj:4347)
        at clojure.core$ns_resolve.invoke(core.clj:4347)
        at cider.nrepl.inlined_deps.orchard.v0v8v0.orchard.java$resolve_class$fn__4766.invoke(java.clj:306)
        at cider.nrepl.inlined_deps.orchard.v0v8v0.orchard.java$resolve_class.invokeStatic(java.clj:306)
        at cider.nrepl.inlined_deps.orchard.v0v8v0.orchard.java$resolve_class.invoke(java.clj:300)

        at cider.nrepl.inlined_deps.orchard.v0v8v0.orchard.java$resolve_symbol.invokeStatic(java.clj:340)
        at cider.nrepl.inlined_deps.orchard.v0v8v0.orchard.java$resolve_symbol.invoke(java.clj:326)
        at cider.nrepl.middleware.stacktrace$analyze_fn.invokeStatic(stacktrace.clj:82)

        at cider.nrepl.middleware.stacktrace$analyze_fn.invoke(stacktrace.clj:61)
        at clojure.core$comp$fn__5825.invoke(core.clj:2573)
        at clojure.core$comp$fn__5825.invoke(core.clj:2573)
        at clojure.core$comp$fn__5825.invoke(core.clj:2573)
        at cider.nrepl.middleware.stacktrace$analyze_frame.invokeStatic(stacktrace.clj:211)
        at cider.nrepl.middleware.stacktrace$analyze_frame.invoke(stacktrace.clj:207)
        at clojure.core$partial$fn__5857.invoke(core.clj:2628)
        at clojure.core$pmap$fn__8485$fn__8486.invoke(core.clj:7024)
        ... 6 more
here is my stack trace

pooriaTaj13:04:15

Full stack trace is in the threads

ERROR: Unhandled REPL handler exception processing message {:op stacktrace, :id 10, :session 851414bb-6000-4e18-bcf2-0bbba1e659e6}
java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class io.pedestal.http.ring_middlewares__init
        at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)

pooriaTaj13:04:52

Getting this error on REPL startup after changing a couple of dependencies while my checkouts was updated Any one got an idea/

hiredman15:04:31

Full stacktrace is in what thread?

hiredman15:04:14

And what are you doing when you get the stacktrace?

pooriaTaj16:04:10

ERROR: Unhandled REPL handler exception processing message {:op stacktrace, :id 10, :session 851414bb-6000-4e18-bcf2-0bbba1e659e6}
java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class io.pedestal.http.ring_middlewares__init
        at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
        at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
        at clojure.core$deref_future.invokeStatic(core.clj:2304)
        at clojure.core$future_call$reify__8477.deref(core.clj:6976)
        at clojure.core$deref.invokeStatic(core.clj:2324)
        at clojure.core$pmap$step__8490$fn__8494.invoke(core.clj:7027)
        at clojure.lang.LazySeq.sval(LazySeq.java:42)
        at clojure.lang.LazySeq.seq(LazySeq.java:51)
        at clojure.lang.RT.seq(RT.java:535)
        at clojure.core$seq__5419.invokeStatic(core.clj:139)
        at clojure.core$map$fn__5888.invoke(core.clj:2761)
        at clojure.lang.LazySeq.sval(LazySeq.java:42)
        at clojure.lang.LazySeq.seq(LazySeq.java:51)
        at clojure.lang.Cons.next(Cons.java:39)
        at clojure.lang.RT.next(RT.java:713)
        at clojure.core$next__5403.invokeStatic(core.clj:64)

        at clojure.core.protocols$fn__8181.invokeStatic(protocols.clj:169)
        at clojure.core.protocols$fn__8181.invoke(protocols.clj:124)
        at clojure.core.protocols$fn__8136$G__8131__8145.invoke(protocols.clj:19)
        at clojure.core.protocols$seq_reduce.invokeStatic(protocols.clj:31)
        at clojure.core.protocols$fn__8168.invokeStatic(protocols.clj:75)

        at clojure.core.protocols$fn__8168.invoke(protocols.clj:75)
        at clojure.core.protocols$fn__8110$G__8105__8123.invoke(protocols.clj:13)
        at clojure.core$reduce.invokeStatic(core.clj:6830)

        at clojure.core$into.invokeStatic(core.clj:6897)
        at clojure.core$mapv.invokeStatic(core.clj:6905)
        at clojure.core$mapv.invoke(core.clj:6905)

        at cider.nrepl.middleware.stacktrace$flag_duplicates.invokeStatic(stacktrace.clj:205)
        at cider.nrepl.middleware.stacktrace$flag_duplicates.invoke(stacktrace.clj:194)
        at cider.nrepl.middleware.stacktrace$analyze_stacktrace.invokeStatic(stacktrace.clj:219)
        at cider.nrepl.middleware.stacktrace$analyze_stacktrace.invoke(stacktrace.clj:213)
        at cider.nrepl.middleware.stacktrace$analyze_cause.invokeStatic(stacktrace.clj:323)
        at cider.nrepl.middleware.stacktrace$analyze_cause.invoke(stacktrace.clj:314)
        at cider.nrepl.middleware.stacktrace$analyze_causes$fn__5279.invoke(stacktrace.clj:348)

        at clojure.core$map$fn__5880$fn__5881.invoke(core.clj:2746)
        at clojure.core$take_while$fn__5931$fn__5932.invoke(core.clj:2905)

        at clojure.lang.Iterate.reduce(Iterate.java:81)
        at clojure.core$transduce.invokeStatic(core.clj:6885)
        at clojure.core$into.invokeStatic(core.clj:6901)
        at clojure.core$into.invoke(core.clj:6889)
        at cider.nrepl.middleware.stacktrace$analyze_causes.invokeStatic(stacktrace.clj:347)
        at cider.nrepl.middleware.stacktrace$analyze_causes.invoke(stacktrace.clj:339)
        at cider.nrepl.middleware.stacktrace$handle_stacktrace.invokeStatic(stacktrace.clj:356)
        at cider.nrepl.middleware.stacktrace$handle_stacktrace.invoke(stacktrace.clj:353)

        at clojure.lang.Var.invoke(Var.java:388)
        at cider.nrepl$wrap_stacktrace$fn__2549.invoke(nrepl.clj:430)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)

        at nrepl.middleware.lookup$wrap_lookup$fn__1854.invoke(lookup.clj:52)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_apropos$fn__2425.invoke(nrepl.clj:127)

        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)

        at nrepl.middleware.interruptible_eval$interruptible_eval$fn__1268.invoke(interruptible_eval.clj:154)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at nrepl.middleware.session$add_stdin$fn__1386.invoke(session.clj:379)

        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_trace$fn__2565.invoke(nrepl.clj:462)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)

        at nrepl.middleware.dynamic_loader$wrap_dynamic_loader$fn__1454.invoke(dynamic_loader.clj:98)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)

        at cider.nrepl$wrap_resource$fn__2533.invoke(nrepl.clj:404)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at nrepl.middleware.load_file$wrap_load_file$fn__1810.invoke(load_file.clj:81)

        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_debug$fn__2451.invoke(nrepl.clj:161)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)

        at cider.nrepl$wrap_xref$fn__2599.invoke(nrepl.clj:512)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_content_type$fn__2409.invoke(nrepl.clj:107)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at nrepl.middleware.completion$wrap_completion$fn__1778.invoke(completion.clj:58)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_undef$fn__2581.invoke(nrepl.clj:491)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_slurp$fn__2417.invoke(nrepl.clj:119)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_spec$fn__2541.invoke(nrepl.clj:414)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_info$fn__2475.invoke(nrepl.clj:206)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_clojuredocs$fn__2607.invoke(
j:527)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_macroexpand$fn__2493.invoke(nrepl.clj:285)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_out$fn__2509.invoke(nrepl.clj:332)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_test$fn__2557.invoke(nrepl.clj:440)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_format$fn__2467.invoke(nrepl.clj:192)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_classpath$fn__2433.invoke(nrepl.clj:135)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_enlighten$fn__2459.invoke(nrepl.clj:188)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at nrepl.middleware.sideloader$wrap_sideloader$fn__1891.invoke(sideloader.clj:108)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_ns$fn__2501.invoke(nrepl.clj:298)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_inspect$fn__2485.invoke(nrepl.clj:225)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at nrepl.middleware.caught$wrap_caught$fn__1201.invoke(caught.clj:97)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_refresh$fn__2525.invoke(nrepl.clj:378)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_tracker$fn__2573.invoke(nrepl.clj:480)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at nrepl.middleware.print$wrap_print$fn__1168.invoke(print.clj:234)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at cider.nrepl$wrap_profile$fn__2517.invoke(nrepl.clj:341)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at nrepl.middleware.session$session$fn__1371.invoke(session.clj:325)
        at nrepl.middleware$wrap_conj_descriptor$fn__932.invoke(middleware.clj:16)
        at nrepl.server$default_handler$fn__1939.invoke(server.clj:141)
        at nrepl.server$handle_STAR_.invokeStatic(server.clj:24)
        at nrepl.server$handle_STAR_.invoke(server.clj:21)
        at nrepl.server$handle$fn__1907.invoke(server.clj:41)
        at clojure.core$binding_conveyor_fn$fn__5772.invoke(core.clj:2034)
        at clojure.lang.AFn.call(AFn.java:18)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class io.pedestal.http.ring_middlewares__init
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:398)

        at clojure.lang.RT.classForName(RT.java:2212)
        at clojure.lang.RT.classForName(RT.java:2221)
        at clojure.lang.Compiler.maybeResolveIn(Compiler.java:7442)
        at clojure.core$ns_resolve.invokeStatic(core.clj:4358)
        at clojure.core$ns_resolve.invokeStatic(core.clj:4347)
        at clojure.core$ns_resolve.invoke(core.clj:4347)
        at cider.nrepl.inlined_deps.orchard.v0v8v0.orchard.java$resolve_class$fn__4766.invoke(java.clj:306)
        at cider.nrepl.inlined_deps.orchard.v0v8v0.orchard.java$resolve_class.invokeStatic(java.clj:306)
        at cider.nrepl.inlined_deps.orchard.v0v8v0.orchard.java$resolve_class.invoke(java.clj:300)

        at cider.nrepl.inlined_deps.orchard.v0v8v0.orchard.java$resolve_symbol.invokeStatic(java.clj:340)
        at cider.nrepl.inlined_deps.orchard.v0v8v0.orchard.java$resolve_symbol.invoke(java.clj:326)
        at cider.nrepl.middleware.stacktrace$analyze_fn.invokeStatic(stacktrace.clj:82)

        at cider.nrepl.middleware.stacktrace$analyze_fn.invoke(stacktrace.clj:61)
        at clojure.core$comp$fn__5825.invoke(core.clj:2573)
        at clojure.core$comp$fn__5825.invoke(core.clj:2573)
        at clojure.core$comp$fn__5825.invoke(core.clj:2573)
        at cider.nrepl.middleware.stacktrace$analyze_frame.invokeStatic(stacktrace.clj:211)
        at cider.nrepl.middleware.stacktrace$analyze_frame.invoke(stacktrace.clj:207)
        at clojure.core$partial$fn__5857.invoke(core.clj:2628)
        at clojure.core$pmap$fn__8485$fn__8486.invoke(core.clj:7024)
        ... 6 more
here is my stack trace

pooriaTaj16:04:40

it happens when I initialize my REPL

pooriaTaj16:04:47

Instantly goes to error

pooriaTaj16:04:26

The funny thing is that you can kind of build a solution when you remove your checkouts and m2

pooriaTaj16:04:45

So I don't really know what is causing this ,mainly if it's a dependency hell issue or something else?

hiredman16:04:50

It is some issue with nrepl middleware

hiredman16:04:27

Hard to say why it is having the issue

hiredman16:04:00

Are you saying it doesn't happen when you don't have any checkouts?

Ho0man14:04:25

Yes @pouriyatajmehrabi1381 exactly were having the same problem here. Here's our error. Any help would be appreceiated. Thanks everyone

hiredman16:04:29

You are using an aot compiled ring that was aot compiled with joda time on the class path, but you don't have joda time on the class path

Ho0man16:04:22

Thanks a lot @U0NCTKEV8 … I had two questions if you’d be so kind … so we can get a better grasp of what's going on here : • Do you mean that we have a version of ring somehow on the dep tree that did this or could it also happen because we have a project that AOT compiles ring with joda present ? • What could cause this to pop up all of a sudden with no changes in build and drops?

hiredman17:04:27

Dunno, and it wouldn't pop up with no changes

hiredman17:04:31

Like possibly you used one set of dev tooling, which injected some code into the project that includes joda, then you aot compiled your project, then switch to some different tooling, or even a different version, which doesn't inject the same thing, so no joda, and you still have those old aot classfiles laying around

dpsutton14:04:13

Those are two very different stacktraces.

Ho0man14:04:44

No @dpsutton. The first one is from a cider repl the second one comes from running lein do clean, compile :all. We've been dealing with this since last night. It happens across multiple dependencies pedestal , ring and this one seems to happen for joda.

practicalli-johnny14:04:00

If there really is a need to dump long stack traces in the slack channel (rather than sharing them on a gist or other text sharing service) could you at least use a threaded conversation please. It feels like they are drowning out other questions. Thank you.

☝️ 2
Gunnar22:04:25

+1 for better threading discipline! I am currently biting my tongue, being new to the community, but at some point I expect I may start gently reminding and inquiring why, when people choose to not use threads to organize the conversations.

ghadi14:04:04

CMD-Shift-Enter for a snippet

☝️ 4
sheluchin16:04:31

Can someone suggest a way to get rid of nested quoting when some top-level form is already quoted?

(identity '{:x 'y}) ; => {:x (quote y)}
(identity (??? '{:x 'y})) ; => {:x y}
Is this a job for clojure.walk/walk?

hiredman16:04:03

Don't do it in the first place

1
noisesmith16:04:03

@alex.sheluchin where are the quotes coming from? you could use walk/post-walk to replace (quote foo) with foo but really you should be able to ensure nothing is ever quoted twice - quoting happens in your source, where is your source coming from and who edits it?

sheluchin16:04:07

I'm building up datalog queries and want to be able to pass in a vector of symbols for :keys. I guess something like :keys (mapv #(symbol "foo" %) ["x" "y"]) works well enough, but '[foo/x foo/y] sure reads easier.

noisesmith17:04:05

if it's in your own code, all you need to do is not use nested quotes

noisesmith17:04:55

there's no need to programmatically remove nesting if you just don't nest them

sheluchin17:04:46

(defn foo
  [& {:keys [keys] :or {keys nil}}]
  (cond-> '{:find [foo]
            :where [[foo :foo]]}
          (some? keys) (assoc :keys keys)))

(foo :keys '[bar])

sheluchin17:04:11

I'm looking for the result to be :

'{:find [foo]
  :keys [bar]
  :where [[foo :foo]]}

noisesmith17:04:50

user=> (foo :keys '[bar])
{:find [foo], :where [[foo :foo]], :keys [bar]}

noisesmith17:04:58

what's the problem?

noisesmith17:04:36

the return value will never print with a '

noisesmith17:04:20

to be absolutely clear: ' is a reader macro, expanding 'x to (quote x) and its job is to prevent evaluation

sheluchin17:04:03

I had a failing test somewhere because there was an extra quote in there somewhere... but now I can't seem to reproduce it.

noisesmith17:04:35

sure, but the solution is to not introduce the extra quote

sheluchin17:04:48

Yeah, I was passing it in like you have here user=> (foo :keys '[bar]).. nevermind. Thank you!

Rikk Mor17:04:12

HI all is there anyone who have worked on http://fullcalendar.io ?

leifericf20:04:43

What do you mean by “have worked on” in this context? That project is written in TypeScript and JavaScript, not Clojure or ClojureScript. Are you asking whether anyone here has contributed to that project or used that product as a component in something else they were building using Clojure?:thinking_face:

Caleb Figgers22:04:01

I have a program that works correctly when all the functions are instrumented for debugging, but not when they aren't. Otherwise absolutely nothing is different. Is there anything in general that's known to cause this?

Nundrum22:04:20

Instrumented...how?

hiredman22:04:01

Sounds like you are printing things, which is forcing lazy values, and never forcing them otherwise

Caleb Figgers23:04:49

@U02UHTG2YH5 I'm using Calva in VS Code—not sure what it uses under the hood for debugging

noisesmith23:04:56

does the instrumenting capture return values? because that could force lazy results that don't get forced otherwise also what kind of "not working correctly" happens without the instrumentation?

Caleb Figgers23:04:39

@U051SS2EU The point of the program is to access a public API, compare the new data for changes against the last time, and then post a message to a Slack webhook if there are updates. Right now uninstrumented the message doesn't send, but stepping through the debugger does send. The tip about laziness is helpful—I think I know what to look at (thanks also @U0NCTKEV8 for the same)

noisesmith23:04:27

it should be pretty easy to find: usage of for, or map are the typical culprits, though concat might catch you too

Caleb Figgers23:04:15

It was a for! Thanks for the help. Working perfectly now. 👍

sheluchin23:04:48

(cond-> {:x []}
  true (update :x conj 1))
How to perform an assoc and update in the clause? Is there something better than using a nested thread, (assoc (update ...) ...)) or a let form with a body?

noisesmith23:04:52

(cond-> {:x []}
        true (update :x conj 1)
        true (assoc ....))

noisesmith23:04:46

if by "nested" you mean a deeper update, use update-in

dpsutton23:04:48

(cond-> {:x []}
  true (->
         (update :x conj 1)
         (assoc :foo :bar)))
{:x [1], :foo :bar}
do you mean in the one branch?

noisesmith23:04:32

personally I find using the condition twice is much simpler than nesting multiple operations under one condition

noisesmith23:04:51

the result is identical

sheluchin23:04:11

Agree, it looks simplest. I thought I read somewhere that using one threading macro inside another is bad form.

noisesmith23:04:47

that's a style question - things like as-> are meant to be used inside -> though

dpsutton23:04:04

go with your gut instinct on those. if its readable go for it. “bad form” is just a judgment call.

noisesmith23:04:02

IMHO if you are using more than one form of threading in a nested expression, -> should be on the outside, all the others nest inside it comfortably

sheluchin23:04:50

Meant to be? Really?

noisesmith23:04:33

classic example: (-> x (f) (as-> y (* y y)) (g))

noisesmith23:04:15

all the threading macros take the value as the first arg, so they all work inside ->

sheluchin23:04:23

When you say meant to be, do you mean that's it's one of main reasons for its existence?

noisesmith23:04:59

right - some even criticize the usage of as-> outside ->

sheluchin23:04:00

Interesting. Ok, thanks for the input everyone.

Nundrum00:04:24

IMO a single as-> is much more readable than one nested in ->

sheluchin11:04:22

(cond-> {:x []}
  true ((comp #(update % :x conj 1)
              #(assoc % :y 2))))
How about that one?

dpsutton13:04:55

To me that is worse

dpsutton14:04:49

I’m not a fan of ((fn ...)) wrapped function literals in threads like that. And a comp with two literals like that to update/assoc. Its all personal style but it just screams to use a -> to me

dpsutton14:04:11

again, no right or wrong answers here. But to my tastes i’d much prefer the thread

sheluchin22:04:19

> that's a style question - things like as-> are meant to be used inside -> though @U051SS2EU as-> and what others? How do I identify the ones that are intended to be used in this way?

noisesmith22:04:51

all of them can be used inside ->, I only saw one person argue for only using as-> inside -> - I forget who and I wasn't totally convinced, but I do remember it being someone who was generally insightful haha

noisesmith22:04:07

and the fact they all take their value as the first arg (every arrow macro), is intentional, and it's so they can all nest inside -> if needed I think this regex catches them all

(ins)user=> (apropos #"->?>$")
(clojure.core/-> clojure.core/->> clojure.core/as-> clojure.core/cond-> clojure.core/cond->> clojure.core/some-> clojure.core/some->>)

sheluchin22:04:27

I think the main takeaway from https://stuartsierra.com/2018/07/06/threading-with-style for this is basically that -&gt; is okay to nest to any level, just don't start mixing -> and *->>.

noisesmith23:04:42

that's definitely it, thanks for finding my citation for me

👍 1
noisesmith23:04:08

and now I see a nuance that I hadn't quite internalized the first time (about not mixing >> and > macros)