`[<<][rtl][>>][..]`
Wed May 30 03:09:19 EDT 2018

## regFix bug

```test_regfix = SeqEmu.trace' \$  do
let t = SInt Nothing 0
regFix [t,t] \$ \[a,b] -> do
return ([a',b'],[a,b])

--- test_regfix
[[0,0],[3,3],[6,6],[9,9],[12,12],[15,15],[18,18],[21,21],[24,24],[27,27]]

So it seems the problem is here:

regFix ::
forall f m r o. (Applicative f, Traversable f, Seq m r) =>
f SType -> (f (r S) -> m (f (r S), o)) -> m o
regFix ts f = do
rs <- sequence \$ fmap signal ts
(rs', o) <- f rs
sequence_ \$ liftA2 next rs rs'
return o

--- test_regfix
[[0,0],[3,3],[6,6],[9,9],[12,12],[15,15],[18,18],[21,21],[24,24],[27,27]]
-- bindings:
(2,Comb2 ADD (Node 0) (Const 2))
(3,Comb2 ADD (Node 1) (Const 3))
(0,Delay (Node 3))
(1,Delay (Node 3))
-- output:
[Node 0,Node 1]
-- inlined:
2 <- (ADD (NODE 0) (CONST 2))
3 <- (ADD (NODE 1) (CONST 3))
0 <- (DELAY (NODE 3))
1 <- (DELAY (NODE 3))

Wo why is node 3 bound twice?
Both interpretations appear to do the same thing.

The nodes get created, and they get bound, but not to the correct
thing?  Very strange.

There you have it:

*Main> sequence \$ Applicative.liftA2 (\a b -> return (a,b)) [1,2] [3,4] :: Maybe [(Int,Int)]
Just [(1,3),(1,4),(2,3),(2,4)]

It will compute the outer product.

So lists can't be used!
ZipList wrapper is needed.

Is there a way to express that two functors have the same structure?
I guess, converting to ziplist would work.

EDIT:
Used explicit zipWidth next + toList in regFix.
Then converted all other lists to ZipList.
Maybe best to use dedicated functors.

```
`[Reply][About]`
`[<<][rtl][>>][..]`