Dynamic variable names

From Rosetta Code
Revision as of 05:40, 2 June 2009 by rosettacode>Tinku99 (common lisp example)
Task
Dynamic variable names
You are encouraged to solve this task according to the task description, using any language you may know.

Create a variable with a user defined name.

AutoHotkey

<lang AutoHotkey> inputbox, dynamic, variable name %dynamic% = hello ListVars msgbox % %dynamic%  ; says hello </lang>

Common Lisp

<lang lisp>

(defmacro set-string (string value) 
 `(setf 
   ,(read-from-string string) 
   ,value))
(set-string "dynamicA" "hello")

(print dynamicA) </lang>