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
((1 + 2) + (((3 + 4) + 5) + (6 + (7 + 8)))) + ((9 + 10) + (((11 + 12) + 13) + (14 + (15 + 16))))
(6 and 7 as well as 14 and 15 fit onto one line)
everywhere non-cumulative:
((1
+ 2)
+ (((3
+ 4)
+ 5)
+ (6 + (7
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