[racket] Delete Second

From: David Van Horn (dvanhorn at ccs.neu.edu)
Date: Mon Sep 17 15:37:30 EDT 2012

On 9/17/12 3:30 PM, Ashley Fowler wrote:
> Disregard the last message with the questions, I get what your saying now. I had to switch the sign.
> (define delete-second2
>      (lambda(ls)
>        (if(> (length ls) 1) (append(list(car ls))(cdr(cdr ls)))
>           (list(car ls)))))
> Only problem I got now is the first test still doesn't work.

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

There's a striking relationship between what comes in and what goes out 
in these two examples.  What is that relationship?  Do other examples of 
this length exhibit the same relationship?

How is that relationship different from what (list (car ls)) computes?


Posted on the users mailing list.