I am lisp beginner and I am doing a lisp execise to write a lisp
function. That function will
take an object a and a vector u, and returns a list of all objects that
immediately precede "a" in "v. And the returned list can't have repeated
elements.
eg.
>pre_list(#\a,"abdacrdaeaefa")
D E F
>pre_list(#\a,"xyazuvayayaxa")
Y V X
If you guys know how to do it, just let me know. Thanks!
Kelly
Just how many times are you going to post this question? It's just not
appropriate to
ask for a solution to a homework problem on this newsgroup. This problem
is extremely
easy anyway--all you really have to do is figure out how to extract
characters from string
(hint: try the aref function). The rest is just putting together a simple
algorithm to compare
elements of the string with the character passed to the function. It
should take 4 or 5 lines
at the most. If you need more help with Lisp, you should consult a
reference guide.
There are plenty on the net, or you can buy a book. The book my artificial
intelligence
class used this semester was Graham's "ANSI Common LISP," which is very
good.
Please don't post this same question again to the newsgroup, and if you're
going to post
questions about a homework assignment, don't just ask for the solution, ask
for help with
the concepts of solving the problem in Lisp--I don't think people will
respond otherwise.
-J. Grewal