On Monday, 18 May 2015 at 10:14:33 UTC, Kagamin wrote:
On Monday, 18 May 2015 at 08:21:38 UTC, Dennis Ritchie wrote:
Hi,

In Common Lisp, there is such a thing as a fill-pointer (Example 5):
http://www.tutorialspoint.com/lisp/lisp_arrays.htm

Does D some equivalent?

Data stored in the array is indicated by the array length property, use capacity to figure out extra available space: http://dlang.org/phobos/object.html#.capacity

No, afraid not. Function capacity is not an analogue of fill-pointers!

Lisp-programmer explains the usefulness of fill-pointers as follows:

"Fill pointer "cuts" the tail of the vector. For example, vector elements 100, but if you set the fill pointer equal to 3, the length of the array (returned by length) will be equal to 3. The remaining elements are not visible.

It seems to be nonsense. But this is nonsense, ideal for buffers. If the buffer is implemented as an array, then fill pointer just marks the boundary of the filled part of the buffer, and adding a buffer (moving away from the fill pointer-a) is carried out using the vector-push. Or a buffer can be filled with the format-a. If you work with the same buffer C, fill pointer simulates a pointer to the last completed item."
  • The analogue of "fill-po... Dennis Ritchie via Digitalmars-d-learn
    • Re: The analogue of &quo... Kagamin via Digitalmars-d-learn
      • Re: The analogue of ... Dennis Ritchie via Digitalmars-d-learn
        • Re: The analogue... thedeemon via Digitalmars-d-learn
          • Re: The anal... John Colvin via Digitalmars-d-learn
            • Re: The... Ali Çehreli via Digitalmars-d-learn
              • Re:... Steven Schveighoffer via Digitalmars-d-learn
                • ... Ali Çehreli via Digitalmars-d-learn
                • ... Steven Schveighoffer via Digitalmars-d-learn
              • Re:... John Colvin via Digitalmars-d-learn
                • ... Ali Çehreli via Digitalmars-d-learn
                • ... Steven Schveighoffer via Digitalmars-d-learn
                • ... Ali Çehreli via Digitalmars-d-learn

Reply via email to