gangueの日記: exception (2)
日記 by
gangue
とりあえず
let rec readall ch acc =
let (line, exitloop) =
try (input_line ch, false)
with End_of_file -> ("", true) in
if exitloop then acc else
readall ch (line::acc)
という方法があるな。あとは新しく exception を定義して、
返り値を exception 経由で返すとか。
でもいろいろと無駄が多い。素直に reference 使うかな。