Subject: Re: Lisp on TV
Date: 11 Oct 1998 22:09:08 GMT
From: Steve Gonedes
Newsgroups: comp.lang.lisp
barmar@bbnplanet.com (Barry Margolin) writes:
< In last night's episode of "The Net" (on the USA cable network), which
< will be rerun tonight at 11pm EDT, there's a scene where a hacker is
< breaking into the computer system that runs the electric power grid. Set
< your VCRs and freeze on the screen shot (it's about 15 minutes into the
< episode). It looked to me like a couple of functions from a logic
< programming language (perhaps a Prolog interpreter) in Lisp. Anyone
< recognize where the code is from? Here's what I was able to see in the
< screen shot:
<
< (lexpand 'bk-out hostile)
<
< (defconstant unbound "unbound")
<
< (defmacro deref (exp)
< "Follow pointers for bound variables."
< `(progn (loop while (and (var-p ,exp) (bound-p ,exp))
< do (setf ,exp (var-binding ,exp)))
< ,exp))
<
< (defstruct var name (binding unbound))
<
< (defun bound-p (var) (not (eq (var-binding var) unbound)
<
< (defun unify (x y)
< "Destructively unify two expressions"
< (cond ((eql (deref x) (deref y) x)
< ((var-p x) (set-binding1 x y))
< ((var-p y) (set-binding1 y x))
< ((and (bound-p x) (bound-p y))
< (and (unify (deref x) (deref y))
<
With the exception of (lexpand 'bk-out), it looks like the stuff on
page 377 and 378 of Norvig's Case Studies in CL, book.