Search found 3 matches

by Optimus
Sun Apr 21, 2013 3:42 pm
Forum: Common Lisp
Topic: Writing my own member function
Replies: 6
Views: 12401

Re: Writing my own member function

I see. So I guess I want a modified function that will return my desired result for: (member 1 '(( 0 1 2 3) 9 1 5)) ;should return (1 2 3) 9 1 5 but currently only returns 1 5 My current code, which was revised to compare atoms as well, is provided below. (defun member (iTerm iValues) ; S is search ...
by Optimus
Sun Apr 21, 2013 6:13 am
Forum: Common Lisp
Topic: Writing my own member function
Replies: 6
Views: 12401

Re: Writing my own member function

Thanks for the reply. I want normal functions. I wrote something up last night, but it doesn't function completely properly. (defun member (iTerm iList) (cond ((null iList) nil) ((equal iTerm (car iList)) iList) (t (member iTerm (cdr iList))) ) ) But returning from the following calls does not yield...
by Optimus
Sat Apr 20, 2013 3:46 pm
Forum: Common Lisp
Topic: Writing my own member function
Replies: 6
Views: 12401

Writing my own member function

Hey everyone. I'm brand new to Lisp. Any help that anyone can provide would be appreciated.

I'd like to write my own 'member' function that performs exactly the same as the built-in 'member' function. Any tips on how to go about doing this, or some code that can get me started?