dev-serveez
[Top][All Lists]
Advanced

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

[dev-serveez] guile support


From: stefan
Subject: [dev-serveez] guile support
Date: Mon, 4 Feb 2002 21:12:20 +0100 (CET)

Hello,

  MGrabMue?  are you yet listening?  Yet another Guile question occured to
me.  I wonder if the following piece of code (part if the `inetd.scm'
script) can be written more elegantly:

============= 8< ======================================================
;; checks whether the rpc service identified by [number,version] is
;; already register at the portmapper and return #t if so.  otherwise 
;; the procedure return #f.
(define (check-rpc-portmapper number version)
  (let* ((mappings (portmap-list)) (result #f))
    (if mappings
        (for-each (lambda (mapping)
                    (if (and (equal? (vector-ref mapping 0) number)
                             (equal? (vector-ref mapping 1) version))
                        (set! result #t)))
                  mappings))
    result))
============= >8 ======================================================

The (portmap-list) procedure returns a list of vectors containing an RPC
port mapping.  It can also return #f.  The above procedure should look in
this list if one of the vectors partly matches the arguments `number' and
`version'.  As you can see I did the (set! result val) thingie again which
is not very Guile'ish, isn't it?

Thanks in advance,
        address@hidden




reply via email to

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