# Lisp macros 3

Power

Macros are one of the things that make Lisp so extensible, because they let you transform arbitrary code into other arbitrary code. This is true for macros in languages like C too, but Common Lisp macros are different because they’re part of the language.

In C you have a layer of macros on top, written in a preprocessor macro language. The macro layer and the language layer are separate from each other, with the macro layer providing one one extra level of abstractive power (which, don’t get me wrong, is certainly useful).

In Common Lisp, you write macros in Common Lisp itself. You can then use those macros to write functions, and use those functions to write more macros. Instead of two stratified layers it’s a feedback loop of abstractive power.

— A Road to Common Lisp

— Steve Losh

.

.

2022.05.22 Sunday ACHK

# PhD, 4

GlenTheMachine on Aug 28, 2018 | next [–]

I have a PhD in aerospace engineering. I loved grad school. Loved loved loved it. I wouldn’t give up the worst day I had in grad school for almost anything. And I love having the skills it taught me. I am a much better engineer and researcher than I could possibly have been had I taken almost any other route. I was given freedom in grad school that just would not have been present in most industry jobs. I was given a hardware project – a submersible robot – that I was completely in charge of on day 1. I had to teach myself machining, how to do electrical and electonic works, how to do embedded programming, how to tune a PID loop, how to work with other students, how to give a persuasive presentation, how to come up with my own ideas, how to convince other people that they were worth pursuing, how to quickly become an expert in a topic.

That being said, I am not under any illusions about the financial loss I experienced. I spent ten years making a pauper’s wage, when if I had chosen to go into industry I would have been a software engineer… in the Valley… in 1993.

I also was in a remarkable lab in grad school. It made top-ten lists of “coolest college lab”. And that wasn’t hype. The caliber of student and of professor was off the charts. And they were not only smart, the vast majority of them were good people. A lot of places aren’t like that. And as the article correctly said: a toxic graduate school environment is worse than most toxic work environments. In any practical sense, students don’t have HR protections. If you can’t get your advisor to write you a recommendation, getting into a different program is nearly impossible. You can be worked 100 hours a week. You can be blackballed for getting sick, for taking vacations, for taking maternity or paternity leave (even if it is – and it almost certainly will be – unpaid).

The key is to find an advisor who is doing good work and who is sane and moral. If you can find that you’re golden. If you can’t you may be completely screwed.

— What You Need to Know Before Considering a PhD

— Hacker News

.

.

2022.05.21 Saturday ACHK

# 十面埋伏

.

.

Excellence is an art won by training and habituation. We do not act rightly because we have virtue or excellence, but we rather have those because we have acted rightly. We are what we repeatedly do. Excellence, then, is not an act but a habit.

— Aristotle

— Me@2022-05-20 05:27:41 PM

.

.

# Quick Calculation 3.5

A First Course in String Theory

.

Show that

\displaystyle{ \begin{aligned} \text{vol}(B^d) &= \frac{\pi^{\frac{d}{2}}}{\Gamma \left( 1 + \frac{d}{2} \right)} \\ \end{aligned} }

~~~

.

Geometric proof

The relations $\displaystyle{V_{n+1}(R)={\frac {R}{n+1}}A_{n}(R)}$ and $\displaystyle{A_{n+1}(R)=(2\pi R)V_{n}(R)}$ and thus the volumes of $n$-balls and areas of $n$-spheres can also be derived geometrically. As noted above, because a ball of radius $\displaystyle{R}$ is obtained from a unit ball $\displaystyle{B_{n}}$ by rescaling all directions in $\displaystyle{R}$ times, $\displaystyle V_{n}(R)$ is proportional to $\displaystyle{R^{n}}$, which implies $\displaystyle{{\frac {dV_{n}(R)}{dR}}={\frac {n}{R}}V_{n}(R)}$.

Also, $\displaystyle{A_{n-1}(R)={\frac {dV_{n}(R)}{dR}}}$ because a ball is a union of concentric spheres and increasing radius by $\displaystyle{\epsilon}$ corresponds to a shell of thickness $\displaystyle{\epsilon}$. Thus, $\displaystyle{V_{n}(R)={\frac {R}{n}}A_{n-1}(R)}$; equivalently, $\displaystyle{V_{n+1}(R)={\frac {R}{n+1}}A_{n}(R)}$.

