frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

Datalog in miniKanren

https://deosjr.github.io/dynamicland/datalog.html
82•deosjr•10h ago

Comments

deosjr•10h ago
Seems like interest in Datalog is high this week, so I thought I'd share a write-up of a minimal Datalog implementation I did a while ago.

Runs in the browser using Hoot (https://spritely.institute/hoot/) which compiles Guile Scheme to WebAssembly.

fithisux•9h ago
What scheme is this?
deosjr•8h ago
Guile Scheme. See https://github.com/deosjr/deosjr.github.io/blob/master/dynam... for more.
upghost•3h ago
Datalog is a syntactic subset of Prolog[1], which this is... not.

I think the most misunderstood thing about Prolog (and Datalog, the functor-free subset of pure Prolog) is that the syntax is really, really important.

It's like, the whole gimmick of the language. It is designed to efficiently and elegantly query and transform itself. If you lose the syntax you lose all of intermediate and advanced Prolog (and Datalog).

[1]: https://en.m.wikipedia.org/wiki/Datalog

kragen•2h ago
Semantics are more important than syntax. Prolog's flexible syntax is a nice-to-have rather than essential when you're in Lisp. And Datalog is purely first-order, so the advanced Prolog you're talking about doesn't exist in it.

However, syntax does matter, and this is not acceptable

    (dl-find 
     (fresh-vars 1 
      (lambda (?id) 
       (dl-findo dl
        ((,?id reachable ,?id)))))))
as a way to ask

    reachable(Id, Id).
I think you could, however, write a bit more Scheme and be able to ask

    (?id reachable ?id)
which would be acceptable.

However, the ordering betrays a deeper semantic difference with orthodox Datalog, which is about distinct N-ary relations, like a relational database, not binary relations. This implementation seems to be specific to binary relations, so it's not really Datalog for reasons that go beyond mere syntax.

On the other hand, this (from the initial goal) would be perfectly fine:

    (dl-rule! dl (reachable ,?x ,?y) :- 
                     (edge ,?x ,?z) (reachable ,?z ,?y))
The orthodox Datalog syntax is:

    reachable(X, Y) :- edge(X, Z), reachable(Z, Y).
jitl•2h ago
Shouldn’t lisp macros make it easy to present such a nice syntax? Perhaps the author could easily implement that bit, if not the wide rows. Or is that the point you’re making?

There is a dl-rule here: https://github.com/deosjr/deosjr.github.io/blob/15b5f7e02153...

kragen•1h ago
I don't think you need Lisp macros for it; you could use just a regular Lisp function. I don't think the standard R5RS macros are powerful enough to grovel over the query expression to make a list of the free variables, but then, standard Scheme also doesn't have records. I think Guile has a procedural macro system that you could use, but I don't think it would be a good idea.

Yes, I think the semantic divergence is more fundamental. Triple stores and graph databases and binary relations are awesome, but they aren't what Datalog is.

j-pb•1h ago
Most database literature simply uses Datalog to mean the query language fragment of conjunctive queries + recursion/fixpoint-iteration and potentially stratified negation.

Yes it started out as a Prolog subset, but the definition as the fragments it supports has become much more prevalent, mainly to contrast it to non-recursive fragments with arbitrary negation (e.g. SQL).

This usage dates back to database literature of the 80s by Ullman et. al.

A new high-voltage breaker can clear grid-scale faults without greenhouse gas

https://spectrum.ieee.org/sf6-gas-replacement
43•rbanffy•4h ago•14 comments

Modifying an HDMI dummy plug's EDID using a Raspberry Pi

https://www.downtowndougbrown.com/2025/06/modifying-an-hdmi-dummy-plugs-edid-using-a-raspberry-pi/
199•zdw•11h ago•51 comments

Telephone Exchanges in the UK

https://telephone-exchanges.org.uk/
96•petecooper•7h ago•33 comments

Lisp-stat: Lisp environment for statistical computing

https://lisp-stat.dev/about/
14•oumua_don17•1d ago•2 comments

Twin – A Textmode WINdow Environment

https://github.com/cosmos72/twin
47•kim_rutherford•6h ago•10 comments

Canyon.mid

https://canyonmid.com/
244•LorenDB•13h ago•139 comments

Meta's Llama 3.1 can recall 42 percent of the first Harry Potter book

