16 ms·
The article's example of a Fortran program is an anachronism. In 1975, what we had was Fortran IV which didn't have any of the structuring stuff shown in the ex
by vajrabum 3y ago
The article's example of a Fortran program is an anachronism. In 1975, what we had was Fortran IV which didn't have any of the structuring stuff shown in the example. This example of Fortran IV shows where most of BASIC came from although there are important features of Fortran that it doesn't show (DO loops, multi-character variable names, SUBROUTINES, FUNCTIONS, COMMON blocks), but Basic was pretty clearly designed as an interactive, student dialect of Fortran.
C AREA OF A TRIANGLE - HERON'S FORMULA
C INPUT - CARD READER UNIT 5, INTEGER INPUT, ONE BLANK CARD FOR END-OF-DATA
C OUTPUT - LINE PRINTER UNIT 6, REAL OUTPUT
C INPUT ERROR DISPAY ERROR MESSAGE ON OUTPUT
501 FORMAT(3I5)
601 FORMAT(4H A= ,I5,5H B= ,I5,5H C= ,I5,8H AREA= ,F10.2,
$13H SQUARE UNITS)
602 FORMAT(10HNORMAL END)
603 FORMAT(23HINPUT ERROR, ZERO VALUE)
INTEGER A,B,C
10 READ(5,501) A,B,C
IF(A.EQ.0 .AND. B.EQ.0 .AND. C.EQ.0) GO TO 50
IF(A.EQ.0 .OR. B.EQ.0 .OR. C.EQ.0) GO TO 90
S = (A + B + C) / 2.0
AREA = SQRT( S * (S - A) * (S - B) * (S - C) )
WRITE(6,601) A,B,C,AREA
GO TO 10
50 WRITE(6,602)
STOP
90 WRITE(6,603)
STOP
END
- AnimalMuppet 3y ago> Basic was pretty clearly designed as an interactive, student dialect of Fortran. Yeah. I knew Fortran (at a high school level). Then I came across the TRS80 Basic manual. I read it in an hour, and I thought "this is just like Fortran, except the words are different".
- cmrdporcupine 3y agoAbsolutely, and I remember in the 80s through the early 90s it being the case that this way of writing Fortran just continued for years in e.g. engineering disciplines (my sister was an EE student early 90s) while the rest of the world had moved on from classic BASIC and line # programming, which made Fortran in the real world twice as horrifying. I see programs written in later dialects of Fortran and they look totally fine. But my understanding is that Fortran in the "real world" is a far messier affair.
- deleted 3y ago[deleted]
- ikari_pl 3y agoThank you! I tried to look up examples from that time exactly. I missed linking to it in the article, but here it is: http://www.bitsavers.org/pdf/ibm/360/pli/GC33-0009-4_PLI_Checkout_And_Opt_Compiler_Lang_Ref_Oct76.pdf http://www.bitsavers.org/pdf/ibm/360/pli/GC33-0009-4_PLI_Che... page 92. It's 1976, so a little newer. Did I follow a bait to a spec that wasn't about to catch on until another few years?
- ikari_pl 3y agoI posted the wrong (PL/I) link above, my bad! I checked again. It seems indeed like Fortran 70 was a spec that wasn't in use until fortran 77 in 1978. Thanks again @vajrabum, I've update the article with your example!
- musicale 3y ago> Basic was pretty clearly designed as an interactive, student dialect of Fortran Exactly. The primary variations in that program from an equivalent BASIC program are the more cryptic output commands (FORMAT/WRITE vs. PRINT) and the comments (C vs. REM). (Note that PRINT did originally mean "print on paper" using a teletype-style printing terminal.) I recall reading that Tom Kurtz (BASIC's co-creator) would travel by train to some other campus to batch-process his FORTRAN punched card decks - and many programs failed because of simple errors.