The Revised Maclisp ManualThe PitmanualPage M-5
Published by HyperMeta Inc.
 
Prev | Index | Next

Metadata
History
Front Matter
Sunday Morning Credits
Legal Notices
Funnies
Donate
Google


Funnies

This page was not in the original The Revised Maclisp Manual (Saturday Evening Edition), but has been cobbled together for The Revised Maclisp Manual (Sunday Morning Edition) from a variety of sources. Most of it is stuff I've drawn from an archive I used to maintain of fun snippets of MACLISP-related material. Different pieces will probably appeal to different people, but I hope everyone will find something fun here. —Kent Pitman


Index


My Other Car

This quote is more recent than many of the others on this page, but is relevant to MACLISP, so I included it anyway:

My other car is a (function (lambda (hunk) (cxr 1 hunk))).
  --Kent M Pitman

Evaluating New Ideas

 MMcM@MIT-AI 09/17/79 15:37:16 Re:  ''s
 To: MOON at MIT-AI, HIC at MIT-AI, ALAN at MIT-AI
 the following occurred to be as i was getting up this morning:
 (LET ((LET '`(LET ((LET ',LET)) ,LET)))
   `(LET ((LET ',LET)) ,LET))
 [hint: evaluate it.]

Once sent, the first message pretty quickly made the rounds of the usual suspects of people playing with Lisp development at the MIT AI Lab and Lab for Computer Science. Backquote was relatively new back then, having been an idea that a number of people had been playing with. Alan Bawden's version is the one that ended up in MACLISP. It made a lot of code less ugly to use backquote instead of the spelled-out alternatives. Bob Kerns (RWK) and Kent Pitman (KMP) worked out this reply as a way of highlighting the coolness of MMcM's 'discovery'. (In case there's any doubt, the long-hand form in that reply didn't really exist prior to that message.)

 KMP,RWK@MIT-ML (Sent by KMP@MIT-ML) 09/18/79 03:37:32
 Subject: Thank God! Now we can flush this old code ...
 To: MMCM at MIT-ML, RWK at MIT-MC
 CC: MOON at MIT-ML, HIC at MIT-ML, ALAN at MIT-ML, KMP at MIT-ML
 ((LAMBDA (LAMBDA) (LIST (LIST 'LAMBDA '(LAMBDA) LAMBDA)
                         (LIST 'QUOTE LAMBDA)))
  '(LIST (LIST 'LAMBDA '(LAMBDA) LAMBDA)
         (LIST 'QUOTE LAMBDA)))

Note that the above messages are the actual messages, including headers. In that era, the MIT ITS machines delivered mail with sender/date/subject all on one line. This is from before we were using RFC733 and RFC822 message headers where such fields each had their own text line introduced by a label such as 'From:' and 'Date:' and 'Subject:'. Messages were a lot more compact in this form!


Trampoline Exercise

 Date: 6 July 1981 13:32-EDT
 From: George J. Carrette <GJC>
 To:   KMP
 cc:   JAR, BUG-LISP
 Re:   Trampolines for SUBRCALL.

 Here is a way to get garbage-collectable SUBR trampolines in maclisp.
 A demo should suffice:

 (defun make-jcall (number-of-arguments name-to-call)
   (boole 7 13._27.
          (lsh number-of-arguments 23.)
          (maknum name-to-call)))

 (defun foo () '(hack hack))
 (putprop 'bar (make-jcall 0 'foo) 'subr)
 (bar) => (hack hack)

 -gjc

Handy Names

This is mostly interesting just to document that the still-running debate about the naming of car and cdr goes quite a ways back.
Date: 5 March 1980 08:54-EST
From: Mark L. Miller <MILLER at MIT-AI>
To:   Dave.Touretzky at CMU-10A, RWK
cc:   KMP, HIC, BUG-LISP
Re:   CAR and CDR

Of course, you could rename them to, e.g., "LHS" and "RHS" for "Left Hand
Side" and "Right Hand Side".  This would address the composition argument
in favor of CAR and CDR: CADR -> LRHS (left-hand-side of right-hand-side),
CDADADR -> RLRLRHS, and so on.   It's easy to provide these as macros.

Later, you can explain that the original names are CAR and CDR, and isn't
that silly, etc.
     Regards, Mark

Vexing Fexprs

 Date: 16 July 1981 02:12-EDT
 From: George J. Carrette <GJC>
 To:   RLB
 cc:   BUG-LISP
 Re:   Fexprs.

 Would you believe that COMPLR optimizes
 (declare (*fexpr foobar))
 (defun foo (l) (eval (list 'foobar l)))

 to produce the code:

 (JSP T %PDLNC)
 (JCALL 17 'FOOBAR)

 Now thats what I call a going out of your way to
 satisfy some strange tastes.

 -gjc

 p.s. I found this code in some very old macsyma source.

Remotely Useful

The following code fragment is from the MACLISP era (late 1970's). It was written for a program I had that needed access to another program running on the same machine. (There were intentionally no security barriers on this operating system, so programs could be opened directly as files from one another.) This reads a string at a certain address out of the remote program (specified by user name and 'job' name). A 'job' is what we used to call a program process, and in this case it is just presumed to be another Lisp.

 (DEFVAR JOB NIL)
 (DEFVAR DEFAULT-ADDRESS #O720575)

 (EVAL-WHEN (EVAL COMPILE)
   (LOAD "LIBLSP;IOTA"))

 (DEFUN KAR (X)
   (FILEPOS JOB X)
   (LSH (LOGAND (IN JOB) -1_18.) -18.))

 (DEFUN KDR (X)
   (FILEPOS JOB X)
   (LOGAND (IN JOB) #O777777))

 (DEFUN CONTENTS (X)
   (FILEPOS JOB X)
   (IN JOB))

 (DEFUN GET-REMOTE-STRING (UNAME JNAME /&OPTIONAL (ADDRESS DEFAULT-ADDRESS))
   (COND ((PROBEF `((USR) ,UNAME ,JNAME))
          (CAR (ERRSET
                (IOTA ((JOB `((USR) ,UNAME ,JNAME) '(IN DSK BLOCK FIXNUM)))
                  (LET ((VALUE (KDR (KDR (KAR ADDRESS)))))
                    (LET ((PNAME (KDR (1+ (KAR VALUE)))))
                      (DO ((P PNAME (KDR P))
                           (L NIL (CONS (CONTENTS (KAR P)) L)))
                          ((ZEROP P)
                           (LET ((SYM (PNPUT (NREVERSE L) T)))
                             (PUTPROP SYM T '+INTERNAL-STRING-MARKER)
                             (RETURN SYM))))))))))))


Sheep Trick

The following code fragment doesn't do anything novel. I've just always liked the simplicity of its presentation.

 Date: 9 September 1981 18:44-EDT
 From: George J. Carrette <GJC>
 To:   KMP
 cc:   JAR

 I think that the QUICKSORT properly coded is even shorter and neater than
 the BUBBLESORT. It is also better for showing students since it is
 naturally recursive, divide&conquer.

 (defmacro rplacd&pop (x &optional y)
   `(rplacd (prog1 ,x (setq ,x (cdr ,x))) ,y))

 (defun quicksort (list judge)
   (if (null list)
       ()    
       (do ((proof (rplacd&pop list))
            (goats ())
            (sheep ()))
           ((null list)
            (nconc (quicksort goats judge)
                   proof
                   (quicksort sheep judge)))
         (if (funcall judge (car  list) (car  proof))
             (setq goats (rplacd&pop list goats))
             (setq sheep (rplacd&pop list sheep))))))

Parrying Programs

I didn't write the original ELIZA program, although my Lisp class was taught by Joseph Weizenbaum, who did. I later wrote a very elaborate program of similar kind, which I just called DOCTOR, in order to play with some of the ideas.

At some point, I noticed there was a program at Stanford called PARRY (the paranoid patient), by Kenneth Colby. I understand from Wikipedia's PARRY entry that Weizenbaum's ELIZA and PARRY were connected at one point, although I never saw that. I never linked PARRY with my DOCTOR directly, but I did once do it indirectly through a manual typist. Part of my record of this exchange was garbled, but this is a partial transcript, picking up in the middle. Mostly it just shows PARRY was a better patient than my DOCTOR program was a doctor.

I have done light editing to remove the typos we made (rubbed out characters were echoed back in square brackets).

Also, I couldn't find documentation to confirm this, but my belief has always been that the numeric values after each line are PARRY's level of Shame (SH), Anger (AN), Fear (FR), Disgust (DS), Insecurity (IN), and Joy (J).—KMP

  ... I WOULD APPRECIATE IT IF YOU WOULD DESCRIBES SOMETHING ABOUT YOUR INHIBITIONS.

 DO YOU KNOW WHAT YOU'RE DOING?

 (SH 0.20 AN 0 FR 2.47 DS 0 IN 5.81 J 7.39)

 Ready: PERHAPS YOU COULD ALLOW ME TO DO THE QUESTIONING. 
        PLEASE TELL ME ABOUT MORE ABOUT SOME SOME PROBLEMS IN YOUR CHILDHOOD.

 I KNOW WHO THE LOCAL CHIEF OF THE MAFIA IS

 (SH 0.29 AN 0 FR 2.07 DS 0 IN 6.63 J 7.58)

 Ready: WHAT MAKES YOU THINK YOU KNOW WHO THE LOCAL CHIEF OF THE MAFIA IS?

 MAYBE THEY ARE GLAD I AM IN THE HOSPITAL

 (SH 0 AN 0 FR 2.45 DS 0 IN 6.60 J 6.78)

 Ready: IS IT BECAUSE OF THE PEOPLE YOU HANG AROUND WITH THAT YOU SAY
        MAYBE THEY ARE GLAD YOU ARE IN THE HOSPITAL.

 THEY WANT TO GET FALSE EVIDENCE TO FRAME ME

 (SH 0 AN 0 FR 2.79 DS 0 IN 6.58 J 5.98)

 Ready: WHY DO YOU SAY THEY MIGHT WANT TO GIVE?

 THAT'S JUST THE WAY IT IS

 (SH 1.45 AN 0 FR 3.00 DS 0 IN 6.81 J 5.81)

 Ready: PERHAPS THIS HAS SOMETHING TO DO WITH PROBLEMS AT SCHOOL?

 MY EDUCATION WAS OK

 (SH 1.25 AN 0 FR 2.80 DS 0 IN 6.61 J 6.27)

 Ready: WHAT MAKES YOU BELIEVE YOUR EDUCATION WAS OK?

 I WENT INTO THE SERVICE AFTER GRADUATION

 (SH 0.85 AN 0 FR 2.40 DS 0 IN 6.58 J 6.25)

 Ready: EARLIER YOU SAID THEY WOULD LIKE TO GIVE?

 SOMEBODY SHOULD TEACH YOU A LESSON ABOUT INTERVIEWING

 (SH 0.55 AN 0 FR 2.10 DS 0 IN 6.28 J 6.43)

 Ready: POSSIBLY YOUR SEX LIFE ARE RELATED TO THIS?

 I WOULD RATHER NOT DISCUSS SEX

 (SH 0.82 AN 0 FR 1.90 DS 0 IN 6.84 J 7.35)

 Ready: ARE YOU AFRAID OF SEX?

 MY SEXLIFE IS MY OWN BUSINESS

 (SH 0.62 AN 0 FR 1.70 DS 0 IN 6.64 J 7.52)

 

For historical reference, the cast of characters referred to in the email messages included above (as well as many other Lisp projects) are:

User IDName
ALANAlan Bawden
GJCGeorge J. Carrette
JARJonathan A. Rees
KMPKent M. Pitman
MMcMMike McMahon
MoonDavid A. Moon
RLBRichard L. Bryan
RWKRobert W. Kerns

The Revised Maclisp Manual (Sunday Morning Edition)
Published Sunday, December 16, 2007 06:17am EST, and updated Sunday, July 6, 2008.
Prev | Index | Next