# Print the lyrics to 99 bottles of beer on the wall. ({ # Iterate, printing one verse. (\n -> { (n show_integer) put; " bottles of beer on the wall" put; put_newline; (n show_integer) put; " bottles of beer" put; put_newline; "Take one down and pass it around" put; put_newline; ((n 1 minus) show_integer) put; " bottles of beer on the wall" put; put_newline; put_newline; # Test for 2 and select the alternative to return. ((n 1 minus) () ((2 n equals) not) select_ (\@@s->s)) be (\@b->b) } : Integer -> IOV (|Integer|True|)) be (\@b->b) =: iterator; # The call to 'iterate_io' passes the initial value 1 and the iterator. 100 iterator iterate_io (\@@i->i); "1 bottle of beer on the wall" put; put_newline; "1 bottle of beer" put; put_newline; "Take one down and pass it around" put; put_newline; "No bottles of beer on the wall" put; put_newline } )