gengyangcai
7/15/2015 8:45:00 AM
So I am currently going through chapter 6 of Paul Graham's Ansi Common Lisp : Functions as Representations.
6.1 Networks
Closures have three useful properties: they are active, they have local state, and we can make multiple instances of them. Where could we use multiple copies of active objects with local state? In applications involving networks, among others. In many cases we can represent nodes in a network as closures. As well as having its own local state, a closure can refer to another closure. Thus a closure representing a node in a network can know of several other nodes (closures) to which it must send its output. This means that we may be able to translate some networks straight into code.
The first figure given in the book , figure 6.1: Session of twenty questions given in the book looks like this :
> (run-node 'people)
Is the person a man?
>> yes
Is he living?
>> no
Was he American?
>> yes
Is he on a coin?
>> yes
Is the coin a penny? >> yes
LINCOLN
When I tried to run the first line of the program in Lispworks , this is what I got :
CL-USER 3 : 2 > (run-node 'people)
Error: Undefined operator RUN-NODE in form (RUN-NODE (QUOTE PEOPLE)).
1 (continue) Try invoking RUN-NODE again.
2 Return some values from the form (RUN-NODE (QUOTE PEOPLE)).
3 Try invoking something other than RUN-NODE with the same arguments.
4 Set the symbol-function of RUN-NODE to another function.
5 Set the macro-function of RUN-NODE to another function.
6 (abort) Return to level 2.
7 Return to debug level 2.
8 Return to level 1.
9 Return to debug level 1.
10 Return to level 0.
11 Return to top loop level 0.
Type :b for backtrace or :c <option number> to proceed.
Type :bug-form "<subject>" for a bug report template or :? for other options.
I tried debugging it and invoking RUN-NODE again, but kept getting similar error messages
If anyone is interested in testing this piece of code and can get it to work or faces similar issues , let me know thanks a lot !
CAI GENGYANG
gengyangcai@gmail.com