Scheme homework problem, need help.

Posted by poorStudent on Stack Overflow See other posts from Stack Overflow or by poorStudent
Published on 2010-03-30T01:18:42Z Indexed on 2010/03/30 1:23 UTC
Read the original article Hit count: 392

Filed under:
|
|
|

Okay one of my homework problems is to take a list of lists and return the car of each sublist as a list. I have it to where I can print out the values, but it's not a list. To be honest, I have no clue how to output lists. Here's what I got:

(define (car-print alist)
  (if (null? alist)
      (newline)
      (begin
         (write (car (car alist))) (display " ")
  (car-print(cdr alist)))))

This is a cheap way to do it, perhaps some help on actually solving this problem would be much appreciated. Not necessarily the full answer but steps to get there. Thanks.

© Stack Overflow or respective owner

Related posts about Scheme

Related posts about homework