
10 Nov
2011
10 Nov
'11
4:39 a.m.
Hello. Wed, Nov 09, 2011 at 07:18:14AM +0200, Lev Broido wrote
Hi I am implementing toy loop search algorithm in graph . I encountered strange problem -- it seems , that fold doesn't run on the whole list . Code is at http://hpaste.org/53776 Section in question is updVis function Problem occurs when _newStateMap_2 is being calculated Please advise.
Thanks, Lev
I have not checked all pasted code but for your problem you can try next solution (using Either to specify is it odd or even argument):
f = foldl (\x y -> inner x y) (Left []) where inner (Left xs) _ = Right xs inner (Right xs) y = Left (yourfunction y:xs)
-- Alexander V Vershilov