Question: Define a new function, called ismember, that returns TRUE if the atom is a member of a list, or FALSE otherwise, i.e.,: (defun ismember (atom

Define a new function, called ismember, that returns TRUE if the atom is a member of a list, or FALSE otherwise, i.e.,: (defun ismember (atom list))

For instance:

(ismember a (1 2 3)) would return false

(ismember 1 (1 2 3) would return true

To quickly implement ismember you can take advantage of Lisp membership functions. As you know, list have several functions to handle lists. For instance, member, member-if, and member-if-not each search list for item or for a top-level element that satisfies the test. The argument to the predicate function is an element of list. If some element satisfies the test, the tail of list beginning with this element is returned; otherwise nil is returned.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!