Pino Dellevoglie
Pino Dellevoglie

Reputation: 13

Lisp defparameter use the name as arguments

I want to do that

(defparameter name (myfunct args))

In myfunct I need to reuse to assign to a variable the "name" that I use in the defparameter! Is it possible? How can I access to that from myfunct.

Upvotes: 1

Views: 190

Answers (1)

krzysz00
krzysz00

Reputation: 2103

If I understand your question correctly, you want myfunc to know what `name' is. Here's how you would do that.

(defun myfunc (name arg1 arg2 ... argN)
  (setf var name) ;;if this is what you want
  ... do things with args and name...)

Then do

(defparameter name (myfunc 'name args...))

However, if you want to do this sort of thing often, you might want to create a macro that will pass 'name for you.

Also, look up symbol-value if you want the value of a symbol (for example 'name)

Upvotes: 1

Related Questions