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

just store the data in an organized fashion in the first place.

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

the 2 means 2 items per list and in the correct list

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.

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:

So you'll need to use a list of categories in your function.

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

i dont know nothing about lisp

Then learn something about it.

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

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.

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

Member Avatar for iamthwee

You have probably written it incorrectly.

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

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

If you bothered to learn the basics of the language, you'd know the answer.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.