Daniel-Diaz / matrix

A Haskell native implementation of matrices and their operations.
BSD 3-Clause "New" or "Revised" License
35 stars 31 forks source link

Boxdrawing #36

Closed istathar closed 8 years ago

istathar commented 8 years ago

I had some fun and redid the prettyMatrix function to use the Unicode box drawing characters to put square brackets around matrices when Shown.

λ> let a = fromLists [[1,2,3],[4,5,6],[7,8,9]]
λ> print a

emits

┌       ┐
│ 1 2 3 │
│ 4 5 6 │
│ 7 8 9 │
└       ┘

which, in my terminal, renders with smooth lines.

As ever with Show instances there's (still) a ridiculous amount of String concatenation; I removed one call to show; if you like I could have a go cleaning it up further I can.

Anyway, just thought it would be fun to replace the ( ... ) with ASCII art closer to what we'd write in mathematical notation.

AfC

Daniel-Diaz commented 8 years ago

That's great. Thank you!

Daniel-Diaz commented 8 years ago

I wonder how this looks on a Windows terminal.