Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

added 239 characters in body
Source Link
marinus
  • 31.3k
  • 7
  • 73
  • 112

#1967 - APL

In 1957, at Harvard University, Ken Iverson started developing a mathematical notation for array manipulation. During the 1960s, his notation was developed into a programming language at IBM. The first partial implementation was created in 1963, and it was even used in a high school to teach students about transcendental functions. A full, usable implementation had to wait until 1965. For two years it was only used internally by IBM. In 1967, IBM released to the public an APL interpreter that ran on the IBM 1130 computer, which had been finished in 1966. You can understand how it's a bit hard to choose a year for it, however, I think it should be 1967, as this is the first year a full implementation was made available to the public. If anyone really disagrees, I could change it.

The source code for APL360,円 is online, as is an emulator. This is what I have used to test these examples. It dates from 1967, and along with APL1130円 (for the aforementioned IBM 1130) it is more or less the true original. As expected, it is very primitive. It lacks support for such niceties as lowercase letters, any operators only work with builtin functions, and the set of builtin functions is very sparse (in particular, is only or, and does not double as gcd). The original, full description is available here, however, I noticed that the version I had is not even complete with respect to that document, lacking among others.

I have provided the programs both in Unicode format (so you can read them), and in the original encoding (so you can cut and paste them into the emulator's APL window).

Unbelievably, these programs run correctly without any changes (except for the encoding) in modern versions of Dyalog, NARS2000, and GNU APL. So I guess I've found the way to write portable APL: just pretend it's 1967!

###Task 1:

Unicode:

⎕←'APL WAS MADE IN 1967!'

APL360円:

L[Kapl was made in 1967ÝK

###Task 2:

Unicode:

⎕←' N'[1+((2⍴N)⍴(⍳N)∊1,N)∨(⍳N)∘.=⍳N←⎕]

APL360円:

L[K nK;1-::2Rn"R:In"E1,n"(:In"J.%In[L'

###Task 3:

I have solved this the standard recursive way. In theory, you could do something clever and array-oriented, like the J answer; in practice, however, that has O(N) memory usage and quickly overwhelms Flower-Power-era hard- and software.

Unicode:

∇R←A GCD B
R←A
→(B=0)/0
R←B GCD B|A
∇
⎕←⎕ GCD ⎕

APL360円:

Gr[a gcd b
r[a
{:b%0"/0
r[b gcd bMa
G
L[L gcd L

#1967 - APL

In 1957, at Harvard University, Ken Iverson started developing a mathematical notation for array manipulation. During the 1960s, his notation was developed into a programming language at IBM. The first partial implementation was created in 1963, and it was even used in a high school to teach students about transcendental functions. A full, usable implementation had to wait until 1965. For two years it was only used internally by IBM. In 1967, IBM released to the public an APL interpreter that ran on the IBM 1130 computer, which had been finished in 1966. You can understand how it's a bit hard to choose a year for it, however, I think it should be 1967, as this is the first year a full implementation was made available to the public. If anyone really disagrees, I could change it.

The source code for APL360,円 is online, as is an emulator. This is what I have used to test these examples. It dates from 1967, and along with APL1130円 (for the aforementioned IBM 1130) it is more or less the true original. As expected, it is very primitive. It lacks support for such niceties as lowercase letters, any operators only work with builtin functions, and the set of builtin functions is very sparse (in particular, is only or, and does not double as gcd). The original, full description is available here, however, I noticed that the version I had is not even complete with respect to that document, lacking among others.

I have provided the programs both in Unicode format (so you can read them), and in the original encoding (so you can cut and paste them into the emulator's APL window).

Unbelievably, these programs run correctly without any changes (except for the encoding) in modern versions of Dyalog, NARS2000, and GNU APL. So I guess I've found the way to write portable APL: just pretend it's 1967!

###Task 1:

Unicode:

⎕←'APL WAS MADE IN 1967!'

APL360円:

L[Kapl was made in 1967ÝK

###Task 2:

Unicode:

⎕←' N'[1+((2⍴N)⍴(⍳N)∊1,N)∨(⍳N)∘.=⍳N←⎕]

APL360円:

L[K nK;1-::2Rn"R:In"E1,n"(:In"J.%In[L'

###Task 3:

Unicode:

∇R←A GCD B
R←A
→(B=0)/0
R←B GCD B|A
∇
⎕←⎕ GCD ⎕

APL360円:

Gr[a gcd b
r[a
{:b%0"/0
r[b gcd bMa
G
L[L gcd L

#1967 - APL

In 1957, at Harvard University, Ken Iverson started developing a mathematical notation for array manipulation. During the 1960s, his notation was developed into a programming language at IBM. The first partial implementation was created in 1963, and it was even used in a high school to teach students about transcendental functions. A full, usable implementation had to wait until 1965. For two years it was only used internally by IBM. In 1967, IBM released to the public an APL interpreter that ran on the IBM 1130 computer, which had been finished in 1966. You can understand how it's a bit hard to choose a year for it, however, I think it should be 1967, as this is the first year a full implementation was made available to the public. If anyone really disagrees, I could change it.

The source code for APL360,円 is online, as is an emulator. This is what I have used to test these examples. It dates from 1967, and along with APL1130円 (for the aforementioned IBM 1130) it is more or less the true original. As expected, it is very primitive. It lacks support for such niceties as lowercase letters, any operators only work with builtin functions, and the set of builtin functions is very sparse (in particular, is only or, and does not double as gcd). The original, full description is available here, however, I noticed that the version I had is not even complete with respect to that document, lacking among others.

I have provided the programs both in Unicode format (so you can read them), and in the original encoding (so you can cut and paste them into the emulator's APL window).

Unbelievably, these programs run correctly without any changes (except for the encoding) in modern versions of Dyalog, NARS2000, and GNU APL. So I guess I've found the way to write portable APL: just pretend it's 1967!

###Task 1:

Unicode:

⎕←'APL WAS MADE IN 1967!'

APL360円:

L[Kapl was made in 1967ÝK

###Task 2:

Unicode:

⎕←' N'[1+((2⍴N)⍴(⍳N)∊1,N)∨(⍳N)∘.=⍳N←⎕]

APL360円:

L[K nK;1-::2Rn"R:In"E1,n"(:In"J.%In[L'

###Task 3:

I have solved this the standard recursive way. In theory, you could do something clever and array-oriented, like the J answer; in practice, however, that has O(N) memory usage and quickly overwhelms Flower-Power-era hard- and software.

Unicode:

∇R←A GCD B
R←A
→(B=0)/0
R←B GCD B|A
∇
⎕←⎕ GCD ⎕

APL360円:

Gr[a gcd b
r[a
{:b%0"/0
r[b gcd bMa
G
L[L gcd L
Source Link
marinus
  • 31.3k
  • 7
  • 73
  • 112

#1967 - APL

In 1957, at Harvard University, Ken Iverson started developing a mathematical notation for array manipulation. During the 1960s, his notation was developed into a programming language at IBM. The first partial implementation was created in 1963, and it was even used in a high school to teach students about transcendental functions. A full, usable implementation had to wait until 1965. For two years it was only used internally by IBM. In 1967, IBM released to the public an APL interpreter that ran on the IBM 1130 computer, which had been finished in 1966. You can understand how it's a bit hard to choose a year for it, however, I think it should be 1967, as this is the first year a full implementation was made available to the public. If anyone really disagrees, I could change it.

The source code for APL360,円 is online, as is an emulator. This is what I have used to test these examples. It dates from 1967, and along with APL1130円 (for the aforementioned IBM 1130) it is more or less the true original. As expected, it is very primitive. It lacks support for such niceties as lowercase letters, any operators only work with builtin functions, and the set of builtin functions is very sparse (in particular, is only or, and does not double as gcd). The original, full description is available here, however, I noticed that the version I had is not even complete with respect to that document, lacking among others.

I have provided the programs both in Unicode format (so you can read them), and in the original encoding (so you can cut and paste them into the emulator's APL window).

Unbelievably, these programs run correctly without any changes (except for the encoding) in modern versions of Dyalog, NARS2000, and GNU APL. So I guess I've found the way to write portable APL: just pretend it's 1967!

###Task 1:

Unicode:

⎕←'APL WAS MADE IN 1967!'

APL360円:

L[Kapl was made in 1967ÝK

###Task 2:

Unicode:

⎕←' N'[1+((2⍴N)⍴(⍳N)∊1,N)∨(⍳N)∘.=⍳N←⎕]

APL360円:

L[K nK;1-::2Rn"R:In"E1,n"(:In"J.%In[L'

###Task 3:

Unicode:

∇R←A GCD B
R←A
→(B=0)/0
R←B GCD B|A
∇
⎕←⎕ GCD ⎕

APL360円:

Gr[a gcd b
r[a
{:b%0"/0
r[b gcd bMa
G
L[L gcd L

AltStyle によって変換されたページ (->オリジナル) /