Haskell - Binary tree - Change a variable in a tree to another tree

0

I have this tree called arb

and this other called arbAux

and I put a function to replace variable axis: replace Variable "d" arbAux arb

then you should change the "d" for the arbAux

What I have of code is this

type Op = String -- operacion puede ser + - *
type Exp = String -- Exprecion es una variable

data Arbol = Hoja Exp | Nodo Op Arbol Arbol

-- caso de ambos con dos hojas

sustVar::Variable -> Arbol -> Arbol -> Arbol
sustVar var (Hoja e) (Hoja exp) = if (exp == var) then let exp = var
                                                        else exp

Please !!! Glue me a little help :) that code gives me an error -.-

codigo.hs:159:113: error: parse error on input ‘else’
|
|                                                       else exp
|                                                       ^^^^
    
asked by Andrey Rojas 27.04.2018 в 08:48
source

1 answer

0

You can not use let without its corresponding in (except in blocks do )

    
answered by 03.05.2018 в 05:25