Skip to content

Instantly share code, notes, and snippets.

View mhuisi's full-sized avatar

Marc Huisinga mhuisi

  • Lean FRO
  • Munich, Germany
View GitHub Profile
def normalize (s : String) : String := Id.run do
let s := s.dropWhile (·.isWhitespace) |>.dropRightWhile (·.isWhitespace)
let lines := s.splitOn "\n"
|>.map (fun s => s.dropWhile (·.isWhitespace) |>.dropRightWhile (·.isWhitespace))
let mut r := ""
for i in [0:lines.length-1] do
let line := lines[i]!
if line.endsWith "." || line.endsWith ":" then
r := r ++ line ++ "\\n"
else if line == "" then