dev-serveez
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [dev-serveez] guile support


From: stefan
Subject: Re: [dev-serveez] guile support
Date: Wed, 6 Feb 2002 07:57:44 +0100 (CET)

On Tue, 5 Feb 2002, Martin Grabmueller wrote:

> (define (check-rpc-portmapper number version)
>   (let ((mappings (portmap-list)))
>     (and mappings
>          (let loop ((m mappings))
>           (if (null? m)
>                 #f
>                 (or (and (equal? (vector-ref (car m) 0) number)
>                          (equal? (vector-ref (car m) 1) version))
>                     (loop (cdr m))))))))
> 
> Don't know whether is nicer...  The (and mappings ...) part checks
> whether mappings is #f, and returns #f if it is.  The (let loop
> ((...)) ...) thingy is a loop which walks down the list of mappings
> (which are named m for brevity inside the loop).  When the end of list
> is reached, #f is returned, otherwise the (or ...) tests whether the
> actual element of m matches or any of the remaining elements of the
> list.
> 
> At least, this should match the spec.  Attention: Not tested though.

Thank you very much!  In order to save the the first (and...) I modified
(portmap-list) that it returns an empty list when not available or an
error occurred.
I applied you proposal instantly.  I assume this proposal is more
Guile'ish since it does not use local variables except one.

Thanks,
        address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]