Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
#######
#
# E-scripts on ocaml.
#
# Note 1: use the eev command (defined in eev.el) and the
# ee alias (in my .zshrc) to execute parts of this file.
# Executing this file as a whole makes no sense.
# An introduction to eev can be found here:
#
#   (find-eev-quick-intro)
#   http://angg.twu.net/eev-intros/find-eev-quick-intro.html
#
# Note 2: be VERY careful and make sure you understand what
# you're doing.
#
# Note 3: If you use a shell other than zsh things like |&
# and the for loops may not work.
#
# Note 4: I always run as root.
#
# Note 5: some parts are too old and don't work anymore. Some
# never worked.
#
# Note 6: the definitions for the find-xxxfile commands are on my
# .emacs.
#
# Note 7: if you see a strange command check my .zshrc -- it may
# be defined there as a function or an alias.
#
# Note 8: the sections without dates are always older than the
# sections with dates.
#
# This file is at <http://angg.twu.net/e/ocaml.e>
#           or at <http://angg.twu.net/e/ocaml.e.html>.
#        See also <http://angg.twu.net/emacs.html>,
#                 <http://angg.twu.net/.emacs[.html]>,
#                 <http://angg.twu.net/.zshrc[.html]>,
#                 <http://angg.twu.net/escripts.html>,
#             and <http://angg.twu.net/>.
#
#######



# «.ocaml-doc»			(to "ocaml-doc")
# «.ocaml-interp»		(to "ocaml-interp")
# «.irc-channel»		(to "irc-channel")
# «.menhir»			(to "menhir")
# «.ocamlbuild»			(to "ocamlbuild")
# «.dune»			(to "dune")
# «.ocamllex»			(to "ocamllex")
# «.ocamldep»			(to "ocamldep")
# «.topfind»			(to "topfind")
# «.caml-mode»			(to "caml-mode")
# «.tuareg»			(to "tuareg")
# «.tuareg-git»			(to "tuareg-git")
# «.tuareg-marmalade»		(to "tuareg-marmalade")
# «.tuareg»			(to "tuareg")
# «.comments»			(to "comments")
# «.tutorials»			(to "tutorials")
# «.opam»			(to "opam")
# «.opam-init»			(to "opam-init")
# «.opam-core»			(to "opam-core")
# «.janestreetcore-git»		(to "janestreetcore-git")
# «.utop»			(to "utop")
# «.ctfp»			(to "ctfp")
# «.ocaml-book-en»		(to "ocaml-book-en")
# «.typer»			(to "typer")
# «.typer-cuc»			(to "typer-cuc")
# «.implementing-functor»	(to "implementing-functor")
# «.tylr»			(to "tylr")
# «.first-hour»			(to "first-hour")
# «.first-hour-graphics»	(to "first-hour-graphics")
# «.pipe»			(to "pipe")
# «.michael-ryan-clarkson»	(to "michael-ryan-clarkson")
# «.lua-and-ocaml»		(to "lua-and-ocaml")
# «.ocaml-canvas»		(to "ocaml-canvas")
# «.error-unbound-module»	(to "error-unbound-module")
# «.metaocaml»			(to "metaocaml")




* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
apti ocaml
apti ocaml-doc


/home/edrx/e(edrx:li)# apti ocaml
[sudo] password for edrx: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  camlp4 ledit libcamlp4-ocaml-dev libfindlib-ocaml libfindlib-ocaml-dev
  ocaml-base ocaml-base-nox ocaml-compiler-libs ocaml-findlib ocaml-interp
  ocaml-nox
Suggested packages:
  ocaml-doc tuareg-mode | ocaml-mode
The following NEW packages will be installed:
  camlp4 ledit libcamlp4-ocaml-dev libfindlib-ocaml libfindlib-ocaml-dev ocaml
  ocaml-base ocaml-base-nox ocaml-compiler-libs ocaml-findlib ocaml-interp
  ocaml-nox
0 upgraded, 12 newly installed, 0 to remove and 0 not upgraded.
Need to get 32.7 MB of archives.
After this operation, 220 MB of additional disk space will be used.
Do you want to continue? [Y/n] 



# (find-zsh "installeddebs | sort | grep ocaml")
# (find-zsh "availabledebs | sort | grep ocaml")

# (find-status   "ocaml-base-nox")
# (find-vldifile "ocaml-base-nox.list")
# (find-udfile   "ocaml-base-nox/")
# (find-status   "ocaml-base")
# (find-vldifile "ocaml-base.list")
# (find-udfile   "ocaml-base/")
# (find-status   "ocaml-interp")
# (find-vldifile "ocaml-interp.list")
# (find-udfile   "ocaml-interp/")
# (find-status   "ocaml-mode")
# (find-vldifile "ocaml-mode.list")
# (find-udfile   "ocaml-mode/")
# (find-status   "ocaml-nox")
# (find-vldifile "ocaml-nox.list")
# (find-udfile   "ocaml-nox/")
# (find-status   "ocaml")
# (find-vldifile "ocaml.list")
# (find-udfile   "ocaml/")

# (find-status   "ocaml-man")
# (find-vldifile "ocaml-man.list")
# (find-udfile   "ocaml-man/")
# (find-status   "ocaml-compiler-libs")
# (find-vldifile "ocaml-compiler-libs.list")
# (find-udfile   "ocaml-compiler-libs/")





#####
#
# ocaml-doc (non-free)
# 2019feb21
#
#####

