From a2e1867902cf80d2b666b880323699b3f57bdab1 Mon Sep 17 00:00:00 2001 From: jim Date: Sat, 4 Apr 2015 23:02:31 -0400 Subject: [PATCH] tweaks --- juli8.mdwn | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/juli8.mdwn b/juli8.mdwn index 8b144f30..e4001620 100644 --- a/juli8.mdwn +++ b/juli8.mdwn @@ -4,7 +4,7 @@ In addition to the fine programming language Kapulet, which doesn't yet exist in a form you can actually execute --- though the full-featured interpreter we provided [[a week or so ago|/topics/week7_untyped_evaluator]] is a good start --- I decided it would be useful to have a collection of basic libraries for our teaching (and other) purposes, that brought OCaml, Haskell, and the Scheme implementations we recommend, more onto even footing. Of course there are fundamental differences between these languages, such as the lack of types in Scheme (though both Racket and Chicken have some facility for working with types in extensions), or the default lazy evaluation strategy in Haskell. But there are also many simply accidental differences between the languages too, in that this one provides a library function doing so-and-so, but the other one doesn't, or calls it by a different name. The Juli8 collection of libraries is aimed to reduce these differences, to make it easier to move back and forth between the languages, and also to just make some of the languages generally easier to use (from my perspective). Juli8 will eventually have components that you can install into each of Haskell, OCaml, Racket, and Chicken. For the moment, OCaml is the most developed of these, and Haskell a bit, with the Scheme components deferred for another time. -Juli8 tries to give OCaml more-or-less the same functionality that you have in Haskell's Maybe, List, and Monad libraries, as well as a few others. It doesn't try for an exact match, and it doesn't strictly use the same names as Haskell does. I've aimed to at least stay close to the existing OCaml naming patterns, and also the Scheme naming patterns when they are salient to me. +Juli8 tries to give OCaml more-or-less the same functionality that you have in Haskell's `Data.Maybe`, `Data.List`, and `Control.Monad` libraries, as well as a few others. It doesn't try for an exact match, and it doesn't strictly use the same names as Haskell does. I've aimed to at least stay close to the existing OCaml naming patterns, and also the Scheme naming patterns when they are salient to me. Below, we'll give instructions on how to install Juli8 into your existing OCaml and/or Haskell setups. We'll also discuss how to use the non-monadic parts of the Juli8 libraries for OCaml. We discuss how to use the monadic parts of the Juli8 libraries for OCaml [[elsewhere|/topics/week9_using_the_monad_library]]. We'll also say a little bit about the little bit that Juli8 provides for you if you're using Haskell. @@ -42,7 +42,8 @@ Below, we'll give instructions on how to install Juli8 into your existing OCaml > That should build and install the readline library in your local user directories. It will take a couple of minutes. Next, download [the source code for rlwrap](http://utopia.knoware.nl/~hlub/rlwrap/rlwrap-0.42.tar.gz). Double-click to expand and go inside the `rlwrap-0.42` folder in a Terminal, as before. Then type this command in the Terminal: - > ./configure --prefix=$HOME && make CFLAGS="-g -O2 -I $HOME/include -L $HOME/lib" && make install + > ./configure --prefix=$HOME && make CFLAGS="-g -O2 \ + > -I $HOME/include -L $HOME/lib" && make install If that all completes without errors, then you have gotten `rlwrap` installed. Congratulations. To use it, you just will now type `rlwrap ocaml ...` wherever before you would ordinarily type `ocaml ...` This is just to make interactive OCaml sessions nicer. To compile code with `ocamlc ...` and so on, you don't use `rlwrap` for that. (If you see error messages of the form `-bash: rlwrap: command not found`, then you should make sure that you have a `.bash_profile` or `.bashrc` in your `$HOME` directory which has a line containing something like `export PATH="$HOME/bin:$HOME/Library/Haskell/bin:$PATH"`. Then maybe start up a new Terminal.) @@ -85,7 +86,8 @@ Below, we'll give instructions on how to install Juli8 into your existing OCaml #directory "+../delimcc";; - #directory "/Users/jim/.juli8/ocaml";; (* you'll have to substitute your own $HOME directory in for `/Users/jim/` *) + (* you'll have to substitute your own $HOME directory in for `/Users/jim/` *) + #directory "/Users/jim/.juli8/ocaml";; #use "juli8.ml";; @@ -129,7 +131,7 @@ raise <exception> failwith "msg" (* same as `raise (Failure "msg")` *) invalid_arg "msg" (* same as `raise (Invalid_argument "msg")` *) undefined () (* provided by Juli8 *) -assert <bool> : unit +assert <bool> : unit Corresponding are the following operations in Haskell: @@ -137,7 +139,7 @@ Corresponding are the following operations in Haskell:
 Prelude.error "msg"
 Prelude.undefined
-Control.Exception.assert <bool> <anything>
+Control.Exception.assert <bool> <anything>