[Info-vax] ChatGPT - Joke about OpenVMS and Linux walking into a bar
Arne Vajhøj
arne at vajhoej.dk
Wed Jan 4 20:45:20 EST 2023
On 1/1/2023 9:45 AM, Johnny Billquist wrote:
> On 2023-01-01 04:24, Dave Froble wrote:
>> Maybe even easier in Basic ...
>>
>> S = S + I For I = 1 to 20
>> Print S
>>
>> Oh, wait, no Basic on x86, yet, ....
>
> BASIC2
>
> s = s + i for i=1 to 20 \ print s
>
>
> 210
Basic has a pretty good LOC/FP ratio.
It has never had a great reputation among let us
call it "programming language gourmets", but lots
of business usage.
One will need to go to way newer languages to
get something similar.
Python:
print(sum(range(1,21)))
Groovy:
println((1..20).sum())
Even though one could argue that a more equivalent
code (being able to sum functions of i instead of
just i) would be Python:
print(sum([i for i in range(1,21)]))
because you can do:
print(sum([i*i for i in range(1,21)]))
Groovy would need to use a different approach like:
println((1..20).collect{it*it}.sum())
Arne
More information about the Info-vax
mailing list