 : seq-offset ( seq n -- new-seq )
     dupd <offset> swap like ;
 
-M: offset modified-nth ( n seq -- elt )
+M: offset modified-nth
     [ seq>> nth ] [ n>> + ] bi ;
 
-M:: offset modified-set-nth ( elt n seq -- )
-    elt seq n>> - n seq seq>> set-nth ;
+M: offset modified-set-nth
+    [ nip n>> - ] [ seq>> set-nth ] 2bi ;
 
 TUPLE: summed < modified seqs ;
 

: scale ( seq c -- new-seq )
    dupd <scaled> swap like ;

M: scaled modified-nth ( n seq -- elt )
    [ seq>> nth ] [ c>> * ] bi ;

M:: scaled modified-set-nth ( elt n seq -- )
    ! don't set c to 0!
    elt seq c>> / n seq seq>> set-nth ;

TUPLE: offset < 1modified n ;


M: modified set-nth modified-set-nth ;
M: modified set-nth-unsafe modified-set-nth ;

INSTANCE: modified virtual-sequence

TUPLE: 1modified < modified seq ;

M: 1modified length seq>> length ;
M: 1modified set-length seq>> set-length ;
M: 1modified virtual-exemplar seq>> ;

TUPLE: scaled < 1modified c ;

