This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: (apply and (list #t #f #t))


   Date: Thu, 30 Oct 1997 11:05:13 +0100
   From: Sascha Ziemann <szi@aibon.ping.de>
   X-Mailer: Mozilla 4.03 [en] (X11; I; Linux 2.0.30 i586)
   MIME-Version: 1.0
   Content-Transfer-Encoding: 7bit
   Sender: owner-guile@cygnus.com
   Precedence: bulk
   Content-Type: text/plain; charset=us-ascii
   Content-Length: 76

   Hi,

   is it intended that this is not possible?

   (apply and (list #t #f #t))

'and' is a syntactic form, not a function, and you can't apply a
syntactic form.

I've never understood quite why this was necessary, perhaps to
implement short-circuiting, but it really breaks the model.

I've skirted it in STk with this function:

     (define (fand . args)
       (eval `(and ,@args))) 

and then I can do:

     (apply fand '(#t #f #t))

but I've never liked this solution very much, since eval isn't
standard.

Avoiding evaluation of the arguments isn't an issue here, since the
list of arguments has already been constructed.  So, now that I think
about this again, a list traversal routine would do just as well.