3 ms·
I'm still not sold on writing complete program this way (I did try, with various level of success), but even partially-literate approach is ridiculously conveni
by TeMPOraL 8y ago
I'm still not sold on writing complete program this way (I did try, with various level of success), but even partially-literate approach is ridiculously convenient if you happen to live in Emacs.
I do my task management and note-taking in Org-mode, and recently I found myself doing things like jotting in the middle of my notes[0]:
#+BEGIN_SRC http
GET address.to.api:123/sth
#+END_SRC
and tapping CTRL+C twice, to get the actual response of the API I was debugging.
Or, the other day I was making notes about gravity batteries, and was wondering how efficient is one startup's solution. I briefly thought about firing up Jupyter, but then simply wrote the following[1]:
these guys power a LED (or three?) with a 0.1W, generated through dropping
a 12kg weight down 1.8 meters over 20 minutes.
Doing some basic math on that:
#+BEGIN_SRC elisp
(let* ((m 12)
(g 9.81)
(h 1.8)
(_t (* 20 60))
(E (* m g h)) ; E = m*g*h
(P (/ E _t)) ; P = E/t
(efficiency (/ 0.1 P)) ; efficiency = Pout/Pin
)
`("ideal power [W]" ,P
"efficiency [1]" ,efficiency))
#+END_SRC
Typing CTRL+C twice, out pops:
#+RESULTS:
| ideal power [W] | 0.17658000000000001 | efficiency [1] | 0.5663155510250312 |
(which is automatically rendered as an org-mode table I can operate on, or even reference in other code snippets).
Point being, note-taking in org mode makes it ridiculously easy to invoke any programming language you hooked up to Emacs without breaking your flow, and you get to edit the code in the mode specific to that programming language - so everything from autocomplete to linters work.
I know Emacs is niche, but I can't recommend it enough.
--
[0] - BEGIN/END_SRC block is under convenient autocomplete of "<s TAB".
[1] - this is a real note, so if I got the physics wrong, I just made a fool of myself publicly -.-