[racket] Delete Second

From: Ashley Fowler (afowler2 at broncos.uncfsu.edu)
Date: Mon Sep 17 12:22:11 EDT 2012

That was the full problem. It started with #2. I'm just confused on how to start #3. I know you have to use a if expression.

2. Write a procedure (delete-second1 LS) that takes a list LS of at 
least two items and returns the same list only with the second item 
deleted. You may assume the input list has at least two elements.

Tests:
(delete-second1 '(3 7))  ==>  (3)
(delete-second1 '(a b c d))  ==>  (a c d)

3. Write a procedure (delete-second2 LS) that takes an arbitrary list 
LS of items and returns the same list only with the second item deleted 
if there is a second item, o.w. returns original input list. 
Hint: you will need to use a conditional.

Tests:
(delete-second2 '())  ==>  ()
(delete-second2 '(3))  ==>  (3)
(delete-second2 '(3 7))  ==>  (3)
(delete-second2 '(a b c d))  ==>  (a c d)
________________________________________
From: Matthias Felleisen [matthias at ccs.neu.edu]
Sent: Monday, September 17, 2012 12:16 PM
To: Ashley Fowler
Cc: users at racket-lang.org
Subject: Re: [racket] Delete Second

On Sep 17, 2012, at 12:11 PM, Ashley Fowler wrote:

> I just wanna know if I am starting the procedure out right? This is what I got so far...
> (define delete-second2(lambda(ls)
>               (if(>ls 1)


Since you're asking a yes-no question, the answer has to be 'no'.

Can you point us to the full problem statement please? The 'tests' specification looks wrong -- Matthias




Posted on the users mailing list.