Skip to content

Instantly share code, notes, and snippets.

@Octachron
Created June 11, 2015 12:48
Show Gist options
  • Save Octachron/e83748b6c400af51ce2f to your computer and use it in GitHub Desktop.
Save Octachron/e83748b6c400af51ce2f to your computer and use it in GitHub Desktop.
let pp = Printf.printf
module Explanation = struct
pp "At the begining of a module (or the beginning of the file),";
pp "we start in execution mode\n.";
pp "We can have a" ;
pp "comma separated list of expression which is evaluted";
pp "at the top-level of the module.\n"
open List [@@remark "This is not an expression: we exit evalation mode" ]
let we_enter_definition_mode =
pp "comma separated sequence of exrepssion";
pp "are still possible in definition mode" ;
pp "but they necessarily belongs to an enclosing let or module binding.\n";
true
module M = struct
pp "Inside a new module,";
pp "we start once again, in execution mode.\n"
end
let after_exiting_M =
pp "we are back to definition mode";
true
let how_to_go_back_to_execution_mode = pp "Double comma are the only way.\n";;
pp "Here, we are back to execution mode\n";
pp "and evaluate one sequence of expression.\n"
let () =
pp "It is also perfectly possible to avoid completely the use of ;;";
pp {|by enclosing all sequence "s_1;..s_n" inside an "let () = s_1;..s_n " construction|}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment