---------------------------------------------------------------- > (dtest NOT-TYPE () > '(instance? not )) Is that form supposed to be quoted? ---------------------------------------------------------------- > (dtest FILL!-8 () > (and ; > > (txt "with end: arg" ) > (= (bind ((t "abcdefgh") t1) > (fill! t #\x end: 2)) > "xxcdefgh"))) Is that binding of t1 valid? ---------------------------------------------------------------- > (dtest FILL!-9 () > (and ; > > (txt "with start: and end: args" ) > (= (fill! #(a b c d) 1 start: 1 end: 3) #(a 1 1 d)) > (= (fill! "abcdefgh" #\x start: 3 end: 5) "abcxxfgh") > (= (fill! () 'x start: 0 end: 3) ()))) In the last line, is the () valid as a literal constant? ---------------------------------------------------------------- > (dtest FINAL-STATE-DEQUE () > (and ; > > (bind ((t (make ))) > (map (method (item) (push t item)) '(a b c)) > (instance? (final-state t) )) > > (and (= (final-state #(1 2 3)) 2) > (= (final-state "1 2 3") 4) > (not (final-state (make ))) > (not (final-state (make )))))) and > (dtest ITERATION () > (and ; > > (= (INSTANCE? '(1 2 3) ) '#t) > (= (INITIAL-STATE '(1 2 3)) '(1 2 3)) > (= (NEXT-STATE '(1 2 3) (INITIAL-STATE '(1 2 3))) '(2 3)) > (= (CURRENT-ELEMENT '(1 2 3) (INITIAL-STATE '(1 2 3))) '1) > (= (current-element '(1 2 3) '(2 3)) 2) > (= (current-element '(1 2 3) '(3)) 3) > (= (COPY-STATE '(1 2 3) (INITIAL-STATE '(1 2 3))) '(1 2 3)))) This assumes a particular implementation of iteration states for these types. Should it? ---------------------------------------------------------------- > (dtest DELETE () > (bind ((t '(1 2 3))) > (and (= (delete 2 t) '(1 3)) > (= t '(1 3))))) > (dtest DELETE-1 () > (bind ((t '(1))) > (and (= (delete 1 t) '()) > (= t '(1))))) There is no mention of a delete in the Dylan book. (Should it be remove!?) ---------------------------------------------------------------- > (dtest logxand () > (and ; > > (instance? (logxand pos-int) ) > (instance? (logxand neg-int) ) > (instance? (logxand) ) > (instance? (logxand) ))) Logxand? Sound it be logand instead? Or something else? ---------------------------------------------------------------- > (dtest IDENTITY () > (and > (= (IDENTITY 1) '1) > (= (identity 'a) 'a) > (= (map funcall (map (method (x) (method () x)) > '(1 2 3))) > (map identity '(1 2 3))))) Funcall? ---------------------------------------------------------------- > (define-method rectangular-complex-instance (#key (real 3) (imag 2)) > (make real: real imag: imag)) There is no mention of a make method on in the book. Is this valid? And if so, what is the difference between calling make on and make on ? ---------------------------------------------------------------- > (define-method stretchy-vector-instance (#rest contents) > (bind ((v (make ))) > (do (method (e) (set! v (add v e))) > (reverse contents)) > v)) and > (define-method simple-object-vector-instance (#rest contents) > (bind ((v (make ))) > (do (method (e) (set! v (add v e))) > (reverse contents)) > v)) these assume that add prepends, while the Dylan book does not require this. Many other tests that then use these functions then go on to assume that the elements will be in the same order they were originally in. ---------------------------------------------------------------- > (dtest ADD-1 () > (and ; > > (txt "dotted pair" ) > (bind ((t '(1 . 2))) > (and (= (+ (size t) 1) > (size (add t 'symbol))) > (= t '(1 . 2)))))) Isn't this inconsistent with dotted list cleanup? I can't find it right now, but I though the collection functions were supposed to signal 's when given dotted lists. ---------------------------------------------------------------- > (dtest ADD-NEW-6 () > (and ; > > (txt "with test: arg" ) > (= (add-new '(3 4 5) 1 test: <) '(3 4 5)) > (bind ((result (add-new '(3 4 5) 1 test: >))) > (and (member? 1 result) > (member? 3 result) > (member? 4 result) > (member? 5 result))) ... The book says that add-new always call the test predicate with an element from the sequence first and the potential addition second, but these tests assume the other ordering. ---------------------------------------------------------------- > (dtest DO-HANDLER-1 () > (and ; > > (txt "most recent first, both done" ) > (bind ((type-con #f) > (second-handler #f)) > (handler-bind ( (method (c d) (list c d))) > (handler-bind ( (method (c d) (list c d))) > (do-handlers (method (type test function description) > (if type-con (set! second-handler #t) > (set! type-con (list > type test function description))))))) > (and (= (first type-con) ) > (= ((second type-con)) #t) > (= (last type-con) #f) > second-handler)))) In the third from last line, the expression ``((second type-con))'' invokes the test function with no arguments, but the Dylan book says that the test function should be invoked with a condition of the specified class. This also happens in the first do-handlers test. ---------------------------------------------------------------- > (dtest ZERO? () > (and ; > (= (zero? pos-int) #f) > (= (zero? neg-int) #f) > (= (zero? 0-int) #t) > (= (zero? 4) #f) > > (= (zero? pos-float) #f) > (= (zero? neg-float) #t) > (= (zero? 0-float) #t) > > (= (zero? cmplx) #f) > (= (zero? (make real: 0 imag: 0))))) Is ``(= (zero? neg-float) #t)'' correct? In other words, is -3.0 really supposed to be zero? And in the last line, = is called with only one argument, but the Dylan book indicates that = takes two required arguments. ---------------------------------------------------------------- > (dtest GCD () > (and ; > (bind ((result (gcd))) > (and (= result 0) > (instance? result ))) > (instance? (lcm pos-int neg-int) ))) isn't part of the spec. ---------------------------------------------------------------- > (dtest ID? () > (and ; > > (txt "SImple cases") > (id? #f #f) > (not (id? '(1 2 3) > '(1 2 3))) > (not (id? "abc" "abc")) > (id? 'abc 'abc))) The ``(not (id? ...))'' tests imply that the compiler cannot combine identical constants. Is this intended? ---------------------------------------------------------------- > (dtest AREF-TYPE () > (and (instance? aref ) > (not (instance? aref )))) and > (dtest DIMENSIONS-TYPE () > (and (instance? dimensions ) > (not (instance? dimensions )))) Are aref and dimensions really required to not be generic functions? If so, why? The Dylan book only says that they are s. ---------------------------------------------------------------- > (dtest REMOVE-DUPLICATES () > (and ; > > (txt "list" ) > (= (remove-duplicates > '(spam eggs spam sausage spam spam spam)) > '(spam eggs sausage)))) This imples that remove-duplicates preserves the original order. Is this intended? ---------------------------------------------------------------- > (dtest AS- () > (= (as 'foo) 'foo:)) The Dylan book makes no mention of this conversion. Is it supposed to exist? ---------------------------------------------------------------- > (define-method array-instance (#key (dimensions (2)) contents) > (if (member? dimensions: contents) > (set! contents (copy-sequence contents start: 2))) > (bind ((v (make dimensions: dimensions))) > (do (method (e) (set! v (add v e))) > (reverse contents)) > v)) Shouldn't that (2) on the first line be quoted? ---------------------------------------------------------------- Added Aug 17 ---------------------------------------------------------------- > (dtest MEMBER?-9 () > (and ; > > (txt "with other tests" ) > (member? #(2) #(#(1) #(2) #(3)) test: =) > ; in honor of design note #18 > (not (member? 1 (range from: 0 up-to: 6) test: >)) > (member? 1 #(1 2 3) test: <) > (not (member? '((1) (2) (3)) '(1))) > (member? #\a #(3 5 #\b 7 #\a)))) Isn't the ``(not (member? 1 (range from: 0 up-to: 6) test: >))'' backwards? The range contains 0, 1, 2, 3, 4, and 5. The call to member asks if 1 is > then any of those. 1 is indeed greater then 0, so the member? call returns #t. This test imples that the result of the member? call should be false for some reason. ---------------------------------------------------------------- > (dtest CHOOSE-BY-3 () > (and ; > > (txt "range" ) > (= (choose-by even? (range from: 0 up-to: 15) > (range from: 0 down-to: -15 by: -1)) > '(0 -2 -4 -6 -8 -10 -12 -14)))) The description of range on page 118 makes no mention of a down-to: keyword argument. ---------------------------------------------------------------- > (dtest BINARY<-2 () > (bind ((t 'true) > (range1 (range from: 2 through: 50 by: 2)) > (range2 (range from: 3 through: 60 by: 3)) > (range3 (range from: 1 through: 40))) > (= (for ((item1 (initial-state range1) (next-state range1 item1)) > (item2 (initial-state range2) (next-state range2 item2)) > (item3 (initial-state range3) (next-state range3 item3))) > ((or (not item1) (not item2) (not item3)) > t) > (if (and (and (binary< item1 item2) (binary< item2 item3)) > (not (binary< item1 item3))) > (set! t 'impossible))) > 'true))) This calls binary< on the deque iteration states. Shouldn't there be some calls to current-element in there? Same thing happens in test FLOW-CONTROL. ---------------------------------------------------------------- > (dtest SHALLOW-COPY () > (and ; > > (= (shallow-copy 3) 3) > > (txt "returns new object, but contents are reused" ) > (bind ((d (deque-instance 3 4)) > (s (list 1 2 d)) > (ns (shallow-copy s))) > (and (= s ns) > (not (id? s ns)) > (id? (third s) (third ns)))) > (bind ((s (deque-instance 3 4)) > (ns (shallow-copy s))) > (and (= s ns) > (not (id? s ns)) > (id? (third s) (third ns)))) > (bind ((s (simple-object-vector-instance 1 2 (deque-instance 3 4))) > (ns (shallow-copy s))) > (and (= s ns) > (not (id? s ns)) > (id? (third s) (third ns)))))) The middle test makes a two element deque, and then tries to access the third element without supplying a default. This is an error.