Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #42821
| From | Paul Rubin <no.email@nospam.invalid> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: How to solve this problem in FORTH? |
| Date | 2015-10-26 00:58 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <87fv0yvz6f.fsf@jester.gateway.sonic.net> (permalink) |
| References | <f195a1a1-8609-4319-9df9-d8cbb2a11fdb@googlegroups.com> <ed5ecb8e-cb01-4acb-9e4c-0a20b12f290b@googlegroups.com> |
lehs <skydda.barnen@gmail.com> writes:
> I think your solution is nice, but it's unfair comparing languages in
> such a limited perspective. In Forth arrays have a simple, not a
> complex and static, implementation.
What would an idiomatic Forth implementation of a word like that be?
E.g. using a typical Forth array definition.
> But what ever built in system other languages might have, any forther
> could extend Forth to be competitive.
It's not too bad with gforth locals:
: v& ( addr i -- addr ) cells + ;
: vadd { v1 v2 v3 -- }
3 0 do v1 i v& @ v2 i v& @ + v3 i v& ! loop ;
but it's not so well-factored, and fixing that is ugly as far as I can
tell. It's one of those situations that makes me want nested functions
that can reach the parent's locals, sort of like the GCC nested function
extension:
void vadd(int *v1, int *v2, int *v3) {
void vk(int k) { v3[k] = v2[k] + v1[k]; }
vk(0); vk(1); vk(2);
}
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to solve this problem in FORTH? lehs <skydda.barnen@gmail.com> - 2015-10-26 00:02 -0700
Re: How to solve this problem in FORTH? Paul Rubin <no.email@nospam.invalid> - 2015-10-26 00:58 -0700
Re: How to solve this problem in FORTH? lehs <skydda.barnen@gmail.com> - 2015-10-26 02:36 -0700
Re: How to solve this problem in FORTH? Paul Rubin <no.email@nospam.invalid> - 2015-10-26 21:56 -0700
Re: How to solve this problem in FORTH? Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-10-26 03:09 -0700
Re: How to solve this problem in FORTH? Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-10-26 03:14 -0700
Re: How to solve this problem in FORTH? lehs <skydda.barnen@gmail.com> - 2015-10-26 04:55 -0700
Re: How to solve this problem in FORTH? Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-10-26 05:11 -0700
Re: How to solve this problem in FORTH? humptydumpty <ouatubi@gmail.com> - 2015-10-26 06:35 -0700
Re: How to solve this problem in FORTH? lehs <skydda.barnen@gmail.com> - 2015-10-26 12:25 -0700
Re: How to solve this problem in FORTH? humptydumpty <ouatubi@gmail.com> - 2015-10-27 00:47 -0700
Re: How to solve this problem in FORTH? lehs <skydda.barnen@gmail.com> - 2015-10-27 08:06 -0700
Re: How to solve this problem in FORTH? humptydumpty <ouatubi@gmail.com> - 2015-10-27 23:43 -0700
Re: How to solve this problem in FORTH? lehs <skydda.barnen@gmail.com> - 2015-10-28 01:30 -0700
Re: How to solve this problem in FORTH? humptydumpty <ouatubi@gmail.com> - 2015-10-28 01:58 -0700
Re: How to solve this problem in FORTH? franck.bensusan@gmail.com - 2015-10-28 02:56 -0700
Re: How to solve this problem in FORTH? lehs <skydda.barnen@gmail.com> - 2015-10-28 03:36 -0700
Re: How to solve this problem in FORTH? Hans Bezemer <the.beez.speaks@gmail.com> - 2015-10-28 15:31 +0100
Re: How to solve this problem in FORTH? Paul Rubin <no.email@nospam.invalid> - 2015-10-26 21:58 -0700
Re: How to solve this problem in FORTH? Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-10-26 23:38 -0700
Re: How to solve this problem in FORTH? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-10-27 09:24 +0000
Re: How to solve this problem in FORTH? Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-10-27 02:54 -0700
Re: How to solve this problem in FORTH? mhx@iae.nl - 2015-10-26 11:31 -0700
Re: How to solve this problem in FORTH? "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-10-26 04:54 -0400
Re: How to solve this problem in FORTH? Paul Rubin <no.email@nospam.invalid> - 2015-10-26 02:09 -0700
Re: How to solve this problem in FORTH? Ron Aaron <rambamist@gmail.com> - 2015-10-26 11:16 +0200
Re: How to solve this problem in FORTH? Lars Brinkhoff <lars.spam@nocrew.org> - 2015-10-26 10:49 +0100
Re: How to solve this problem in FORTH? Hans Bezemer <the.beez.speaks@gmail.com> - 2015-10-28 11:22 +0100
Re: How to solve this problem in FORTH? Howerd <howerdo@yahoo.co.uk> - 2015-10-28 04:09 -0700
Re: How to solve this problem in FORTH? hughaguilar96@gmail.com - 2015-10-29 19:52 -0700
Re: How to solve this problem in FORTH? "WJ" <w_a_x_man@yahoo.com> - 2015-10-30 09:00 +0000
Re: How to solve this problem in FORTH? lehs <skydda.barnen@gmail.com> - 2015-10-26 02:44 -0700
csiph-web