One way woul be to represent them usnig a data structure. If it's only artihmetic operations, it should be pretty easy.

data Arith = Var String
           | Plus Artih Arith
           | Mult Arith Arith
           | Pow  Arith Arith

x + y would be Plus (Var "x") (Var "y"), so on so forth..

You can even use infix constructors like :+:, :*:, :^:


On 4 June 2010 16:37, Martin Drautzburg <Martin.Drautzburg@web.de> wrote:
Dear all,

If I have a problem where I have to select from a set of operations, how would
I print the result?

Example: If I can chose from (x+y), (x*y), (x^2+y)...
and I feed them all into my problem solver
and it finds that "(x*y) is right", how can I print that string?

--
Martin
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe



--
Ozgur Akgun