[Top][All Lists]

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

Re: [dev-serveez] request for scheme

From: Martin Grabmueller
Subject: Re: [dev-serveez] request for scheme
Date: Tue, 19 Jun 2001 11:03:56 +0200 (MET DST)

> From: stefan <address@hidden>
> Date: Wed, 13 Jun 2001 23:09:22 +0200 (CEST)
> (define (bind-servers! . args)
>   (foreach args
>     (if (serveez-port? arg)
>       (remember-in-port-list))
>     (if (serveez-server? arg)
>       (remember-in-server-list))
>   )
>   (foreach port-list
>     (foreach server-list
>       (bind-server! port server)))))
> Do you understand ? I want a function given a list of port configurations
> and servers and bind each to every. With the functions (serveez-port?) you
> can check if that is a port configuration and with (serveez-server?) if it
> is a server prevously defined.
> I tried to write that myself but stuck into guile documentation without
> end... I think you will teach us all scheme :-)

I'm not sure I got what you're aiming at, but what about the
following (beware, untested):

(define (bind-servers! . args)
  (let ((server-list '())  ;; Initialize lists.
        (port-list '()))

    ;; Iterate over argument list, separating ports from servers.
      (lambda (elem)
        (cond ((serveez-port? elem)
               (set! port-list (cons elem port-list)))
              ((serveez-server? elem)
               (set! server-list (cons elem server-list)))))

      ;; Iterate over server list and ..
         (lambda (server)
           ;; ... for each server, iterate over port list and ...
              (lambda (port)
                 ;; ... bind each port to each server.
                 (bind-server! port server))


reply via email to

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