[racket] Delete Second
Yeah I got a error.
This is what I got so far though.
(if(< (length ls) 1)(append(list(car ls))(cdr(cdr ls)))
________________________________________
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:15 PM
To: Ashley Fowler
Cc: users at racket-lang.org
Subject: Re: [racket] Delete Second
> delete-second2 takes the same procedure from delete-second1, I just need to know how to use the if expression because you have to find out if the list has more than one item in order for it to delete anything.
Ok. Let's look at the expression you had written earlier:
(if (> ls 1) <consequent> <alternative>)
I've put placeholders <consequent> and <alternative> for what happens
when the test is true or false, and assume you'll know how to fill
these. For now, let me just fill them in with "big" and "small".
(if (> ls 1) "big" "small")
Let's give this expression a concrete list value for "ls", and see if
the expression correctly computes "big" or "small".
(if (> '(a big list) 1)
"big"
"small")
If we evaluate this at the Interactions window, we want to see "big",
of course, but what really happens? Try it. Does an error occur?