# «ocaml-doc» (to ".ocaml-doc")
# (find-angg ".emacs" "ocaml")
# https://packages.debian.org/sid/ocaml-doc
# (find-status   "ocaml-doc")
# (find-vldifile "ocaml-doc.list")
# (find-udfile   "ocaml-doc/")
# (find-udfile "ocaml-doc/ocaml.html/")
# (find-udfile "ocaml-doc/ocaml.html/libref/")
# (find-udfile "ocaml-doc/ocaml-4.05-refman.txt.gz")
# (find-fline "/usr/share/doc/ocaml-doc/" "ocaml-4.11-refman.pdf")
# (find-pdf-page "/usr/share/doc/ocaml-doc/ocaml-4.11-refman.pdf")
# (find-pdf-text "/usr/share/doc/ocaml-doc/ocaml-4.11-refman.pdf")
# (code-pdf-page "ocamlref" "/usr/share/doc/ocaml-doc/ocaml-4.11-refman.pdf")
# (code-pdf-text "ocamlref" "/usr/share/doc/ocaml-doc/ocaml-4.11-refman.pdf")
# (find-ocamlrefpage)
# (find-ocamlreftext)

# file:///usr/share/doc/ocaml-doc/ocaml.html/index.html

/usr/share/doc/ocaml-doc/ocaml-4.05-refman.pdf

# (find-node "(ocaml)Top")

(code-c-d "ocamlref" "/usr/share/doc/ocaml-doc/ocaml-4.05-refman.")
# (find-ocamlreffile "txt.gz")
# (find-ocamlreffile "txt.gz" "\n1.1  Basics")

* (eepitch-ocaml)
* (eepitch-kill)
* (eepitch-ocaml)
1+2*3;;
let pi = 4.0 *. atan 1.0;;
let square x = x *. x;;
square (sin pi) +. square (cos pi);;
1.0 * 2;;
let rec fib n =
  if n < 2 then n else fib (n-1) + fib (n-2);;
fib 10;;

# (find-ocamlreffile "txt.gz" "\n6.1  Lexical conventions")
# (find-ocamlreffile "txt.gz" "\n6.1  Lexical conventions" "Comments")





#####
#
# ocaml-interp
# 2019feb21
#
#####

# «ocaml-interp» (to ".ocaml-interp")
# (find-es "ml" "ocaml")

# (find-fline "/usr/bin/ocaml")
# (find-fline "/usr/share/pixmaps/ocaml.xpm")
# (find-fline "/usr/share/menu/ocaml-interp")
# (find-udfile "ocaml-interp/copyright")
# (find-man "1 ocaml")
# (find-udfile "ocaml-interp/changelog.Debian.gz")

* (eepitch-ocaml)
* (eepitch-kill)
* (eepitch-ocaml)



#####
#
# irc-channel
# 2022oct05
#
#####

# «irc-channel»  (to ".irc-channel")
# (find-efunction 'find-erclibera)
# On libera:

*** 480 #ocaml Cannot join channel (+S) - SSL/TLS required
(edrx) 




#####
#
# menhir
# 2019sep21 / 2022mar17
#
#####

# «menhir» (to ".menhir")
# (find-zsh "installeddebs | sort | grep menhir")
# (find-zsh "availabledebs | sort | grep menhir")
# (find-status   "menhir")
# (find-vldifile "menhir.list")
# (find-udfile   "menhir/")
# (find-status   "menhir-doc")
# (find-vldifile "menhir-doc.list")
# (find-udfile   "menhir-doc/")
# (code-pdf-page "menhir" "/usr/share/doc/menhir/manual.pdf.gz")
# (code-pdf-text "menhir" "/usr/share/doc/menhir/manual.pdf.gz")
# (find-menhirpage)
# (find-menhirtext)

apti menhir menhir-doc




#####
#
# ocamlbuild
# 2022mar17
#
#####

# «ocamlbuild»  (to ".ocamlbuild")
# (find-status   "ocamlbuild")
# (find-vldifile "ocamlbuild.list")
# (find-udfile   "ocamlbuild/")
# (find-ocamlrefpage (+ 2 333) "19" "The ocamlbuild compilation manager")
# (find-ocamlreftext (+ 2 333) "19" "The ocamlbuild compilation manager")

# https://github.com/ocaml/ocamlbuild -> dune
# (find-git-links "https://github.com/ocaml/ocamlbuild" "ocamlbuild")
# (code-c-d "ocamlbuild" "~/usrc/ocamlbuild/")
# (find-ocamlbuildfile "")
# (find-ocamlbuildfile "manual/manual.adoc")
# (find-ocamlbuildfile "manual/manual.adoc" "-build-dir")

