Skip to content
On this page

0d87d2a6 ​

arc
let g: Grid
let c: Cell
let hs: OList Int
let vs: OList Int
let rs: OList Rect

let input = g
  |> fold rect rs
  |> fold (λx. point (x, 0, c)) vs
  |> fold (λx. point (x, -1, c)) vs
  |> fold (λy. point (0, y, c)) hs
  |> fold (λy. point (-1, y, c)) hs

let output = g
  |> fold (λr. rect (r.0, r.1,
    if (
      some (λx. (gt r.0.0 x) && (lt r.1.0 x)) vs ||
      some (λy. (gt r.0.1 y) && (lt r.0.1 y)) hs
    ) c r.2
  )) rs
  |> fold (λx. vline x 0 -1 c) vs
  |> fold (λy. hline 0 -1 y c) hs