Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #28964
| From | Andrew Haley <andrew29@littlepinkcloud.invalid> |
|---|---|
| Subject | Re: top 10 words which should *not* be in a Forth dictionary? |
| Newsgroups | comp.lang.forth |
| References | (7 earlier) <2014Mar7.123439@mips.complang.tuwien.ac.at> <gL6dnZ7lMJ6aIoTOnZ2dnUVZ_t6dnZ2d@supernews.com> <2014Mar7.140704@mips.complang.tuwien.ac.at> <cdadnZ8xV6wCR4TOnZ2dnUVZ_hCdnZ2d@supernews.com> <153047df-e0d7-4828-8455-d6bd475bd262@googlegroups.com> |
| Message-ID | <N76dnRIryJBehIfOnZ2dnUVZ_s-dnZ2d@supernews.com> (permalink) |
| Date | 2014-03-07 13:10 -0600 |
Assad Ebrahim <assadebrahim2000@gmail.com> wrote:
> I should probably weigh in here.
Please. :-)
> As far as the code example itself, yes, it did take a little more
> effort to follow, so, certainly stack comments and text explanations
> would always help, but if I were to choose between someone not
> bothering to answer at all or answering perhaps with less documented
> code, I would still rather the former.
I confess, it was something of an exercise for the reader. :-)
Stack comments for that one are an interesting challenge. The idea
isn't at all complex, and the Forth doesn't look all that bad, but it
is subtle:
: inorder ( a)
0 swap
begin
begin
?dup while
\ Go as far as we can down the left subtrees, pushing trees
\ as we go
dup left @
repeat ( 0 a0 a1 a2 ... aN)
\ We now have a stack of trees. The tree on top is empty or
\ has no left node
?dup while \ If the tree on top is empty, the algorithm terminates
dup visit ( 0 a0 a1 a2 ... aN)
\ Fetch the right subtree and traverse it
right @
( 0 a0 a1 a2 ... aN-1 aN.right)
repeat ;
Andrew.
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
top 10 words which should *not* be in a Forth dictionary? "Rod Pemberton" <dont_use_email@xnohavenotit.cnm> - 2014-02-20 16:30 -0500
Re: top 10 words which should *not* be in a Forth dictionary? AKK <akk@nospam.org> - 2014-02-20 23:56 +0100
Re: top 10 words which should *not* be in a Forth dictionary? Coos Haak <chforth@hccnet.nl> - 2014-02-21 02:40 +0100
Re: top 10 words which should *not* be in a Forth dictionary? hughaguilar96@yahoo.com - 2014-02-20 21:17 -0800
Re: top 10 words which should *not* be in a Forth dictionary? Syd Rumpo <usenet@nononono.co.uk> - 2014-02-21 13:58 +0000
Re: top 10 words which should *not* be in a Forth dictionary? Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2014-02-21 11:04 +0000
Re: top 10 words which should *not* be in a Forth dictionary? Hans Bezemer <the.beez.speaks@gmail.com> - 2014-02-22 17:10 +0100
Re: top 10 words which should *not* be in a Forth dictionary? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-02-22 13:15 -0600
Re: top 10 words which should *not* be in a Forth dictionary? "Alex McDonald" <blog@rivadpm.com> - 2014-02-22 21:46 +0000
Re: top 10 words which should *not* be in a Forth dictionary? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-02-23 15:42 +0000
Re: top 10 words which should *not* be in a Forth dictionary? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-02-23 15:46 +0000
Re: top 10 words which should *not* be in a Forth dictionary? Assad Ebrahim <assadebrahim2000@gmail.com> - 2014-03-03 12:08 -0800
Re: top 10 words which should *not* be in a Forth dictionary? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-03-03 20:23 +0000
Re: top 10 words which should *not* be in a Forth dictionary? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-03-03 15:58 -0600
Re: top 10 words which should *not* be in a Forth dictionary? Coos Haak <chforth@hccnet.nl> - 2014-03-04 01:06 +0100
Re: top 10 words which should *not* be in a Forth dictionary? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-03-06 18:01 +0000
Re: top 10 words which should *not* be in a Forth dictionary? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-03-06 17:59 -0600
Re: top 10 words which should *not* be in a Forth dictionary? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-03-07 11:34 +0000
Re: top 10 words which should *not* be in a Forth dictionary? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-03-07 06:43 -0600
Re: top 10 words which should *not* be in a Forth dictionary? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-03-07 13:07 +0000
Re: top 10 words which should *not* be in a Forth dictionary? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-03-07 08:41 -0600
Re: top 10 words which should *not* be in a Forth dictionary? Assad Ebrahim <assadebrahim2000@gmail.com> - 2014-03-07 10:17 -0800
Re: top 10 words which should *not* be in a Forth dictionary? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-03-07 13:10 -0600
Re: top 10 words which should *not* be in a Forth dictionary? Assad Ebrahim <assadebrahim2000@gmail.com> - 2014-03-07 11:32 -0800
Re: top 10 words which should *not* be in a Forth dictionary? Lars Brinkhoff <lars.spam@nocrew.org> - 2014-03-07 14:28 +0100
Re: top 10 words which should *not* be in a Forth dictionary? Assad Ebrahim <assadebrahim2000@gmail.com> - 2014-03-07 22:59 -0800
Re: top 10 words which should *not* be in a Forth dictionary? Coos Haak <chforth@hccnet.nl> - 2014-03-08 08:33 +0100
Re: top 10 words which should *not* be in a Forth dictionary? "Elizabeth D. Rather" <erather@forth.com> - 2014-03-07 23:21 -1000
Re: top 10 words which should *not* be in a Forth dictionary? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-03-08 04:30 -0600
top 10 words which should *not* be in a Forth dictionary? Mark Wills <markwills1970@gmail.com> - 2014-03-08 03:27 -0800
Re: top 10 words which should *not* be in a Forth dictionary? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-03-08 05:36 -0600
Re: top 10 words which should *not* be in a Forth dictionary? Mark Wills <markwills1970@gmail.com> - 2014-03-08 15:39 -0800
Re: top 10 words which should *not* be in a Forth dictionary? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-03-08 14:02 +0000
Re: top 10 words which should *not* be in a Forth dictionary? "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-03-08 17:20 -0500
Re: top 10 words which should *not* be in a Forth dictionary? "Elizabeth D. Rather" <erather@forth.com> - 2014-03-08 12:36 -1000
Re: top 10 words which should *not* be in a Forth dictionary? "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-03-08 18:40 -0500
csiph-web