— Wikipedia on Volume of an $n$-ball

.

\displaystyle{ \begin{aligned} V &= \int_0^R S dr \\ V(B^d) &= \int_0^R V(S^{d-1}) dR \\ &= \frac{2 \pi^{\frac{d}{2}}}{\Gamma(\frac{d}{2})} \int_0^R r^{d-1} dr \\ &= \frac{2 \pi^{\frac{d}{2}}}{\Gamma(\frac{d}{2})} \frac{1}{d} R^{d} \\ \end{aligned}}

— Me@2022-05-18 09:08:11 AM

.

.

# Physically-indistinguishable mathematical states

… that’s not totally correct, because a macroscopic state, even in principle, cannot be a superposition of macroscopic eigenstates.

— Me@2012.12.31

.

A macrosopic state is an actual physical state.

A macrosopic state, by definition, cannot be a superposition of different macroscopic states. A superposition must be of different macroscopically-indistinguishable microscopic states.

In other words, a physical state, by definition, cannot be a superposition of different physically-distinguishable physical states. A superposition must be of different physically-indistinguishable mathematical states.

— Me@2022-05-17

.

.

# 地獄篇 10.1.2

— Me@2011.10.05

.

Sharing knowledge is the most fundamental act of friendship. Because it is a way you can give something without loosing something.

— Richard Stallman

.

Name: Jimmy “Jimbo” Wales
Job: Founder, Wikipedia
Passion: Information for everyone
Turning Point: An operation that saved his daughter’s life taught him the need to stockpile rare knowledge such as her doctor’s

He wipes it off and begins haltingly.

“At the end of the procedure, I realized how precious the doctor’s knowledge was. It occurred to me that no one other than this doctor would ever know about this whole thing. There had to be a way.” And that is how Wikipedia came about.

— Daddy has Kira to Thank

— by Subroto Bagchi | Jun 5, 2009

.

.

2022.05.17 Tuesday ACHK

# 以右攻左

.

The whole notion of being “left wing” or “right wing” is silly.

Almost no one initially agrees with the semi-random collection of policies associated with each wing.

They only support those policies after they join the left or right mind tribe.

— 12:27 AM · May 13, 2022

— Elon Musk

.

「兼善天下」（大乘）這目標固然是好，但就大到執行不到。

「獨善其身」（小乘）這目標則執行得到，但是就小到，其實沒有大用。如果是僅是「小乘」而已，人生沒有多大意義。試想想，假如，你可以「獨善其身」，生活富足，但是沒有愛人，沒有朋友，你會被迫，思考人生的意義。

「被迫思考人生意義」，可以簡稱「抑鬱」。

「兼善天下」是最終目標，永不達到，但可以不斷走近。 「獨善其身」則是起點。千里之行，始於足下。沒有起點，就沒有旅程。

— Me@2022.05.16 06:48:36 PM

.

.

# Watermelon

1990s, 19

.

(package-initialize)

