1 ! Copyright (C) 2008, 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors alien.c-types assocs compiler.units functors
4 growable kernel lexer namespaces parser prettyprint.custom
5 sequences specialized-arrays specialized-arrays.private strings
7 QUALIFIED: vectors.functor
8 IN: specialized-vectors
12 FUNCTOR: define-vector ( T -- )
14 V DEFINES-CLASS ${T}-vector
25 V A <A> vectors.functor:define-vector
29 M: V byte-length underlying>> byte-length ;
31 M: V pprint-delims drop \ V{ \ } ;
33 M: V >pprint-sequence ;
35 M: V pprint* pprint-object ;
37 SYNTAX: V{ \ } [ >V ] parse-literal ;
44 : specialized-vector-vocab ( type -- vocab )
45 "specialized-vectors.instances." prepend ;
49 : define-vector-vocab ( type -- vocab )
51 [ specialized-vector-vocab ] [ '[ _ define-vector ] ] bi
54 SYNTAX: SPECIALIZED-VECTOR:
56 [ define-array-vocab use-vocab ]
57 [ define-vector-vocab use-vocab ] bi ;