This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-05-10
Channels
- # announcements (4)
- # beginners (111)
- # boot (34)
- # cider (67)
- # cljdoc (10)
- # clojure (90)
- # clojure-dev (37)
- # clojure-europe (3)
- # clojure-gamedev (3)
- # clojure-italy (18)
- # clojure-losangeles (2)
- # clojure-nl (27)
- # clojure-spec (24)
- # clojure-uk (59)
- # clojurescript (41)
- # cursive (32)
- # datomic (31)
- # emacs (21)
- # figwheel (1)
- # figwheel-main (2)
- # fulcro (43)
- # graalvm (6)
- # graphql (3)
- # jobs-discuss (3)
- # kaocha (1)
- # nyc (1)
- # off-topic (22)
- # pathom (10)
- # pedestal (11)
- # re-frame (9)
- # reitit (17)
- # shadow-cljs (15)
- # spacemacs (13)
- # sql (6)
- # testing (5)
- # tools-deps (3)
- # vim (13)
- # yada (1)
Knowing nothing about this, it seems like making transients iterable would make it possible without changes to RT. But not sure if that would be a good idea or not.
if you're passing transients to code that isn't aware of them, that's almost certainly a design error
things you can do to various transients: update them (conj! / assoc! / pop! / disj! ) graduate them (persistent!) get (get / lookup) count them
Yeah, my understanding of transient/persistent is that the scope has always been intended to be very minimal
I was disappointed the other day that I couldn't update
one 🙂
Yeah, my first reaction was "Aww!" and then I was like, "No, that makes perfect sense..." and I just assoc!
'd in an updated value 🙂
After nine years of using Clojure, I don't question core decisions anywhere near as much as I used to 🙂
update!
should be easily writable though
17 lines of code with !
added in the appropriate places 🙂 But each of those functions add up. And I only needed a specific arity (and it's the first time I've wanted update!
in all those years).
the options seem to be implement iterable or cond
in empty?
to do the (zero? (count coll))
for TransientCollection
s. Mike fikes has proposed the latter on the CLJS side.
user=> (seq (transient []))
Execution error (IllegalArgumentException) at user/eval143 (REPL:1).
Don't know how to create ISeq from: clojure.lang.PersistentVector$TransientVector
(I think this issue is distinct from the issue of contains?
being broken on transients - https://dev.clojure.org/jira/browse/CLJ-700 , as find
already works on transients, so why shouldn't contains?
)
I guess I mean it's different in nature: one is a busted impl, one is enlarging the contract of transient
https://dev.clojure.org/jira/browse/CLJ-1872 ticket is here if you're interested in adding your opinion.
The short list of operations supported on transients makes sense, sure. You can add and remove things, get a value at a position, check for the existence of a value or values across vec/set/map, count them. All those fun things.
Truth of the matter is I don't necessarily disagree with you, but I found myself at the contains?
issue while poking around in JIRA today, and then found my way over to this ticket. The ticket is currently listed as a defect with critical priority. It was triaged and vetted. Were it not for these things, I may not have spent any time looking at it.
I forgot about bounded-count
it already works on transients too
I'm not sure I follow. Transients are counted?
, and so bounded-count
simply calls count
on the transient.
@devn I think that was just in response to the comment about not being able to define empty?
in terms of count
because of potentially infinite lazy sequences...?
(so it could be defined in terms of bounded-count
)