]> gitweb.factorcode.org Git - factor.git/commitdiff
ranges: add some docs for syntax words
authorJohn Benediktsson <mrjbq7@gmail.com>
Tue, 12 Sep 2023 02:59:52 +0000 (19:59 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 12 Sep 2023 02:59:52 +0000 (19:59 -0700)
core/ranges/ranges-docs.factor

index b10740e81471fd0232278d4b402fae59e933ab25..c526e5ead722b7a2dd3b0e13e75e9155a42142ae 100644 (file)
@@ -25,4 +25,28 @@ $nl
 { $code "100 1 [a..b] product" }
 "A range can be converted into a concrete sequence using a word such as " { $link >array } ". In most cases this is unnecessary since ranges implement the sequence protocol already. It is necessary if a mutable sequence is needed, for use with words such as " { $link set-nth } " or " { $link map! } "." ;
 
+HELP: ..=
+{ $syntax "start ..= end" }
+{ $description "Defines a literal " { $link range } " from " { $snippet "start" } " to " { $snippet "end" } " (inclusive) with a step of 1." }
+{ $examples
+    { $example
+        "USING: arrays prettyprint ranges ;"
+        "1 ..= 10 >array ."
+        "{ 1 2 3 4 5 6 7 8 9 10 }"
+    }
+}
+{ $see-also [a..b] } ;
+
+HELP: ..<
+{ $syntax "start ..< end" }
+{ $description "Defines a literal " { $link range } " from " { $snippet "start" } " to " { $snippet "end" } " (exclusive) with a step of 1." }
+{ $examples
+    { $example
+        "USING: arrays prettyprint ranges ;"
+        "1 ..< 10 >array ."
+        "{ 1 2 3 4 5 6 7 8 9 }"
+    }
+}
+{ $see-also [a..b) } ;
+
 ABOUT: "ranges"