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
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe