Re: contains? and transient set
Hi, contains? is for checking whether a data structure contains the respective key. A more idiomatic way to check whether an element is in the set is (#{1 2 3} 1) ;; = returns 1 (#{1 2 3} 0) ;; = returns nil works for (transient #{1 2 3}) too. Las 2013/12/4 Burt burkhardt.r...@googlemail.com Does contains? and get not work with transient sets? Examples: (contains? #{1 2 3} 1) ; = true (contains? (transient #{1 2 3}) 1) ; = IllegalArgumentException contains? not supported on type: clojure.lang.PersistentHashSet$TransientHashSet (get #{1 2 3} 1) ; = 1 (get (transient #{1 2 3}) 1) ; = nil How can I check whether an element is contained in a transient set? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- László Török -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: contains? and transient set
Thanks, Burt -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: contains? and transient set
It looks like you're onto something here get works with transient maps: (get (transient {:a 1 :b 2}) :a) ;= 1 and with transient vectors, too: (get (transient [1 2 3]) 0) ;= 1 but not with transient sets: (get (transient #{1 2 3}) 2) ;= nil And using contains? in a reduce with a transient accumulator does not seem too far fetched to me. According to clojure.org/transients: Transients support the read-only interface of the source, i.e. you can call *nth*, *get*, *count* and fn-call a transient vector, just like a persistent vector. Did you search in Jira whether this is a known issue? Regards, Stefan -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: contains? and transient set
Also it seems it used to work on clojure 1.4 On Wednesday, December 4, 2013 2:29:35 PM UTC+1, Stefan Kamphausen wrote: It looks like you're onto something here get works with transient maps: (get (transient {:a 1 :b 2}) :a) ;= 1 and with transient vectors, too: (get (transient [1 2 3]) 0) ;= 1 but not with transient sets: (get (transient #{1 2 3}) 2) ;= nil And using contains? in a reduce with a transient accumulator does not seem too far fetched to me. According to clojure.org/transients: Transients support the read-only interface of the source, i.e. you can call *nth*, *get*, *count* and fn-call a transient vector, just like a persistent vector. Did you search in Jira whether this is a known issue? Regards, Stefan -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: contains? and transient set
Well not quite: (contains? (transient #{1 2 3}) 1) false *clojure-version* {:major 1, :minor 4, :incremental 0, :qualifier nil} So it used not to throw but return a wrong value instead, which was worse. On Wednesday, December 4, 2013 2:50:19 PM UTC+1, Max Penet wrote: Also it seems it used to work on clojure 1.4 On Wednesday, December 4, 2013 2:29:35 PM UTC+1, Stefan Kamphausen wrote: It looks like you're onto something here get works with transient maps: (get (transient {:a 1 :b 2}) :a) ;= 1 and with transient vectors, too: (get (transient [1 2 3]) 0) ;= 1 but not with transient sets: (get (transient #{1 2 3}) 2) ;= nil And using contains? in a reduce with a transient accumulator does not seem too far fetched to me. According to clojure.org/transients: Transients support the read-only interface of the source, i.e. you can call *nth*, *get*, *count* and fn-call a transient vector, just like a persistent vector. Did you search in Jira whether this is a known issue? Regards, Stefan -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: contains? and transient set
Hi Stefan, I did not search in Jira, I don't know whether this is a known bug. I use the Lars' work-around in the context I need contains? with a transient set. Regards, Burt Am Mittwoch, 4. Dezember 2013 14:29:35 UTC+1 schrieb Stefan Kamphausen: It looks like you're onto something here get works with transient maps: (get (transient {:a 1 :b 2}) :a) ;= 1 and with transient vectors, too: (get (transient [1 2 3]) 0) ;= 1 but not with transient sets: (get (transient #{1 2 3}) 2) ;= nil And using contains? in a reduce with a transient accumulator does not seem too far fetched to me. According to clojure.org/transients: Transients support the read-only interface of the source, i.e. you can call *nth*, *get*, *count* and fn-call a transient vector, just like a persistent vector. Did you search in Jira whether this is a known issue? Regards, Stefan -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: contains? and transient set
Both contains? and get should work with transient sets imo. This is already in jira: http://dev.clojure.org/jira/browse/CLJ-700. Alex On Wednesday, December 4, 2013 5:04:40 AM UTC-6, Burt wrote: Does contains? and get not work with transient sets? Examples: (contains? #{1 2 3} 1) ; = true (contains? (transient #{1 2 3}) 1) ; = IllegalArgumentException contains? not supported on type: clojure.lang.PersistentHashSet$TransientHashSet (get #{1 2 3} 1) ; = 1 (get (transient #{1 2 3}) 1) ; = nil How can I check whether an element is contained in a transient set? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: contains? and transient set
This is not a good way to check whether an *arbitrary* element is in a set: user= (contains? #{nil} nil) true user= (#{nil} nil) nil On Wed, Dec 4, 2013 at 3:35 AM, László Török ltoro...@gmail.com wrote: Hi, contains? is for checking whether a data structure contains the respective key. A more idiomatic way to check whether an element is in the set is (#{1 2 3} 1) ;; = returns 1 (#{1 2 3} 0) ;; = returns nil works for (transient #{1 2 3}) too. Las 2013/12/4 Burt burkhardt.r...@googlemail.com Does contains? and get not work with transient sets? Examples: (contains? #{1 2 3} 1) ; = true (contains? (transient #{1 2 3}) 1) ; = IllegalArgumentException contains? not supported on type: clojure.lang.PersistentHashSet$TransientHashSet (get #{1 2 3} 1) ; = 1 (get (transient #{1 2 3}) 1) ; = nil How can I check whether an element is contained in a transient set? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- László Török -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Ben Wolfson Human kind has used its intelligence to vary the flavour of drinks, which may be sweet, aromatic, fermented or spirit-based. ... Family and social life also offer numerous other occasions to consume drinks for pleasure. [Larousse, Drink entry] -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: contains? and transient set
cool! hope the patch is good for 1.6! :) 2013/12/4 Alex Miller a...@puredanger.com Both contains? and get should work with transient sets imo. This is already in jira: http://dev.clojure.org/jira/browse/CLJ-700. Alex On Wednesday, December 4, 2013 5:04:40 AM UTC-6, Burt wrote: Does contains? and get not work with transient sets? Examples: (contains? #{1 2 3} 1) ; = true (contains? (transient #{1 2 3}) 1) ; = IllegalArgumentException contains? not supported on type: clojure.lang.PersistentHashSet$TransientHashSet (get #{1 2 3} 1) ; = 1 (get (transient #{1 2 3}) 1) ; = nil How can I check whether an element is contained in a transient set? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- László Török -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: contains? and transient set
It is not currently in the list for 1.6. At some point, we have to draw a line and bear down on some set of tickets - this ticket is currently behind that line. We will be more regularly moving patches through the system, getting them reviewed and included in master, and releasing new versions so that the wait time between releases is reduced (and the volume of included patches is increased). Voting for an issue helps raise its visibility and level of community interest and that is one of the most important things we look at for triage. Alex On Wednesday, December 4, 2013 10:00:20 AM UTC-6, Las wrote: cool! hope the patch is good for 1.6! :) 2013/12/4 Alex Miller al...@puredanger.com javascript: Both contains? and get should work with transient sets imo. This is already in jira: http://dev.clojure.org/jira/browse/CLJ-700. Alex On Wednesday, December 4, 2013 5:04:40 AM UTC-6, Burt wrote: Does contains? and get not work with transient sets? Examples: (contains? #{1 2 3} 1) ; = true (contains? (transient #{1 2 3}) 1) ; = IllegalArgumentException contains? not supported on type: clojure.lang.PersistentHashSet$TransientHashSet (get #{1 2 3} 1) ; = 1 (get (transient #{1 2 3}) 1) ; = nil How can I check whether an element is contained in a transient set? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.comjavascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- László Török -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.