Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In a long forgotten past a large part of my graduation was Prolog (I was as far ahead then as i'm behind now with the ol' AI thing; I worked on mixing neural nets, reasoning with uncertainty with Prolog at the time) and, after hallucinatory episodes living, sleeping, (day)dreaming in Prolog for months on end, when something was finished I was always so surprised how clean, readable and 'too little' the code looked for what it did. Once you really grok it, it's a magic tool. I replaced it with Common Lisp after (in my uni, there was no mention of Lisp; we didn't even know it existed basically besides some weird scribbles in papers which were easy enough to study so we didn't give it more thought) and have the same feelings/experiences there but CL is usable for basically anything, including logic programming.


I really wish there was "regex for prolog", ie: when pounding away in JavaScript be able to do:

    let options = { foo: 1, bar: 2, ... }
    ```prolog
    $X :- fromJson( options )
    Solution = Optimize( $X )
    ...
    ```
...like writing a whole web app in prolog sounds terrifying (same as writing a whole web app in regex), but recognizing and having some excellent interop between "modes" is obviously useful for regex, sometimes sql is supported in other languages, but even with the usefulness of prolog outcomes, there's almost never been that convenient "this section is logic" in the same way that we've universally adopted "regex" for string matching.


It's been a while since I used it, but look at the miniKanren implementations for your favorite programming language (js in your case, but there are a lot). It's basically a stripped-down version of logic programming.



It may "sound terrifying" but it's likely to be much more pleasant than you think:

https://github.com/Anniepoo/swiplwebtut/blob/master/web.adoc




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: