[racket] Delete Second

From: Ashley Fowler (afowler2 at broncos.uncfsu.edu)
Date: Mon Sep 17 14:54:50 EDT 2012

Okay I understand. I made some changes

(define delete-second2
      (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)
From: danny.yoo at gmail.com [danny.yoo at gmail.com] on behalf of Danny Yoo [dyoo at hashcollision.org]
Sent: Monday, September 17, 2012 1:42 PM
To: Ashley Fowler
Cc: users at racket-lang.org
Subject: Re: [racket] Delete Second

On Mon, Sep 17, 2012 at 11:30 AM, Ashley Fowler
<afowler2 at broncos.uncfsu.edu> wrote:
> I was just showing my first part lol...but here goes the rest of i below
> (define delete-second1(lambda(ls)
>                  (if(< (length ls) 1)
>                            (append(list(car ls))(cdr(cdr ls))
>                                 list(car ls))))))

There are problems still here, but you should be able to figure it out
from the error messages you're getting back from Racket.  If there's a
particular error message that you do not understand, please feel free
to ask questions.

The problems you're running into now are minor, but you need to know
how to fight them because you'll probably hit them again in future

Hints: highlight your whole program, and press TAB.  Note that this
will re-indent your program.  Watch how the indentation is slightly
screwy.  Also, put the cursor on the opening paren right before the
"append".  Notice that DrRacket will highlight what it thinks the
"part when the test is true".

Good luck!

Posted on the users mailing list.