Reputation: 1332
How can I define value of variable as variable name?
For example I define x
as newname
(define x 'newname)
then I want to define new variable with name of value of x
.
I want something like
(define x 'asd)
and if I call newname
I get 'asd
Is it possible?
Upvotes: 0
Views: 85
Reputation: 48775
Both Scheme and Common Lisps original binding way did this but you tend to find yourself debugging for hours because you forgot to quote the symbols. The result is that set
advanced to define
in Scheme and setq
in CL while the previous version became deprecated and totally removed in Schemes case.
I'm pretty sure you got a XY problem so if you could explain what you are trying to do with such a feature there must be a way to solve your problems without them.
Upvotes: 1