cooked up that JS datalog thing - https://gist.github.com/alandipert/4e390808b5dcee9020b6622c0a24023e
no optimizations or anything (indexes, query planning)
came out a little wordier than i'd hoped, not sure i arrived at the highest leverage representation of relations. but any thoughts or ideas for improvement would be most welcome
the algorithm is basically: map the clauses over the facts to get a set of relations. then join the relations, either cross-join or inner-join depending on whether or not they share variables
It’s always weird when a simple idea ends up taking a lot of space. It makes me feel suspicious of what I’ve done
The inner join is clear, but I’m so used to working with large data sets that the m×n algorithm makes me a bit uncomfortable. Your use case shouldn’t have an issue though
TIL about Proxy
🙂
That’s pretty neat Alan. Borderline method_missing
🙂
between template literals and Proxy, ES6+ has job security
thanks for taking a look. i'll keep going towards the dom mgmt idea i have and post back if i arrive anywhere interesting. hope everyone has a great weekend!