Re: reset! and merge for (transient {})

121 views
Skip to first unread message

Jim

unread,
Jul 2, 2013, 6:43:32 AM7/2/13
to clo...@googlegroups.com
No merge will not work with transients because it uses conj instead of
conj!
If you absolutely have to do this define your own 'merge!' that uses conj!.

I'm not sure what you mean by reset! for transients...reset! is an
operation on reference types (atom, ref, agent etc)

Jim


On 02/07/13 11:33, Amir Wasim wrote:
> Is there reset! and merge a possibility for (transient {})
>
> sometimes we have a doseq and it might be requirement sometime.....
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

dennis zhuang

unread,
Jul 2, 2013, 7:03:02 AM7/2/13
to Clojure
Maybe he means clear?


2013/7/2 Jim <jimpi...@gmail.com>
No merge will not work with transients because it uses conj instead of conj!
If you absolutely have to do this define your own 'merge!' that uses conj!.

I'm not sure what you mean by reset! for transients...reset! is an operation on reference types (atom, ref, agent etc)

Jim



On 02/07/13 11:33, Amir Wasim wrote:
Is there reset! and merge a possibility for (transient {})

sometimes we have a doseq and it might be requirement sometime.....
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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

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+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.


--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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

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+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.





--
庄晓丹
Email:        killm...@gmail.com xzh...@avos.com
Site:           http://fnil.net
Twitter:      @killme2008


Jim

unread,
Jul 2, 2013, 7:28:28 AM7/2/13
to clo...@googlegroups.com
what is 'clear' ? cannot find it anywhere...

Jim



On 02/07/13 12:03, dennis zhuang wrote:
Maybe he means clear?


2013/7/2 Jim <jimpi...@gmail.com>
No merge will not work with transients because it uses conj instead of conj!
If you absolutely have to do this define your own 'merge!' that uses conj!.

I'm not sure what you mean by reset! for transients...reset! is an operation on reference types (atom, ref, agent etc)

Jim



On 02/07/13 11:33, Amir Wasim wrote:
Is there reset! and merge a possibility for (transient {})

sometimes we have a doseq and it might be requirement sometime.....
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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

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.

For more options, visit https://groups.google.com/groups/opt_out.



--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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

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.

For more options, visit https://groups.google.com/groups/opt_out.





--
庄晓丹
Email:        killm...@gmail.com xzh...@avos.com
Site:           http://fnil.net
Twitter:      @killme2008


--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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

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.

dennis zhuang

unread,
Jul 2, 2013, 7:35:59 AM7/2/13
to Clojure
Clear the collection.
user=> (doc empty)
-------------------------
clojure.core/empty
([coll])
  Returns an empty collection of the same category as coll, or nil
nil


2013/7/2 Jim <jimpi...@gmail.com>

John D. Hume

unread,
Jul 2, 2013, 8:16:31 AM7/2/13
to clo...@googlegroups.com

Note that `merge` is basically just `conj` plus nil-checking, so there's a good chance `conj!` already does what you need.

Reply all
Reply to author
Forward
0 new messages