This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-23
Channels
- # arachne (3)
- # aws (1)
- # bangalore-clj (2)
- # beginners (19)
- # boot (151)
- # cider (72)
- # cljs-dev (9)
- # cljsjs (7)
- # cljsrn (37)
- # clojure (215)
- # clojure-austin (1)
- # clojure-denmark (2)
- # clojure-dev (68)
- # clojure-india (1)
- # clojure-ireland (2)
- # clojure-italy (4)
- # clojure-mke (1)
- # clojure-nl (4)
- # clojure-russia (4)
- # clojure-serbia (1)
- # clojure-spec (29)
- # clojure-uk (23)
- # clojurescript (23)
- # cursive (24)
- # datomic (71)
- # emacs (5)
- # events (1)
- # gsoc (11)
- # hoplon (20)
- # klipse (4)
- # lambdaisland (2)
- # leiningen (3)
- # luminus (3)
- # off-topic (30)
- # om (40)
- # om-next (1)
- # onyx (15)
- # pedestal (19)
- # perun (7)
- # planck (23)
- # proton (1)
- # protorepl (2)
- # re-frame (35)
- # reagent (21)
- # ring-swagger (38)
- # rum (19)
- # spacemacs (9)
- # untangled (11)
- # vim (5)
- # yada (4)
In the interceptor code: Is there a good reason peek
is used to obtain the first item of the stack? It’s a list so first
should be just as good? https://github.com/pedestal/pedestal/blob/0.5.2/interceptor/src/io/pedestal/interceptor/chain.clj#L246
I’m doing some, ahem, adventurous stuff I guess and modify the stack (appending something) which the usage of peek
complicates because it explicitly requires a PersistentList and anything that comes out of concat
is LazySeq/Cons
@martinklepsch I can only speculate that it's used to decouple the semantics of the operation from the underlying collection type. Is laziness an important property of your implementation?
@ddeaguiar Hey 🙂 laziness is not important, appending is. I ended up using something like this:
(defn concat-stack [l1 l2]
;; (into '(4 5) (reverse '(1 2 3))) ; => '(1 2 3 4 5)
(into l2 (reverse l1)))
@ddeaguiar I was initially thinking “oh maybe this should be a PersistentQueue” as well but has repercussions into many places and complicates adding to the front
@ddeaguiar trying to think of a reason you’d want this decoupled from collection type but when would the stack be something else than a PersistentList?
Yeah, so I'm just speculating. Perhaps @mtnygard could clarify. Unfortunately I personally have not done much work requiring manipulation of the interceptor chain.
@martinklepsch I had a quick conversation with Paul deGrandis about this. Although the underlying collection type of the stack doesn't change, that's an implementation detail. The current implementation should still work if you changed the collection types of ::queue and ::stack dynamically.
@ddeaguiar to what type would I change it? PersistentQueue is the only one that supports pop/peek afaik?
Good to know you’re sitting close to the source heh 🙂
right vectors but then the code uses conj to add items to the stack 🙂
(so vectors are out)
> PersistentQueue is the only one that supports pop/peek afaik? should have included PersistentList
You could change it to PersistentQueue which would make some sense I guess (I can’t track down the repercussions mentioned earlier, maybe they were in my code not the interceptor code)
Either way, this is complaining at a high level, I solved my problem in an acceptable way so no need to discuss more unless more people think it’s irritating
Well, thanks for bringing this up. I'm very interested in seeing how your work progresses!
Me too 😄
So far interceptors are holding up nicely (and I think I’ve abused them a fair bit 🙂)