From: Doug Coleman Date: Thu, 18 Dec 2014 01:41:25 +0000 (-0800) Subject: sequences: Add some examples of head and tail with short. X-Git-Tag: unmaintained~3054 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=2dc5590966a6212d1911eaba63d698e1c8b04e73 sequences: Add some examples of head and tail with short. --- diff --git a/core/sequences/sequences-docs.factor b/core/sequences/sequences-docs.factor index 3caf128de2..c28b7dcaaa 100644 --- a/core/sequences/sequences-docs.factor +++ b/core/sequences/sequences-docs.factor @@ -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." } ;