I couldn't find any links or books claiming that Lisp is the first programming language to adopt structured programming (actually, most of them don't even mention Lisp at all), but if conditionals were invented by McCarthy and got into Algol later, is it fair to say that Lisp is the first?

  • 1
    A good historical a theoretical question. +1. Welcome to Programmers! – Gangnus Feb 15 '14 at 17:00
  • BTW, conditionals (and loops, and GOTOs) were invented by Ada Lovelace, 170 years ago.
  • The structured programming is a style. You can structure your Assembler code. And you can write non-structured mess on any language, too. So we can't say that any language adopted structured programming. The question is incorrect.
  • But some languages give better opportunities for a programmer to code in structured way. And as the main request of the structured programming is a better readability of the code, Lisp, definitely, is very good in that sense.
  • Lisp is the second-oldest high-level programming language in widespread use today (wiki). Made in 1958.
  • The first high-level language was Fortran (1957) and its code is not well read, it is NOT good for structuring, but for these times, in comparison with Assembler, it was VERY readable. And its code CAN be structured.
  • Other languages, before Lisp and Fortran, were not readable at all, or never realized, or both. RPG and COBOl appeared only in 1959.
  • But it is not correct to compare nowadays Lisp with the old Fortran. The old Lisp (look here) is even less readable than Fortran. And nobody would name it now the language good for structured programming.
  • On the other hand, the Lisp uses its own structure, List, to organize its own code, and in this sense, its code IS structured. But it is not in the sense of structured programming as we take it now.

So there is a bit of truth in the sentence that you are asking about. But I can't say it IS true.

I've done some research on the history of programming languages.

But first, lets see what Wikipedia says about structured programming:

Structured programming is a programming paradigm aimed on improving the clarity, quality, and development time of a computer program by making extensive use of subroutines, block structures and for and while loops—in contrast to using simple tests and jumps such as the goto statement which could lead to "spaghetti code" which is both difficult to follow and to maintain.

And that, of course, includes the use of recursive functions.

From History of Lisp (written by McCarthy. Bold emphasis mine):

  • As a programming language, LISP is characterized by the following ideas: ..., the recursive use of conditional expressions as a sufficient tool for building computable functions, ...

  • Towards the end of the initial period, it became clear that this combination of ideas made an elegant mathematical system as well as a practical programming language. Then mathematical neatness became a goal and led to pruning some features from the core of the language. This was partly motivated by esthetic reasons and partly by the belief that it would be easier to devise techniques for proving programs correct if the semantics were compact and without exceptions.

  • I invented conditional expressions in connection with a set of chess legal move routines I wrote in FORTRAN for the IBM 704 at M.I.T. during 1957-58. This program did not use list processing. The IF statement provided in FORTRAN 1 and FORTRAN 2 was very awkward to use, and it was natural to invent a function XIF(M,N1,N2) whose value was N1 or N2 according to whether the expression M was zero or not. The function shortened many programs and made them easier to understand, but it had to be used sparingly, because all three arguments had to be evaluated before XIF was entered, since XIF was called as an ordinary FORTRAN function though written in machine language. This led to the invention of the true conditional expression which evaluates only one of N1 and N2 according to whether M is true or false and to a desire for a programming language that would allow its use.

    A paper defining conditional expressions and proposing their use in Algol was sent to the Communications of the ACM but was arbitrarily demoted to a letter to the editor, because it was very short.

From The Advent of Recursion & Logic in Computer Science:

  • Since FORTRAN did not contain recursion either, he(McCarthy) tried to add it to the language, but without success.

  • In August 1959, McCarthy wrote a letter in which he openly advocated for recursive procedures [80], and, in January 1960, at the final ALGOL60 Paris conference, McCarthy suggested to add recursive procedures to the ALGOL60 language [116, p.30].

  • Perlis even stated in 1978 with respect to the ALGOL Effort that:

    "The implications of recursion were not really understood, except by McCarthy." [91, p.160]

To summarize, he had not only thought recursive functions and conditional expresions are sufficient for building computable functions, but also believed they would lead to a readable and easy to verify code, and spread the idea to other languages.

Therefore, even though McCarthy didn't say goto is harmful, I think he is the first one to perceive the importance of structured programming and Lisp is the first language that can be called structured programming language. (Fortran I didn't even support subroutines or nested expressions, and only had an arithmetic if statement)

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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