https://github.com/bryik/experiments-in-ocaml
Small snippets of OCaml.
https://github.com/bryik/experiments-in-ocaml
ocaml
Last synced: 2 months ago
JSON representation
Small snippets of OCaml.
- Host: GitHub
- URL: https://github.com/bryik/experiments-in-ocaml
- Owner: bryik
- Created: 2018-12-18T19:58:11.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-22T02:19:32.000Z (over 7 years ago)
- Last Synced: 2025-01-19T23:32:48.398Z (over 1 year ago)
- Topics: ocaml
- Language: OCaml
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Experiments in OCamel
This repo contains little examples demonstrating certain concepts from OCaml. They are slightly cleaned up versions of notes I wrote during the uOttawa course CSI 3120.
## Running these experiments
All of the examples in `./experiments` have been tested with OCaml 4.07.0.
The easiest way to try out these examples is to open [utop](https://opam.ocaml.org/blog/about-utop/) in `./experiments` and `#use` a file to run the code via OCaml's interpreter. For example,
```
# "hello" refers to ./experiments/hello.ml
#use "hello".ml
```
Alternatively, to compile, run, and remove the compiled files:
1. Open a terminal in the `./experiments` directory.
2. Execute:
```bash
ocamlbuild $1.native -- && rm $1.native && rm -rf _build
```
Where `$1` is the filename of the example you want to run.
You can wrap this in a handy bash function:
```bash
function camel {
ocamlbuild $1.native -- && rm $1.native && rm -rf _build
}
```
With this, running a single file can be accomplished with:
```bash
# "hello" refers to ./experiments/hello.ml
camel hello
```