HN user

deosjr

126 karma

https://github.com/deosjr

Posts1
Comments22
View on HN

This might be your jam. I should revisit this, most of it is unimplemented. But the parsing part was interesting, since MTG has such a codified language for explaining the rules. My idea here was to take a card's rules text from the official API and parse it into smth that can be used in the game, so you could keep up with new sets with implementation. The weird rule-breaking edge cases will always fail, but a large set of design space can fit, I think.

See https://github.com/deosjr/pmtg/blob/master/parse.pl

A while ago I was playing the romhack Run&Bun, which drastically ups the difficulty of Pokemon Emerald. Watching others play, most of the game was doing 'calcs': calculating how to approach a battle. This was done using a javascript frontend to a simulator, and a lot of excel sheets.

So I forked the calculator and added a Prolog wrapper so I could find solutions to battles based on the team of Pokemon that I caught. https://github.com/deosjr/runbuncalc/blob/master/main.pl

My runs died pretty early, but there are some notes here as I was implementing that are fun to read. I implemented each battle as a test case and let my solver find a solution, then amended the plan and commented on what actually happened. For example: https://github.com/deosjr/runbuncalc/blob/master/run10.pl#L2...

Exploring the implementation of Dynamicland (dynamicland.org) using Guile Scheme, Hoot (scheme->wasm) and miniKanren. Main write-up can be found here: https://deosjr.github.io/dynamicland/

I cycle between learning about scheme macro hygiene and implementing more and more realtalk/dynamicland demos and trying to grok the programming model. Doing this in the browser is a weird but fun constraint that makes things shareable.

My latest project is a wikipedia explorer: https://deosjr.github.io/dynamicland/wiki.html

Cheers, this is super useful. I will have to do some reading. Being able to build up n-ary predicates using triples that way makes a lot of sense.

Thanks Dave, high praise! I was inspired after seeing you all take over the declarative & minimalist programming room at FOSDEM this year.

If you thought this was cool, wait until you see what I ended up using it for: https://deosjr.github.io/dynamicland/ I personally think this is much cooler :) But it needs some more explaining before I can broadly share, I think.

Now that I have you here, a question: am I correct in thinking that in Hoot, eval in the browser does not currently work with macros?

I appreciate it; this kind of exchange is exactly why I read HackerNews. If you have any good sources on extending Datalog to N-ary relations, I'd love to know. Just had a look at the implementation I based mine on and it exclusively talks about triples: https://www.instantdb.com/essays/datalogjs

Coming from Prolog I'd like to get closer to the original if possible :)

Thank you for the feedback! I agree with all of the above.

Should've probably been a bit more clear on the dl-find syntax; I find it just as unacceptable as you do. It is the result of laziness: my intended use of this minimal Datalog does not include any querying whatsoever but abuses fixpoint analysis for side-effects (see https://github.com/deosjr/deosjr.github.io/blob/master/dynam... which I intend to go over in a future post). I initially had it working like you described but butchered it for the above and haven't repaired it yet (see https://github.com/deosjr/whistle?tab=readme-ov-file#datalog). This version relied on some monstrous eval-hacking using a homebrew Lisp, which I've mostly cleaned up now in this version (https://github.com/deosjr/whistle/blob/main/datalog/datalog.... is a crime, for example).

The semantics are indeed limited to binary relations atm, which I agree is the main thing that disqualifies this as a proper Datalog. iirc the tutorial on Datalog that I based this implementation on only handled triples as well so I stopped there, but extending to N-ary relations is on my list to look into for sure.

My way of learning about Lisp was based on first principles, after reading Norvigs blogpost many times and working through SICP. What helped is that I had just finished the nand2tetris book, which is very much a first principles speedrun of how a computer works.

So I built my own Lisp machine based on the nand2tetris architecture, with lisp instructions supported on the simulated chip level. I'm currently in the progress of doing a writeup of the project, you can see my attempts here if you are interested: https://deosjr.github.io/

I have an almost working version of a REPL running on the machine now, including garbage collection and parsing Lisp with Lisp and passing the output to an eval function written in assembly (the operating system, if you will).

Bret Victor update 3 years ago

Glad to hear from Dynamicland; the last video got me so excited I decided to try and build a demo for tinkering with at home: https://github.com/deosjr/elephanttalk

Only dependency is on openCV through GoCV, otherwise pure Go. Supports a webcam/beamer setup. Uses Lisp for scripting instead of Lua (see https://github.com/deosjr/elephanttalk/blob/main/cmd/elephan...).

It's a lot slower/less mature than paperprograms, but it does attempt to implement the wish/claim/when model using a homebrew datalog implementation :)