just store the data in an organized fashion in the first place.
Rashakil Fol
Super Senior Demiposter
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
Writing a function for this is less efficient than writing a list with these organized into sublists; in fact, a properly written procedure will contain such a list anyway.
Rashakil Fol
Super Senior Demiposter
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
So you'll need to use a list of categories in your function.
Rashakil Fol
Super Senior Demiposter
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
i dont know nothing about lisp
Then learn something about it.
Rashakil Fol
Super Senior Demiposter
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
Sigh...
If you don't know anything about the language you're using, how do you expect to do anything useful with it? Are you just going to go around asking people to write code for you, without learning anything?
Here's one book you can buy:
http://www.paulgraham.com/acl.html
Here is a pdf to On Lisp, which assumes you know a bit about the language already...
http://www.paulgraham.com/lib/paulgraham/onlisp.pdf
There are countless resources for learning this language online, and I am not in the mood to tell you basics that you could look up for yourself.
Rashakil Fol
Super Senior Demiposter
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
Rashakil Fol
Super Senior Demiposter
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
You have probably written it incorrectly.
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
Your problem is that you don't have a function named Ford, and that's what your Lisp interpreter is looking for. If you want to assign a list to the value, you should assign a list; right now your code wants to call a procedure named Fieata, too...
Rashakil Fol
Super Senior Demiposter
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
If you bothered to learn the basics of the language, you'd know the answer.
Rashakil Fol
Super Senior Demiposter
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
Watch out with variable names...especially in this situation: CAR is a function in Lisp, so I would name the variable *cars* instead.
It's also not working, because you haven't defined the symbols Ford, Fiesta, Focus and Mondeo anywhere. Unless you want to define them like this: (defparameter <em>car-name</em> (cons <em>"car model" "car brand"</em>)) , you will have to assign them as strings in lists: (defparameter *cars* (cons "Ford" (list "Focus" "Fiesta" "Mondeo")))
I hope you find this of some use - even though this thread is approximately 10 months old.NOTE: When discussing Lisp, all functions are always typed in caps.
NOTE: If you don't know what CONS lists are, look them up - they're almost always one of the first things covered in any Lisp book/reference.
indienick
Junior Poster in Training
71 posts since Aug 2005
Reputation Points: 23
Solved Threads: 2