## Can you summarize the differences between our made-up language and Scheme, OCaml, and Haskell? ## The made-up language we wet our toes in in week 1 is called Kapulet. (I'll tell you the story behind its name sometime.) The purpose of starting with this language is that it represents something of a center of gravity between Scheme, OCaml, and Haskell, and also lacks many of their idiosyncratic warts. One downside is that it's not yet implemented in a form that you can run on your computers. So for now, if you want to try out your code on a real mechanical evaluator, you'll need to use one of the other languages. Also, if you want to read code written outside this class, or have others read your code, for these reasons too you'll need to make the shift over to one of the established languages. We hope, though, that learning Kapulet first puts you in a position to make that shift more effortlessly, and also to more quickly see the places where there's underlying unity to Scheme, OCaml, and Haskell, despite their diverse syntaxes. (And idiosyncratic warts.) ### Comments ... # this is a comment in Kapulet, that goes until the end of the line ... ; this is a comment in Scheme, that goes until the end of the line ... -- this is a comment in Haskell, that goes until the end of the line Note that for Haskell's comments, the `--` must be immediately followed by something like a space or a letter. `-->` does not begin a comment; it's a legal operator symbol. OCaml doesn't have comments of that sort. It only has "block" comments like this: (* ... *) which may last for several lines. These comments *nest*, so that: (* ... (* inner *) ... *) is a single comment. Haskell also has block comments, though it `{- writes them differently -}`. Haskell's block comments also nest. Racket and Scheme also have block comments, though they `#| write them differently |#`. These block comments also nest. Another form of block comments is `#;( ... )`. Those may contain nested parentheses, and extend until the next *matching* `)`. So prefixing `#;` to a complex parenthesized expression is a way to turn the whole thing into a comment. (These two comment styles aren't part of the official Scheme standard, but they widely implemented.) ## Offsite Readings comparing Scheme, OCaml, and Haskell ## * [Haskell for OCaml Programmers](http://science.raphael.poss.name/haskell-for-ocaml-programmers.pdf) * [Introduction to OCaml for Haskellers](http://foswiki.cs.uu.nl/foswiki/pub/Stc/BeyondFunctionalProgrammingInHaskell:AnIntroductionToOCaml/ocaml.pdf), [another](http://blog.ezyang.com/2010/10/ocaml-for-haskellers/) * Haskell Wiki on [OCaml](https://wiki.haskell.org/OCaml) * [ML Dialects and Haskell](http://hyperpolyglot.org/ml) * [Differences between Haskell and SML?](http://www.quora.com/What-are-the-key-differences-between-Haskell-and-Standard-ML?browse) * [Comparing SML to OCaml](http://www.mpi-sws.org/~rossberg/sml-vs-ocaml.html) ## Why did you name these pages "Rosetta"? ## The [Rosetta Stone](https://en.wikipedia.org/wiki/Rosetta_Stone) is a famous slab discovered during Napoleon's invasion of Egypt, that had the same decree written in ancient Greek (which modern scholars understood) and two ancient Egyptian scripts (which they didn't). The slab enabled us to recover understanding of those Egyptian scripts; and has since come to be a symbol for the simultaneous expression of a single idea in multiple languages. A number of websites do this for various programming languages:
Scheme OCaml Haskell
  Rosetta Code Rosetta Code Rosetta Code
PLEAC PLEAC PLEAC
n/a
langref.org
code codex code codex code codex
99 problems 99 problems 99 problems
See also the [Project Euler](https://projecteuler.net/) programming challenges.