lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, Jul 22, 2011 at 02:21:54AM +0200, Pascal J. Bourguignon wrote:
> (for k=1, 10 do
>  (for j=1, 10 do
>   (for i=1, 10 do
>     f(i, j, k)
>     )))

Pari/GP replaces the "do" as well:

    for(k=1,10, for(j=1,10, for(i=1,10, f(i, j, k) )))

But here is a tale of personal experience.

Back in the 1980's, at Toronto University, a programming language named 
Turing (starts with TU, get it?) was invented.  I used it because there
was an implementation “Numerical Turing” which allowed multiprecision.

Turing had all sorts of syntax alternatives like this (taken from an actual
program I wrote in 1990):

[ first=0 :  x := h ;  f(a+0.5*d,s) {+i:0..level  s(i) *= 0.5*d*h}
            |:  x := h/2 {+i:0..level  s(i) := 0} ]

You didn't need to do it this way.  `[`, `:` `{+`, `}`, `|:` `]`
were simply alternative spellings of `if`, `then`, `for` `end for`,
`else` and `end if`.  There were others: `>>` for `while`, `>>>` 
for `return` etc.

My first few programs betray a love affair with the abridged syntax.
Gradually, as the pain of debugging that sort of code grew, I switched 
to the full syntax.  

Nowadays, Turing is no longer supported.  You can get the 2007 version
of the Windows software and two books as freeware.  The books don't 
mention the abridged syntax.  I haven't checked whether the compiler
still accepts it.  

Dirk