You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Set difference and union sometimes have to be computed together, such as in semi-naive fixed point computation:
seminaive::Orda=>Seta-> (Seta->Seta) ->Seta
seminaive x f = go Set.empty x where
go !done !todo
|Set.null todo' = done
|otherwise= go (done `Set.union` todo') (f todo')
where todo' = todo Set.\\ done
seminaive::Orda=>Seta-> (Seta->Seta) ->Seta
seminaive x f = go Set.empty x where
go !done !todo
|Set.null dif = uni
|otherwise= go uni (f dif)
where (dif, uni) =Set.differenceAndUnion todo done
The text was updated successfully, but these errors were encountered:
This feels way too specialized. Most combinations of operations can probably be implemented more efficiently by having a combined operation, but that doesn't mean we should do it. This isn't something I'd expect any library to implement, on the contrary, I'd feel like this would be bloat.
I've been wanting to make an equivalent of the Data.MapmergeA interface for sets for a long time, but I've never gotten around to it. That would include this operation.
Set difference and union sometimes have to be computed together, such as in semi-naive fixed point computation:
If there was a combined operation:
Then I can write it more efficiently:
The text was updated successfully, but these errors were encountered: