News for hackers. Stuff that matters.
Re:Datalog in 100 lines of JavaScript (2022) by rebanevapustus on Monday January 22, 2024 @12:05PM (#39091924)
I second the disgruntled commenter's feelings. This has nothing to do with Datalog.

Here are three accurate and sound Datalog implementations: 1: https://github.com/ekzhang/crepe 2: https://github.com/s-arash/ascent 3: https://github.com/brurucy/micro-datalog

Re:Datalog in 100 lines of JavaScript (2022) by pests on Monday January 22, 2024 @04:02PM (#39095394)
Thank you!

I didn't know this had nothing to do with Datalog - just extremely annoying (and not your fault) that we are 7 comments deep.

I think we called it C&C back in the day, constructive criticism. Just was missing the constructive part.

Re:Datalog in 100 lines of JavaScript (2022) by stopachka on Monday January 22, 2024 @09:21PM (#39098742)
Hi pests, I don't think the criticism in the comments gives a full picture.

I wrote about a particular flavor of datalog, in common use today. [1] [2]. The earliest representation I know which matches the syntax of my essay, was in SICP [3]

There's another, more academic form of datalog which looks a lot like prolog. There's lots of similarities and [2] mentions them.

[1] https://github.com/tonsky/datascript [2] https://docs.datomic.com/pro/query/query.html [3] https://sarabander.github.io/sicp/html/4_002e4.xhtml

Re:Datalog in 100 lines of JavaScript (2022) by rebanevapustus on Tuesday January 23, 2024 @05:41AM (#39101728)
There is no such thing as "a more academic form of Datalog". There is only one Datalog.

Both Datascript and Datomic support recursion. In SICP it too talks about how rules can be defined recursively.

If there is no recursion, then it's just SQL without negation.

What makes it Datalog is the recursive part.

Plus, the "triples" part of what you call "Datalog", as it is explained on Datomic's documentation, is nothing related to Datalog at all. It's just a convenient format to ensure that all data is in a RDF-inspired format. Semantics aside, it makes it easier to build indexes and for it to be performant, compared to multi-relation unbounded-arity Datalog.