See Assembla ticket 13 in for clojure contrib to view the diff
containing the test cases

I just finished writing tests for the following functions in seq-
utils:

flatten
separate
includes?
indexed
group-by
partition-by
frequencies
reductions
rotations
partition-all
shuffle (invariants)
rand-elt (invariants)
find-first

As best I can tell, all of these functions except flatten behave as
they should.  There were no surprises with them.

flatten is a different story.

I wrote my test cases to deliberately make flatten pass.  This way it
can be used as a regression testing tool.  That being said, I found
several behaviors with flatten that I think are bugs.  Check the
flatten test function at the beginning of the file for examples.  The
executive summary is

1.  flattening a set at the top level always returns an empty seq.
Wrapping the set in a seq call enables normal behavior

2.  flattening a map at the top level always returns an empty seq.
Wrapping the map in a seq call enables normal behavior

3.  flattening a vector containing a set does not recursively enter
the set.

4.  flattening a vector containing a map does not recursively enter
the map.

5.  flattening nil returns an empty seq.  The doc string explicitly
states that (flatten nil) should return nil.

In my opinion, flatten to behave more like this:

http://gist.github.com/164291

It seems to me that the differnce is the sequential? call in
flatten.

One way to reconcile this is to have a proper seqable? function, like
the one specified in clojure.contrib.core.seqable? (recently discussed
here: 
http://groups.google.com/group/clojure/browse_thread/thread/9dbaff59e8de9a8a/7db470140505a92d
).  There would still be some minor tweaking required, but I think
this will enable maps and sets to behave properly.

Hope this helps,
Sean


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to