1 with Garbage_Collected
;
3 package Types
.Sequences
is
5 -- Hiding the implementation would either cause a significative
6 -- performance hit (the compiler performs better optimization with
7 -- explicit arrays) or a convoluted interface (demonstrated for
8 -- strings and maps, where the balance is different).
10 type Instance
(Length
: Natural) is new Garbage_Collected
.Instance
with
13 Data
: T_Array
(1 .. Length
);
16 -- Built-in functions.
17 function Concat
(Args
: in T_Array
) return T
;
18 function Conj
(Args
: in T_Array
) return T
;
19 function Cons
(Args
: in T_Array
) return T
;
20 function Count
(Args
: in T_Array
) return T
;
21 function First
(Args
: in T_Array
) return T
;
22 function Is_Empty
(Args
: in T_Array
) return T
;
23 function List
(Args
: in T_Array
) return T
;
24 function Map
(Args
: in T_Array
) return T
;
25 function Nth
(Args
: in T_Array
) return T
;
26 function Rest
(Args
: in T_Array
) return T
;
27 function Vector
(Args
: in T_Array
) return T
;
29 -- New instances must be created via this constructor.
30 function Constructor
(Length
: in Natural) return Sequence_Ptr
with Inline
;
32 -- Helper for Types."=".
33 function "=" (Left
, Right
: in Instance
) return Boolean;
37 overriding
procedure Keep_References
(Object
: in out Instance
) with Inline
;