
25 Jun
2009
25 Jun
'09
4:38 a.m.
Thanks for the quick and short answer. Maybe I am already thinking too complicated. However, exactly your given preconditions I can not satisfy.
The preconditions for bestFirst rate edges xs are: map rate xs must be nondecreasing,
Here lies my problem, because edges must also be applied to xs. So a quick fix of bestFirst would be the following: bestFirst' :: (Ord o) => (a -> o) -> (a -> [a]) -> [a] -> [a] bestFirst' rate edges = go where go [] = [] -- go (x:xs) = x : go (mergeOn rate (edges x) xs) go (x:xs) = x : go (mergeOn rate (edges x) (sortBy rate (concatMap edges xs)) And here I am afraid, that my efficiency gets worse. Or do I worry too much? Thanks