Click the green “Code” button, select the Codespaces tab, and create your own.
Hopefully not too long after, you should be in VS Code inside your browser. Go
to the “TERMINAL” tab, extend it and run dune test
. Tests should fail; this is
normal. You may need to install a missing dependency using the command opam install
.
Using Replit
You need to have a configured account at https://replit.com/
Click into “Create a Repl”, “Import from GitHub”, “From URL” (use
https://github.com/tarides/camellito) and select “Blank Repl” as template. Not
too long after, you should be able to edit the lib/task.ml
. Pressing the green
“Run” button will launch the test cases.
So that you know, you'll be given access to the documentation you need to use to complete the task. Please do not refer to other documentation.
Open the files lib/task.ml
and lib/task.mli
.
Tips:
-
Code samples from the tutorials can be executed in the provided environment. Find the terminal tab, launch
utop
command. In the tutorials, copy expressions after#
, including the;;
. In Terminal-Utop, paste the expression and pressReturn
. The output in the Utop should be the same as in the tutorial. You can also enter your expressions, try2 + 2
for instance (always finish your input by;;
andReturn
). Exitutop
withCtrl+D
or#quit;;
-
You may have to delete more than the pragma and the
failwith
. -
To implement the functions
split_words
andsplit_lines
you can the moduleStr
with the following regular expressions:"\r?\n"
and"\\(\\(\r?\n\\)\\| \\|\t\\)+"
-
To implement the function
discuss_wc
you need to use the functionCurly.get
from packagecurly
. If you are using Codespace, you'll need to install it using Opam. If you are using Replit, it's already installed.
Here is the command you need to type to build your code:
$ dune build
Here is the command you need to type to test your code:
$ dune test
Once all the tests are successfully passed, you've succeeded.