954,498 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Lisp Programming defparameter

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

coolman2006
Newbie Poster
12 posts since Mar 2006
Reputation Points: 10
Solved Threads: 0
 

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

Rashakil Fol
Super Senior Demiposter
Team Colleague
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
 

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

coolman2006
Newbie Poster
12 posts since Mar 2006
Reputation Points: 10
Solved Threads: 0
 

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

coolman2006
Newbie Poster
12 posts since Mar 2006
Reputation Points: 10
Solved Threads: 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.

Rashakil Fol
Super Senior Demiposter
Team Colleague
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
 

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:

coolman2006
Newbie Poster
12 posts since Mar 2006
Reputation Points: 10
Solved Threads: 0
 

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

Rashakil Fol
Super Senior Demiposter
Team Colleague
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
 

how do I do that

coolman2006
Newbie Poster
12 posts since Mar 2006
Reputation Points: 10
Solved Threads: 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

coolman2006
Newbie Poster
12 posts since Mar 2006
Reputation Points: 10
Solved Threads: 0
 
i dont know nothing about lisp

Then learn something about it.

Rashakil Fol
Super Senior Demiposter
Team Colleague
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
 

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

coolman2006
Newbie Poster
12 posts since Mar 2006
Reputation Points: 10
Solved Threads: 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.

Rashakil Fol
Super Senior Demiposter
Team Colleague
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
 

And here's the one I was looking for:
http://www.gigamonkeys.com/book/

Rashakil Fol
Super Senior Demiposter
Team Colleague
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
 

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

coolman2006
Newbie Poster
12 posts since Mar 2006
Reputation Points: 10
Solved Threads: 0
 

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
Team Colleague
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
 

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

coolman2006
Newbie Poster
12 posts since Mar 2006
Reputation Points: 10
Solved Threads: 0
 

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

Rashakil Fol
Super Senior Demiposter
Team Colleague
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
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You