# (find-udfile "ocamlbuild/examples/")
# (find-udfile "ocamlbuild/examples/01-simple/")
# (find-man  "1 ocamlbuild")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rv /tmp/ocamlbuild01/
mkdir  /tmp/ocamlbuild01/
cd     /tmp/ocamlbuild01/
cp /usr/share/doc/ocamlbuild/examples/01-simple/* .
make |& tee om

# (find-fline "/usr/share/doc/ocamlbuild/examples/01-simple/")
# (find-fline "/tmp/ocamlbuild01/")
# (find-fline "/tmp/ocamlbuild01/om")
# (find-fline "/tmp/ocamlbuild01/_build/")
# (find-tuareggrep "grep --color=auto -nH --null -e _build *.el")
# (find-tuaregfile "tuareg.el" "(defun tuareg--switch-outside-build")




#####
#
# dune
# 2022mar17
#
#####

# «dune»  (to ".dune")
# (find-status   "ocaml-dune")
# (find-vldifile "ocaml-dune.list")
# (find-udfile   "ocaml-dune/")
# (find-sh "apt-file search dune | grep ocaml")
# (find-zsh "availabledebs | sort | grep dune")
# https://github.com/ocaml/dune
# (find-git-links "https://github.com/ocaml/dune" "dune")
# (code-c-d "dune" "~/usrc/dune/")
# (find-dunefile "")
# (find-dunefile "doc/")
# (find-dunefile "example/")




#####
#
# ocamllex
# 2022mar17
#
#####

# «ocamllex»  (to ".ocamllex")
# (find-ocamlrefpage (+ 2 271) "13" "Lexer and parser generators")
# (find-ocamlreftext (+ 2 271) "13" "Lexer and parser generators")
# (find-status   "ocaml-nox")
# (find-vldifile "ocaml-nox.list")
# (find-udfile   "ocaml-nox/")
# (find-man "1 ocamllex")



#####
#
# ocamldep
# 2022mar17
#
#####

# «ocamldep»  (to ".ocamldep")
# (find-ocamlrefpage (+ 2 285) "14" "Dependency generator (ocamldep)")
# (find-ocamlreftext (+ 2 285) "14" "Dependency generator (ocamldep)")
# (find-man "1 ocamldep")





#####
#
# topfind
# 2022mar17
#
#####

# «topfind»  (to ".topfind")

# (find-status   "libfindlib-ocaml")
# (find-vldifile "libfindlib-ocaml.list")
# (find-udfile   "libfindlib-ocaml/")
# (find-status   "libfindlib-ocaml-dev")
# (find-vldifile "libfindlib-ocaml-dev.list")
# (find-udfile   "libfindlib-ocaml-dev/")
# (find-status   "ocaml-findlib")
# (find-vldifile "ocaml-findlib.list")
# (find-udfile   "ocaml-findlib/")

# (find-status   "libgraphics-ocaml")
# (find-vldifile "libgraphics-ocaml.list")
# (find-udfile   "libgraphics-ocaml/")
# (find-status   "libgraphics-ocaml-dev")
# (find-vldifile "libgraphics-ocaml-dev.list")
# (find-udfile   "libgraphics-ocaml-dev/")




#####
#
# plzoo-git
# 2019aug29
#
#####

# «plzoo-git» (to ".plzoo-git")
# (find-es "ml" "plzoo-git")
# https://github.com/andrejbauer/plzoo

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rfv ~/usrc/plzoo/
cd      ~/usrc/
git clone https://github.com/andrejbauer/plzoo
cd      ~/usrc/plzoo/

git branch --list -a
git for-each-ref
PAGER=cat git log --oneline --graph --all -20

make     |& tee om
make all |& tee om

# (find-fline "~/usrc/")
# (find-fline "~/usrc/plzoo/")
# (find-gitk  "~/usrc/plzoo/")

# (code-c-d "plzoo" "~/usrc/plzoo/")
# (find-plzoofile "")
# (find-plzoofile "src/")
# (find-plzoofile "src/lambda/")
# (find-plzoofile "src/levy/")




#####
#
# caml-mode
# 2019sep21
#
#####

# «caml-mode» (to ".caml-mode")
# (find-es "ml" "ocaml-mode")
# (find-epackages "\n  caml " t)
# (find-epackage 'caml)
# (find-elpafile "caml-readme.txt")
# (find-elpafile "caml-20190413.1205/")
# https://github.com/ocaml/ocaml/

# (code-c-d "camlmode" "~/.emacs.d/elpa/caml-20190413.1205/")
# (find-camlmodefile "")




#####
#
# tuareg
# 2022mar17
#
#####

# «tuareg»  (to ".tuareg")
# (find-epackage-links 'tuareg "tuareg" t)
# (find-epackage       'tuareg)
# (code-c-d "tuareg" "~/.emacs.d/elpa/tuareg-20220104.2039/")
# https://github.com/ocaml/tuareg
# (find-tuaregfile "")
# (find-tuaregfile "tuareg.el")



#####
#
# tuareg-git
# 2019sep21
#
#####

# «tuareg-git» (to ".tuareg-git")
# (find-es "ml" "ocaml-mode")
# http://www.emacswiki.org/emacs/TuaregMode ->
# http://tuareg.forge.ocamlcore.org/ ->
# https://github.com/ocaml/tuareg

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rfv ~/usrc/tuareg/
cd      ~/usrc/
git clone https://github.com/ocaml/tuareg
cd      ~/usrc/tuareg/

git branch --list -a
git for-each-ref
PAGER=cat git log --oneline --graph --all -20

# (find-fline "~/usrc/")
# (find-fline "~/usrc/tuareg/")
# (find-gitk  "~/usrc/tuareg/")

# (code-c-d "tuareggit" "~/usrc/tuareg/")
# (find-tuaregfile "")
# (find-tuareggitfile "")
# (find-tuareggitfile "README.md")
# (find-tuareggitfile "tuareg-site-file.el")
# (find-tuareggitfile "tuareg.el" "M-x tuareg-run-ocaml")
# (find-tuareggitgrep "grep --color -nH -e run-ocaml *.el")

# (load "~/usrc/tuareg/tuareg-site-file")





#####
#
# tuareg-marmalade
# 2019sep21
#
#####

# «tuareg-marmalade» (to ".tuareg-marmalade")
# (find-es "emacs" "marmalade")
# https://marmalade-repo.org/
# https://marmalade-repo.org/packages/tuareg
# https://forge.ocamlcore.org/projects/tuareg/
# https://forge.ocamlcore.org/tracker/?group_id=43
# http://melpa.org/#/tuareg

(package-refresh-contents)
;; (find-evardescr 'package-archives)
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
(package-refresh-contents)

M-x package-refresh-contents [RET]
M-: (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
M-x package-refresh-contents [RET]
M-x package-install [RET] marmalade-demo
(find-epackage-links 'tuareg)

;; (find-fline "~/.emacs.d/elpa/tuareg-20190805.958/")
(code-c-d "tuareg" "~/.emacs.d/elpa/tuareg-20190805.958/")
;; (find-tuaregfile "")




#####
#
# tuareg
# 2019nov30
#
#####

# «tuareg» (to ".tuareg")
# (find-efunctiondescr 'tuareg-mode)
# (find-efunction      'tuareg-mode)
# (find-ekeymapdescr tuareg-mode-map)
# (find-ekeymapdescr tuareg-interactive-mode-map)
# (find-tuaregfile "")
# (find-tuareggitfile "")
# (find-tuareggitfile "README.md")
# (find-tuareggitfile "README.md" "M-x run-ocaml")
# (find-efunctiondescr 'run-ocaml)
# (find-efunction      'run-ocaml)

# (find-tuareggrep "grep --color -nH --null -e tuareg-eval-phrase *.el")
# (find-tuaregfile "tuareg.el" "(defun tuareg-eval-phrase ()")




#####
#
# comments
# 2019sep21
#
#####

# «comments» (to ".comments")
# (find-ocamlrefpage (+ 2 91) "6.1    Lexical conventions")
# (find-ocamlreftext (+ 2 91) "6.1    Lexical conventions")





#####
#
# tutorials
# 2019sep21
#
#####

# «tutorials» (to ".tutorials")
# https://ocaml.org/docs
# https://ocaml.org/learn/tutorials/
# https://ocaml.org/learn/tutorials/basics.html




#####
#
# opam
# 2019sep21
#
#####

# «opam» (to ".opam")
# https://opam.ocaml.org/
# https://opam.ocaml.org/doc/Install.html
# https://opam.ocaml.org/doc/Install.html#Debian
# https://opam.ocaml.org/doc/Usage.html
# https://github.com/ocaml/opam

# (find-status   "opam")
# (find-vldifile "opam.list")
# (find-udfile   "opam/")
# (find-status   "opam-doc")
# (find-vldifile "opam-doc.list")
# (find-udfile   "opam-doc/")
# (find-fline "/usr/share/doc-base/opam-dev-man")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
export PAGER=cat
opam
opam help
# (find-sh "opam help")
# (find-sh "opam help | col -bx")
# (find-sh "opam help source | col -bx")

opam init
opam update
opam upgrade

opam info core
opam install core

# (find-anggfile ".ocamlinit" "Added by OPAM")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
opam install utop
opam info utop

opam list
opam show utop

apti opam opam-doc

# (find-man "1 opam")
# (find-man "1 opam-admin-check")
# (find-man "1 opam-admin-depexts")
# (find-man "1 opam-admin-findlib")
# (find-man "1 opam-admin-make")
# (find-man "1 opam-admin-rename")
# (find-man "1 opam-admin-stats")
# (find-man "1 opam-admin")
# (find-man "1 opam-config")
# (find-man "1 opam-help")
# (find-man "1 opam-info")
# (find-man "1 opam-init")
# (find-man "1 opam-init" "-j JOBS, --jobs=JOBS")
# (find-man "1 opam-install")
# (find-man "1 opam-installer")
# (find-man "1 opam-lint")
# (find-man "1 opam-list")
# (find-man "1 opam-pin")
# (find-man "1 opam-reinstall")
# (find-man "1 opam-remote")
# (find-man "1 opam-remove")
# (find-man "1 opam-repository")
# (find-man "1 opam-search")
# (find-man "1 opam-show")
# (find-man "1 opam-source")
# (find-man "1 opam-switch")
# (find-man "1 opam-uninstall")
# (find-man "1 opam-unpin")
# (find-man "1 opam-update")
# (find-man "1 opam-upgrade")

(code-pdf-page "opam" "/usr/share/doc/opam-docs/dev-manual.pdf")
(code-pdf-text "opam" "/usr/share/doc/opam-docs/dev-manual.pdf")
(code-c-d      "opam" "~/.opam/")
;; (find-opampage)
;; (find-opamtext)
;; (find-opamfile "")
;; (find-opamsh "find * | sort")
;; (find-opamsh "du -c | sort -n")
;; (find-opamsh "find * | sort | grep utop")
# (find-fline "~/.opam/system/lib/utop/")




#####
#
# opam-init
# 2019sep21
#
#####

# «opam-init» (to ".opam-init")
# (find-angg ".zshrc" "opam")
# (find-man "1 opam-init")
# (find-fline "~/.opam/")
# (find-fline "~/.opam/opam-init/")
# (find-fline "~/.opam/opam-init/init.zsh")
# (find-fline "~/.opam/opam-init/variables.sh")

# (code-c-d      "opam" "~/.opam/")
# (find-opamfile "")
# (find-opamsh "find * | sort")

In normal operation, OPAM only alters files within ~/.opam.

During this initialisation, you can allow OPAM to add information to two
other files for best results. You can also make these additions manually
if you wish.

If you agree, OPAM will modify:

  - ~/.zshrc (or a file you specify) to set the right environment
    variables and to load the auto-completion scripts for your shell (zsh)
    on startup. Specifically, it checks for and appends the following line:

    . /home/edrx/.opam/opam-init/init.zsh > /dev/null 2> /dev/null || true


  - ~/.ocamlinit to ensure that non-system installations of `ocamlfind`
    (i.e. those installed by OPAM) will work correctly when running the
    OCaml toplevel. It does this by adding $OCAML_TOPLEVEL_PATH to the list
    of include directories.

If you choose to not configure your system now, you can either configure
OPAM manually (instructions will be displayed) or launch the automatic setup
later by running:

   opam config setup -a


Do you want OPAM to modify ~/.zshrc and ~/.ocamlinit?
(default is 'no', use 'f' to name a file other than ~/.zshrc)
    [N/y/f] 

Global configuration:
  Updating ~/.opam/opam-init/init.sh
  Updating ~/.opam/opam-init/init.zsh
  Updating ~/.opam/opam-init/init.csh
  Updating ~/.opam/opam-init/init.fish

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

1. To configure OPAM in the current shell session, you need to run:

      eval `opam config env`

2. To correctly configure OPAM for subsequent use, add the following
   line to your profile file (for instance ~/.zshrc):

      . /home/edrx/.opam/opam-init/init.zsh > /dev/null 2> /dev/null || true

3. To avoid issues related to non-system installations of `ocamlfind`
   add the following lines to ~/.ocamlinit (create it if necessary):

      let () =
        try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH")
        with Not_found -> ()
      ;;

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=




#####
#
# Where opam stores a package ("core")
# 2019nov30
#
#####

# «opam-core» (to ".opam-core")
# (find-anggsh "find .opam/ | sort")
# (find-anggsh "find .opam/ | sort | grep core")
# (find-fline "~/.opam/")
# (find-fline "~/.opam/system/lib/core/")
# (find-fline "~/.opam/packages/")
# (find-fline "~/.opam/packages/" " core")
# (find-fline "~/.opam/packages/core/core.113.33.03/")
# (find-fline "~/.opam/packages/core/core.113.33.03/opam")
# (find-fline "~/.opam/packages/core/core.113.33.03/url")
# (find-fline "~/.opam/repo/default/packages/core/")
# (find-fline "~/.opam/repo/default/packages/core/core.113.33.03/")
# (find-fline "~/.opam/repo/default/packages/core/core.113.33.03/opam")
# (find-fline "~/.opam/repo/default/packages/core/core.113.33.03/url")
# (find-fline "~/.opam/archives/core.113.33.03+opam.tar.gz")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# (find-fline "~/usrc/core.113.33.03/")
rm -Rv ~/usrc/core.113.33.03/
mkdir  ~/usrc/core.113.33.03/
cd     ~/usrc/
tar -xvzf ~/.opam/archives/core.113.33.03+opam.tar.gz
cd     ~/usrc/core.113.33.03/

# (code-c-d "janestreetcore" "~/usrc/core.113.33.03/")
# (find-janestreetcorefile "")




#####
#
# janestreetcore-git
# 2019nov30
#
#####

# «janestreetcore-git» (to ".janestreetcore-git")
# (find-git-links "https://github.com/janestreet/core" "janestreetcoregit")
# https://github.com/janestreet/core

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# rm -Rfv ~/usrc/core/
cd      ~/usrc/
git clone https://github.com/janestreet/core
cd      ~/usrc/core/

# (find-fline "~/usrc/")
# (find-fline "~/usrc/core/")
# (find-gitk  "~/usrc/core/")

# (code-c-d "janestreetcoregit" "~/usrc/core/")
# (find-janestreetcoregitfile "")




https://github.com/janestreet/core
https://opensource.janestreet.com/core/
https://ocaml.janestreet.com/ocaml-core/v0.12/doc/
https://opam.ocaml.org/packages/core/
https://discuss.ocaml.org/t/documentation-on-jane-street-core/200








#####
#
# utop
# 2019sep21
#
#####

# «utop» (to ".utop")
# https://opam.ocaml.org/blog/about-utop/
# https://opam.ocaml.org/packages/utop/
# (find-status   "utop")
# (find-vldifile "utop.list")
# (find-udfile   "utop/")
# (find-fline "/etc/emacs/site-start.d/50utop.el")


# (find-man "utop")
# (find-fline "~/.opam/packages/utop/utop.2.2.0/")


https://ocaml.org/learn/books.html

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
utop
#utop_help




#####
#
# Category Theory for Programmers - OCaml edition
# 2020feb16
#
#####

# «ctfp» (to ".ctfp")
# https://github.com/hmemcpy/milewski-ctfp-pdf/
# https://github.com/hmemcpy/milewski-ctfp-pdf/releases/tag/v1.4.0-rc1
# https://github.com/hmemcpy/milewski-ctfp-pdf/releases/download/v1.4.0-rc1/category-theory-for-programmers-ocaml.pdf

(code-pdf-page "ctfpocaml" "$S/https/github.com/hmemcpy/milewski-ctfp-pdf/releases/download/v1.4.0-rc1/category-theory-for-programmers-ocaml.pdf")
(code-pdf-text "ctfpocaml" "$S/https/github.com/hmemcpy/milewski-ctfp-pdf/releases/download/v1.4.0-rc1/category-theory-for-programmers-ocaml.pdf")
;; (find-ctfpocamlpage)
;; (find-ctfpocamlpage 3 "Contents")
;; (find-ctfpocamltext 3 "Contents")
;; (find-ctfpocamltext)




#####
#
# ocaml-book-en - Developing applications with Objective Caml (O'Reilly, 2000)
# 2020may09
#
#####

# «ocaml-book-en» (to ".ocaml-book-en")
# (find-status   "ocaml-book-en")
# (find-vldifile "ocaml-book-en.list")
# (find-udfile   "ocaml-book-en/")
# (code-pdf-page "ocamlorabook" "/usr/share/doc/ocaml-book/en/ocaml-ora-book.pdf")
# (code-pdf-text "ocamlorabook" "/usr/share/doc/ocaml-book/en/ocaml-ora-book.pdf")
# (find-ocamlorabookpage)
# (find-ocamlorabooktext)
# (find-ocamlorabookpage 7 "Contents")
# (find-ocamlorabooktext 7 "Contents")






#####
#
# typer
# 2020may09
#
#####

# «typer» (to ".typer")
# (find-books "__comp/__comp.el" "monnier-typer")
# http://www.iro.umontreal.ca/~monnier/

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# rm -Rfv ~/usrc/typer/
cd      ~/usrc/
git clone https://gitlab.com/monnier/typer
cd      ~/usrc/typer/

# (find-gitk  "~/usrc/typer/")
# (code-c-d "typer" "~/usrc/typer/")
# (find-typerfile "")
# (find-typerfile ".travis.yml" "sudo apt-get install opam")
# (find-typerfile "GNUmakefile")
# (find-typerfile "README.md")
# (find-typersh "find * | sort")
# (find-typersh "find * | grep typer | sort")
# (find-typersh "find * | grep tex | sort")

apti opam
apti ocamlbuild
apti ocaml-findlib
apti libzarith-ocaml-dev libzarith-ocaml-doc
apti dune

git reset
make clean
cd      ~/usrc/typer/
make install

make tests

# (find-fline "~/usrc/typer/doc/formal/")
# (find-fline "~/usrc/typer/doc/formal/typer_theory.tex")
cd ~/usrc/typer/
git checkout master

cd ~/usrc/typer/doc/formal/
pdflatex typer_theory.tex
bibtex   typer_theory
pdflatex typer_theory.tex
pdflatex typer_theory.tex

# «typer-cuc»  (to ".typer-cuc")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rfv ~/usrc/typer/
cd      ~/usrc/
git clone https://gitlab.com/monnier/typer
cd      ~/usrc/typer/
git checkout report/itd

# (find-fline "~/usrc/typer/")
# (find-typerfile "GNUmakefile")
# (find-typerfile "GNUmakefile" "bibexport")
# (find-typerfile "paper.tex")
# (find-typerfile "paper.tex" "\\caption{Mapping CUC to CIC}")
cd ~/usrc/typer/
pdflatex paper
bibtex   paper
pdflatex paper
pdflatex paper




Ooops, sorry (?)!
I just found about 50% of what I was looking for...

  mkdir -p ~/usrc/
  rm -Rfv  ~/usrc/typer/
  cd       ~/usrc/
  git clone https://gitlab.com/monnier/typer
  cd       ~/usrc/typer/
  cd       ~/usrc/typer/doc/formal/
  pdflatex typer_theory.tex
  bibtex   typer_theory
  pdflatex typer_theory.tex
  pdflatex typer_theory.tex

  # (code-c-d      "typertheory" "~/usrc/typer/doc/formal/")
  # (code-pdf-page "typertheory" "~/usrc/typer/doc/formal/typer_theory.pdf")
  # (code-pdf-text "typertheory" "~/usrc/typer/doc/formal/typer_theory.pdf")
  # (find-typertheoryfile "")
  # (find-typertheorypage)
  # (find-typertheorytext)

but if you can share the source of your Figure 12 in
<http://www.iro.umontreal.ca/~monnier/itd-tyde-2019.pdf#page=10>
that would be really great!

  Cheers =),
    Eduardo





#####
#
# implementing-functor
# 2021apr23
#
#####

# «implementing-functor»  (to ".implementing-functor")
# https://blog.0branch.com/posts/2012-03-26-01-implementing-functor-ocaml.html
# https://blog.0branch.com/posts/2012-03-26-02-from-functor.html




#####
#
# tylr
# 2022aug10
#
#####

# «tylr»  (to ".tylr")
# https://twitter.com/dm_0ney/status/1414742742530498566?s=20
# https://tylr.fun/
# https://github.com/hazelgrove/tylr
# (find-git-links "https://github.com/hazelgrove/tylr" "tylr")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# rm -Rfv ~/bigsrc/tylr/
cd      ~/bigsrc/
git clone https://github.com/hazelgrove/tylr
cd      ~/bigsrc/tylr/

# (find-fline "~/bigsrc/")
# (find-fline "~/bigsrc/tylr/")
# (find-gitk  "~/bigsrc/tylr/")

# (code-c-d "tylr" "~/bigsrc/tylr/")
# (find-tylrfile "")
# (find-tylrfile "README.md")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd      ~/bigsrc/tylr/
make deps       # build dependencies (locked in opam.export)
make            # build tylr src
make echo-html  # echo path to compiled page

# file:///home/edrx/bigsrc/tylr/_build/default/src/web/www/index.html




#####
#
# A First Hour with OCaml
# 2022mar16
#
#####

# «first-hour»  (to ".first-hour")
# https://ocaml.org/learn/tutorials/a_first_hour_with_ocaml.html
# (brprinceurl "https://ocaml.org/learn/tutorials/a_first_hour_with_ocaml.html")
# (code-pdf-page "firsthour" "$S/https/ocaml.org/learn/tutorials/a_first_hour_with_ocaml.pdf")
# (code-pdf-text "firsthour" "$S/https/ocaml.org/learn/tutorials/a_first_hour_with_ocaml.pdf")
# (find-firsthourpage)
# (find-firsthourtext)

* (eepitch-ocaml)
* (eepitch-kill)
* (eepitch-ocaml)
50 * 50;;

(*# #use "program.ml"
*)

let x = 50;;
x * x;;
let x = 50 in x * x;;
let a   = 1 in
let b   = 2 in
    a + b;;
let square x = x * x;;
square 50;;

let square_is_even x =
    square x mod 2 = 0;;
square_is_even 50;;
square_is_even 3;;

let ordered a b c =
  a <= b && b <= c;;
ordered 1 1 2;;

let average a b =
    (a +. b) /. 2.0;;
1 +  2.5;;   (* err *)
1 +. 2.5;;   (* err *)
float_of_int 1 +. 2.5;;

let rec range a b =
    if a > b then []
    else a :: range (a + 1) b;;
let digits = range 0 9;;

(* (find-firsthourpage 5 "Types")
 * (find-firsthourtext   "Types")
*)
1 + 2;;
1.0 +. 2.0;;
false;;
'c';;
"Help me!";;

int_of_char;;

let rec factorial n =
  if n <= 1 then 1 else n * factorial (n - 1);;
let rec factorial n =
  match n with
  | 0 | 1 -> 1
  | x -> x * factorial (x - 1);;
let rec factorial n =
  match n with
  | 0 | 1 -> 1
  | _ -> n * factorial (n - 1);;
let rec factorial = function
  | 0 | 1 -> 1
  | n -> n * factorial (n - 1);;

(* (find-firsthourpage 7 "Lists")
 * (find-firsthourtext 7 "Lists")
*)

[];;
[1; 2; 3];;
[false; false; true];;
[[1; 2]; [3; 4]; [5; 6]];;
1 :: [2; 3];;
[1] @ [2; 3];;

let rec total l =
  match l with
  | [] -> 0
  | h :: t -> h + total t;;
total [1; 3; 5; 3; 1];;

let rec total_wrong l =
  match l with
  | h :: t -> h + total_wrong t;;  (* warning: not exhaustive *)

total_wrong [1; 3; 5; 3; 1];;

let rec length l =
  match l with
  | [] -> 0
  | _ :: t -> 1 + length t;;

length [1; 2; 3];;
length ["cow"; "sheep"; "cat"];;
length [[]];;

let rec append a b =
  match a with
  | [] -> b
  | h :: t -> h :: append t b;;

let rec map f l =
  match l with
  | [] -> []
  | h :: t -> f h :: map f t;;

map total [[1; 2]; [3; 4]; [5; 6]];;
map (fun x -> x * 2) [1; 2; 3];;

let add a b = a + b;;
add;;
let f = add 6;;
f 7;;
map (add 6) [1; 2; 3];;
map (map (fun x -> x * 2)) [[1; 2]; [3; 4]; [5; 6]];;

(* (find-firsthourpage 10 "Other built-in types")
 * (find-firsthourtext 10 "Other built-in types")
*)

let t = (1, "one", '1');;
type person =
  {first_name : string;
   surname : string;
   age : int};;
let frank =
  {first_name = "Frank";
   surname = "Smith";
   age = 40};;
let s = frank.surname;;
type colour = Red | Blue | Green | Yellow;;
let l = [Red; Blue; Red];;
type colour =
  | Red
  | Blue
  | Green
  | Yellow
  | RGB of int * int * int;;
let l = [Red; Blue; RGB (30, 255, 154)];;

type 'a tree =
  | Leaf
  | Node of 'a tree * 'a * 'a tree;;
let t =
  Node (Node (Leaf, 1, Leaf), 2, Node (Node (Leaf, 3, Leaf), 4, Leaf));;

let rec total t =
  match t with
  | Leaf -> 0
  | Node (l, x, r) -> total l + x + total r;;
let rec flip t =
  match t with
  | Leaf -> Leaf
  | Node (l, x, r) -> Node (flip r, x, flip l);;
let all = total t;;
let flipped = flip t;;
t = flip flipped;;

(* (find-firsthourpage 12 "Dealing with errors")
 * (find-firsthourtext 12 "Dealing with errors")
*)

exception E;;
exception E2 of string;;
let f a b =
  if b = 0 then raise (E2 "division by zero") else a / b;;
try f 10 0 with E2 _ -> 0;;
f 10 0;;
let f a b =
  if b = 0 then None else Some (a / b);;
let list_find_opt p l =
  try Some (List.find p l) with
    Not_found -> None;;
let list_find_opt p l =
  match List.find p l with
  | v -> Some v
  | exception Not_found -> None;;

* (eepitch-ocaml)
* (eepitch-kill)
* (eepitch-ocaml)

(* (find-firsthourpage 12 "Imperative OCaml")
 * (find-firsthourtext 12 "Imperative OCaml")
*)

let r = ref 0;;
r := 100;;
!r;;
let swap a b =
  let t = !a in
    a := !b;
    b := t;;
let print_number n =
  print_string (string_of_int n);
  print_newline ();;
print_newline;;
let table n =
  for row = 1 to n do
    for column = 1 to n do
      print_string (string_of_int (row * column));
      print_string " "
    done;
    print_newline ()
  done;;
let smallest_power_of_two x =
  let t = ref 1 in
    while !t < x do
      t := !t * 2
    done;
    !t;;
let arr = [|1; 2; 3|];;
arr.(0);;
arr.(0) <- 0;;
arr;;
type person =
  {first_name : string;
   surname : string;
   mutable age : int};;
let birthday p =
  p.age <- p.age + 1;;

(* (find-firsthourpage 15 "The Standard Library")
 * (find-firsthourtext 15 "The Standard Library")
*)

List.concat [[1; 2; 3]; [4; 5; 6]; [7; 8; 9]];;
List.filter (( < ) 10) [1; 4; 20; 10; 9; 2];;
List.sort compare [1; 6; 2; 2; 3; 56; 3; 2];;
let print_length s =
  Printf.printf "%s has %i characters\n" s (String.length s);;
List.iter print_length ["one"; "two"; "three"];;


** «first-hour-graphics»  (to ".first-hour-graphics")
**
* (eepitch-ocaml)
* (eepitch-kill)
* (eepitch-ocaml)
#use "topfind";;
#require "graphics";;
open Graphics;;
open_graph " 640x480";;

for i = 12 downto 1 do
  let radius = i * 20 in
    set_color (if i mod 2 = 0 then red else yellow);
    fill_circle 320 240 radius
done;;

read_line ();;

Random.self_init ();;

Graphics.open_graph " 640x480";;

set_color red;;

let rec iterate r x_init i =
  if i = 1 then x_init else
    let x = iterate r x_init (i - 1) in
      r *. x *. (1.0 -. x);;

for x = 0 to 639 do
  let r = 4.0 *. (float_of_int x) /. 640.0 in
  for i = 0 to 39 do
    let x_init = Random.float 1.0 in
    let x_final = iterate r x_init 500 in
    let y = int_of_float (x_final *. 480.) in
       Graphics.plot x y
  done
done;;

read_line ();;



#####
#
# pipe
# 2022oct05
#
#####

# «pipe»  (to ".pipe")
# (find-books "__comp/__comp.el" "ocaml")
# (find-books "__comp/__comp.el" "ocaml" "Pipe.transfer")
# (find-realworldocamlpage (+ 24 352)     "Pipe.transfer")
# (find-realworldocamltext (+ 24 352)     "Pipe.transfer")
# (find-anggfile "OCAML/PipeTest1.ml")

https://v2.ocaml.org/api/index.html



#####
#
# michael-ryan-clarkson
# 2022oct10
#
#####

# «michael-ryan-clarkson»  (to ".michael-ryan-clarkson")
# https://yewtu.be/playlist?list=PLre5AT9JnKShBOPeuiD9b-I4XROIJhkIU




#####
#
# lua-and-ocaml
# 2022nov01
#
#####

# «lua-and-ocaml»  (to ".lua-and-ocaml")
# https://stackoverflow.com/questions/405995/embedding-lua-in-ocaml?rq=1




#####
#
# ocaml-canvas
# 2022dec15
#
#####

# «ocaml-canvas»  (to ".ocaml-canvas")
# https://news.ycombinator.com/item?id=33954958 OCaml Canvas (ocamlpro.github.io)
# https://github.com/ocamlpro/ocaml-canvas
# https://ocamlpro.github.io/ocaml-canvas/
# https://ocamlpro.github.io/ocaml-canvas/sphinx/
# (code-c-d "ocamlcanvas" "~/usrc/ocaml-canvas/")
# (find-ocamlcanvasfile "")
# (find-ocamlcanvasfile "examples/")
# (find-ocamlcanvasfile "sphinx/")
# (find-opam-links "ocaml-canvas")
# (find-opamsourcesfile "ocaml-canvas.1.0.0/")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
opam update
opam upgrade
opam install ocaml-canvas

apti libxcb-image0-dev libxcb-keysyms1-dev libxcb-xkb-dev

# (find-fline "~/OCAML/canv.ml")





#####
#
# Error: Unbound module OcamlCanvas
# 2022dec17
#
#####

# «error-unbound-module»  (to ".error-unbound-module")
# https://discuss.ocaml.org/t/unbound-module-base-unbound-directive-require/8196/4

* (eepitch-ocaml)
* (eepitch-kill)
* (eepitch-ocaml)
#use "topfind";;
#list;;
#require "ocaml-canvas";;
#use "ocaml-canvas";;




#####
#
# metaocaml
# 2023apr21
#
#####

# «metaocaml»  (to ".metaocaml")
# (find-fline "~/LOGS/2023apr21.emacs" "MetaOCaml")
# https://okmij.org/ftp/ML/MetaOCaml.html
# https://okmij.org/ftp/meta-programming/




https://github.com/clayrat/sequent-calc uses Levy

https://discuss.ocaml.org/t/interactive-ocaml-development-with-utop-in-emacs/6058
https://samarthkishor.github.io/posts/interactive_ocaml_development/
https://discuss.ocaml.org/t/ocaml-repl-driven-development/4068

Today was all about setting up Emacs for OCaml development.
https://kevinsjoberg.com/30-days-of-emacs-day-2

https://batsov.com/articles/2022/08/23/setting-up-emacs-for-ocaml-development/
https://batsov.com/articles/2022/08/19/learning-ocaml/
https://batsov.com/articles/2022/08/28/ocaml-tips-multiple-let-bindings/
https://batsov.com/articles/2022/08/29/ocaml-at-first-glance/
https://batsov.com/articles/2022/09/03/zipping-collections-in-ocaml/

https://news.ycombinator.com/item?id=32954517 OCaml Exercises (ocaml.org)

<edrx> hi all - I'm a beginner who has only followed some basic tutorials, but
       I haven't even used any libraries/modules yet...
<edrx> I'm wondering if it's easy to make ocaml call an external program -
       say, for an example/prototype, tac
<edrx> ...with a given input, and capture what it spits on stdout, and returns
       that as a string...
<edrx> where can I learn how do to that? any recommended links?
<edrx> actually the external program that I want to call is this one:
       http://angg.twu.net/eev-maxima.html#luatree




<><> ocp-indent.1.8.1 installed successfully ><><><><><><><><><><><><><><><><><>
=> This package requires additional configuration for use in editors. Install package 'user-setup', or
   manually:

   * for Emacs, add these lines to ~/.emacs:
     (add-to-list 'load-path "/home/edrx/.opam/default/share/emacs/site-lisp")
     (require 'ocp-indent)

   * for Vim, add this line to ~/.vimrc:
     set rtp^="/home/edrx/.opam/default/share/ocp-indent/vim"

<><> merlin.3.8.0 installed successfully ><><><><><><><><><><><><><><><><><><><>
=> merlin installed.

   Quick setup for VIM
   -------------------
   Append this to your .vimrc to add merlin to vim's runtime-path:
     let g:opamshare = substitute(system('opam var share'),'\n$','','''')
     execute "set rtp+=" . g:opamshare . "/merlin/vim"

   Also run the following line in vim to index the documentation:
     :execute "helptags " . g:opamshare . "/merlin/vim/doc"

   Quick setup for EMACS
   -------------------
   Add opam emacs directory to your load-path by appending this to your .emacs:
     (let ((opam-share (ignore-errors (car (process-lines "opam" "config" "var" "share")))))
      (when (and opam-share (file-directory-p opam-share))
       ;; Register Merlin
       (add-to-list 'load-path (expand-file-name "emacs/site-lisp" opam-share))
       (autoload 'merlin-mode "merlin" nil t nil)
       ;; Automatically start it in OCaml buffers
       (add-hook 'tuareg-mode-hook 'merlin-mode t)
       (add-hook 'caml-mode-hook 'merlin-mode t)
       ;; Use opam switch to lookup ocamlmerlin binary
       (setq merlin-command 'opam)))

   Take a look at https://github.com/ocaml/merlin for more information

   Quick setup with opam-user-setup
   --------------------------------

   Opam-user-setup support Merlin.

     $ opam user-setup install

   should take care of basic setup.
   See https://github.com/OCamlPro/opam-user-setup
# Run eval $(opam env) to update the current shell environment


https://sancho.dev/blog/learning-ocaml in 2023 ***
https://gist.github.com/Hirrolot/27e6b02a051df333811a23b97c375196 How to implement dependent types in 80 lines of code ***
https://borretti.me/article/design-austral-compiler
https://osa1.net/posts/2023-04-24-ocaml-thoughts.html
https://news.ycombinator.com/item?id=36094799 Oxidizing OCaml: Locality (janestreet.com)
https://tarides.com/blog/2024-05-29-effective-ml-through-merlin-s-destruct-command/
https://okmij.org/ftp/ML/generalization.html How OCaml type checker works -- or what polymorphism and garbage collection have in common ***
https://news.ycombinator.com/item?id=41281555 How the OCaml type checker works (2022) (okmij.org)




#  Local Variables:
#  coding:               utf-8-unix
#  End: