HELP: when-empty
{ $values
- { "seq" sequence } { "quot1" "the first quotation of an " { $link if-empty } } }
+ { "seq" sequence } { "quot" "the first quotation of an " { $link if-empty } } }
{ $description "Makes an implicit check if the sequence is empty. An empty sequence is dropped and the " { $snippet "quot1" } " is called." }
{ $examples "This word is equivalent to " { $link if-empty } " with an empty second quotation:"
{ $example
HELP: unless-empty
{ $values
- { "seq" sequence } { "quot2" "the second quotation of an " { $link if-empty } } }
-{ $description "Makes an implicit check if the sequence is empty. An empty sequence is dropped. Otherwise, the " { $snippet "quot2" } " is called on the sequence.." }
+ { "seq" sequence } { "quot" "the second quotation of an " { $link if-empty } } }
+{ $description "Makes an implicit check if the sequence is empty. An empty sequence is dropped. Otherwise, the " { $snippet "quot2" } " is called on the sequence." }
{ $examples "This word is equivalent to " { $link if-empty } " with an empty first quotation:"
{ $example
"USING: sequences prettyprint ;"
: if-empty ( seq quot1 quot2 -- )
[ dup empty? ] [ [ drop ] prepose ] [ ] tri* if ; inline
-: when-empty ( seq quot1 -- ) [ ] if-empty ; inline
+: when-empty ( seq quot -- ) [ ] if-empty ; inline
-: unless-empty ( seq quot2 -- ) [ ] swap if-empty ; inline
+: unless-empty ( seq quot -- ) [ ] swap if-empty ; inline
: delete-all ( seq -- ) 0 swap set-length ;