Search found 3 matches
- Fri Apr 27, 2012 9:00 pm
- Forum: Homework
- Topic: Ordering a list depending on the order of elements in anothe
- Replies: 3
- Views: 9493
Re: Ordering a list depending on the order of elements in an
So this problem is designed to step through one list and at each atom check if it exists in the other. This problem is asking you to make two recursive tasks, one based on L and one on L2. I suggest you start with L as it defines your order. L's function: If null, return nil else If L2 contains car ...
- Wed Apr 25, 2012 9:14 am
- Forum: Common Lisp
- Topic: Check if two elements are in order one after another in a li
- Replies: 2
- Views: 4971
Re: Check if two elements are in order one after another in
A simple way is to first step through the list for the first element. If found return the new list from that point. Next search the new sublist for the second element. (defun verify (lst a b) (labels ((is-found (lst x) (cond ((null lst) nil) ((equal x (car lst)) lst) (t (is-found (cdr lst) x))))) (l...
- Thu Mar 01, 2012 12:12 pm
- Forum: Common Lisp
- Topic: Create a method dynamically for an instance of a class
- Replies: 4
- Views: 6577
Create a method dynamically for an instance of a class
I'm new to Lisp, still trying to grasp the full usage of macros so bare with me if I'm doing this wrong. I want to create a class (lets call it foo) that has a method that allows you to create a method using a passed in name, and object to manipulate contained in the instance of the class. For examp...