This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-01-27
Channels
- # announcements (2)
- # beginners (69)
- # boot (2)
- # calva (15)
- # cider (4)
- # cljs-dev (8)
- # cljsrn (1)
- # clojure (38)
- # clojure-spec (2)
- # clojure-uk (6)
- # clojurescript (6)
- # cursive (12)
- # data-science (1)
- # datomic (6)
- # emacs (10)
- # figwheel-main (12)
- # fulcro (41)
- # nrepl (1)
- # re-frame (16)
- # reitit (1)
- # shadow-cljs (6)
- # spacemacs (2)
- # speculative (1)
- # test-check (9)
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.
Or use tree-seq
, that one gives more flexibility https://clojuredocs.org/clojure.core/tree-seq
I think I’ll just call my function recursively and hope that no one passes me a huge vector ¯\(ツ)/¯
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}
[:router
[:db/conn [:config]]]
[:foo
[: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 foo.bar/-main
function, when starting it using clojure -m foo.bar
? Just returning the error code does not work. Program always terminates with error code 0
.
I have a devtool that I want to allow people to easily install into their Clojure projects
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.
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.
Most people won't mind you starting a Web server, and you can separate the API so it is easy to upgrade.
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
how would it know that that is the case?
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
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.