#+BEGIN_SRC elisp
(list (list 'col1 'col2) (list 1 2))
#+END_SRC
(I don't use quote syntax to not confuse non-lispers)
Hitting C-c C-c on it produces the following block just below it: #+RESULTS:
| col1 | col2 |
| 1 | 2 |
With Org source blocks you can have a literate program even using multiple languages and still communicating easily between source code blocks and both generated and static tables. It can easily be intermixed with formatted text and exported to a suite of various formats, including plain text source code (so-called "tangled source").Edit: just for the sake of it, another example, this one in Python:
#+BEGIN_SRC python
return [[x for x in range(1,5)],
[chr(y) for y in range(ord('a'),ord('e'))]]
#+END_SRC
#+RESULTS:
| 1 | 2 | 3 | 4 |
| a | b | c | d |Freaking IBM had box drawing characters in freaking 1985, how hard is it to have them in 2018? https://www.ascii-codes.com/
See this:
┌─┬┐
│ ││
├─┼┤
└─┴┘
vs the crappy table.Beauty is in the eye of the beholder, true, but the majority of the beholders want a table to actually look like a table. If you give me pen and paper, I'm not going to draw weird half lines around the table, I'm going to draw the table first, line fully drawn everywhere and then add the content.
| Hello | Planet | Earth |
|-------+--------+-------|
| foo | 4 | 88 |
| bar | 265 | 123 |
|-------+--------+-------|
| sum | 269 | 211 |
This org table looks clean enough to me.The disadvantage of using box drawing characters is that they do not always align nicely - depending on the font, renderer, and couple other things. You can't go wrong with basic ASCII and a fixed-width display.
How do you type ┌─ ?
It's easier to use a font that renders "regular" keyboard characters as borders, akin to https://github.com/tonsky/FiraCode