[Haskell-cafe] Re: tensor product of dynamic-sized bits

Ahn, Ki Yung kyagrd at gmail.com
Thu Jan 22 02:07:49 EST 2009

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.

More information about the Haskell-Cafe mailing list