Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #37715
| From | "Alex McDonald" <blog@rivadpm.com> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: How to solve this problem in FORTH? |
| Date | 2015-03-28 20:53 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <mf74am$dvo$1@dont-email.me> (permalink) |
| References | <f195a1a1-8609-4319-9df9-d8cbb2a11fdb@googlegroups.com> <4f133fbc-fe93-4aa1-a14b-5aeff8af2299@googlegroups.com> |
on 28/03/2015 15:09:30, wrote: > I wasn't sure what the fuss was. Then I spent an hour on this? > Hypocrit. Here's a naieve, simple stab, from a beginner: Good that you're trying. > > CREATE V1 1 , 2 , 3 , > CREATE V2 4 , 5 , 6 , > CREATE V3 0 , 0 , 0 , > >: VSUM ( addr1 addr2 i -- x ) CELLS TUCK + ROT ROT + @ SWAP @ + CR ; >: VSTORE ( x adest i -- ) CELLS + ! ; >: VADD ( asrc1 asrc2 adest -- ) > 3 0 DO > ROT ROT 2DUP I VSUM > 2SWAP ROT ROT TUCK I VSTORE ( asrc1 and asrc2 switch places ) > LOOP > 2DROP DROP ; But help! what does all this stack juggling do? Comments might help... >: VADD-HERE ( asrc1 asrc2 adest -- ) > \ HERE happens so simply, hubris howls in fury. A comment. O dear. One of the most frustrating jobs I ever had was as a maintenance programmer. You got to rewrite someone else's code, often badly written and buggy code. I didn't enjoy it, although it taught me a lot. One particular set of applications I still remember with irritation, even now. In tens of thousands of lines of code, there was not a single sensible comment. Not one. Sections were preceded by chunks of the Rubaiyat of Omar Khayyam. Individual lines were decorated with comments much like the one you quote above. I would encourage you, as an artisan programmer, to consider this. It's from a parody of the Rubaiyat that I've lightly modified: : VSUM-STUFF ( addr1 addr2 i -- x ) \ Therefore, O Comment, because to all Code's plans \ And projects some promotion thou impartest, \ Thou still hast many zealous artisans, \ Tho' not one artist. ... Like the code you wrote, that's probably quite challenging to understand and it may require reading a few times. Unlike "HERE happens so simply, hubris howls in fury", which is still a complete mystery to me.
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to solve this problem in FORTH? Marek Brunda <marekb@phoenics.org> - 2015-01-13 04:24 -0800
How to solve this problem in FORTH? Julian Fondren <julian.fondren@gmail.com> - 2015-01-13 05:02 -0800
How to solve this problem in FORTH? Julian Fondren <julian.fondren@gmail.com> - 2015-01-13 05:09 -0800
Re: How to solve this problem in FORTH? november.nihal@gmail.com - 2015-01-13 05:29 -0800
Re: How to solve this problem in FORTH? "WJ" <w_a_x_man@yahoo.com> - 2015-01-14 14:00 +0000
Re: How to solve this problem in FORTH? november.nihal@gmail.com - 2015-01-14 06:59 -0800
Re: How to solve this problem in FORTH? awegel@arcor.de (Alexander Wegel) - 2015-01-14 23:39 +0100
Re: How to solve this problem in FORTH? Coos Haak <chforth@hccnet.nl> - 2015-01-13 15:12 +0100
Re: How to solve this problem in FORTH? humptydumpty <ouatubi@gmail.com> - 2015-01-13 10:30 -0800
Re: How to solve this problem in FORTH? mhx@iae.nl - 2015-01-13 12:14 -0800
Re: How to solve this problem in FORTH? "WJ" <w_a_x_man@yahoo.com> - 2015-01-14 09:06 +0000
Re: How to solve this problem in FORTH? mhx@iae.nl - 2015-01-14 04:13 -0800
Re: How to solve this problem in FORTH? Julian Fondren <julian.fondren@gmail.com> - 2015-01-14 04:55 -0800
Re: How to solve this problem in FORTH? "WJ" <w_a_x_man@yahoo.com> - 2015-03-27 06:47 +0000
Re: How to solve this problem in FORTH? jrcd83@gmail.com - 2015-03-28 08:09 -0700
Re: How to solve this problem in FORTH? "Alex McDonald" <blog@rivadpm.com> - 2015-03-28 20:53 +0000
Re: How to solve this problem in FORTH? rickman <gnuarm@gmail.com> - 2015-03-28 20:32 -0400
Re: How to solve this problem in FORTH? hughaguilar96@gmail.com - 2015-03-28 21:16 -0700
Re: How to solve this problem in FORTH? hughaguilar96@gmail.com - 2015-03-29 12:16 -0700
csiph-web