[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

records with additional indexed fields

This page is part of the web mail archives of SRFI 76 from before July 7th, 2015. The new archives for SRFI 76 contain all messages, not just those from before July 7th, 2015.




Often I require data structures which are a combination of a vector
with some other components, e.g. a limited-size FIFO buffer is a
vector with an index pointing to the head of the queue and a size
which is the number of elements in the queue. You will find lots of
other cases. In fact, vector types have context information more
often than not.

Some time back, I defined an interface (unpublished) adding this functionality
to SRFI-9 records. The idea is that you have a record with n named fields,
n >= 0 known at type-definition time, and additionally m fields indexed by
{0..m-1}, m >= 0 known at object-allocation time. For defining the type only
one optional flag ('add vector functionality') is required; in the explicit-naming
layer it must be possible to name the length/ref/set! methods.

The extension provides a way of defining a new type of vector,
distinct from any other type. Currently, the only way to do this is using
'the' vector type and wrapping it up in a record---which in practice
means it is more convenient and efficient not to wrap it up and just
use 'the' vector with other information represented somewhere in
the context.

Sebastian.

----
Dr. Sebastian Egner
Senior Scientist
Philips Research Laboratories
Prof. Holstlaan 4 (WDC 1-051, 1st floor, room 51)
5656 AA Eindhoven
The Netherlands
tel:       +31 40 27-43166
fax:      +31 40 27-44004
email: sebastian.egner@xxxxxxxxxxx