ported a python program for prime decomposition to LRDL and made good progress until i, already at the finish line, found a compiler bug so inexplicable that i had to call it a day and continue tomorrow.

#devlog

finally got the prime decomposition program to run in LRDL:

https://git.sr.ht/~duangle/tukan/tree/master/item/testing/various/prime_decomp.lrdl

it's a naive translation with some hacks to emulate control flow.

#devlog #LRDL

learned a bunch through this.

there is tension between global iterations and case-local iterations, since cues do not update until the next iteration, unless you use the non-parallel `buffer` table.

so, a clean sequential program wouldn't use `buffer`, but instead carefully thread all updates one iteration at a time. here, we feed 2,3,5 into Y all at once, which is what causes the subsequent problems with immutability.

#devlog #LRDL

have now properly serialized processing, and thus do not need `buffer` anymore. the program is now much cleaner.

#devlog #LRDL

the prime decomposition example is already better now:

https://git.sr.ht/~duangle/tukan/tree/master/item/testing/various/prime_decomp.lrdl

but there is more to improve. the next step is adding support for deletion so `done_roots` can be removed and the checks simplified.

#devlog #LRDL

row deletion in tables has already been supported by the compiler but not by the `set` table type, until now.

#devlog #LRDL

these are all term types available by now, by the way.

#devlog #LRDL

as user i noticed i'd like to have some kind of if/elseif/else form. and for the compiler, it would also be helpful since it is computationally efficient.

here's one idea how this could work. all blocks form disjunctive cases, but the first case that completes excludes execution of all remaining cases.

#devlog #LRDL

and try blocks work! i updated the prime decomposition example to use them; it now also tests more than one prime.

https://git.sr.ht/~duangle/tukan/tree/master/item/testing/various/prime_decomp.lrdl

#devlog #LRDL