db4
Slava Pestov 2008-09-07 02:10:13 -05:00
parent 8c486d4c77
commit 3e1e0cf232
2 changed files with 5 additions and 5 deletions

View File

@ -337,7 +337,7 @@ HELP: if-empty
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
@ -354,8 +354,8 @@ HELP: when-empty
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 ;"

View File

@ -32,9 +32,9 @@ M: sequence shorten 2dup length < [ set-length ] [ 2drop ] if ;
: 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 ;