Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Forth > Re: Creating an...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 9 of 65 Topic 3945 of 4236
Post > Topic >>

Re: Creating and using arrays - again

by Jonah Thomas <jethomas5@[EMAIL PROTECTED] > Mar 21, 2008 at 12:14 PM

Duke Normandin <dukeofperl@[EMAIL PROTECTED]
> wrote:

> I've come up with something that works for me. Would you folks
> critique it please, and let me know any potential pitfalls.

> : } cells + ; ( addr n -- n-addr ) ok
>   ok
> create ages{ 10 cells allot  ok
>   ok
> 15 ages{ 0 } !  ok
> 60 ages{ 1 } !  ok
> 25 ages{ 2 } !  ok
>   ok
> ages{ 1 } ? 20  ok
> cr ." I am " ages{ 1 } ? ." years old!" cr
> 
> I'm going to make it a practice to name my arrays with a trailing { in
> order to use the word } and have the whole thing look like something
> I'm used to and seems intuitive _to me_ .
> 
> What do you think, folks?

It works for you. That's all that counts.

You might at some point want to have some sort of overflow warning. If
you do

13 ages{ 100 } ! 

there's no telling what you'll clobber, maybe something im****tant. Right
now you don't do that because you just know not to. As long as that
works for you, no problem.

As a sheerly esthetic thing, you might want to call it age{ or years{ .
It might look a little better that way. Sometimes when I name an array I
find a good name for the whole array, but when I use it I'm always using
one particular item from it and it looks better naming it for the item
than the whole.
 




 65 Posts in Topic:
Creating and using arrays - again
Duke Normandin <dukeof  2008-03-21 15:54:28 
Re: Creating and using arrays - again
Elizabeth D Rather <er  2008-03-21 11:49:44 
Re: Creating and using arrays - again
Duke Normandin <dukeof  2008-03-21 18:51:11 
Re: Creating and using arrays - again
Elizabeth D Rather <er  2008-03-21 15:16:05 
Re: Creating and using arrays - again
Duke Normandin <dukeof  2008-03-21 20:37:06 
Re: Creating and using arrays - again
JK <jk.usenet@[EMAIL P  2008-03-21 14:59:30 
Re: Creating and using arrays - again
Albert van der Horst <  2008-03-22 12:19:21 
Re: Creating and using arrays - again
Duke Normandin <dukeof  2008-03-22 21:53:06 
Re: Creating and using arrays - again
Jonah Thomas <jethomas  2008-03-21 12:14:43 
Re: Creating and using arrays - again
Duke Normandin <dukeof  2008-03-21 18:57:07 
Re: Creating and using arrays - again
Jerry Avins <jya@[EMAI  2008-03-22 12:55:51 
Re: Creating and using arrays - again
Duke Normandin <dukeof  2008-03-22 17:35:49 
Re: Creating and using arrays - again
Jerry Avins <jya@[EMAI  2008-03-22 13:58:37 
Re: Creating and using arrays - again
Jerry Avins <jya@[EMAI  2008-03-22 14:02:28 
Re: Creating and using arrays - again
kenney@[EMAIL PROTECTED]   2008-03-23 14:37:59 
Re: Creating and using arrays - again
Bruce McFarling <agila  2008-03-21 10:20:33 
Re: Creating and using arrays - again
Duke Normandin <dukeof  2008-03-21 18:36:16 
Re: Creating and using arrays - again
Jonah Thomas <jethomas  2008-03-21 15:28:15 
Re: Creating and using arrays - again
Krishna Myneni <krishn  2008-03-21 20:20:55 
Re: Creating and using arrays - again
Duke Normandin <dukeof  2008-03-22 03:06:35 
Re: Creating and using arrays - again
Duke Normandin <dukeof  2008-03-22 17:32:04 
Re: Creating and using arrays - again
"Mark W. Humphries&q  2008-03-21 21:05:28 
Re: Creating and using arrays - again
Andrew Haley <andrew29  2008-03-22 14:33:04 
Re: Creating and using arrays - again
Bruce McFarling <agila  2008-03-22 06:01:33 
Re: Creating and using arrays - again
Jonah Thomas <jethomas  2008-03-22 10:29:43 
Re: Creating and using arrays - again
Andrew Haley <andrew29  2008-03-22 14:36:34 
Re: Creating and using arrays - again
Jerry Avins <jya@[EMAI  2008-03-22 12:48:49 
Re: Creating and using arrays - again
<Montesquiou>   2008-03-22 19:23:19 
Re: Creating and using arrays - again
Andrew Haley <andrew29  2008-03-22 22:19:36 
Re: Creating and using arrays - again
Jerry Avins <jya@[EMAI  2008-03-22 22:45:21 
Re: Creating and using arrays - again
Andrew Haley <andrew29  2008-03-23 12:13:19 
Re: Creating and using arrays - again
Coos Haak <chforth@[EM  2008-03-23 13:37:55 
Re: Creating and using arrays - again
Andrew Haley <andrew29  2008-03-23 13:06:36 
Re: Creating and using arrays - again
Elizabeth D Rather <er  2008-03-23 09:10:08 
Re: Creating and using arrays - again
Jerry Avins <jya@[EMAI  2008-03-23 10:50:39 
Re: Creating and using arrays - again
Andrew Haley <andrew29  2008-03-23 15:50:35 
Re: Creating and using arrays - again
Jerry Avins <jya@[EMAI  2008-03-23 10:49:26 
Re: Creating and using arrays - again
Jerry Avins <jya@[EMAI  2008-03-23 10:47:31 
Re: Creating and using arrays - again
Elizabeth D Rather <er  2008-03-23 11:33:59 
Re: Creating and using arrays - again
Jerry Avins <jya@[EMAI  2008-03-25 17:39:47 
Re: Creating and using arrays - again
Dennis Ruffer <druffer  2008-03-26 00:57:35 
Re: Creating and using arrays - again
Elizabeth D Rather <er  2008-03-25 20:43:54 
Re: Creating and using arrays - again
Jerry Avins <jya@[EMAI  2008-03-26 11:00:22 
Re: Creating and using arrays - again
Bruce McFarling <agila  2008-03-22 08:44:53 
Re: Creating and using arrays - again
"Mark W. Humphries&q  2008-03-22 11:16:58 
Re: Creating and using arrays - again
Bruce McFarling <agila  2008-03-22 12:05:35 
Re: Creating and using arrays - again
Jonah Thomas <jethomas  2008-03-22 17:02:25 
Re: Creating and using arrays - again
Josh Grams <josh@[EMAI  2008-03-23 13:18:16 
Re: Creating and using arrays - again
Elizabeth D Rather <er  2008-03-23 08:53:42 
Re: Creating and using arrays - again
Bruce McFarling <agila  2008-03-22 16:03:57 
Re: Creating and using arrays - again
Jerry Avins <jya@[EMAI  2008-03-22 22:46:54 
Re: Creating and using arrays - again
Bruce McFarling <agila  2008-03-23 06:23:42 
Re: Creating and using arrays - again
Bruce McFarling <agila  2008-03-23 06:46:58 
Re: Creating and using arrays - again
Albert van der Horst <  2008-03-24 02:48:31 
Re: Creating and using arrays - again
"Mark W. Humphries&q  2008-03-23 08:40:13 
Re: Creating and using arrays - again
Jonah Thomas <jethomas  2008-03-23 12:32:11 
Re: Creating and using arrays - again
Bruce McFarling <agila  2008-03-23 12:02:17 
Re: Creating and using arrays - again
Bruce McFarling <agila  2008-03-23 14:17:56 
Re: Creating and using arrays - again
Elizabeth D Rather <er  2008-03-23 17:48:14 
Re: Creating and using arrays - again
Jonah Thomas <jethomas  2008-03-23 18:55:28 
Re: Creating and using arrays - again
Elizabeth D Rather <er  2008-03-23 19:02:53 
Re: Creating and using arrays - again
"Mark W. Humphries&q  2008-03-23 17:26:40 
Re: Creating and using arrays - again
Bruce McFarling <agila  2008-03-23 21:13:31 
Re: Creating and using arrays - again
Albert van der Horst <  2008-03-24 15:51:05 
Re: Creating and using arrays - again
Bruce McFarling <agila  2008-03-24 09:27:46 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Sep 7 2:55:00 CDT 2008.