For general Lisp questions, the usenet group comp.lang.lisp is
probably more appropriate.  But, to answer your question...

Paulo J. Matos writes:
 > I'm trying to call an OR without using eval. The idea is that I
 > have a function that returns a list of T's and NILs and I want to
 > or the list. I've tried:
 > * (apply #'or '(t t t nil))
 > 
 > OR is a macro.

Yep.  There are a variety of ways to accomplish what you want to do,
that don't involve APPLYing OR (using MEMBER, FIND-IF, EVERY, etc).

 > The only way I found out is:
 > * (eval `(or ,@(funcall  #'(lambda () '(t t nil)))))
 > T

To answer your question about how to apply something like OR, you can
wrap it in a function.  EG:

  (reduce #'(lambda (a b) (or a b))
          '(t t nil))

or

  (flet ((or-fn (&rest args)
            (reduce #'(lambda (a b) args))))
    (apply #'or-fn '(t t nil)))

 > Anyway, people say eval shouldn't be used. Is there any other
 > suggestion?

This is a good example of why people say that :).  It's not that EVAL
is evil, but that until you're really comfortable with Lisp, you'll
probably be using it for something like this, that can be done better
another way.

-- 
           /|_     .-----------------------.                        
         ,'  .\  / | No to Imperialist war |                        
     ,--'    _,'   | Wage class war!       |                        
    /       /      `-----------------------'                        
   (   -.  |                               
   |     ) |                               
  (`-.  '--.)                              
   `. )----'                               

Reply via email to