Newsgroups: comp.lang.scheme
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!howland.reston.ans.net!agate!library.ucla.edu!info.ucla.edu!csulb.edu!nic-nac.CSU.net!charnel.ecst.csuchico.edu!waldorf.csc.calpoly.edu!zimmer!news
From: caryp@zimmer.CSUFresno.EDU (Cary Penniman)
Subject: -=< Basic Scheme Question >=-
Message-ID: <D8JLAy.KBy@CSUFresno.EDU>
Sender: news@CSUFresno.EDU
Nntp-Posting-Host: zimmer.csufresno.edu
Organization: CSU Fresno
Date: Sun, 14 May 1995 00:28:10 GMT
Lines: 40

Hello.  I am a begining SCHEME programer. Could someone tell me what I
am doing wrong.  I am Stuck.

Here's the code:
================

(define (way x y)
     (ways x y () ))

(define (ways x y w)
    (cond
        ((= x 0) w)
        ((< x 0) ())
        (else (waysrec x y y w))))

(define (waysrec x y z w)
    (cond
        ((null? y) 0)
        (else (list (ways (- x (car y)) z (list w (car y))) (waysrec x
(cdr y) z w)))))


Here's my Problem
=================
1 ]=> (way 3 '(1 2 3))

;Value: ((((((() 1) 1) 1) (() (() 0))) (((() 1) 2) (() 0))) ((((() 2)
1) (() (() 0))) ((() 3) 0)))

I would like the output to be => ((1 1 1)(1 2)(2 1)(3))
Basicly what I have above, but w/out
all those parens.

Thank you for any Help! :)
  (cary@zimmer.csufresno.edu)
-- 
((((((((((((((((((((((((((((((((((((((()))))))))))))))))))))))))))))))))))))))
 )) Cary Penniman   ))  "No one knows much more of this                    ((
((  Goleta, CA     ((    than anyone can see. anyone can see."              ))
 )) 'the good land' ))                               -Hunter & Garcia      ((
