




Scheme Programming Language









Using (second alist) or (third alist) help
hey everyone. Quick question. I am trying to formulate a program to break a list of numbers into lists of three. For example: [list 1 2 3 4 5 6] would equal: [list [list 1 2 3] [list 2 3 4] [list 3 4 5][list 4 5 6]] here's how i tackled it, however when you use second and third alist, you run into the following error. Can anyone think of a conditional statement to check against this problem. Thanks for any/all help, I really appreciate it.
Sorry everyone, here is how i tackled the problem: (define (thinger alon) (cond [(empty? (rest alon)) empty] [else (list (first alon) (second alon) (third alon) (thinger (rest alon)))])) (thinger (list 1 1 1 0 0 0))
In article <1174966212.965632.166@n59g2000hsh.googlegroups.com>, AdamHegst @gmail.com wrote: > hey everyone. > Quick question. I am trying to formulate a program to break a list of > numbers into lists of three. For example: > [list 1 2 3 4 5 6] would equal: > [list [list 1 2 3] [list 2 3 4] [list 3 4 5][list 4 5 6]] > here's how i tackled it, however when you use second and third alist, > you run into the following error. Can anyone think of a conditional > statement to check against this problem. Thanks for any/all help, I > really appreciate it.
You never posted "the following error".  Barry Margolin, bar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group ***





