This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (6)
- # beginners (54)
- # calva (9)
- # cider (2)
- # clj-kondo (26)
- # cljsrn (2)
- # clojure (49)
- # clojure-brasil (1)
- # clojure-dev (3)
- # clojure-europe (11)
- # clojure-italy (28)
- # clojure-nl (5)
- # clojure-serbia (1)
- # clojure-spec (4)
- # clojure-uk (182)
- # clojuredesign-podcast (2)
- # clojurescript (59)
- # clojurex (9)
- # cursive (26)
- # data-science (11)
- # datomic (40)
- # duct (1)
- # emacs (3)
- # events (4)
- # figwheel-main (2)
- # fulcro (7)
- # instaparse (1)
- # kaocha (2)
- # leiningen (25)
- # off-topic (3)
- # re-frame (36)
- # reagent (15)
- # shadow-cljs (87)
- # spacemacs (12)
- # sql (20)
- # tools-deps (8)
- # vim (1)
- # yada (40)
hi guys, I'm trying to get REBL working in cursive ( intellij ) , I'm following this guide https://github.com/cognitect-labs/REBL-distro/wiki/REBL-in-IntelliJ-Cursive , but I'm stuck when setting the clojure REPL preferences in intelliJ, it displays "Run Configuration Error : No external project path found for ..."
@seancorfield thanks, got it working, I had to enable the alias in the clojure deps toolbar
Hi all, beginner here. The Clojure's default repl (by typing
clojure in bash) doesn't support up arrow key for history and syntax highlighting. Is there a widely used better alternative to this default REPL?
for interactive programming at the command line, there's another shell script named
clj (which is a
readline wrapper around
clojure command) that supports command line navigation/editing. you may also use https://repl.it/languages/clojure which provides both an online editor (with syntax highlighting) and an online repl.
Happy Friday everyone! In spec, how would I specify that keys in a map should be the first items from a list? If the map has 1 kv pair, its key should be :player1, if the map has 2 kv pairs, the keys should be :player1 and :player2 etc.
I suppose, said another way, can I ensure that if :playerx is present, then :player1, :player2, ... :playerx must be?
functions can be specs, so if you can write a function to express that constraint you can use it as a spec
Cool, I'll work on that. I guess the function should return true where the check passes?
As a follow-up I presume I'll be best off writing a custom generator for this spec, since a random selection of keys is unlikely to fulfil this criterion
Hello. Does anyone know of a repository for a clojure console application that can serve as an example of folder organization, names, and separation of responsibilities?
hmm a clojure console application... i would say go through all the lein templates and do
lein new [whatever] yourprojname and you'll be able to inspect from the console with tree or from the finder/file browser
i don't really know what you mean by clojure console app but i'm sure there is something similar to what you need, computers don't have that many output organs 😛 could you elaborate on your end-goal?
I am developing a project to build on some clojure concepts by reading a json file via stdin and doing some manipulation. I wanted some example of good folder structuring practices. I think my project is a little messy
@julianodgtz I'm not sure it would be that different from a standard application. You are going to have a
main that gets executed when you run it from the CLI. Seems like it should be the standard
src/project_name structure. Having said that, there are a couple of tools you should check out for helping to build the console application.
Sure thing. Spammed the main thread with a few other things you might find useful. Let me know if you have any questions or whatever and good luck!
I need some help with making my REPL driven development better. I am working on an API and when I run it locally I call
lein run-server which starts the application and I can hit
localhost:8080/mo/status and it responds with "ok". If I want to return "ready" instead, I make the changes and restart the server. I'd like to be able to start the app by starting a REPL and then navigating to the
handler's namespace and calling the
start method. Then whenever I make changes to one of the routes I can then re-evaluate the file and navigate to
localhost:8080/mo/status and see "ready". The last sentence is where I am tripping up on. Since when I tried this, this did not work. Thinking about it I realized that, thats not how things work. I can't just load up a file into the REPL process and expect the app to reflect those changes as they are two different processes (right?). So my question is how can I set up a work flow like this?
That is the best lib I have come across for dealing with command line arguments and sub-commands.
@julianodgtz There are couple of things to help boost JVM startup speed, but unfortunately I can't find/remember their names. This was the only one I found but it hasn't been touched in a while so I'm not sure if it is still actively maintained: https://github.com/ninjudd/drip
@julianodgtz there's also which is an interesting alternative for creating cmd applications: https://github.com/candid82/joker
Lastly, lein-binplus is a handy lein plugin for generating executable JAR files and outputting them someplace on your class path.
@mario.cordova.862 Ring apps tend to wrap functions in middleware so they take the value of the function(s) when you start the app and you don't see redefinitions. The "trick" is to use
#' to pass Vars instead so that they are still dereferenced (a bit slower) but will see changes.
So if your
start function refers to
app (your application/routes), change it to use
The same is true for your handlers in your route declarations. See https://github.com/seancorfield/usermanager-example/blob/master/src/usermanager/main.clj#L108-L130 and https://github.com/seancorfield/usermanager-example/blob/master/src/usermanager/main.clj#L202 as examples of passing Vars instead of values, so that you can get live updates in the REPL for your running application.
Anyone know a library that has a function for getting leaf nodes in a directed graph? I don't see it in loom or ubergraph, but maybe I'm looking for the wrong thing? Using the wrong terminology? I can write it myself, but I feel like I'm duplicating work that's already been done.
with a common graph data format that should be a simple reduce (use a set of the node list as an accumulator, traverse the edges and remove origin nodes from the set)
I was doing a product that fit naturally with a graph representation a while back, and found that the clj graph data libs were good for specific and relatively tricky algorithms from the graph theory cs literature but tended to lack simple data operations like this, and also lacked more advanced algorithms
so we had to do a lot ourselves, because it was either too simple for the graph libs or too tricky
If by 'leaf' you mean maybe it has some in-edges, but no out-edges, then yeah, you can iterate over all nodes and ubergraph (and probably also loom) has a function to return the list of out-edges, and/or a count of them.
can someone explain transit to me? i have a huge json dictionary file to parse and i want to do that.
okay thanks, i'll look at data.xml ... [the proj in question] is a popular open source japanese dictionary file called JMdict that has a common .gz XML and some ports to JSON and several small programs just to spit out a JSON version, i think sticking to the original XML is probably the way to go forward w/ highest fidelity, if I can figure it out I can push a clojure data version of the same jmdict