On Wednesday, June 22, 2016 at 8:22:35 PM UTC-6, Ashish Negi wrote: > > I am reading joy of clojure. In the "forward to second edition" William E > Byrd and Daniel P Firedman says : > > > > *As with recursion, the art of defining little languages encourages—and > rewards—wishful thinking. You might think to yourself, “If only I had a > language for expressing the rules for legal passwords for my login system.” > A more involved example—a story, really—started several years ago, when we > thought to ourselves, “If only we had the right relational language, we > could write a Lisp interpreter that runs backward.”[2] > <http://www-legacy.manning.com/fogus2/excerpt_foreword2ed.html#footnote-2> > What does this mean? * > > > *An interpreter can be thought of as a function that maps an input > expression, such as (+ 5 1), onto a value—in this case, 6. We wanted to > write an interpreter in the style of a relational database, in which either > the expression being interpreted or the value of that expression, or both, > can be treated as unknown variables. We can run the interpreter forward > using the query (interpret ‘(+ 5 1) x), which associates the query variable > x with the value 6. Better yet, we can run the interpreter backward with > the query (interpret x 6), which associates x with an infinite stream of > expressions that evaluate to 6, including (+ 5 1) and ((lambda (n) (* n 2)) > 3). (Brainteaser: determine the behavior of the query (interpret x x).)* > > Although the writer gave an example of `*(interpret x 6)*` i could not > imagine the use case of `*lisp interpreter running backwards*` ? > I am not even sure what he meant exactly. > > Thinking on it, i could only relate this to *theorem prover*s where you > run backwards from the result. > Can somebody explain this ? >
One of the authors of the forward (William Byrd) gave a great presentation on miniKanren at lambda lounge utah a couple of years ago. Towards the end of the presentation we went through the exercise of actually creating a simple lisp interpreter that can run backwards. Luckily it was recorded and posted online. https://www.youtube.com/watch?v=zHov3fKYqBA -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.