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