https://www.understandingai.org/p/metas-llama-31-can-recall-42-percent
19•aspenmayer•15h ago•33 comments

Why SSL was renamed to TLS in late 90s (2014)

https://tim.dierks.org/2014/05/security-standards-and-name-changes-in.html
176•Bogdanp•12h ago•91 comments

Childhood leukemia: how a deadly cancer became treatable

https://ourworldindata.org/childhood-leukemia-treatment-history
169•surprisetalk•13h ago•39 comments

Chemical knowledge and reasoning of large language models vs. chemist expertise

https://www.nature.com/articles/s41557-025-01815-x
19•bookofjoe•1d ago•2 comments

First 2D, non-silicon computer developed

https://www.psu.edu/news/research/story/worlds-first-2d-non-silicon-computer-developed
74•giuliomagnifico•3d ago•13 comments

DARPA program sets distance record for power beaming

https://www.darpa.mil/news/2025/darpa-program-distance-record-power-beaming
13•gnabgib•4h ago•9 comments

Datalog in Rust

https://github.com/frankmcsherry/blog/blob/master/posts/2025-06-03.md
243•brson•15h ago•25 comments

Datalog in miniKanren

https://deosjr.github.io/dynamicland/datalog.html
82•deosjr•10h ago•8 comments

How to modify Starlink Mini to run without the built-in WiFi router

https://olegkutkov.me/2025/06/15/how-to-modify-starlink-mini-to-run-without-the-built-in-wifi-router/
265•LorenDB•14h ago•72 comments

Simplest C++ Callback, from SumatraPDF

https://blog.kowalczyk.info/a-stsj/simplest-c-callback-from-sumatrapdf.html
80•jandeboevrie•9h ago•63 comments

David Attenborough at 99: 'I will not see how the story ends'

https://www.thetimes.com/life-style/celebrity/article/david-attenborough-book-extract-age-99-lj3rd2fg7
127•herbertl•5h ago•59 comments

Let's Talk About ChatGPT-Induced Spiritual Psychosis

https://default.blog/p/lets-talk-about-chatgpt-induced-spiritual
12•greenie_beans•4h ago•6 comments

Cyborg Embryos Offer New Insights into Brain Growth

https://spectrum.ieee.org/embryo-electrode-array
14•rbanffy•3d ago•0 comments

Cure Dolly's Japanese Grammar Lessons

https://kellenok.github.io/cure-script/
56•agnishom•1d ago•11 comments

Fields where Native Americans farmed a thousand years ago discovered in Michigan

https://www.smithsonianmag.com/smart-news/massive-field-where-native-american-farmers-grew-corn-beans-and-squash-1000-years-ago-discovered-in-michigan-180986758/
159•CoopaTroopa•3d ago•66 comments

It’s nearly impossible to buy an original Bob Ross painting (2021)

https://thehustle.co/why-its-nearly-impossible-to-buy-an-original-bob-ross-painting
116•rmason•6h ago•105 comments

How fast can the RPython GC allocate?

https://pypy.org/posts/2025/06/rpython-gc-allocation-speed.html
31•todsacerdoti•7h ago•7 comments

Foundations of Computer Vision

https://visionbook.mit.edu
146•tzury•16h ago•6 comments

An Introduction to the Hieroglyphic Language of Early 1900s Train-Hoppers

https://www.openculture.com/2018/08/hobo-code-introduction-hieroglyphic-language-early-1900s-train-hoppers.html
31•squircle•7h ago•3 comments

KAIST Succeeds in Real-Time CO2 Monitoring Without Batteries or External Power

https://news.kaist.ac.kr/newsen/html/news/?mode=V&mng_no=47450
7•gnabgib•4h ago•1 comments

Show HN: StellarSnap – Explore NASA APODs, simulate orbits, learn astronomy

https://stellarsnap.space
15•stellarsnap•2d ago•0 comments

Ruby on Rails Audit Complete

https://ostif.org/ruby-on-rails-audit-complete/
176•todsacerdoti•3d ago•139 comments

The Art of Lisp and Writing (2003)

https://www.dreamsongs.com/ArtOfLisp.html
165•Bogdanp•19h ago•66 comments

The experience continues until you stop experiencing it

https://strangemachine.tv/safespace/popov/
67•durakot•10h ago•20 comments