
Hello, Is it possible to define variable names according to input data? For instance: input = "I k" => Int k input = "I m" => Int m input = "S s" => String s Of course, the real application is much more complicated, but the basic question is the same. Many thanks, Maria

On 5 September 2010 21:04, Maria Merit
Is it possible to define variable names according to input data? For instance:
You can do arbitrary IO in TemplateHaskell. So, theoretically yes, you can define variables depending on input. But it has to be input during compilation/interpretation.

On Sun, 5 Sep 2010, Maria Merit wrote:
Hello, Is it possible to define variable names according to input data? For instance: input = "I k" => Int k input = "I m" => Int m input = "S s" => String s
No this is not possible. However you can use Data.Map String Object with data Object = Int Int | String String in order to manage a set of variables, that is their names and their values.
participants (3)
-
Henning Thielemann
-
Maria Merit
-
Tobias Brandt