This page is not created by, affiliated with, or supported by Slack Technologies, Inc.


@noisesmith He meant let he told me later via DM.


Hello everyone. I'm interested in building some RPC based server/clients to work on a digital crypto asset.... i'm wondering how i could do this with clojure (instead of using gRPC with golang)


Hi, is there any way to make an "api first" approach in Clojure? I am not finding any ring/compojure/compojure-api generator


filter keeps all the elements that are true; is there a builtin that runs through the list, generates two lists, one of the true, one of the false ?


group-by ?




group-by is the right solution; thanks @leonoel


Assume I want to build a high-traffic clojure rest service router which is to be deployed in the cloud and dynamically scaled with new nodes etc, any opinions on what webserver to use in a critical production scenario like this? tomcat? aleph? jetty? undertow? I realize this is opinion based, but I also realize this is the kind of thing you only figure out once you go down the wrong path...I'd like to learn from wrong paths already taken if possible...


I have used various servers in past lives for java based apps, but I figured there are special considerations (production repl? upsides with executable jar instead of servlet container etc) when deploying with clojure


I vote for aleph


ok, was starting to think I had no takers : ) Why aleph and I assume running with aleph would mean not running in say jetty/tomcat etc? (I'm new to web apps with clojure)


that's my preference because: - aleph is built on netty which is cool and fast async server - my boss has a lot of commits in it so I can get some knowledge from him without googling :smile: and yes, you don't need jetty/undertow


and there's awesome manifold library which aleph also uses


very minor indeed


By "generator", do you mean for example a Leiningen template?


tomcat isn't your choice for light weight btw - it's nice if you want multiple jvm processes in one vm though


you can get a repl in production regardless of container by using the socket repl startup arg or using the nrepl library and starting an nrepl server in your -main


of course you shouldn't listen to any non local connections from that repl... - not secure at all


No, i mean having a swagger api specification generate the compojure routing endpoints, and schema


I have noticed that lein new does not play well with cloning a github repository. I did not see any issues about this on the leinengen github repo. Has there been any discussion about fixing this?


When using clojure.walk/postwalk, is there a way to distinguish map k/v pairs (which are given as 2-element PersistentVectors) and regular 2-element vectors?


@jrootham how do the two have anything to do with each other at all?


lein new creates a new project, a cloned repo isn't a new project


For context, I'm walking {:a 1 :b [:c :2]}


and I only want to act on the k/v pair :a 1


The easy way to create a new git project is to create it on github and clone it. That will create .gitignore, LICENSE, and, if you run lein new on that those files get walked on.


yeah, I dunno, I've never seen it done it that order


What's your workflow? If there is a trivial alternative I'm all ears.


I create a project locally, work on it for a while, later if I want to publish to github I create an empty repo there and push to it


it has never occurred to me to actually check the "Initialize this repository with a README" box when creating a repo on github


@jrootham could you not create your own lein template and do lein new mytemplate foo


yeah, I usually lein new foo or copy the relevant bits from an existing project, then create an empty repo in github to push to


Ah, hadn't considered that. Is there a public repository for templates? I am thinking someone might have already built this.


$ lein new foo
$ cd foo
$ git init .
$ git remote add origin [email protected]:$USER/foo.git
$ git add .
$ git commit
$ git push -u origin master


And then replace the LICENSE file with the github tool. Not too bad.


there is an 'app' template built into lein that includes a README, LICENSE, and gitignore, if you weren't aware:


I am aware, those are the files I don't want from lein. Especially LICENSE


Anyone have experience using data.finger-tree in production? It seems like the repo could use some love so I wasn’t entirely sure about it’s stability.


@jody Many Clojure libraries are "complete" and/or "stable" so they often don't show much recent activity.


hey guys I had a one-off question I’m hoping someone could help me with: what’s the idiomatic way to lazily read lines in a file for later processing? after some experimentation i came up with

(let [rdr (io/reader (io/resource path))]
    (letfn [(read-next []
                (if-let [line (.readLine rdr)]
                  (cons line (read-next))
                  (do (.close rdr) nil))))]
I know that with-open exists to help close the resource, but it doesn’t work if you’re trying to return from a function some lazy sequence (i.e. you’re not doing all the processing in the body of the with-open). is there another way to handle this that I’m missing?


Unlike other languages, Clojure tends to encourage very narrow-focused libraries so they do one thing and do it well.


I figured as much. Thanks for the input!


(that said, there certainly are abandoned libraries out there -- but even then, they tend to be fairly stable)


^ @jody coming from the node/js/npm ecosystem it scared me too initially, that a lot of clojure libs are “stale”. I now take it as a good thing, not a bad, that I can use a 4 year old library written against some older version of clojure and everything still works. Welcome to the awesomeness of people who actually care about backwards compatibility.


That is quite nice. lol


in a lot of javascript ecosystems, if you arent just this side of the bleeding edge, nothing works. “ill just change this one package.json line” turns into days of reconciliation. nightmares persist.


Hi everyone. I'm really struggling with this one and I'm hoping someone can help me out. I've got a lot of the pieces in place, but it's my final recursive step that I'm having a mental block with. I have a 2 dimensional vector, e.g.:

[[0 0 2 0 0]
[0 2 2 0 0]
[0 0 0 2 0]
[2 0 2 0 0]]
I have a function that gets me the vertical / horizontal adjacent "cells" which I've named get-adjacent-points which accepts the X and Y points of the "cell" I'm navigating from. So if I specify get-adjacent-points [0 0]), I will get [[1 0][0 1] back. I've also got a function to check the value of a specific point which I've named get-point-value. Calling (get-point-value 0 0) will return 0, whereas calling (get-point-value 2 0) will return 2 (the third column value in the first row). I'm trying to figure out a way to combine these functions within another function (or more) where I can find all vertical/horizontal adjacent cells with the same value as my initial randomly selected cell and update those to a new value (in this example 1) and repeat the process finding related adjacent cells for those until I exhaust any adjacent cells with the same initial value. So using my initial 2D example above, if I started with [0 0], it would see the top left "cell" is a zero value, update it to be 1, find it's adjacent cells, and if any of those are zero, change them to 1, etc, ending up with a final value of:
[[1 1 2 0 0]
 [1 2 2 0 0]
 [1 1 1 2 0]
 [2 1 2 0 0]]
I've tried to be as descriptive as possible here. I hope the explanation makes sense. Thanks in advance for any help with this.


get-in and update-in


or switch to a map of {cord value} depending on what you are doing