Welcome! Please see the About page for a little more info on how this works.

+1 vote
in Collections by

I've encountered situations where I wanted to check whether something was transient in order to know whether I should call assoc(image: or assoc, conj) or conj, etc.

This patch adds transient? as a predicate fn.

11 Answers

0 votes
by

Comment made by: alexmiller

Patch needs a docstring and a test.

0 votes
by

Comment made by: devn

Alex: I figured that would be the case! Sorry about that. I've updated the patch. It now includes a docstring and has tests of transient? for #{}, (link: ), and {}.

Thanks!

0 votes
by

Comment made by: alexmiller

Thanks - please don't use the labels "patch" or "test" - those are covered by the Patch field.

0 votes
by

Comment made by: devn

Ah, sorry for the mixup Alex. I assumed you removed "patch" as a label the first time around to flag this ticket as still needing a vetted patch. My mistake.

0 votes
by

Comment made by: jafingerhut

Patch 0001-Add-transient-predicate.patch dated Mar 17, 2014 applies cleanly to latest Clojure master, but fails a test because the new function transient? has no :added metadata. See most other Clojure functions in clojure.core for examples.

It also generates a new warning while running tests:

WARNING: transient? already refers to: #'clojure.core/transient? in namespace: clojure.test-clojure.data-structures, being replaced by: #'clojure.test-clojure.data-structures/transient?

There is an older (but equivalent) definition of transient? in test file data_structures.clj that should be removed when adding it to clojure.core

0 votes
by

Comment made by: devn

@Andy, the reason I did not add :added metadata is because I do not know if/when this patch will be accepted, and as a result, I don't really know if it will sneak into 1.6.X or 1.7. For now, I've put it in as 1.7. If it's in the running to be added sooner than that, let me know and I'll adjust it.

RE: The warning. Good catch. I've submitted a new patch which removes the private version of transient? from data_structures.clj. All tests pass.

Edit to Add: The latest patch as of this comment is now 0002-Add-transient-predicate.patch.

0 votes
by

Comment made by: jafingerhut

Patch 0002-Add-transient-predicate.patch dated Mar 22 2014 no longer applies cleanly to latest Clojure master due to some changes committed earlier today. I haven't checked whether this patch is straightforward to update.

0 votes
by

Comment made by: devn

I've updated the patch to 0003-Add-transient-predicate.patch. This patch applies cleanly to the latest version of master.

0 votes
by

Comment made by: jafingerhut

Patch 0003-Add-transient-predicate.patch dated Aug 6 2013 no longer applied cleanly to latest master after some commits were made to Clojure on Aug 29, 2014. It did apply cleanly before that day.

I have not checked how easy or difficult it might be to update this patch.

0 votes
by

Comment made by: devn

I've updated the patch to 0004-Add-transient-predicate.patch. This patch applies cleanly to the latest version of master.

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-1386 (reported by devn)
...