define-tuple-array ( CLASS -- )


Vocabulary
tuple-arrays

Inputs
CLASSan object


Outputs
None

Definition


:: define-tuple-array ( CLASS -- )
[ CLASS present write ] with-string-writer parse-word
:> CLASS
[ CLASS present write "-array" write ] with-string-writer
create-class-in :> CLASS-array
[ CLASS-array present write "?" write ] with-string-writer
parse-word :> CLASS-array?
[ "<" write CLASS present write "-array>" write ]
with-string-writer create-word-in :> <CLASS-array>
[ ">" write CLASS present write "-array" write ]
with-string-writer create-word-in :> >CLASS-array CLASS
check-final CLASS-array tuple {
{ "seq" array read-only }
{ "n" array-capacity read-only }
{ "length" array-capacity read-only }
} define-tuple-class* <CLASS-array> T{ fake-quotation
{ seq
{
T{ fake-quotation { seq ~array~ } }
keep
\ CLASS-array
boa
}
}
} fake-quotations> first ( length -- tuple-array )
define-declared* last-word make-inline
CLASS-array \ length create-method-in dup \ method set
T{ fake-quotation { seq { length>> } } } fake-quotations>
first define* last-word make-inline
CLASS-array \ nth-unsafe create-method-in dup \ method set
T{ fake-quotation
{ seq { tuple-slice \ CLASS read-tuple } }
} fake-quotations> first define* last-word make-inline
CLASS-array \ set-nth-unsafe create-method-in
dup \ method set T{ fake-quotation
{ seq { tuple-slice \ CLASS write-tuple } }
} fake-quotations> first define* last-word make-inline
CLASS-array \ new-sequence create-method-in dup \ method set
T{ fake-quotation { seq { drop <CLASS-array> } } }
fake-quotations> first define* last-word make-inline
>CLASS-array
T{ fake-quotation { seq { 0 <CLASS-array> clone-like } } }
fake-quotations> first ( seq -- tuple-array )
define-declared* CLASS-array \ like create-method-in
dup \ method set T{ fake-quotation
{ seq
{
drop
dup
CLASS-array?
T{ fake-quotation { seq ~array~ } }
unless
}
}
} fake-quotations> first define* last-word ~4 more~ ;