Comments
Loading Dream Comments...
You must be logged in to write a comment - Log In
The expression ( count $> 1 : "s" ) represents a "conditional array", an array which has 1 element if count is greater than 1, or has no elements if count is less or equal to 1. As in
{ ttyout ( "There ", ("is", "are") [1+ ( count $> 1 ) ], count, " cat", count $> 1 :"s" ) };
This prints "There are 3 cats" when count is 3, but "There is 1 cat" when count is 1. When used inside a procedure, it implements the IF ... THEN construct more elegantly than the alternative { (falsebranch, truebranch) [1+condition] }, which is also shown in the example above, to select "is" or "are". More information on the homebrew retro OS ::SHE+ILA:: is at the hashtag #sheila based on a mashup of C++, APL, and LISP :)