5 ms·
Implementing and using a miniKanren was fun and enlightening. And it helped me appreciate how incredibly optimized and fast SWI-Prolog is for relational/logical
by z5h 2y ago
Implementing and using a miniKanren was fun and enlightening. And it helped me appreciate how incredibly optimized and fast SWI-Prolog is for relational/logical programming. If someone knows of a miniKanren/language combination that outperforms SWI-Prolog and has good developer ergonomics for relational/logical programming, I’d love to hear about it.
- cess11 2y agoIIRC SWI-Prolog can be embedded in Python if that's your thing. Interfacing with Scryer Prolog might be require a bit more but ought to be doable, and if they haven't surpassed SWI in some performance metrics yet I'd be surprised. I'm kind of a lisper but I find it easier to get things done in a proper Prolog than the kanrens.
- upghost 2y agoIt hasn't been merged into the main branch yet, but you can embed Scryer in Python now[1], and it's quite enjoyable. I've also embedded in Java, Clojure, and elisp[2] :) The Clojure one is bundled up into a library called libscryer-clj, which I haven't released yet, but it operates the same way as libpython-clj[3], libjulia-clj[4], and libapl-clj[5]. As an aside, Scryer is hella ergonomic. clpz+reif is an amazing and amazingly powerful combination, and Scryer's DCG philsophy over double quoted strings is chefs kiss -- it really delivers on the original mission of Prolog. Ediprolog[6] is a fantastic REPL for Emacs. And honestly if you haven't seen Marcus Triska's work[7], by God you are missing out on one of the true joys of life. [1]: https://github.com/jjtolton/scryer-prolog/blob/ISSUE-2464/scryer-prolog-shared-lib-eval-code-c/docs/shared_library/scryer_python.py https://github.com/jjtolton/scryer-prolog/blob/ISSUE-2464/sc... [2]: https://github.com/mthom/scryer-prolog/discussions/2687 https://github.com/mthom/scryer-prolog/discussions/2687 [3]: https://github.com/clj-python/libpython-clj https://github.com/clj-python/libpython-clj [4]: https://github.com/cnuernber/libjulia-clj https://github.com/cnuernber/libjulia-clj [5]: https://github.com/jjtolton/libapl-clj https://github.com/jjtolton/libapl-clj [6]: https://www.metalevel.at/ediprolog/ https://www.metalevel.at/ediprolog/ [7]: https://www.youtube.com/@ThePowerOfProlog https://www.youtube.com/@ThePowerOfProlog
- jasonhemann 2y agoI was going to mention how cool JJs work is. Upvote to all those links.
- upghost 2y agoNah dude YOU are awesome! I'm just embedding the work other smart people did haha.
- cess11 2y agoAh, nice! Yeah, I really like Scryer, it's been my goto Prolog for quite some time. You wouldn't know a way to get it working under Termux on Android? I tried to build it a while back but got inscrutable compiler errors and didn't follow through. Maybe building Trealla would be easier, since it's implemented in C. I'm also enjoying http://tau-prolog.org/ http://tau-prolog.org/.
- upghost 2y agoTrealla and Tau are both wonderful. Very close cousins of Scryer. I've never tried compiling on rust before but open an issue or a discussion on the Scryer board and maybe we can figure it out! https://github.com/mthom/scryer-prolog https://github.com/mthom/scryer-prolog
- upghost 2y ago*clarification-- it's written in rust, never tried compiling rust for android before
- z5h 2y ago> if they haven't surpassed SWI in some performance metrics yet I'd be surprised I was/am also anticipating performance gains from Scryer. Which is why I made a point to request up to date Scryer benchmarks in the SWI forums. Still, for free/open Prolog, SWI-Prolog is hard to beat: https://swi-prolog.discourse.group/t/porting-the-swi-prolog-benchmark-suite-comparing-8-prolog-systems/6997/31?u=z5h https://swi-prolog.discourse.group/t/porting-the-swi-prolog-...
- sn9 2y agoMight be worth looking into Flix [0]. [0] https://en.wikipedia.org/wiki/Flix_(programming_language) https://en.wikipedia.org/wiki/Flix_(programming_language)