I wonder why life/10.8 runs nonsensically on my PC even with Language.Haskell.HsColour.ANSI import?
These cls and goto reappear in 11.7 that spoil the pleasure of understanding.
Also putGrid/11.4 is unintuitive backsword engineering concoction that teaches nothing, while it can be very intuitively written:
putGrid g =
sequence_ [putStrLn j| j<-weave [' ','|',' ','|',' '] (interleave (replicate 6 '-') [(interleave '|' i)| i<-g])]
interleave :: a->[a]->[a]
interleave x [] = []
interleave x [y] = [y]
interleave x (y:ys)= y:x:interleave x ys
weave :: a->[a]->[a]
weave x [] = [x]
weave x [y] = x:[y,x]
weave x (y:ys)= x:y:weave x ys
Prelude> putGrid [[' ','O','O'],['O','X','O'],['X','X','X']]
| |
|O|O
| |
------
| |
O|X|O
| |
------
| |
X|X|X
| |