factor/library/collections/sequences.factor

25 lines
865 B
Factor
Raw Normal View History

2005-04-02 02:39:33 -05:00
! Copyright (C) 2005 Slava Pestov.
! See http://factor.sf.net/license.txt for BSD license.
IN: sequences
2005-04-17 21:59:11 -04:00
USING: generic kernel math strings vectors ;
2005-04-02 02:39:33 -05:00
! This file is needed very early in bootstrap.
! Sequences support the following protocol. Concrete examples
! are strings, string buffers, vectors, and arrays. Arrays are
! low level and not bounds-checked; they are in the
! kernel-internals vocabulary, so don't use them unless you have
! a good reason.
GENERIC: empty? ( sequence -- ? )
2005-04-02 02:39:33 -05:00
GENERIC: length ( sequence -- n )
GENERIC: set-length ( n sequence -- )
2005-04-17 21:59:11 -04:00
GENERIC: ensure-capacity ( n sequence -- )
2005-04-02 02:39:33 -05:00
GENERIC: nth ( n sequence -- obj )
GENERIC: set-nth ( value n sequence -- obj )
GENERIC: thaw ( seq -- mutable-seq )
2005-04-17 21:59:11 -04:00
GENERIC: freeze ( new orig -- new )
GENERIC: reverse ( seq -- seq )
DEFER: append ! remove this when sort is moved from lists to sequences