]> gitweb.factorcode.org Git - factor.git/blob - basis/columns/columns.factor
core: map-integers -> map-integers-as
[factor.git] / basis / columns / columns.factor
1 ! Copyright (C) 2005, 2010 Slava Pestov, Daniel Ehrenberg.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: sequences kernel accessors ;
4 IN: columns
5
6 ! A column of a matrix
7 TUPLE: column seq col ;
8
9 C: <column> column
10
11 M: column virtual-exemplar seq>> ;
12 M: column virtual@ [ col>> swap ] [ seq>> ] bi nth bounds-check ;
13 M: column length seq>> length ;
14
15 INSTANCE: column virtual-sequence
16
17 : <flipped> ( seq -- seq' )
18     dup empty? [ dup first length [ <column> ] with map-integers ] unless ;