Coding 2023-07-05
Traveled back, and messed around with algebra stuff in OCaml. But let's ignore that for now, and see about getting scanning written for Lox. What do I have so far...
I have a function that attempts to produce a token given some source string and a control data structure. It returns an updated control value, and a token option. The equivalent code in Lua relied on a helper function that acts similarly to filter_map id, so, um, let's assume I'm using that, and I need to define a function that produces a token option Seq.t or something.
Given all of that writeup, I've managed to write the desired iterator, wire it in, handle the effects, and...
Something, somewhere in it is broken. The problem currently seems localized to the number function. I'll see if I can fix that up quickly.
...
Got it. I forgot to copy over everything, and I ended up with an off-by-one error. Now it all seems to work perfectly.
I'm going to wrap things up for tonight, but now feels like a good time to sum up how I feel about OCaml so far:
The normal programming with looking at types and matching everything up is great, basic meta-programming with the module system is fine, trying to push the limits of "obvious" when it comes to meta-programming just ends in confusion so far.
I'd like to figure out if there's some way to avoid that confusion, but I'm going to keep assuming for now that it's a result of a deficit in my understanding. Anyway, it's late now.
Good night.