Re: [racket] Delete Second

2012-09-17 Thread David Van Horn
On 9/17/12 3:46 PM, Ashley Fowler wrote: Well i got (list(car'(())) ===> (()) (list(car'(3))) ===> (3) You changed the first example. If you plug in '() for ls you should get to: (list (car '())) What's the next step? Are you saying I need to change (list(car ls)) ? First, you should

Re: [racket] Delete Second

2012-09-17 Thread Greg Graham
g.org Subject: Re: [racket] Delete Second Well i got  (list(car'(())) ===> (()) (list(car'(3))) ===> (3) Are you saying I need to change (list(car ls)) ? From: David Van Horn [dvanh...@ccs.neu.edu] Sent: Monday, September 17, 2012 3:37

Re: [racket] Delete Second

2012-09-17 Thread Ashley Fowler
oo; users@racket-lang.org Subject: Re: [racket] Delete Second 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

Re: [racket] Delete Second

2012-09-17 Thread David Van Horn
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 n

Re: [racket] Delete Second

2012-09-17 Thread Ashley Fowler
7;t work. From: danny@gmail.com [danny@gmail.com] on behalf of Danny Yoo [d...@hashcollision.org] Sent: Monday, September 17, 2012 3:18 PM To: Ashley Fowler Cc: users@racket-lang.org Subject: Re: [racket] Delete Second On Mon, Sep 17, 2012 at 12:54 PM

Re: [racket] Delete Second

2012-09-17 Thread David Van Horn
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) (del

Re: [racket] Delete Second

2012-09-17 Thread Ashley Fowler
: users@racket-lang.org Subject: Re: [racket] Delete Second On Mon, Sep 17, 2012 at 12: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))) > (li

Re: [racket] Delete Second

2012-09-17 Thread Danny Yoo
On Mon, Sep 17, 2012 at 12: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-sec

Re: [racket] Delete Second

2012-09-17 Thread Ashley Fowler
, 2012 1:42 PM To: Ashley Fowler Cc: users@racket-lang.org Subject: Re: [racket] Delete Second On Mon, Sep 17, 2012 at 11:30 AM, Ashley Fowler wrote: > I was just showing my first part lol...but here goes the rest of i below > > (define delete-second1(lambd

Re: [racket] Delete Second

2012-09-17 Thread Danny Yoo
On Mon, Sep 17, 2012 at 11:30 AM, Ashley Fowler 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)) >

Re: [racket] Delete Second

2012-09-17 Thread Ashley Fowler
ls)) From: danny@gmail.com [danny@gmail.com] on behalf of Danny Yoo [d...@hashcollision.org] Sent: Monday, September 17, 2012 1:22 PM To: Ashley Fowler Cc: users@racket-lang.org Subject: Re: [racket] Delete Second On Mon, Sep 17, 2012 at 11:19 AM, Ashley Fowler wrote: > Yeah I got a

Re: [racket] Delete Second

2012-09-17 Thread Danny Yoo
On Mon, Sep 17, 2012 at 11:19 AM, Ashley Fowler wrote: > Yeah I got a error. > > This is what I got so far though. > > (if(< (length ls) 1)(append(list(car ls))(cdr(cdr ls))) I can't read this one-liner. I can't count parens. :) Let me break it down into a few lines:

Re: [racket] Delete Second

2012-09-17 Thread Ashley Fowler
To: Ashley Fowler Cc: users@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 an

Re: [racket] Delete Second

2012-09-17 Thread Kieron Hardy
The documentation for 'if' is here http://docs.racket-lang.org/reference/if.html?q=if Here's a slightly modified example from the doc using 'if': (if (positive? -5) (error "shouldn't get here") (display "hi")) You might want to consider the 'when', documented here http://docs.racket-lang.org

Re: [racket] Delete Second

2012-09-17 Thread Danny Yoo
> 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) )

Re: [racket] Delete Second

2012-09-17 Thread Ashley Fowler
@gmail.com] on behalf of Danny Yoo [d...@hashcollision.org] Sent: Monday, September 17, 2012 12:44 PM To: Ashley Fowler Cc: users@racket-lang.org Subject: Re: [racket] Delete Second On Mon, Sep 17, 2012 at 10:40 AM, Ashley Fowler wrote: > Basically delete-second2 has to take a input of a list, if the l

Re: [racket] Delete Second

2012-09-17 Thread Danny Yoo
On Mon, Sep 17, 2012 at 10:40 AM, Ashley Fowler wrote: > Basically delete-second2 has to take a input of a list, if the list has more > than 1 item then it will delete the second item and return the new list, if > it doesnt have more than 1 item it will just return the original list. Let me be

Re: [racket] Delete Second

2012-09-17 Thread Ashley Fowler
[danny@gmail.com] on behalf of Danny Yoo [d...@hashcollision.org] Sent: Monday, September 17, 2012 12:36 PM To: Ashley Fowler Cc: Matthias Felleisen; users@racket-lang.org Subject: Re: [racket] Delete Second > 2. Write a procedure (delete-second1 LS) that takes a list LS of at > least two ite

Re: [racket] Delete Second

2012-09-17 Thread Danny Yoo
> 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)

Re: [racket] Delete Second

2012-09-17 Thread Matthias Felleisen
eu.edu] > Sent: Monday, September 17, 2012 12:16 PM > To: Ashley Fowler > Cc: users@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

Re: [racket] Delete Second

2012-09-17 Thread Ashley Fowler
__ From: Matthias Felleisen [matth...@ccs.neu.edu] Sent: Monday, September 17, 2012 12:16 PM To: Ashley Fowler Cc: users@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?

Re: [racket] Delete Second

2012-09-17 Thread Matthias Felleisen
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

[racket] Delete Second

2012-09-17 Thread Ashley Fowler
I have to 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 no second item, o.w. returns original input list. I will need to use a conditional. And the tests should be as below. Tests: (delete-seco