On 01/20/2011 07:53 AM, John Szakmeister wrote:
On Thu, Jan 20, 2011 at 5:38 AM, Baishampayan Ghose<[email protected]> wrote:
when we give an empty vector of seq-exprs to doseq it returns the value of
the last s-expression.. but returns nil when the
vector-of-seq-exprs is not empty.. may be this is the expected behaviour ..
but the documentation states otherwise ..
Yeah, that looks like a bug (either in the documentation or the code):
(doseq [] 1) => 1
doseq works just like do when the seq-exprs part is empty. This is
certainly not a bug in the code, but I believe the documentation can
be improved.
Relevant portion of the code:
https://github.com/clojure/clojure/blob/b578c69d7480f621841ebcafdfa98e33fcb765f6/src/clj/clojure/core.clj#L2395
Yep, I took a look at that before responding. I'm just not sure what
the fix should be: make (doseq) return nil as advertised, or update
the documentation. I tend towards the former, although the latter is
fine too. :-) Either way, something should be fixed. :-)
I folks believe it's a documentation problem, I'm happy to whip up a
patch for that.
-John
Please create a ticket in JIRA for this. If you have a patch and have
signed the CA then all is good there.
Cheers,
Aaron Bedra
--
Clojure/core
http://clojure.com
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en