Hacker News new | ask | show | jobs
by xigoi 1241 days ago
If they want it to look like actual math notation, they might as well:

  A_ij = ⎰ 1 if (i,j) ∈ E
         ⎱ 0 otherwise
  where
  A ∈ ℝ^(n × n)
  E ∈ { ℤ × ℤ }
  n ∈ ℤ
1 comments

Unicode actually has semantic symbols that could be used for a nicer 2D monospaced layout here, such as ⎧ ⎪ ⎨ ⎩ ( (LEFT CURLY BRACKET UPPER HOOK, MIDDLE PIECE, LOWER HOOK, and CURLY BRACKET EXTENSION). With more conditional rows, you could use these. One downside is that you would have to do a 2D parse, since the = wouldn't be on the first line. We've been loath to go there. It also seems painful as a user to have to type all the right bracket symbols in all the right places.

We do support the Unicode ⎡|⎦ symbols for matrices. The grammar is that a matrix starts with either [ or ⎡ and ends with either ] or ⎦. Rows can be optionally surrounded by |. I find this too cumbersome to use myself.

I'm aware of those. The symbols I used are also semantic, for the special case of 2-row tall braces.
Ah, I didn't realize. I guess that would work for the case of 2-row tall statements.