Discussion of Common Lisp
-
csphysics27
- Posts: 2
- Joined: Tue Jun 14, 2011 2:02 pm
Post
by csphysics27 » Tue Jun 14, 2011 2:06 pm
program written in muLisp trying to conver to clisp. everything seems to be correct maybe someone can guide me in the right way regarding this function. thanks in advance.
Code: Select all
(defun isMemb? (lList1 lList2)
(cond ((null lList1) nil);
;(or (car (member (car lLista1) lLista2 'equal)) (isMemb? (cdr lList1) lList2)));
-
csphysics27
- Posts: 2
- Joined: Tue Jun 14, 2011 2:02 pm
Post
by csphysics27 » Tue Jun 14, 2011 2:54 pm
**Updated code**
Ive got a successful load running "(isMemb? '(a (b g) c) '(n h (b g)) );", though now an error comes up "*** - MEMBER: keyword arguments in (EQUAL) should occur pairwise"
Maybe something is incorrect with the equal in my code, help is appreciated. thank you.
Code: Select all
(defun isMemb? (lList1 lList2)
(cond ((null lList1) nil)
);*** null
(or (car (member (car lList1) lList2 'equal)) (isMemb? (cdr lList1)lList2)));*** defun isMemb?
-
nuntius
- Posts: 538
- Joined: Sat Aug 09, 2008 10:44 am
- Location: Newton, MA
Post
by nuntius » Tue Jun 14, 2011 7:24 pm
The new code still doesn't look right. Copied here with more reasonable indentation (lisp programmers tend to use vertical space a bit more freely).
Code: Select all
(defun isMemb? (lList1 lList2)
(cond ((null lList1) nil))
(or (car (member (car lList1) lList2 'equal))
(isMemb? (cdr lList1) lList2)))
Note that the COND form has no effect. The call to
MEMBER is missing the :test argument.
-
Konfusius
- Posts: 62
- Joined: Fri Jun 10, 2011 6:38 am
Post
by Konfusius » Wed Jun 15, 2011 9:05 am
Your code doesn't make sense in any Lisp dialect. Maybe you mean something like this:
Code: Select all
(defun isMemb? (lList1 lList2)
(when lList1
(or (member (car lList1) lList2 :test #'equal)
(isMemb? (cdr lList1) lList2))))