|
|
 |
 |
 |
 |
Scheme Programming Language
|
 |
 |
 |
 |
 |
 |
 |
 |
Using (second a-list) or (third a-list) 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 a-list, 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 a-lon) (cond [(empty? (rest a-lon)) empty] [else (list (first a-lon) (second a-lon) (third a-lon) (thinger (rest a-lon)))])) (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 a-list, > 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 ***
|
 |
 |
 |
 |
|