Newsgroups: comp.lang.forth
From: jzakiya <jzak...@mail.com>
Date: Tue, 14 Oct 2008 21:49:38 -0700 (PDT)
Local: Wed 15 Oct 2008 05:49
Subject: Re: Shorter/better way to do this?
On Oct 14, 6:50 pm, William James <w_a_x_...@yahoo.com> wrote:
> On Oct 14, 12:44 pm, jzakiya <jzak...@mail.com> wrote: Maybe you haven't noticed but this is a Forth group and NOT Ruby. > > I have a string of integer values: > > p1<p2<p3<p4...<p8 and a reference value lndx > > I have a code snippet that I have to do this way > > begin p8 lndx < while > > So when p8 >= lndx I want to check the other pi < lndx once > > Conceptually, I want to do something like this: > > p7 < lndx IF goto 7 elsif p6 < lndx if goto 6 elsif ...p1 < lndx goto > > 7: 0 p7 sieve c! > > So, if pi < lndx I want to "goto" the ith label and do all the > > The way I've done it was the shortest/fastest way I was able to do > > Is there a shorter/faster way to do this? > Instead of p1 ... p8, use array p. > Something like this (untested). > Ruby: > p = Array.new(8){ 0 } > top = nil > top.downto(0){|i| > } FYI I use Ruby, and the Ruby versions of this code does not use nor Also FYI, you are not making Ruby friends by being a PITA about When in Forthland speak Forth, please. Jabari You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||