HN user

anthay

54 karma

I'm a programmer.

I wrote some stuff here: http://howtowriteaprogram.blogspot.com/

I'm trying to complete this: http://logfilerobot.com/

Posts4
Comments40
View on HN

I agree with you. I think the presence of START is accidental and is not supposed to be part of the script. The ELIZA code uses a Slip function called LISTRD to read the script rules one by one. If it reads an empty list it stops reading the script and begins the conversation. So I think the empty list at the end of the script had a reason to be there. Another accidental thing about the script in the CACM paper is that there are 6 duplicated lines, each one 34 lines from the previous one. I had not heard of Moiré logic. I'm contributing to a book about ELIZA and its legacy. No publisher yet. The editors may be looking for other contributors. I realize this is not much to go on, but say if it might be of interest to you.

Weizenbaum says the list must be there, but may be empty: "Finally, the script writer must begin his script with a list, i.e., a message enclosed in parentheses, which contains the statement he wishes ELIZA to type when the system is first loaded. This list may be empty." page 42 of the 1966 CACM ELIZA paper.

And the MEMORY keyword "must be an ordinary keyword as well." So you'd need a (XYZZY ...) rule.

Also, the START symbol appears in the DOCTOR script, but is never mentioned in the body of the paper.

Another thing Weizenbaum doesn't mention in his description is the final empty list in the DOCTOR script. This does seem to be expected by the code.

That's really cool. (The paper uses the palidrome example to try to demonstrate how a Turing machine might be encoded in an ELIZA script.) ELIZA scripts must begin with some opening remarks, e.g. (HELLO. PLEASE TELL ME YOUR PROBLEM), and they must have a MEMORY rule, e.g. (MEMORY PALIN (0 = 1) (0 = 1) (0 = 1) (0 = 1)).

All I did was submit this Ask HN here. I've not posted a link to it anywhere. As I write the post has 13 points and I have 51 points. Again. I'm sure my life would be much better if only I could escape from the clutches of 51. (I've been down to 49 and up to 52 since I posted.)

Pascal at Apple 9 years ago

It's probably a bit late for this reply, but... Another clumsy workaround is to use operator(). Again, standard C++ and this one has access to local variables:

    int g()
    {
        int x, y;

        struct local {
            int & a_;
            int & b_;
            local(int & a, int & b) : a_(a), b_(b) {}
        
            int operator()()
            {
                return a_ + b_;
            }

        } nested(x, y);

        x = 99; y = 1;
        return nested();
    }

    assert(g() == 100);
Pascal at Apple 9 years ago

In the past I've sometimes used standard C++ local structs to nest functions. E.g.:

    int f()
    {
        struct local {
            static int nested_func()
            {
                return 123;
            }
        };

        return local::nested_func();
    }

Will you permit a couple more quotes apropos taste?

"Good judgement is the result of experience and experience is the result of bad judgement." - Mark Twain

and

"To write a good program takes intelligence, taste, and patience. You are not going to get it right the first time; experiment!" - Bjarne Stroustrup

I was one of the first employees in a UK tech startup. I was given share options that I calculated represented about 0.5% of the value of the company. When the company was sold about 10 years later, making the founders multi-millionaires, I got about £30K. I was clueless and didn't realise the shares could and would be diluted many times.

I was pleasantly surprised to see prices quoted in £GBP - the Powerwall is available in the UK! But, we don't have enough sunlight here to run a typical house off-grid year-round, do we?

That's cool and I agree about the advantages you mention.

In your code \n must be a line separator rather than a line terminator. (Otherwise, if the last line is \n terminated, the function returns 0.)