ersatz icon indicating copy to clipboard operation
ersatz copied to clipboard

rows, colums of relation

Open jwaldmann opened this issue 1 year ago • 0 comments

I sometimes want to convert between R.Relation a b and [[Bit]]. It's easy to write

rows b =
  let ((u,l),(o,r)) = R.bounds b
  in  flip map (A.range (u,o)) $ \ x ->
         flip map (A.range (l,r)) $ \ y ->
         b R.! (x,y)

but it could be in the library.

Actually, it already is, sort of, but hidden in the implementation of https://hackage.haskell.org/package/ersatz-0.5/docs/src/Ersatz.Relation.Data.html#table

jwaldmann avatar Oct 24 '24 08:10 jwaldmann