core hello world / workshop /

* Answers to questions
** When to use ocamlbuild vs ocaml{c,opt} and .byte vs .opt
 - ocamlc is the byte-code compiler
   supports more platforms, ocaml debugger support, probably compiles faster?
 - ocamlopt is the native-code compiler
   faster code!
 - ocamlbuild is just a tool to manage more complex builds (may
   invoke ocamlc* multiple times under the hood)
 - both ocamlc and ocamlopt are byte-code programs, but there are
   native-compiled versions (ending with ".opt").
** Difference between [open] and [include]
** Other questions?
* Intro to Core
** Provides lots of useful modules
*** Data structures
 - list
 - map
 - set
 - hash table
 - hash set
 - doubly-linked list
 - heap
 - avl tree
 - queue
 - bag
 - stack
 - dequeue
 - univ_map
*** Time modules
 - time
 - timezone
 - date
 - weekday
 - ofday
 - time
*** Error handling
 - option
 - result
 - error
 - info
 - or_error
 - exn
 - with_return
*** "Pratical stuff"
 - unix
 - {in,out}_channel
 - command
 - blang
 - sexp
 - bin_io
*** Interfaces
 - container
 - comparable
 - hashable
 - stringable
 - monad
** Very careful about following conventions
 - explicit error handling (different from the stdlib)
   eg [List.hd : 'a list -> 'a] vs [Core.List.hd : 'a list -> 'a option]
 - redefines many modules in the stdlib, with incompatible interfaces
 - the [type t] convetion
   each module usually defines a datatype, and operations on that
   datatype -- within that module, the type will be called simply
 - see
** Understanding the .mli's
 - best way to learn an ocaml library (if it's well written, the
   types should tell the story)
 - understanding interface includes (see, eg, the Map interface)
 - opam makes mli's available, eg: ~/.opam/system/lib/core/*
* "Hello World" example 
** Command line parsing
 - ../
 - [open Core.Std] at the top
 - [let () =]
 - [Command.Spec.( ... )], [(+>)] is just an infix function
 - a simple ocaml command-line program with the Command module
 - example: add anonymous arg "Hello World, this is _"
 - exercise: add an optional argument to end the greeting with a "!"
** File IO, reading s-expressions
 - hello-world/
 - let's make the greeting configurable
* "Line counts" example -- file io
 - count-lines-1/
 - exercise: add an argument to read input from file(s) or stdin
* "Line counts" example -- refactoring into modules
 - count-lines-2/
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
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.