]> gitweb.factorcode.org Git - factor.git/commitdiff
sequences: Add some examples of head and tail with short.
authorDoug Coleman <doug.coleman@gmail.com>
Thu, 18 Dec 2014 01:41:25 +0000 (17:41 -0800)
committerDoug Coleman <doug.coleman@gmail.com>
Thu, 18 Dec 2014 01:43:18 +0000 (17:43 -0800)
core/sequences/sequences-docs.factor

index 3caf128de2d276dd53ef6b64f966ff93c89c5d2d..c28b7dcaaaedeb97fd0a41dda8b8b2f6b4d79dd0 100644 (file)
@@ -966,6 +966,11 @@ HELP: head
         "{ 1 2 3 4 5 6 7 } 2 head ."
         "{ 1 2 }"
     }
+    "When a sequence may not have enough elements:"
+    { $example "USING: sequences prettyprint ;"
+        "{ 1 2 } 5 short head ."
+        "{ 1 2 }"
+    }
 }
 { $errors "Throws an error if the index is out of bounds." } ;
 
@@ -977,6 +982,11 @@ HELP: tail
         "{ 1 2 3 4 5 6 7 } 2 tail ."
         "{ 3 4 5 6 7 }"
     }
+    "When a sequence may not have enough elements:"
+    { $example "USING: sequences prettyprint ;"
+        "{ 1 2 } 5 short tail ."
+        "{ }"
+    }
 }
 { $errors "Throws an error if the index is out of bounds." } ;
 
@@ -998,6 +1008,11 @@ HELP: head*
         "{ 1 2 3 4 5 6 7 } 2 head* ."
         "{ 1 2 3 4 5 }"
     }
+    "When a sequence may not have enough elements:"
+    { $example "USING: sequences prettyprint ;"
+        "{ 1 2 } 5 short head* ."
+        "{ }"
+    }
 }
 { $errors "Throws an error if the index is out of bounds." } ;
 
@@ -1009,6 +1024,11 @@ HELP: tail*
         "{ 1 2 3 4 5 6 7 } 2 tail* ."
         "{ 6 7 }"
     }
+    "When a sequence may not have enough elements:"
+    { $example "USING: sequences prettyprint ;"
+        "{ 1 2 } 5 short tail* ."
+        "{ 1 2 }"
+    }
 }
 { $errors "Throws an error if the index is out of bounds." } ;