You’re using the file on the file system which doesn’t exist when all you have is a jar. Use http://clojure.Java.io/resource
Datalog perhaps?
Implemented over Clojure data: https://github.com/tonsky/datascript
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.
That's probably confusing -- I'm trying to load the library in a github-pr-tool and it just doesn't work.
This is the library I'm trying to load: https://clojars.org/eamonnsullivan/github-pr-lib
Fix it. Just me working too late. Can't see straight.
The reason Im using it is simply because it was the first thing that google brought up when dealing with dates. Its a throw away project so I didnt look to deep into it.
I thought about it, but I feel asking non Clojure devs to learn datalog isn't that much better then asking them to learn how to map/filter in Clojure itself. Which is what I have now, just take some Clojure code.
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...@jamesleonis 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.
I admit, having a SQL JDBC driver that works on named collections of hash maps is quite appealing 🙂
This might be a good starting point if you want to build a DSL for them to use? http://www.multunus.com/blog/2016/11/building-sql-like-dsl-clojure-part-1/
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 Namespace.java 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.
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))
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: https://www.electronjs.org/
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
@ales.najmann cljfx didn't work too well for me so I wanted to try out the one from this stack overflow.
@p-himik Do you know any resources to get me started working?
Sorry, I don't.
@sunchaesk, 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
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.