On 9/17/12 2:54 PM, Ashley Fowler wrote:
Okay I understand. I made some changes

(define delete-second2
     (lambda(ls)
       (if(< (length ls) 1) (append(list(car ls))(cdr(cdr ls)))
          (list(car ls)))))

it works for when I do the following tests:

(delete-second2 '(3 7))  ==>  (3)
(delete-second2 '(a b c d))  ==>  (a c d)

but it gives me a error for the tests:

(delete-second2 '())  ==>  ()
(delete-second2 '(3))  ==>  (3)

I'd like to encourage you to step through these failing computations on pencil and paper. Plug '() in for ls in the body of the lambda expression and continue with the remaining steps. Likewise with '(3).

Also, some of the examples that "work" don't really. Check those on pencil and paper too.

BTW, did you already solve delete-second1?

David

____________________
 Racket Users list:
 http://lists.racket-lang.org/users

Reply via email to