]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/persistent/vectors/vectors.factor
sequences: add index-of-last
[factor.git] / basis / persistent / vectors / vectors.factor
index 8910e99d3c1519b3f132c4a1cf512948797b40cb..b0aba0590ba07a506a9f10f9a2cedfa93c4dd676 100644 (file)
@@ -63,7 +63,7 @@ M: persistent-vector nth-unsafe
     dup full? [ [ level>> 1node ] keep swap ] [ node-add f ] if ;
 
 : new-last ( val seq -- seq' )
-    [ length 1 - ] keep new-nth ;
+    index-of-last new-nth ;
 
 : node-set-last ( child node -- node' )
     clone [ new-last ] change-children ;