[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gforth] my vsum function is suspiciously non-local
From: |
Carsten Strotmann (private) |
Subject: |
Re: [gforth] my vsum function is suspiciously non-local |
Date: |
Sun, 07 Mar 2010 20:35:51 +0100 |
User-agent: |
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-GB; rv:1.9.1.8) Gecko/20100216 Thunderbird/3.0.2 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello Elko,
I agree it looks better, but unfortunatly I mostly need to work on Fort
systems that do not have local variables, so I avoid them to keep my
programs portable. But that's just me.
- -- Carsten
On 3/7/10 8:04 PM, Elko Tchernev wrote:
> A solution without locals is sometimes less readable than desired. This
> version looks better, I think:
>
> : vsum { addr n -- sum }
> 0 \ the initial counter
> addr n CELLS + addr \ the ending and starting addresses
> ?DO \ don't do it if n was 0; negative OK
> I @ + \ add to the cumulative
> 1 CELLS +LOOP
> ;
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.14 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkuUABYACgkQsUJ3c+pomYFehQCbBvZ6ECKaE43dyqS5TWlAKAsW
jQ0AnAwKsxpxAhiS+eQE5ftCjQpogiex
=5aAk
-----END PGP SIGNATURE-----