help for LISP program
Posted: Thu Apr 12, 2012 7:57 am
So I need help i have to show to my teacher a LISP program for factory for bikes and we have the following information for each type of bike:
number of the model - nm
name of the model - name
amount that is produced of this model - produce
amount that is sold of this product - sell
single prduct price - price
that is for bikes:
And Now i should make a function which tells us the amount of produced products and the single product price when we are given a number from keyboard
So my question is: Is this program is corect and which program to use and how to make a program of that and show my teacher the funcion i created works correctly, becouse my teacher didn't teach us how to use a LISP program and test it on PC our works was only on paper PLEASE HELP !!!
number of the model - nm
name of the model - name
amount that is produced of this model - produce
amount that is sold of this product - sell
single prduct price - price
that is for bikes:
Code: Select all
(DEFUN make-bike(nm name1 produce1 sell1 price1)
(SETF (GET nm 'name) name1)
(SETF (GET nm 'produce) produce1)
(SETF (GET nm 'sell) sell1)
(SETF (GET nm 'price) price1)
nm
)
(SETQ I ( LIST (make-bike 'n1234' Mountine 11 5 330 )
(make-bike 'n2345' Sprinter 10 4 200 )
(make-bike 'n3456' Jumper 5 2 890 )
(make-bike 'n4567' OldFashion 3 1 1001 )
(make-bike 'n5678' Kids 20 13 110)
))
Code: Select all
(DEFUN ponm (I nom)
(COND ((NULL I)(PRINC "No such a Bike"))
((EQUAL nom(Get (CAR I) 'nm))(PRINT (GET (CAR I) 'produce))
(TERPRI)
(PRINT (GET (CAR I) 'price)))
(T (ponm (CDR I) nom))
))