Source

core hello world / hello_world.ml

Yaron Minsky 74784b4 

Yaron Minsky b4825ea 


Yaron Minsky 74784b4 
Yaron Minsky 52e7892 
Yaron Minsky b4825ea 
Yaron Minsky 74784b4 

Yaron Minsky b4825ea 

Yaron Minsky 74784b4 






Yaron Minsky b4825ea 

Yaron Minsky c88e3c2 
Yaron Minsky 74784b4 
Yaron Minsky c88e3c2 
open Core.Std

(* A very basic command-line program, using Command, Core's Command line
   parsing library.  *)

let command =
  (* [Command.basic] is used for creating a command.  Every command takes a text
     summary and a command line spec *)
  Command.basic
    ~summary:"Hello World"
    (* Command line specs are built up component by component, using a small
       combinator library whose operators are contained in [Command.Spec] *)
    Command.Spec.(
      empty
      +> flag "-hello" (optional_with_default "Hello" string)
        ~doc:" The 'hello' of 'hello world'"
      +> flag "-world" (optional_with_default "World" string)
        ~doc:" The 'world' of 'hello world'"
    )
    (* The command-line spec determines the argument to this function, which
       show up in an order that matches the spec. *)
    (fun hello world () -> printf "%s %s!\n" hello world)

let () = Command.run command
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.