On Fri, May 29, 2009 at 11:03 PM, Hugh Aguilar <[email protected]> wrote: > I'm aware of unit testing, having read about it in a book: "Foundations of > Agile Python Development" (Jeff Younker). I don't have much experience with > it in any language though (I'm learning Python simultaneously with learning > Factor). Unit testing seems complicated for recursive functions. It might > work with list, that only uses tail-recursion, but I am very dubious that it > could be done with the functions in symtab (especially optimize) that are > truly recursive. I'll give it some thought and possibly take a stab at it.
Unit testing works just fine with recursive functions. : factorial ( n -- n! ) dup 1 <= [ drop 1 ] [ dup 1 - factorial * ] if ; [ 3628800 ] [ 10 factorial ] unit-test > That dlist class looks interesting. I don't see anything comparable to my > link function though. I want something like a + for lists, that appends or > prepends one list onto another. Also, my link function can be used for > inserting one list into the middle of another list. This works because my > lists are circular. It is not clear to me if the dlists are circular or if > they have null pointers at the ends. I also like my remove because it > returns the next node; it can be called repeatedly to delete a section of > the list. I would prefer to use dlist rather than my own list if I can > though. Factor is already quite complicated, so having two implementations > of doubly-linked lists that are slightly different would just be unnecessary > complication. You could use Factor's sequences instead: http://docs.factorcode.org/content/article-sequences.html. Dlists are intended to be used as a double-ended queue, not as a general list of items. Slava ------------------------------------------------------------------------------ Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers & brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, & iPhoneDevCamp as they present alongside digital heavyweights like Barbarian Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com _______________________________________________ Factor-talk mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/factor-talk
