Thursday, November 12, 2015

Real World OCaml - Day 1

Will be flying to work at Jane Street in less than 2 weeks! Exciting, however unfortunately exams (and procrastination) is taking it's toll on my progress on digesting that nice "Real World OCaml" book by Minsky, Madhavapeddy and Hickey.

I will be posting my progress as I go as a reminder that I have to get my shit together, and also for your interest - any interesting tidbits I will definitely let yall know.

So anyway, I have OCaml installed, will be installing Core and utop, and will be going through the guided tour!

Once I figure out how long a chapter roughly takes me, I will develop a time plan and commit to (at least trying to) finishing the book before my internship on the 30th of November.

~

Edit ===============================

Things that I screwed up:

Installation:

For some reason core wouldn't install, throwing me errors like
#=== ERROR while installing herelib.112.35.00 =================================#
# opam-version    1.2.2
# os              darwin
Cannot remove /Users/yujinwunz/.opam/system/build/herelib.112.35.00 (error 1).

but switching:

$ opam switch 4.02.1

and then installing again:

$ opam install core

worked. I still don't know what happened. I ran:

$ ocaml -version
The OCaml toplevel, version 4.02.1

before I switched, which is even more confusing.

Running ocaml with core:

When I first launched ocaml, I couldn't open core:

$ utop

# open Core.Std;;
Error: Unbound module Core

That's because we didn't #requre "core". So I appended the following to my ~/.ocamlinit (which contained core's associated libraries too):

#use “topfind”#thread#require “dynlink”#camlp4o#require “bin_prot.syntax”#require “sexplib.syntax”#require “variantslib.syntax”#require “fieldslib.syntax”#require “comparelib.syntax”#require “core”#require “async”#require “core_extended”#require “core.topopen Core.Std

No comments:

Post a Comment