Computing.Net > Forums > Programming > Scheme programming question

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Scheme programming question

Reply to Message Icon

Name: mrbsktbll10234
Date: March 25, 2008 at 06:23:06 Pacific
OS: XP
CPU/Ram: 1G
Product: hp
Comment:

I have a list of integers and want to change them into a list of of lists containing the integers. i.e.:
(make-sublists '(1 2 3 4)) -> ((1) (2) (3) (4))

Any help would be great!
Thanks.



Sponsored Link
Ads by Google

Response Number 1
Name: klint
Date: March 25, 2008 at 06:50:58 Pacific
Reply:

I don't know scheme but as this sounds like a homework question it would help you if you think it through. Here's some ideas.

You want (make-sublists '()) to return ()

and for any one-element list, you want
(make-sublists '(1)) to return ((1)).

For any list of more than one element, denoted by head and tail, you want it to return ((head) ...) where the "..." is for you to think about. Use recursion.


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Scheme programming question

C Programming Question www.computing.net/answers/programming/c-programming-question/13567.html

Game programing question www.computing.net/answers/programming/game-programing-question/4262.html

IRQ Programming www.computing.net/answers/programming/irq-programming/9506.html