[muddle] [PULLREQ] Implement global bindings]

keziahw at gmail.com keziahw at gmail.com
Fri Feb 2 19:18:23 PST 2018

repo: git://git.lambdaverse.org/muddle
branch: gval

I've implemented GVAL and a procedure for setting up the standard global
bindings (branch also includes the previous OBLIST patch). This marks
the point when our interpreter becomes capable of running real subrs; to
start with, I've implemented <ROOT> (to show off the OBLIST
functionality). You can try it out with inputs like:

(a b c <ROOT>)
> (a b c #OBLIST ![() (a) () (ROOT c) (b) () () () () () () () ()!])

Here I interned 3 atoms (just by naming them), so we can see what an
oblist looks like when non-empty. (Because of the current Amnesiac GC I
created the atoms and inspected the oblist in the same statement). I
implemented OBLIST exactly as described in The Muddle Programming
Language--as a UVECTOR of LISTs of ATOMs. A hash function is used to
selects a list (I used 32-bit FNV 1a; it's DoS-insecure, but simple and
very fast for short keys). Each list is ordered by its atoms'
PNAME. It's not necessarily the most efficient approach, but it'll work
reasonably well even for large programs and I thought it would be neat
to use the algorithm of original implementors.

More information about the muddle mailing list