 
 : all-eq? ( seq -- ? ) [ eq? ] monotonic? ;
 
-: flip ( matrix -- newmatrix )
-    dup empty? [
-        dup first length [ <column> dup like ] curry* map
-    ] unless ;
-
 : exchange ( m n seq -- )
     pick over bounds-check 2drop 2dup bounds-check 2drop
     exchange-unsafe ;

: infimum ( seq -- n ) dup first [ min ] reduce ;
: supremum ( seq -- n ) dup first [ max ] reduce ;

: sequence-hashcode ( n seq -- x )
    0 -rot [
        hashcode* >fixnum swap 31 fixnum*fast fixnum+fast

C: <column> column

M: column virtual-seq column-seq ;
M: column virtual@
    dup column-col -rot column-seq nth bounds-check ;
M: column length column-seq length ;

INSTANCE: column virtual-sequence
