-
Notifications
You must be signed in to change notification settings - Fork 66
The optional file "depent.txt" is not working #366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@lsylvestre Can you help us with this one? |
Hi, thank you for your interest in this feature. The optional file For instance, by replacing the content of Test_lib.set_result @@
[ Report.info ~message:("Q.q = " ^ string_of_int Q.q) ] ;; the result in the web browser is : |
You answer was very useful to me. I quickly understood that the exercises run in a restricted environment with access to a limited set of libraries and with no reach to the file system. This is a consequence of the translated OCaml code running on the browser, on the client side of the learn-ocaml application. Probably, it should be possible to create a customized version of learn-ocaml with extra ocaml libraries available. Nevertheless, we tried to find a solution within the confines of the user manual. Our code had a single dependence: the Yojson library. Our final, best solution was to get rid of this dependency and to write by hand a new small JSon parser, a neat piece of code with only 150 lines. After all, the json format is LL(1) parsable... A different attempt that also worked, however with less flexibility, was to preprocess all the JSon examples beforehand, so that the json parser was not required at runtime. One funny failed attempt that is worth mentioning was to try and expand inline the entire code of the Yojson library, which amounts to 14 thousand lines of OCaml code. Extra two thousand lines of code from the module Stream was also required. The final single file "depend.txt" ran perfectly on the regular OCaml interpreter, but the client side of learn-ocaml couldn't cope with it due to sheer size (we got the error "INTERNAL ERROR: error in prelude"). Thank you! |
Thank you for your feedback on your experiments. You can customise the Learn-OCaml interpreter by declaring compiled files in : https://github.com/ocaml-sf/learn-ocaml/blob/master/src/grader/dune#L86 For instance, by declaring On my opam installation, Therefore, by declaring something like Have a good day! |
This is great! Thank you for the very clear examples. |
I guess we can close this issue, right? |
Yes, I agree. |
Hi,
In the context of some learn-ocaml exercises, I need to preload some external code (".ml" and ".cma" files). I tried to use the optional file "depend.txt" as described in the manual (http://ocaml-sf.org/learn-ocaml/tutorials/step-8.html). However, this seems to fail to work. I cannot manage to make the external code available to the student's code.
Here is the description of one failed experiment. I'm trying to gain access to some module "Q" that exports the symbol "q".
- Definition of module Q
- Checking the module Q
- The file "depend.txt"
- Rebuilding the repository and launching the learn-ocaml server
- Using the exercise "demo" in the web browser
Thank you,
- Artur Miguel Dias
The text was updated successfully, but these errors were encountered: