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

what does "zero lines" mean here? because the linked file, lisprolog.pl is clearly 162 lines.


It's a somewhat misleading way of stating that if you try to build a Lisp in Prolog, most of the necessary constructs already exist, you just need to tie them together.

Prolog is also homoiconic, has macros, and is built out of atoms and arbitrarily nestable lists. (Its design is very strongly tilted towards pattern matching and search, though, so it's less of a general-purpose language.)


Thats rather pedantic... the title should really just be "lisp in prolog". As it stands, I go to the page, see a large (compared to 0 lines) chunk of source, and conclude link-bait.


""" Some online books show how to implement a simple "Prolog" engine in Lisp. They typically rely on a representation of Prolog programs that is convenient from a Lisp perspective, and can't even parse a single proper Prolog term. With this approach, implementing a simple "Lisp" in Prolog is even easier ("Lisp in Prolog in zero lines"): Translate each Lisp function to a Prolog predicate with one additional argument to hold the original function's return value. Done. This is possible since a function is a special case of a relation, and functional programming is a restricted form of logic programming. """


Right: this actually parses Lisp. (Parsing is supposedly another thing Prolog is particularly good at, but I haven't gotten to that chapter in _The Art of Prolog_ yet.)

Parsing Prolog is actually pretty easy (the syntax is almost as simple as Lisp's!), but IIRC the Prolog-in-Lisps I've seen in PAIP and On Lisp just use native Lisp sexps. While the Prolog-y syntax strikes me as a bit weird in Erlang, it actually makes a lot of sense for Prolog.




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

Search: