]> gitweb.factorcode.org Git - factor.git/commitdiff
sequences: move ??nth
authorDoug Coleman <doug.coleman@gmail.com>
Sat, 25 Feb 2023 05:20:14 +0000 (23:20 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 26 Feb 2023 23:11:04 +0000 (17:11 -0600)
core/sequences/sequences-docs.factor
core/sequences/sequences.factor

index 1ae56566fd588861b3ea4e342b01dac4de108d92..f75224c53f7597376cc90181b42f5cc71087bbbd 100644 (file)
@@ -180,11 +180,7 @@ HELP: ?nth
 { $values { "n" integer } { "seq" sequence } { "elt/f" { $maybe object } } }
 { $description "A forgiving version of " { $link nth } ". If the index is out of bounds, or if the sequence is " { $link f } ", simply outputs " { $link f } "." } ;
 
-HELP: ??nth
-{ $values { "n" integer } { "seq" sequence } { "elt/f" { $maybe object } } { "?" boolean } }
-{ $description "A forgiving version of " { $link nth } ". If the index is out of bounds, or if the sequence is " { $link f } ", simply outputs " { $link f } ". Also outputs a boolean to distinguish between the sequence containing an " { $link f } " or an out of bounds index." } ;
-
-{ nth ?nth ??nth } related-words
+{ nth ?nth } related-words
 
 HELP: ?set-nth
 { $values { "elt" object } { "n" integer } { "seq" sequence } }
index 1716e5ce972c783d33c598c4947fa0f0e6ad5c12..7759cf3bac706e0497a7f4b9812ed3782f6a9074 100644 (file)
@@ -180,10 +180,8 @@ PRIVATE>
 : first4 ( seq -- first second third fourth )
     3 swap bounds-check nip first4-unsafe ; inline
 
-: ??nth ( n seq -- elt/f ? )
-    2dup bounds-check? [ nth-unsafe t ] [ 2drop f f ] if ; inline
-
-: ?nth ( n seq -- elt/f ) ??nth drop ; inline
+ : ?nth ( n seq -- elt/f )
+    2dup bounds-check? [ nth-unsafe ] [ 2drop f ] if ; inline
 
 : ?set-nth ( elt n seq -- )
     2dup bounds-check? [ set-nth-unsafe ] [ 3drop ] if ; inline