8

I don't see DEFUN in a ~1966 copy of PDP-6 LISP. I do see it in a 1972 Maclisp.

AI memo 116A from 1967 doesn't have DEFUN. (It does have MACRO.)

  • 1
    Since DEFUN is a macro (combining lambda and setf), this might be reduced to "What was the first LISP to support macros". – Raffzahn Feb 18 at 9:12
  • 1
    I'd like to know when DEFUN became a built in macro. As opposed to a macro a user adds. PDP-6 LISP has macros. – Lars Brinkhoff Feb 18 at 10:38
  • 1
    You might want to take a look at Scheme, which was influenced by PDP-6 Lisp. The omission of a DEFUN like feature from Scheme was intentional, IIRC. en.wikipedia.org/wiki/Scheme_(programming_language) – Walter Mitty Feb 18 at 14:07
  • @WalterMitty, are you saying Scheme was influenced more by PDP-6 Lisp than Maclisp? – Lars Brinkhoff Feb 19 at 13:11
10

From the MIT AI Lab file .INFO.; LISP ARCHIV for Maclisp updates:

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.

| improve this answer | |
  • I didn't really understand the citation at the top, so I googled the quoted text and found it here and here. I put these links for future Wayback Machine users, since I don't suppose there'll be a search engine for stuff that's gone offline in the future. – JoL Feb 18 at 17:51
  • Sorry I don't understand what you're saying about Wayback Machine users, as you didn't use web.archive.org links. As far as I know they're not going to automatically be added to archive.org just by posting them here. – kristianp Feb 19 at 0:10
  • 1
    @kristianp The links work right now, which IMHO means it's better to reference them directly at the moment, but if they go away in the future, they may also disappear from search engines, which means that it's good to keep copies of the links here. (Not to mention it saves others a bit of time searching.) And as you'll see when you check the wayback machine, JoL made sure that those links are archived by querying them there. – cjs Feb 19 at 1:37
3

The defun macro is just syntactic sugar for define plus lambda.

InterLisp (1970) doesn't seem to have it either, so your MacLisp example is either the first, or pretty close to being the first.

| improve this answer | |
  • It turns out the first DEFUN wasn't a macro, but a built-in FSUBR. – Lars Brinkhoff Feb 18 at 19:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.