Talk About Network



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: & in A rati...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 7 Topic 4047 of 4053
Post > Topic >>

Re: & in A rationale for ARRAYs in the Forth Scientific Library

by Josh Grams <josh@[EMAIL PROTECTED] > May 10, 2008 at 11:14 AM

C. G. Montgomery <cgm@[EMAIL PROTECTED]
> wrote:
> Michael michael.kalus@[EMAIL PROTECTED]
 wrote:
>
>> Is & a forth word? How about &! ?
>
> The words & and &! are among those defined in the fsl-util files in the
> Auxiliary code provided with the Library:
> http://www.taygeta.com/fsl/scilib.html
>
> Unfortunately, these and a number of other FSL words are defined only by
a
> particular implementation rather than fully specified, so other
> implementations may provide the same functionality differently.  In
other
> words, full phrases such as the ones you quote, have standard effects,
> while the individual words may behave differently.

Bleh.  That's not very helpful.  How about putting it this way?

  name{ ( -- elements )
  & ( "array-name" -- array )

An `elements` reference is sufficient to access the elements of the
array, but words which modify the array's structure need a full array
reference.  You can only get an array reference for dynamically
allocated arrays, as the structure of a statically allocated array can't
be modified.

  &! ( elements array -- )  \ set ARRAY so that it refers to ELEMENTS
  }malloc ( array u -- )    \ allocate U elements for ARRAY
  }free ( array -- )        \ free the elements of ARRAY

Or does this abstraction break down in some cases?

--Josh




 7 Posts in Topic:
& in A rationale for ARRAYs in the Forth Scientific Library
Michael <michael.kalus  2008-05-09 11:57:42 
Re: & in A rationale for ARRAYs in the Forth Scientific Library
"C. G. Montgomery&qu  2008-05-09 19:51:18 
Re: & in A rationale for ARRAYs in the Forth Scientific Library
Josh Grams <josh@[EMAI  2008-05-10 11:14:54 
Re: & in A rationale for ARRAYs in the Forth Scientific Library
"C. G. Montgomery&qu  2008-05-10 13:11:25 
Re: & in A rationale for ARRAYs in the Forth Scientific Library
Josh Grams <josh@[EMAI  2008-05-11 12:07:22 
Re: & in A rationale for ARRAYs in the Forth Scientific Library
Michael <michael.kalus  2008-05-11 00:48:42 
Re: & in A rationale for ARRAYs in the Forth Scientific Library
Bruce McFarling <agila  2008-05-11 11:07:41 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Thu May 15 22:27:36 CDT 2008.