An O(x)Caml book that runs
Posted by anirudh24seven 3 days ago
Comments
Comment by belmarca 1 day ago
Our tech stack is different but the choices we made are quite similar. Multi-tiered platform, markdown for authoring, executable exercises, teacher platform to produce, give, receive and grade homework/exams, etc. A distinguishing characteristic is that codeBoot's Python interpreter (pyinterp) allows single-stepping through the code. That's quite useful for teaching and studying.
We have a few exciting features coming up and we're working on a proper landing page and clean English translation for the book. If anybody is interested to learn more, reply here or contact me (email in my profile). I'd love to connect with educators, students or hackers alike!
Comment by kcsrk 1 day ago
I have used Jupyter notebooks with a Docker deployment in my prior courses for OCaml and Prolog, with support for auto grading (using nbgrader). Jupyter notebooks aren’t great for version control. Otherwise, it worked pretty well across multiple iterations of the course with new professors coming in and independently being able to use the infra.
Comment by belmarca 21 hours ago
BTW, here's another quite nice feature of codeBoot: easy sharing! The following link will bring you to a suspended execution of 'print("hello, world!")' that you can then single-step.
https://app.codeboot.org/6.0.0/?init=.faGVsbG9fd29ybGQucHk=~...
Now I'm very curious about integrating OCaml too :)
Comment by quibono 1 day ago
Is that _really_ the case? I find it very unlikely (not just in an OCaml context).
Comment by QuadmasterXLII 1 day ago
Comment by belmarca 1 day ago
Comment by fn-mote 1 day ago
A criticism like “I didn’t understand recursive functions” is a student problem. A criticism like “the instructions to install the environment never worked” is much more clearly a problem of the instructions. Even if, as you said, there are subtleties.
I will maintain that the only way the install process is actually the most difficult part for the student is if they are already a competent programmer. Which seems unlikely for a class like this.
Comment by belmarca 18 hours ago
Comment by charcircuit 1 day ago
Comment by belmarca 18 hours ago
Comment by penteract 1 day ago
You have to precisely follow a sequence of instructions without the experience to understand their purpose, or any idea of how to fix things if you make a mistake.
Web technology is an exception to this. People already have a web browser, and ignoring mobile devices, browsers come with a js REPL.
Comment by Jach 1 day ago
Still, I don't know if such things are the biggest obstacles, I remember the conceptual hurdle of the for loop syntax being pretty difficult to overcome. (I crashed my friend's server once with a very long loop echoing stuff each iteration that I might have tried opening in multiple tabs at once too.)
I've also seen such initial setup hurdles justified as filters: if you can't handle this, well, programming is full of such obstacles (bigger, smaller, or about the same size left unstated), so maybe it's for the best you just give up now since you probably won't make it. I generally don't like that excuse, and appreciate that getting into programming has been made so easy, but at the same time when a lot of effort has been made into making something so easy (even if not quite as easy as it could be, or as easy as something else) and people still bounce off their first setup difficulty, I sympathize with those who think good riddance, especially if the person isn't an absolute beginner. The horse and water adage always applies.
Comment by ladax72707 1 day ago
Comment by TylerE 1 day ago
Comment by UncleOxidant 1 day ago
Wow, this is wild!
> The thing I would love to reach is booting a compiled unikernel directly in wasm via WASI, with no Linux host underneath at all. That would make the last module as live as the rest.
Couldn't the Mirage unikernel thingy be used to compile a unikernel with all of the needed OCaml libs + i/o support? Thus negating the need for having to boot Linux inside of a browser tab? Couldn't that be done in all of the places they're booting Linux in a tab?
Comment by kcsrk 1 day ago
I need a Linux VM to illustrate a couple of things in the last few lectures. Showing C undefined behaviour, memory safety issues and how that becomes security issues, compiling OCaml program to show test coverage, and being able to build unikernels. So can’t completely do away with Linux VMs.
For Unikernels, currently v86 is 32-bit only and OCaml 5 has dropped support for native 32-bit backends. In order to boot 64-bit unikernels, I’d need qemu. All of this could be done, but (a) this is likely to be quite slow (and the current emulation already is) and (b) the learning objectives are probably not improved a lot with the additional infrastructure. Hence, dropped it.
Comment by UncleOxidant 1 day ago
Comment by kcsrk 1 day ago
OCaml 4.x does support 32-bit native compilation, and I don't think it should be too hard to be able to boot them in the browser using v86.
Comment by WillAdams 1 day ago