This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-04-06
Channels
- # announcements (1)
- # bangalore-clj (3)
- # beginners (73)
- # boot (1)
- # calva (88)
- # cljdoc (13)
- # cljsrn (1)
- # clojure (65)
- # clojure-finland (1)
- # clojure-spec (14)
- # clojure-uk (1)
- # clojurescript (50)
- # core-async (4)
- # datavis (6)
- # duct (2)
- # figwheel-main (1)
- # off-topic (15)
- # pedestal (16)
- # planck (11)
- # re-frame (3)
- # shadow-cljs (19)
- # yada (3)
if you dissoc x, it downgrades to a hash-map, last I checked
Yeah, so (defrecord [mandatory-id]…) and then we good
When I start #datomic -ions + #shadow-cljs in the same repl, my JVM just freezes. How can I debug this? I think that I'm running out of threads
which platform does that run on? JVM can take quite a few threads so its unlikely you are running out?
It's a jvm11@linux. I'm using a i7 so there is 8vcpu. When jvm freeze, it keep at "0%" of cpu usage. When I query first, the start shadow, it keep compiling forever (web UI works, but do nothing about stop/start builds ) When I start shadow first, then query, the query freezes / lock my repl
but in general: why are you running shadow-cljs as part of a datomic ion? that makes little sense to me?
It's just my dev setup. I like to keep everything in one repl. At home I will try to make something reproducible
if you use Control-\
or use jstack you can trigger a dump of the stack traces of all running threads. My hunch is that something is running and not getting expected input.
I could use a little help designing an algorithm. How would you go about transforming between the two formats?
{:logger {:name :logger
:deps [:render]}
:render {:name :render
:deps [:store]}
:store {:name :store
:deps [:router]}
:router {:name :router
:deps []}}
;; Would like to format as:
[[:router []]
[:store [:router]]
[:render [:store]]
[:logger [:render]]]
I implemented a gross solution in JS by first transforming the input into {:router {:store {:render {:logger {}}}}}
then walking it again to build a list like the bottom. However, I feel like I’m making it messier\more complicated than it needs to be.
this doesn't give the right order @U6N4HSMFW
there's generic solutions e.g in loom https://cljdoc.org/d/aysylu/loom/1.0.2/api/loom.alg#topsort
Ahhh, I thought it was simply transforming data format to another, which is quite trivial though. It’s likely that I didn’t get the point from the example. 🙂
But yeah, now looking at it it makes sense. I’d maybe look how integrant or component does that.
the algorithm is not very complex so it's not rare too see ad-hoc implementations in libraries having to do some kind of dependency resolution
If it helps, this is very close to being an adjacency-list / tree transform, which is well studied and well documented. And loom itself has code that turns a tree into an adjacency list and visa versa (every tree can be converted to an adjacency list, an adjacency list can only be converted to a tree if its graph is non-cyclical, directed, and each node has only one incoming link)
Thanks @U051SS2EU. Learning the term helped me find a section about it in an algorithms text book I impulsively bought but never used. After reading that section then watching a youtube talk on topological sorting I was able to implement a depth-first-search topological sort for directed-acyclic-graphs on my own 😄
adjacency-lists are especially useful in a language with immutable data structures, as they allow cycles and complex nested updates without doing a tree worth of mutations
Ah that makes sense, the book’s solution used an AdjacencyList but it also used a mutable list to track what was visited. I’m not quite sure how to handle that part in an immutable language without something like an atom.
Actually I take that back. The recursive function would need to return the updated sorted list and the updated visited list is all.
precisely - we can use normal updating / recursion tricks, and it's simplified since it's flattened
I am using the https://github.com/metosin/compojure-api/wiki/Component-integration#using-closures but how does this work in development env? In the case of defroutes
it is a var and evaling(c-x c-e) changes just works. In the case of closure, I have to keep restarting the server.
@munichlinux Component out-of-the-box needs a little setup to have it work well in a hot-reloading environment. I'm assuming you're using CIDER + Emacs, my setup defines reloading functionality for component called user/reset in dev/user.clj. Then I have key chord C-x C-r setup to call user/reset, which refreshes component. It works perfectly. For example, I could define some new functionality for a closure, test it with C-x C-e, and then hit C-x C-r to see the changes appear.
@munichlinux This isn't my own idea it's based off the article: http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded. Though the article won't get you all the way, if you follow through it and tinker with your emacs config for a bit, you'll be able to find a good solution. If you want to check out my .emacs config file I can send it over in a private message.
@henri.schmidt Thanks for the link
I doing the same thing. I though there could be a better way since I have to keep firing (reset) all the time.
@munichlinux yeah I hoped as well, if you find one message me about it. Though I think it's unsolvable due to components use of protocols.
@henri.schmidt https://github.com/clojure-emacs/cider/blob/master/doc/miscellaneous_features.md#reloading-code
@munichlinux so this will save and refresh component every time you reset buffer?
@henri.schmidt you can turn the logger on *cider-ns-refresh-log*
Is it possible to compose aliases in deps.edn? For example, if my ~/.clojure/deps.edn
contains a test alias (adding test directory to the path) and a cider alias (adding some cider libs), can I create a dev alias in my main project deps.edn which says, "switch on the test and cider aliases when dev is used"?
Ok, thanks. What I was really trying to do here was to configure cider to start with the dev alias by setting cider-clojure-cli-global-options
to -A:dev
and then configure the dev profile on a per project basis. I suppose I can either just put all of the config in the project dev alias (little duplication, but nothing too worry too much about), or get into .dir-locals.el
stuff, though emacs seems to complain about setting this the cider-clojure-cli-global-options
variable in dir locals. Apparently it "may not be safe", but I am not sure exactly what determines that. Probably simpler to do the first thing I suppose.
It does seem to give me an option to say, "Mark this variable as safe in the future", but I am not sure I understand why it is unsafe. Something makes me anxious about overriding a message like this without fully understanding it 🙂
If you cider jack in with a prefix argument you can edit the actual startup form. Makes it easy to tweak those without knowing which config to set