49 lines
1.2 KiB
Text
49 lines
1.2 KiB
Text
F hello()
|
||
print(‘Hello, world!’)
|
||
|
||
String src
|
||
F quine()
|
||
print(:src)
|
||
|
||
F bottles()
|
||
L(i) (99.<2).step(-1)
|
||
print(‘#. bottles of beer on the wall’.format(i))
|
||
print(‘#. bottles of beer’.format(i))
|
||
print(‘Take one down, pass it around’)
|
||
print(‘#. bottles of beer on the wall’.format(i - 1))
|
||
print()
|
||
|
||
print(‘2 bottles of beer on the wall’)
|
||
print(‘2 bottles of beer’)
|
||
print(‘Take one down, pass it around’)
|
||
print(‘1 bottle of beer on the wall’)
|
||
print()
|
||
|
||
print(‘1 bottle of beer on the wall’)
|
||
print(‘1 bottle of beer’)
|
||
print(‘Take one down, pass it around’)
|
||
print(‘No more bottles of beer on the wall’)
|
||
print()
|
||
|
||
print(‘No more bottles of beer on the wall’)
|
||
print(‘No more bottles of beer on the wall’)
|
||
print(‘Go to the store and buy some more’)
|
||
print(‘99 bottles of beer on the wall.’)
|
||
print()
|
||
|
||
V acc = 0
|
||
F incr()
|
||
:acc++
|
||
|
||
:start:
|
||
src = File(:argv[1]).read()
|
||
|
||
[Char = (() -> Void)] dispatch
|
||
dispatch[Char(‘h’)] = hello
|
||
dispatch[Char(‘q’)] = quine
|
||
dispatch[Char(‘9’)] = bottles
|
||
dispatch[Char(‘+’)] = incr
|
||
|
||
L(i) src.lowercase()
|
||
I i C dispatch
|
||
dispatch[i]()
|