Fork me on GitHub

is it possible to tell clojure.walk/postwalk not to descend into maps, only vectors?


Not that I can think of. You can copy and modify the source of clojure.walk/walk pretty easily, if you want.

Jan K00:01:00

Or use tree-seq, that one gives more flexibility


I think I’ll just call my function recursively and hope that no one passes me a huge vector ¯\(ツ)


oh, that’s pretty much what clojure.walk does anyway


I thought it had something fancy that was preventing the stack from growing


clojure.walk/walk should work for arbitrarily large collections without blowing the stack. It should only grow the stack when there is more nesting in the collection given.


i’m walking a hiccup-like structure, e.g.:

[:server/http {:port 8000 :join? false}
            [:db/conn [:config]]]
            [:db/conn [:config]]]]


Maybe not all, but most code that deals with nested structures - reading, printing, processing - will typically cause a number of levels of function calls that is proportional to the level of nesting of the data. 20 levels deep of nesting isn't going to blow the Java call stack. 1000 probably won't either. If you've got 20,000 levels of nesting in your data, you will probably start blowing at least the default Java stack depth limits.


I am not aware of any reasons to have such deep nesting of data, except for artificially generated test cases that attempt to determine where the call stack depth limit is.


How do I return an error code from my function, when starting it using clojure -m Just returning the error code does not work. Program always terminates with error code 0.


(System/exit 127)

👍 5

I have a devtool that I want to allow people to easily install into their Clojure projects


atm, it relies on websockets to communicate with a web UI


I’m worried that installing the dependencies for and starting a webserver on behalf of a user is really invasive


@lilactown no other way around it, I guess. Unless you expose the WebSocket API as a core.async channel and allow people to override the WebSocket implementation with their own server.


I mean, surely it is isn't a huge stretch to go from websockets to just sockets?


and that is just part of the jre


Figwheel does it :)


hmm, well a browser page can’t talk just sockets


most people don’t run figwheel in the same process as their server-side app


I've always seen it done that way fwiw, at least in dev.


really? that seems strange. I guess I haven’t used figwheel in awhile, so maybe I’m missing some context


However, I have wished that figwheel could be used without its server, so a callback based API would be wonderful.


All our projects at work, and also Edge work that way.


Most people won't mind you starting a Web server, and you can separate the API so it is easy to upgrade.


what do you mean by callback-based?


Your java thread will run a callback which will write to whatever transport I use (websocket, sse, core.async, long polling, whatever). Same thing on the frontend for responding to messages that come in


I think it would be nice, if the user already has a webserver running, to provide a way to serve the devtool through that instead of starting it’s own server


but i’m not sure how to do that generally

Lennart Buit20:01:04

how would it know that that is the case?

Lennart Buit21:01:35

I guess you would want to mount your dev tool into the running webserver. That would mean having a companion lib per “possible webserver” plus one for apps that don’t have any

Lennart Buit21:01:50

Like, my-dev-tool-pedestal


I like to run a web app with its own, you know, lein repl thing, and start lein figwheel in another terminal; so the l.f. terminal listens to port 3349 and the l.r. terminal listens to port 8088 or whatever the website is. Amazingly it hangs together. The js made by figwheel apparently has the 3349 baked in, and learns dynamically the origin of the page that embedded it (ie 8088)


Is this the appropriate forum to ask about VS Code? Or maybe Calva, I don't know whose fault it is. When the point is adjacent to a paren or bracket or brace, the point is invisible. The two brackets are outlined and the point is apparently blended in with one edge of one bracket. Hard to guess which.


Aha, editor.cursorWidth. Changing it from 0 to 4 makes it easy enough to see.


Is cursor obviousness configurable?