Skip to content

Instantly share code, notes, and snippets.

@alexy
Created February 3, 2011 01:51
Show Gist options
  • Save alexy/808895 to your computer and use it in GitHub Desktop.
Save alexy/808895 to your computer and use it in GitHub Desktop.
let printShowTable: tex -> ?verbose:bool ->
('a BatInnerIO.output -> 'b -> unit) ->
'c list list -> string -> unit =
fun tex ?(verbose=false) printOne table tableName ->
let oc = open_out tableName in
printTable oc tex printOne table tableName;
close_out oc;
if verbose then
printTable stdout tex printOne table tableName
else ()
(* TODO this binds to Int.print, doesn't take floatPrint anymore -- why? *)
let printShowTable2: tex -> ?verbose:bool ->
~printOne:('a BatInnerIO.output -> 'b -> unit) ->
'c list list -> string -> unit =
fun tex ?(verbose=false) ?(printOne=Int.print) table tableName ->
let oc = open_out tableName in
printTable oc tex printOne table tableName;
close_out oc;
if verbose then
printTable stdout tex printOne table tableName
else ()
(* works: *)
printShowTable tex ~verbose floatPrint floatTable name
printShowTable2 tex ~verbose intTable name
(* FAILS: *)
printShowTable2 tex ~verbose ~printOne:floatPrint floatTable name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment