Monday, November 2, 2020

Beauty is in the eye (and hand) of great programmers

Digging through my (paper) library the other night I came across the listing (on green-bar, fan-fold) of the implementation of a LISP system written around 1967. I used it quite a bit back in the day. It is implemented in old-school FORTRAN. By old-school, I mean a FORTRAN that only had computed IF statements, as in

IF (X) 3,4,5

which means

if x<0 then goto 3 if x=0 then goto 4 if x>0 then goto 5

This is a listing of a punched-card deck. Columns 73-80 are sequentially numbered so that, if you dropped your card deck, you could sort the cards by those columns. The increment per-line is 100 so the numbers are 00000100, 00000200, 00000300, etc. This allows new cards to be put in between existing cards while maintaining the sort sequence, e.g. 00000150.

This program is a work of beauty. Many of the statements have numeric labels so they can be reached by GOTO or computed IF statements. This programmer chose the label numbers so they are in ascending order (so you know where to look for a jump target). They are 4 digit labels where the left-most digit is the main task (e.g. handle recursive function calling), the next digit is a subtask within the main task, etc.

The FORTRAN function names mirror the intended LISP names, e.g. CAR, CDR, etc. so it is clear to a LISP programmer what the semantics will be. The call stack is named STACK, etc.

Every grouping has a comment line (character in column 1), e.g.

C EVALUATE THE FUNCTION

I am typing in the source code so I can share it with the LISP history site. Something this beautiful deserves to be preserved. This programmer is an artist.

Read source code. You can tell how good a programmer is just by looking.


Comments URL: https://news.ycombinator.com/item?id=24974986

Points: 1

# Comments: 0



from Hacker News: Newest https://ift.tt/2U0z1qJ
via IFTTT

No comments:

Post a Comment

What does Trump's foreign policy mean for World Cup?

As a group of cross-party MPs calls on Fifa to consider expelling the USA from the World Cup, BBC Sport analyses what Donald Trump’s foreign...