Re: random numbers

new topic     » goto parent     » topic index » view thread      » older message » newer message

Juergen Luethje wrote:
> 
> Hi Jason,
> 
> you wrote:
> 
> <snip>
> 
> > Does any other compiled or interpreted language have a built-in swap?
> 
> Oh yes, oh yes! smile
> 
> > I can't
> > recall coming across one, even though it is a pretty common operation.
> 
> It is implemented in many BASIC flavours:
>      SWAP a, b

Heh. The last time that I wrote in BASIC was on an 8-bit machine and it required
line numbers.

> Also interesting in this regard is Lua. Lua allows multiple assignment
> in one command, e.g.:
>      a, b = 1, 3
> which is the same as:
>      a = 1
>      b = 3
> 
> This feature can be used for swapping:
>      a, b = b, a
> 
> No joke, that actually works fine in Lua. Cool, no? smile
> 
> Regards,
>    Juergen

I've always thought that Lua was a pretty cool implementation of Euphoria...

;)

--
A complex system that works is invariably found to have evolved from a simple
system that works.
--John Gall's 15th law of Systemantics.

"Premature optimization is the root of all evil in programming."
--C.A.R. Hoare

j.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu