RE: (dsssl) simple loop question

Subject: RE: (dsssl) simple loop question
From: Miroslaw Prywata <Miroslaw.Prywata@xxxxxxxxxx>
Date: Fri, 11 Apr 2003 10:06:04 +0200
Maybe I shouldn't answer my own post, but I found a mistake :-))

> -----Original Message-----
> From: Miroslaw Prywata [mailto:Miroslaw.Prywata@xxxxxxxxxx]

> (define wrap-with-mi (lambda (#!optional (nl (children 
> (current-node))))
>     (let loop ((n nl) (result empty-sosofo))

Here I changed the second argument to (result (literal ""))
openjade was complaining empty-sosofo is not sosofo :)

>         (if (node-list-empty? n)
>             result
>         (let* ((cn (node-list-first n))   (c (node-property 
> 'class-name
> cn)))
>             (loop
>                 (node-list-rest n)
>                 (sosofo-append

I have to append current value to result, so there is one missing line:

result

>                     (if (equal? 'data-char c)
>                         (make element gi: "mi"
>                             (literal (string (node-property 
> 'char cn))))
>                         (process-node-list cn)
>                     ))
>             ); loop
>             );let
>        );if
> );let
> ))

The whole function looks lite this:

(define wrap-with-mi (lambda (#!optional (nl (children (current-node))))
    (let loop ((n nl) (result (literal "")))
        (if (node-list-empty? n)
            result
        (let* ((cn (node-list-first n))   (c (node-property 'class-name
cn)))
            (loop
                (node-list-rest n)
                (sosofo-append
                    result
                    (if (equal? 'data-char c)
                        (make element gi: "mi"
                            (literal (string (node-property 'char cn))))
                    (process-node-list cn)
                    ))
            ); loop
            );let
       );if
);let
))

Mirek

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

Current Thread