Skip to content

Commit

Permalink
Add support for ml (#827, WIP)
Browse files Browse the repository at this point in the history
TODO: use block comment instead of line comment
  • Loading branch information
fortierq authored and mwouts committed Sep 7, 2021
1 parent e97819f commit f3d4508
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/languages.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Jupytext works with notebooks in any of the following languages:
- Javascript
- Julia
- Matlab
- OCaml
- Octave
- PowerShell
- Python
Expand Down
1 change: 1 addition & 0 deletions jupytext/languages.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
".java": {"language": "java", "comment": "//"},
".groovy": {"language": "groovy", "comment": "//"},
".sage": {"language": "sage", "comment": "#"},
".ml": {"language": "ocaml"}, # no line comment for OCaml
}

_COMMENT_CHARS = [
Expand Down
83 changes: 83 additions & 0 deletions tests/notebooks/ipynb_ocaml/ocaml_notebook.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "ba111577",
"metadata": {},
"source": [
"# Example of an OCaml notebook"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "04192beb",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"val sum : int -> int -> int = <fun>\n"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"let sum x y = x + y"
]
},
{
"cell_type": "markdown",
"id": "e184eee6",
"metadata": {},
"source": [
"Let's try our function:"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "99b4cac0",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"- : bool = true\n"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sum 3 4 = 7 + 0"
]
}
],
"metadata": {
"jupytext": {
"formats": "ipynb:markdown,md"
},
"kernelspec": {
"display_name": "OCaml default",
"language": "OCaml",
"name": "ocaml-jupyter"
},
"language_info": {
"codemirror_mode": "text/x-ocaml",
"file_extension": ".ml",
"mimetype": "text/x-ocaml",
"name": "OCaml",
"nbconverter_exporter": null,
"pygments_lexer": "OCaml",
"version": "4.12.0"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

0 comments on commit f3d4508

Please sign in to comment.