]> gitweb.factorcode.org Git - factor.git/commitdiff
sequences: use index-of-last more places
authorDoug Coleman <doug.coleman@gmail.com>
Mon, 1 Aug 2022 16:21:34 +0000 (11:21 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Mon, 1 Aug 2022 16:22:17 +0000 (11:22 -0500)
basis/urls/urls.factor
core/sequences/sequences.factor

index b9f23f4641dbad41de27623031aea272a80773c4..c78a44bd4eaeccaa02156db1aaa50bf5f25f9019 100644 (file)
@@ -120,7 +120,7 @@ M: pathname >url string>> >url ;
 
 : ipv6-host ( host -- host/ipv6 ipv6? )
     dup { [ "[" head? ] [ "]" tail? ] } 1&& [
-        1 swap [ length 1 - ] [ subseq ] bi t
+        1 swap index-of-last subseq t
     ] [ f ] if ;
 
 : unparse-host ( url -- host )
index b70ffec32bcc019dfa2dd21252649499e689905f..5a8ef341eeb49e12b30f2a76218591ceca9f455a 100644 (file)
@@ -825,7 +825,7 @@ PRIVATE>
 <PRIVATE
 
 : last-unsafe ( seq -- elt )
-    [ length 1 - ] [ nth-unsafe ] bi ; inline
+    index-of-last nth-unsafe ; inline
 
 PRIVATE>
 
@@ -833,7 +833,7 @@ PRIVATE>
     index-of-last
     over 0 < [ bounds-error ] [ set-nth-unsafe ] if ; inline
 
-: pop* ( seq -- ) [ length 1 - ] [ shorten ] bi ;
+: pop* ( seq -- ) index-of-last shorten ;
 
 <PRIVATE