Discussion:
History: DEFUN added to Lisp
(too old to reply)
Lars Brinkhoff
2020-02-20 10:15:52 UTC
Permalink
Since I'm sometimes dealing with ancient Lisp files, I have sometimes
wondered, when was DEFUN added to Lisp? After a while I found the
answer in this announcement of a Maclisp update:


3/1/69 JONL

THE CURRENT VERSION OF LISP, "LISP 102", HAS
THE FOLLOWING AS-YET UNDOCUMENTED FEATURES:

1)"DEFUN" IS AN FSUBR USED TO DEFINE
FUNCTIONS. EXAMPLES ARE
(DEFUN ONECONS (X) (CONS 1 X))
WHICH IS EQUIVALENT TO
(DEFPROP ONECONS
(LAMBDA (X) (CONS 1 X)
EXPR)

AND (DEFUN SMASH FEXPR (L) (RPLACD L NIL))
IS EQUIVALENT TO
(DEFPROP SMASH
(LAMBDA (L) (RPLACD L NIL))
FEXPR)
THE NOVEL FEATURE OF "DEFUN" IS THAT ONE NEED
NOT BE SO CONCERNED WITH BALANCING
PARENTHESES AT THE VERY END OF THE FUNCTION
DEFINITION, SINCE THE TYPE FLAG MAY BE
OMITTED IF IT IS "EXPR", AND APPEARS NEAR
THE FRONT OF THE "DEFUN" LIST IF IT IS SOME
OTHER. ALSO, THE "LAMBDA" NEED NOT BE
DIRECTLY INSERTED.
Kaz Kylheku
2020-02-25 07:34:22 UTC
Permalink
Post by Lars Brinkhoff
Since I'm sometimes dealing with ancient Lisp files, I have sometimes
wondered, when was DEFUN added to Lisp? After a while I found the
3/1/69 JONL
THE CURRENT VERSION OF LISP, "LISP 102", HAS
1)"DEFUN" IS AN FSUBR USED TO DEFINE
FUNCTIONS. EXAMPLES ARE
(DEFUN ONECONS (X) (CONS 1 X))
WHICH IS EQUIVALENT TO
(DEFPROP ONECONS
(LAMBDA (X) (CONS 1 X)
EXPR)
That was a half-decent way to repent for screwing
up DEFINE into DEFPROP.
Post by Lars Brinkhoff
AND (DEFUN SMASH FEXPR (L) (RPLACD L NIL))
IS EQUIVALENT TO
(DEFPROP SMASH
(LAMBDA (L) (RPLACD L NIL))
FEXPR)
THE NOVEL FEATURE OF "DEFUN" IS THAT ONE NEED
^^^^^
Post by Lars Brinkhoff
NOT BE SO CONCERNED WITH BALANCING
PARENTHESES AT THE VERY END OF THE FUNCTION
DEFINITION, SINCE THE TYPE FLAG MAY BE
^^^^^^^^^^^^^^^^^^^^^^^^^^
Post by Lars Brinkhoff
OMITTED IF IT IS "EXPR", AND APPEARS NEAR
^^^^^^^
Post by Lars Brinkhoff
THE FRONT OF THE "DEFUN" LIST IF IT IS SOME
OTHER. ALSO, THE "LAMBDA" NEED NOT BE
DIRECTLY INSERTED.
Wut? THe Lisp 1.5 Manual from 1960 shows a DEFINE that requires no
crufty type flag at the end, so how can that be called "novel?"

(I see that the Lisp art of kidding onself goes decades back.)

The following example is given on on page 15 of the manual, of three
functions defined in a single DEFINE:

DEFINE ((
(MEMBER (LAMBDA (A X) (COND ((NULL X) F)
( (EQ A (CAR X)) T) (T (MEMBER A (CDR X))) )))
(UNION (LAMBDA (X Y) (COND ((NULL X) Y) ((MEMBER
(CAR X) Y) (UNION (CDR X) Y)) (T (CONS (CAR X)
(UNION (CDR X) Y))) 1))
(INTERSECTION (LAMBDA (X Y) (COND ((NULL X) NIL)
( (MEMBER (CAR X) Y) (CONS (CAR X) (INTERSECTION
(CDR X) Y))) (T (INTERSECTION (CDR X) Y)) )))
))

Moreover, the 1960 manual also has M-Expr syntax that just uses = to
define functions. The above MEMBER is given as:

member[a;x] = [null[x] -> F;
eq[a;car[x]] -> T;
T -> member[a;cdr [x]]]
--
TXR Programming Lanuage: http://nongnu.org/txr
Music DIY Mailing List: http://www.kylheku.com/diy
ADA MP-1 Mailing List: http://www.kylheku.com/mp1
t***@google.com
2020-02-25 14:22:34 UTC
Permalink
Post by Kaz Kylheku
Post by Lars Brinkhoff
Since I'm sometimes dealing with ancient Lisp files, I have sometimes
wondered, when was DEFUN added to Lisp? After a while I found the
3/1/69 JONL
THE CURRENT VERSION OF LISP, "LISP 102", HAS
1)"DEFUN" IS AN FSUBR USED TO DEFINE
FUNCTIONS. EXAMPLES ARE
(DEFUN ONECONS (X) (CONS 1 X))
WHICH IS EQUIVALENT TO
(DEFPROP ONECONS
(LAMBDA (X) (CONS 1 X)
EXPR)
That was a half-decent way to repent for screwing
up DEFINE into DEFPROP.
To be fair, though, EXPR was just one of the properties that one could
define on a symbol. Property lists used to be a much bigger thing once
upon a time.
Barry Margolin
2020-02-25 17:01:03 UTC
Permalink
Post by t***@google.com
Post by Kaz Kylheku
Post by Lars Brinkhoff
Since I'm sometimes dealing with ancient Lisp files, I have sometimes
wondered, when was DEFUN added to Lisp? After a while I found the
3/1/69 JONL
THE CURRENT VERSION OF LISP, "LISP 102", HAS
1)"DEFUN" IS AN FSUBR USED TO DEFINE
FUNCTIONS. EXAMPLES ARE
(DEFUN ONECONS (X) (CONS 1 X))
WHICH IS EQUIVALENT TO
(DEFPROP ONECONS
(LAMBDA (X) (CONS 1 X)
EXPR)
That was a half-decent way to repent for screwing
up DEFINE into DEFPROP.
To be fair, though, EXPR was just one of the properties that one could
define on a symbol. Property lists used to be a much bigger thing once
upon a time.
Indeed, I think they were THE thing -- I think the value cell was in the
property list in some early Lisps.
--
Barry Margolin, ***@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
Chris Riesbeck
2020-02-25 18:45:43 UTC
Permalink
Post by Barry Margolin
Post by t***@google.com
To be fair, though, EXPR was just one of the properties that one could
define on a symbol. Property lists used to be a much bigger thing once
upon a time.
Indeed, I think they were THE thing -- I think the value cell was in the
property list in some early Lisps.
In UCI Lisp, an atom was just a list whose CAR was 65536 and whose CDR
was the property list, that contained properties for the value, function
definition, and print name. If you replaced the car of an symbol A with
another symbol B, typing A the interpreter would look like a function
call and apply B t the property list of A. If B was a FEXPR, this ran
without error!

These days, language implementers like to lock the knives away.

Loading...