Re: How to Collect Sosofos?

Subject: Re: How to Collect Sosofos?
From: Paul Prescod <papresco@xxxxxxxxxxxxxxxx>
Date: Tue, 09 Sep 1997 11:24:06 -0400
W. Eliot Kimber wrote:
> (define (process-props node
>   (let ((propnames (split (node-property 'allpns node))))
>     (sosofo-append
>       (let loop ((propnames propnames))
>         (if (null? propnames)
>           (what do I return here?)
>           (sosofo-append
>             (process-property (car propnames))
>             (loop (cdr propnames))))))))
> What I can't figure out is what I return for the IF inside the loop--my
> understanding is that the result of this loop would always be the empty
> sosofo, not the sosofos appended by the false branch.

Maybe I don't understand properly, but can't you just put (empty-sosofo)
there? The final return code of the function would not be empty because
of all of the (sosofo-append)s.
> I guess what I'm looking for is some kind of "for-each" function that can
> return a list of sosofos or a way to accumulate sosofos explicitly.

I would use map:

(let ((process-props (split (node-property 'allpns)))
	(apply sosofo-append (map process-property process-props))))

There are implementations of map hanging around (or is it in Jade 1.0?).

 Paul Prescod

 DSSSList info and archive:

Current Thread