Re: Iteration with named let

Subject: Re: Iteration with named let
From: Paul Prescod <papresco@xxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 24 Jun 1997 17:25:03 -0400 (EDT)
> 
> Here's a function I created to determine if a child has a particular GI:
> 
> (define (has-child? %gi% %element%)
>   (let loop ((desc-list (children %element%)))
>     (if (equal? (gi (node-list-first desc-list)) %gi%)
>        #t
>        (if (node-list-empty? desc-list)
>           #f
>           (loop (node-list-rest desc-list))
>       )
>     )
>   )
> )
> 
> There's probably an easier way, except that Jade doesn't support
> match-element?.
> 
> Have I done this correctly? 

Yes. One stylistic comments though. You've probaby noticed 
that many DSSSL programmers use a different parentheses syntax. It saves 
screen real estate. 

Also, I would do what you did like this:

(not (node-list-empty? (select-elements gi (children element))))

Styles vary...

 Paul Prescod


 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread