nchurch <nchubr...@gmail.com> writes: Hi,
> Someone was asking on the list here about multiple return values, > which Clojure does not have. > > If the facility were ever added, perhaps multiple values could be > accessed via namespaces. Functions would possess another level of > namespace and have the ability to inject values into the environment > under that namespace. For instance: > > (defn quotient [x y] > ..... > (values quotient remainder)) > > (clojure.core/quotient 5 2) > --> 2 > clojure.core/quotient/remainder > --> 1 > > This seems simpler than the Common Lisp way. I don't think so. And there are several major problems with that approach. First of all, your clojure.core.quotient/remainder var needs to be a mutable, thread-local var, because else you couldn't be sure that 1 is the remainder of the quotient call directly above, or the remainder of a call that happened a blink later in another thread (or ForkJoinTask). Another problem is that if the var name is determined by the name of the local var in the function which is given to `values', then changing its name requires changing all places where clojure.core.quotient/remainder is used. Bye, Tassilo -- 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