Sorry if I gave offense; we do get a small but regular stream of people trying to outsource their homework assignments, and it's pretty unusual that a problem requires a specific function or operator, so I may have leapt to a conclusion.
You've explained the solution that you're trying to apply and that you're having trouble with, not the problem that you're trying to solve with it.
If you need to check whether one or more of the elements in the list is non-null, then any of Goheeca's suggestions will work - as long as you don't try to shoehorn #"or where it won't fit.
To ask from another angle: what behaviour is it that you need, that only the #'or operator provides?
Perhaps you could tell us what the aim of the project is? That would help us to give you more appropriate advice.
OR between list elements
Re: OR between list elements
No problem. But I just started to program in lisp less that 2 week ago so I don't know even the simple syntax. Remind yourself when you started to program in lisp.
I also search for everything that I need but I put my question here for the best solution.
Now I define the function for what I need like this :
(defun my-or (li)
(setf k nil)
(loop for l in li collecting (setf k (or k l)))
)
It works now. But I thought maybe there is a direct solution without defining the new function.
Anyway thank you for your time

I also search for everything that I need but I put my question here for the best solution.
Now I define the function for what I need like this :
(defun my-or (li)
(setf k nil)
(loop for l in li collecting (setf k (or k l)))
)
It works now. But I thought maybe there is a direct solution without defining the new function.
Anyway thank you for your time

Re: OR between list elements
Code: Select all
(some #'identity (list nil nil t nil))
Code: Select all
(some #'or (list nil nil t nil))
cl-2dsyntax is my attempt to create a Python-like reader. My mirror of CLHS (and the dark themed version). Temporary mirrors of aferomentioned: CLHS and a dark version.
Re: OR between list elements
yes. My bad. I used or besides identity. Now it works.
Thanks in advance.
Thanks in advance.