Fork me on GitHub

You’re using the file on the file system which doesn’t exist when all you have is a jar. Use

Eamonn Sullivan00:10:37

I'm sorry, I'm really, really stupid when it comes to building things in the jvm world. Do I need to do something else (in addition to this) in the pom.xml file? Now I just get

Execution error (IllegalArgumentException) at bbc.dpub.github-pr-tool/eval138$loading (github_pr_tool.clj:1).
Cannot open <nil> as a Reader.

Eamonn Sullivan00:10:58

That's probably confusing -- I'm trying to load the library in a github-pr-tool and it just doesn't work.

Eamonn Sullivan00:10:37

Fix it. Just me working too late. Can't see straight.


I have a hard question that might not have an answer. I'm trying to build up an ns form from nothing but the surrounding REPL environment instead of Files. I can infer 90% of a given namespace's :require form from the interns and aliases. However a non-aliased namespace is giving me a headache. Consider the following ns form:

(ns some.awesome.namespace
  (:require [clojure.set :as cset]             ; This can be inferred from 'ns-alias
            [clojure.test :refer [is deftest]] ; This can be inferred from 'ns-refers and some poking
            clojure.string                     ; this is completely invisible to any known query
Is there a way to discover such a dependency on a naked symbol like 'clojure.string above, but without a file and/or existing 'ns form? I can see it in 'all-ns, so I know it's loaded...


I don't necessarily know everything Clojure stores at run time that might be used to recover that relationship, but from a few minutes of looking in the source file within Clojure's implementation, it isn't obvious there is anything.


You can look at the list of all namespaces that are currently loaded, but without aliases, I can't think of any way to know if A requires B, or B requires A, or neither requires the other.


Out of curiosity, why do you want to try to build up an ns form from the run-time state of a Clojure JVM process?


I'm on a lark where I build up a program purely from a REPL session. Ideally I would be able to query the REPL and output a file to "save" a session. I'm exploring more REPL-driven development ideas.


Note that the source code of Clojure functions is not saved anywhere when entered into a REPL, unless you write code yourself that saves the input text somewhere.


A straightforward technique would be to save all text entered into the REPL into a file, and then later load that file into a new Clojure JVM. That can fail in various ways, e.g. if in the original REPL session you were opening network connections, reading files from the file system (and later you tried loading that text on a different system that did not have those files), etc.


@U0SCZ80LS palletops ns-reload hooks load-lib to do this. Might be worth a poke.


These are all good suggestions. I'll look more into pallet. At least now I know where some limitations are, which still helps.


hey clojurians. could you explain to me this?

=> (def data (vec (map inc (range 100000))))
=> (def xf (comp (map inc)(filter even?) (map #(* 2 %))))
=> (quick-bench (->> data (map inc)(filter even?) (map #(* 2 %))))
Execution time mean : 23.365075 ns
=> (quick-bench (into [] xf data))
Execution time mean : 6.275398 ms


how come the transducer version is slower than the simple composition ->> version?


i think because the first one is only returning LazySeq and the second one evaluates all


(type (->> data (map inc) (filter even?) (map #(* 2 %))))
=> clojure.lang.LazySeq
(type (into [] xf data))
=> clojure.lang.PersistentVector


oh missing a vec at the end 🙂


(quick-bench (->> data (map inc)(filter even?) (map #(* 2 %)) vec))

Chris K08:10:43

Just found this answer on stack overflow of how I can make a gui app using clojure but I don't know how to develop using this way... can someone reference me to a resource or things I should research and learn about?

Nobody yet suggested it, so I will: Browser as UI platform. You could write your app in Clojure, including an HTTP server and then develop the UI using anything from HTML to hiccup, ClojureScript and any of the billions of JS libaries you need. If you wanted consistent browser behaviour and "desktop app look'n'feel" you could bundle chrome with your app.

This seems to be how Light Table is distributed.


They're talking about this:

Chris K12:10:21

thanks so I can use hiccup here?


You can use HTML and JS there. But CLJS can be converted to JS, just like Hiccup can be converted to HTML.


There are projects that bring Electron closer to CLJS.


It is not the only way. You can develop UI apps with OpenJFX. There is even a channel for it here #cljfx

Chris K12:10:04

@UBLU3FQRZ cljfx didn't work too well for me so I wanted to try out the one from this stack overflow.

Chris K12:10:31

@U2FRKM4TW Do you know any resources to get me started working?


Sorry, I don't.


@U012BEGBECC, what kind of GUI app are you trying to make?


I can only second cljfx, it works really well, the only thing that's a bit cumbersome is to add support for new GUI elements from libraries

Chris K00:10:53

@U7RJTCH6J I want to try making a productivity app with stuff like timers, and way to store notes


is the app for personal use or will it be distributed to other users?

Chris K02:10:49

@U7RJTCH6J I want to try a personal one


i'm not exactly sure why cljfx wasn't a good fit, but it seems like it could work in principle. the folks in #cljfx are pretty responsive if you have questions. if you have cljs experience, an electron app is pretty straightforward. I would recommend something like (#re-frame for questions) as an overall framework, browser apis for timing, and then use the storage.


Curious, is anyone aware of a java/clojure task/job queue with a dashboard available? I'm struggling, which surprises me given the java ecosystem. Maybe I'm not using the right term. I can find examples for ruby, php, nodejs quite easily.