Ahn, Ki Yung 쓴 글:
> 
>> reduce (Bs (x:xs))     | all (x==) xs = x
>> reduce (Rep x@(Rep _)) = x
>> reduce x               = x

I already found a bug. The second equation of reduce
"reduce (Rep x@(Rep _)) = x" is wrong because it flattens
two dimensions into one. The reduce function should be:

> reduce x = x
> reduce (Bs (x:xs))     | all (x==) xs = reduce x
> reduce (Bs xs)         = Bs (map reduce xs)
> reduce (Rep O)         = O
> reduce (Rep I)         = I
> reduce (Rep x)         = Rep (reduce x)
> reduce x               = x

This is why I am looking for existing work, because I am
not yet very sure about my code I'm using.

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to