func! (bang) is a naming convention from the programming language Scheme that Clojure often uses. In general it means that the function mutates data, i.e. it is not a pure function. Clojure does not have a ! after all of its core functions that do this, but it does after some. In particular, the functions that operate on transients like conj! assoc! persistent! etc. mutate their arguments.
Many (maybe most) regular collection functions do not take transients. As I said, I think it is an accident, not by design, that 'into' can take a transient as an argument. Originally it only took persistent collections as arguments (perhaps also seqs, but those are immutable, too). Andy On Mar 20, 2012, at 11:17 AM, László Török wrote: > Ok, > > so the pattern is: > > func! (bang) takes a transient and returns a transient > > regular collection functions MAY take a transient but ALWAYS return a > persistent collection, right? :) > > thx > Las > > 2012/3/20 Andy Fingerhut <andy.finger...@gmail.com> > into uses transient and persistent! for speed. The fact that into can take a > transient as input is an accidental consequence of that, I think. Before > into was changed to use transients internally, it could only take persistent > data structures as input, and return a persistent data structure. > > Andy > > On Mar 20, 2012, at 10:32 AM, László Török wrote: > >> Hi, >> >> While implementing qsort with clojure for fun, I thought about using >> transient vectors to speed up sorting vs the "naive" functional >> implementation. >> >> I need an into! version of into when joining two sorted subarrays and I was >> wondering why there isn't one. >> >> It seems that (source into) does in fact support a transient collection as >> the first argument, however it calls persistent! on the result. >> >> What was the rationale behind the decision? (Note: I'm not questioning it, >> just interested.) >> Is there a particular reason why this feature remains undocumented? >> >> -- >> 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 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 > > > > -- > 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 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