Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on A micro compiler in Ocaml. Parent comment
let is_digit c = let code = Char.code c in code >= Char.code('0') && code <= Char.code('9')
Could have been written: let is_digit = function '0'..'9' -> true | _ -> false
So the purpose probably wasn't to teach OCaml.
There are no comments on this comment yet.
let is_digit c = let code = Char.code c in code >= Char.code('0') && code <= Char.code('9')
Could have been written: let is_digit = function '0'..'9' -> true | _ -> false
So the purpose probably wasn't to teach OCaml.