(custom-set-variables
'(cua-mode t nil (cua-base))
'(custom-enabled-themes (quote (leuven))))
(custom-set-faces
)

(set-register ?e '(file . "~/.emacs"))

(prefer-coding-system 'utf-8)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun backup-dot-emacs ()
(interactive)

(save-buffer)

(setq backup-path (format "%s%s%s"
"/path_to_the_backup_folder/ubuntu_dot_emacs_"
(format-time-string "%Y_%m_%d_%I_%M_%S_%p")
".el"))

(write-file backup-path 'confirm)

(setq original-cursor (point))

(kill-buffer)
(find-file "~/.emacs")

(goto-char original-cursor)
)

(global-set-key (kbd "C-") 'backup-dot-emacs)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



(set-register ?d '(file . "/path_to_the_blog_folder/dialogue59.txt"))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun backup-blogging-tray ()
(interactive)
(save-buffer)

(setq return-file-name (buffer-file-name))

(setq backup-path (format "%s%s%s"
"/path_to_the_backup_folder/blogging_tray_"
(format-time-string "%Y_%m_%d_%I_%M_%S_%p")
".txt"))

(write-file backup-path 'confirm)

(setq original-cursor (point))

(kill-buffer)

(find-file return-file-name)

(goto-char original-cursor)

)

(global-set-key (kbd "C-x C-a") 'backup-blogging-tray)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


— Me@2022.05.14 05:10:49 PM

.

.

# Ex 1.25 Properties of Dt, 2

Structure and Interpretation of Classical Mechanics

.

Demonstrate that …

b. $\displaystyle{D_t (c F) = c D_t F}$

c. $\displaystyle{D_t (F G) = F D_t G + (D_t F) G}$

~~~

\displaystyle{ \begin{aligned} &D_t (c F) \circ \Gamma[q] (t) \\ \end{aligned} }

\displaystyle{ \begin{aligned} &= \partial_0 \left[c F(t, q, v, a, ...) \right] + \partial_1 \left[c F(t, q, v, a, ...) \right] v(t) + \partial_2 \left[c F(t, q, v, a, ...) \right] a(t) + ... \end{aligned} }

\displaystyle{ \begin{aligned} &= c \partial_0 F(t, q, v, a, ...) + c \partial_1 F(t, q, v, a, ...) v(t) + c \partial_2 F(t, q, v, a, ...) a(t) + ... \end{aligned} }

\displaystyle{ \begin{aligned} &= c \left[ \partial_0 F(t, q, v, a, ...) + \partial_1 F(t, q, v, a, ...) v(t) + \partial_2 F(t, q, v, a, ...) a(t) + ... \right] \end{aligned} }

\displaystyle{ \begin{aligned} &= c D_t F \circ \Gamma[q] (t) \\ \end{aligned} }

.

\displaystyle{ \begin{aligned} &D_t (FG) \circ \Gamma[q] (t) \\ \end{aligned} }

\displaystyle{ \begin{aligned} &= \partial_0 \left[ F(t, q, v, a, ...) G(t, q, v, a, ...) \right] \\ &+ \partial_1 \left[ F(t, q, v, a, ...) G(t, q, v, a, ...) \right] v(t) \\ &+ \partial_2 \left[ F(t, q, v, a, ...) G(t, q, v, a, ...) \right] a(t) + ... \\ \end{aligned} }

\displaystyle{ \begin{aligned} &= \left[ \partial_0 F(t, q, v, a, ...) \right] G(t, q, v, a, ...) + F(t, q, v, a, ...) \partial_0 G(t, q, v, a, ...) \\ &+ \left\{ \left[ \partial_1 F(t, q, v, a, ...) \right] G(t, q, v, a, ...) + F(t, q, v, a, ...) \partial_1 G(t, q, v, a, ...) \right\} v(t) \\ &+ \left\{ \left[ \partial_2 F(t, q, v, a, ...) \right] G(t, q, v, a, ...) + F(t, q, v, a, ...) \partial_2 G(t, q, v, a, ...) \right\} a(t) + ... \\ \end{aligned} }

\displaystyle{ \begin{aligned} &= \left[ \partial_0 F(t, q, v, a, ...) \right] G(t, q, v, a, ...) \\ &+ \left[ \partial_1 F(t, q, v, a, ...) \right] G(t, q, v, a, ...) v(t) \\ &+ \left[ \partial_2 F(t, q, v, a, ...) \right] G(t, q, v, a, ...) a(t) + ... \\ \\ &+ F(t, q, v, a, ...) \partial_0 G(t, q, v, a, ...) \\ &+ F(t, q, v, a, ...) \partial_1 G(t, q, v, a, ...) v(t) \\ &+ F(t, q, v, a, ...) \partial_2 G(t, q, v, a, ...) a(t) + ... \\ \end{aligned} }

\displaystyle{ \begin{aligned} &= \left[ \partial_0 F(t, q, v, a, ...) + \partial_1 F(t, q, v, a, ...) v(t) + \partial_2 F(t, q, v, a, ...) a(t) + ... \right] G(t, q, v, a, ...) \\ &+ F(t, q, v, a, ...) \left[ \partial_0 G(t, q, v, a, ...) + \partial_1 G(t, q, v, a, ...) v(t) + \partial_2 G(t, q, v, a, ...) a(t) + ... \right] \\ \end{aligned} }

\displaystyle{ \begin{aligned} &= \left\{ D_t F \circ \Gamma[q] (t) \right\} G(t, q, v, a, ...) + F(t, q, v, a, ...) D_t G \circ \Gamma[q] (t) \\ \end{aligned} }

\displaystyle{ \begin{aligned} &= \left\{ D_t F \circ \Gamma[q] (t) \right\} G \circ \Gamma[q] (t) + F \circ \Gamma[q] (t) D_t G \circ \Gamma[q] (t) \\ \end{aligned} }

The meaning of $\displaystyle{\delta_\eta (fg)[q]}$ is

$\displaystyle{\delta_\eta (f[q]g[q])}$

\displaystyle{ \begin{aligned} &D_t (FG) \circ \Gamma[q] (t) \\ \end{aligned} }

\displaystyle{ \begin{aligned} &= \left\{ D_t F \circ \Gamma[q] (t) \right\} G \circ \Gamma[q] (t) + F \circ \Gamma[q] (t) D_t G \circ \Gamma[q] (t) \\ \end{aligned} }

\displaystyle{ \begin{aligned} &= \left[ (D_t F) G + F D_t G \right] \circ \Gamma[q] (t) \\ \end{aligned} }

.

\displaystyle{ \begin{aligned} D_t (FG) \circ \Gamma[q] (t) &= \left[ (D_t F) G + F D_t G \right] \circ \Gamma[q] (t) \\ \\ D_t (FG) &= (D_t F) G + F D_t G \\ \end{aligned} }

— Me@2022.05.12 07:02:30 PM

.

.

# The least of all evils, 9

.

Politics allows people to vote for the impossible, which may be one reason why politicians are often more popular than economists, who keep reminding people that there is no free lunch and that there are no “solutions” but only trade-offs.

— Thomas Sowell

.

.

2022.05.12 Thursday ACHK

# 難得有情人

.

— Me@2022-02-08 11:50:35 PM

「你是要找『條件最適合你』的人，如果你剛巧又，最適合她的話。」

.

Today I found my soulmate; she didn’t.

「你是要找『與感情最深』之人，如果你剛巧也是，『與她感情最深』之人。」

.

.

.

「情人」的重點在於情。

.

.

— Me@2022.05.11 07:07:43 PM

.

.

# 伏線驅動程式 1.5

.

.

— Me@2022-02-08 11:50:35 PM

「你是要找『條件最適合』的人，如果你剛巧又最適合她的話。」

.

— Me@2014.09.07

.

— Me@2022.05.10 05:23:26 PM

.

.

# Junkions

output = system.exec_command("date +%Y.%m.%d")
output += " "
output += system.exec_command("date +%I:%M:%S")
output += " "
output += system.exec_command("date +%p")

clipboard.fill_clipboard(output.upper())
keyboard.send_keys("<ctrl>+v")


output = system.exec_command("date +%Y.%m.%d")
output += " "
output += system.exec_command("date +%A")

clipboard.fill_clipboard(output)
keyboard.send_keys("<ctrl>+v")


.

output = system.exec_command("date +_%Y_%m_%d_")
output += system.exec_command("date +_%H_%M_%S_%p")

clipboard.fill_clipboard(output.upper())
keyboard.send_keys("<ctrl>+v")
`

— Me@2022.05.07 11:27:28 AM

.

.

# Quick Calculation 3.4

A First Course in String Theory

.

Show that

\displaystyle{ \begin{aligned} F^{\mu \nu} &= - F^{\nu \mu} \\ F^{0 i} &= - F_{0 i} \\ F^{ij} &= F_{ij} \\ \end{aligned} }

~~~

Eq. (3.15):

$\displaystyle{ F_{\mu \nu} \equiv \partial_\mu A_\nu - \partial_\nu A_\mu \\ }$

Eq. (3.29):

$\displaystyle{ F^{\mu \nu} = \eta^{\mu \alpha} \eta^{\nu \beta} F _{\alpha \beta} \\ }$

Eq. (3.16):

$\displaystyle{ F_{\mu \nu} = - F_{\nu \mu} \\ }$

.

\displaystyle{ \begin{aligned} F_{\mu \nu} &= - F_{\nu \mu} \\ \eta^{\mu \alpha} \eta^{\nu \beta} F_{\mu \nu} &= - \eta^{\mu \alpha} \eta^{\nu \beta} F_{\nu \mu} \\ \eta^{\mu \alpha} \eta^{\nu \beta} F_{\mu \nu} &= - \eta^{\nu \beta} \eta^{\mu \alpha} F_{\nu \mu} \\ F^{\mu \nu} &= - F^{\nu \mu} \\ \end{aligned} }

.

\displaystyle{ \begin{aligned} F^{\mu \nu} &= \eta^{\mu \alpha} \eta^{\nu \beta} F_{\alpha \beta} \\ F^{0 i} &= \eta^{0 \alpha} \eta^{i \beta} F _{\alpha \beta} \\ &= \eta^{0 0} \eta^{i \beta} F _{0 \beta} + \eta^{0 1} \eta^{i \beta} F _{1 \beta} + \eta^{0 2} \eta^{i \beta} F _{2 \beta} + \eta^{0 3} \eta^{i \beta} F _{3 \beta} \\ &= (-1) \eta^{i \beta} F _{0 \beta} + (0) \eta^{i \beta} F _{1 \beta} + (0) \eta^{i \beta} F _{2 \beta} + (0) \eta^{i \beta} F _{3 \beta} \\ &= (-1) \eta^{i \beta} F _{0 \beta} \\ &= - F _{0 i} \\ \end{aligned} }

.

\displaystyle{ \begin{aligned} F^{\mu \nu} &= \eta^{\mu \alpha} \eta^{\nu \beta} F_{\alpha \beta} \\ F^{i j} &= \eta^{i \alpha} \eta^{j \beta} F_{i j} \\ &= \sum_\alpha \sum_\beta \eta^{i \alpha} \eta^{j \beta} F_{\alpha \beta} \\ &= \sum_\beta \eta^{i i} \eta^{j \beta} F_{i \beta} \\ &= \eta^{i i} \eta^{j j} F_{i j} \\ &= (1) (1) F_{i j} \\ &= F_{i j} \\ \end{aligned} }

— Me@2022.05.05 07:49 PM

.

.

# The Lisp debugger

oo101 7 days ago [-]

There are a few ways in which the shared objects method you suggest does not match the full power of Lisp debugging.

First of all, when a C program crashes, it just crashes. There is no REPL. There is only a core dump. So any live-debugging you plan to do is after the fact. After you have seen a crash, you would now begin to prepare for the next crash by launching your process via GDB or restarting your process and attaching a GDB to it. Whether a similar crash would occur again or not or when it would occur again depends on the nature of the bug. Now contrast this with Lisp debugging when your program crashes, it stops there and offers you an REPL to interact with the program right then. There is no need to wait for the next crash.

Secondly, when you debug with GDB, you would be dealing with syntaxes: The syntax of C that we are so familiar with. The GDB syntax to investigate the problem that we may be less familiar with. When the Lisp debugger offers the REPL to you, you are working with Lisp again. Your compiler, debugger, program, etc. all are part of the same unified environment where you just execute Lisp code to debug your issue.

Finally, putting your code in shared objects and reloading them requires you to go through the complete write-build-test-debug cycle. And then what do you do if your shared object itself crashes? With Lisp you skip the write-build-test part when all you want to do is debug an error. You jump straight to the debug part of the cycle and begin investigating the runtime state. And it works the same in a uniform manner whether your main program crashes or a dependency crashes.

— A Road to Common Lisp

— Hacker News

.

.

2022.05.05 Thursday ACHK

# 數學時間論 4

.

.

.

2022.05.04 Wednesday ACHK

# 數學教育 7.5.1

Genius 4.2.1 | A Fraction of Algebra, 2.1

.

.

（安：但是，這個講法可能有一個問題。

.

.

（安：去翻譯那些抽象數學概念，到其他範疇，或者日常生活。）

.

.

1. 對數學（及其他學問人生），有極大興趣；

2. 遇到合理的老師和書籍：

3. 極超大量的背誦和練習：

.

— Me@2022.05.02 11:48 PM

.

.