0

Does anyone know about LISP Programming

I am trying to make this program where I have 3 types of cars, which are ford bmw merc

ford has focus and fiesta BMW has 1series and 2series and the merc has SK100 and SK200

well basically i am trying to put them in the correct list for example focus will go into ford list and SK100 will go to the merc list

at the moment to store the data i will use defparameter

example

(defparameter *cars* ' ( focus fiesta 1series 2series SK100 SK200))

so now i want to create a funtion where the cars will go into the correct list

if u have any idea please help

4
Contributors
18
Replies
19
Views
11 Years
Discussion Span
Last Post by indienick
0

no i gota use a proper function for it so (defun test-a-car 2) and den it puts these items in a list

0

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.

0

there gota be a way i mean i wanana do it so i run a funtion and i have a list of cars and those have got to go into the right type of cars at the moment there just in a list i want to put them in another list so fiesta goes to the ford list

so its sort it out. Sorting is the keyword here. u have a list of ramdon cars and u want to sort it into the correct category

please help!!! :lol:

0

Please man u gota give some sort of code so i can work on it i dont know nothing about lisp

if (test-a-list 2) the two means put two cars in a list, but they must be sorted to the correct list, that what i have to do because i need to learn this staff i tried the internet and everything but i cant find nothing

0

then wats the point of dis forum then!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! the truth is u dont know wat ur talking about i only wanted help so I can learn


thanks for nothing

0

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.

0

ok guys y does dis dont work (defparameter *car* (Ford (Fieata Mondeo Focus)))

so wat i am trying to say that ford is a list and within dat list there a fieasta and moneo and focus

but when i ran it in Lisp it dont work so wat wrong with it

0

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...

0

Thanks ok now I want to create another list where it will put the ford item into another list so the current ford list becomes nill because its being push to another list how do i do dat any ideas

(defparameter *ford* (list ' Fieata ' Mondeo ' Focus))

(defparameter *newFord* ( () ;;which is nill

0

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 [i]car-name[/i] (cons [i]"car model" "car brand"[/i])) , 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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.