Teodorico Levoff
Teodorico Levoff

Reputation: 1659

Imitate Prolog's Backtracking in Racket

I find Prolog's backtracking quite fascinating and was wondering if anyone has any possible ideas on how one could imitate Prolog's backtracking in Racket, as a possible summer project idea. Also, why is Racket macros so powerful?

Upvotes: 1

Views: 340

Answers (3)

Christophe De Troyer
Christophe De Troyer

Reputation: 2922

As it has not been mentioned yet, there is a meta-circular implementation in the Structure and Implementation of Computer programs by Abelson and Sussman, which runs a code by converting it into two-continuations passing style, with the passing of two continuations throughout, one for success and the other for failure.

Upvotes: 4

John Clements
John Clements

Reputation: 17203

Alas, you may not be entirely delighted to hear that this package already exists. It's called Racklog, and it was initially developed by Dorai Sitaram. Here's the documentation:

http://docs.racket-lang.org/racklog/index.html?q=racklog

Upvotes: 6

soegaard
soegaard

Reputation: 31147

A blast from the past "Transliterating Prolog into Scheme", Mathias Felleisen, 1982.

ftp://infosecon.net/pub/techreports/TR182.pdf

Also, get your hands on "The Reasoned Schemer".

https://mitpress.mit.edu/books/reasoned-schemer

Upvotes: 6

Related Questions