And then there is Virding's First Rule of Programming:
Any sufficiently complicated concurrent program in another language contains an ad hoc informally-specified bug-ridden slow implementation of half of Erlang.
Cool. I made a so called dynamically recompiling (dynarec) CHIP-8 emulator in Lisp myself, but never got around to implementing the actual graphics, input, and sound.
This is kind of situation where LOOP really shines.
(defun machin-pi (digits)
"Accurately calculates PI digits using Machin's formula
with fixed point arithmetic and variable digit guarding."
(flet ((arccot (x unity)
(loop
with xsq = (* x x)
for positive = t then (not positive)
for n upfrom 1 by 2
for xpow = (floor (/ unity x)) then (floor xpow xsq)
for term = (floor xpow n)
until (= 0 term)
sum (if positive term (- term)))))
(when (> digits 0)
(let* ((guard (floor (* 10 (log digits 10))))
(unity (expt 10 (+ digits guard)))
(thispi (* 4 (- (* 4 (arccot 5 unity)) (arccot 239 unity)))))
(floor thispi (expt 10 guard))))))
Unfortunately, no. Go to a blank line inside a code block that's indented a bit and hit tab. Nothing happens :/
I wasn't clear above, I have been able to have it never insert a tab, but it's that and the "don't try to 'intelligently' prevent me from indenting" thing that I need.
Any sufficiently complicated concurrent program in another language contains an ad hoc informally-specified bug-ridden slow implementation of half of Erlang.