<sequence-info> 1array ;
: fold-<tuple-boa> ( values class -- info )
- [ [ literal>> ] map ] dip prefix >tuple
+ [ [ literal>> ] map ] dip slots>tuple
<literal-info> ;
: read-only-slots ( values class -- slots )
{ "state" } define-tuple-class
"((empty))" "hashtables.private" create
-"tombstone" "hashtables.private" lookup-word f
-2array >tuple 1quotation ( -- value ) define-inline
+{ f } "tombstone" "hashtables.private" lookup-word
+slots>tuple 1quotation ( -- value ) define-inline
"((tombstone))" "hashtables.private" create
-"tombstone" "hashtables.private" lookup-word t
-2array >tuple 1quotation ( -- value ) define-inline
+{ t } "tombstone" "hashtables.private" lookup-word
+slots>tuple 1quotation ( -- value ) define-inline
! Some tuple classes
"curry" "kernel" create
GENERIC# boa>object 1 ( class slots -- tuple )
M: tuple-class boa>object
- swap prefix >tuple ;
+ swap slots>tuple ;
: check-slot-exists ( class initials slot-spec/f index/f name -- class initials slot-spec index )
over [ drop ] [ nip nip nip bad-slot-name ] if ;
: check-tuple ( object -- tuple )
dup tuple? [ not-a-tuple ] unless ; inline
-: prepare-tuple>array ( tuple -- n tuple layout )
- check-tuple [ tuple-size iota ] [ ] [ layout-of ] tri ;
+: prepare-tuple-slots ( tuple -- n tuple )
+ check-tuple [ tuple-size iota ] keep ;
: copy-tuple-slots ( n tuple -- array )
[ array-nth ] curry map ;
PRIVATE>
-: tuple>array ( tuple -- array )
- prepare-tuple>array
- [ copy-tuple-slots ] dip
- first prefix ;
-
: tuple-slots ( tuple -- seq )
- prepare-tuple>array drop copy-tuple-slots ;
+ prepare-tuple-slots copy-tuple-slots ;
GENERIC: slots>tuple ( seq class -- tuple )
bi 2each
] keep ;
+: tuple>array ( tuple -- array )
+ [ tuple-slots ] [ layout-of first prefix ] bi ;
+
: >tuple ( seq -- tuple )
unclip slots>tuple ;