(φ (μ (λ)))
This, I believe, is also the case with Lisps. And one sees examples of this across several dialects of Lisp, such as Common Lisp with its CLOS. While I do agree with Hoyte (2008) when he says Common Lisp is the language to consider when doing serious Lisp…
The classic Euler-Lagrange equations for a mechanical system
(φ (μ (λ)))
The classic Euler-Lagrange equations for a mechanical system
This weird looking equation can be described with much simplicity in a Scheme procedure as such:
One employs the functional abstraction that is very ubiquitous in lisp programs, to implement
(define ((Lagrange-equations Lagrangian) w)
(- (D (compose ((partial 2) Lagrangian) (Gamma w)))
(compose ((partial 1) Lagrangian) (Gamma w))))
One employs the functional abstraction that is very ubiquitous in lisp programs, to implement
Lagrangian, D, Gamma and partial. Once that has been done, using this equation for a harmonic oscillator or a double pendulum is only a matter of applying the procedure to it's specific arguments.
(φ (μ (λ)))
This weird looking equation can be described with much simplicity in a Scheme procedure as such: (define ((Lagrange-equations Lagrangian) w) (- (D (compose ((partial 2) Lagrangian) (Gamma w))) (compose ((partial 1) Lagrangian) (Gamma w)))) One…
This is not that far from what you can achieve with Haskell, though honestly you hit a wall with Haskell after a while. I had to implement a quick symbolic differentiator for a particular task and here's the code below for the final differentiation function that will be called:
Now if you see the conditions, they're pretty close to what you'd write in mathematics. Except the
d :: Expr -> Char -> Expr
-- Trivial Conditions
d (Const _) _ = 0
d (Var v) x
| x == v = 1
| otherwise = 0
-- Primary Conditions
d (DSum m n) x = freduce (d m x + d n x)
d (DSub m n) x = freduce (d m x - d n x)
d (DProduct m n) x = freduce (m * d n x + n * d m x)
Now if you see the conditions, they're pretty close to what you'd write in mathematics. Except the
freduce part which I need to simplify the equations further. I need a separate function because simply a lambda can't handle that much of conditional reduction, and actually freduce itself calls another helper function. This is why I mentioned about hitting a wall, you cannot extend things after a while. You cannot easily extend the + operator, or have your own that works with numbers. I had to instead instantiate the Num typeclass and use it but then I need to define the properties of these operations (+, -, *) in a separate function and then recursively apply them instead of changing them directly.
(φ (μ (λ)))
This is not that far from what you can achieve with Haskell, though honestly you hit a wall with Haskell after a while. I had to implement a quick symbolic differentiator for a particular task and here's the code below for the final differentiation function…
Now the same symbolic differentiator when implemented in Scheme, looks almost the same:
When one compares the two, they might seem almost the same which they are on the surface. But when one realizes, that yeah my procedure/function isn't simplifying the equations, and I need to fix this. In the case of the Scheme procedure you can leave the
(define (diff e v)
(cond ((constant? e) 0)
((variable? e)
(if (variable-eq? e v) 1 0))
((sum? e)
(make-sum (diff (augend e) v)
(diff (addend e) v)))
((sub? e)
(make-sub (diff (augend e) v)
(diff (addend e) v)))
((product? e)
(make-sum
(make-product (multiplier e) (diff (multiplicand e) v))
(make-product (multiplicand e) (diff (multiplier e) v))))
(else
(error "This expression cannot be differentiated." e))))
When one compares the two, they might seem almost the same which they are on the surface. But when one realizes, that yeah my procedure/function isn't simplifying the equations, and I need to fix this. In the case of the Scheme procedure you can leave the
diff entirely unchanged and only add new conditions to make-product, make-sum etc. Even adding exponentiation can be done similarly. This can be achieved in Haskell if you go out of your way and do the typeclass shenanigans but Scheme symbolically allows you to do it with much ease. It naturally supports the structure of never having to rely on a specific set of things, you make structures and break them and rebuild them as you like. And in doing so, you don't have to fight with the semantics of the language, rather it's awaiting for you to make use of it.👍1
On his honeymoon in 1961, Knuth discovered that the roads of mathematics and computer programs intersect. For, Jill was not only accompanied by her newly wed husband on their joint trip through Europe, but also by Noam Chomsky's book Syntactic Structures which Knuth was studying eagerly. Chomsky showed Knuth how mathematics and computing can be practiced together. One year later, Knuth met Bob Floyd who would teach him that you really could use mathematical reasoning to understand computer programs. The early sixties thus not only brought Jill and Don Knuth officially together, it also married mathematics and programming.
E.G Daylight, The Essential Knuth (2013)
👍1
Varities of REPLs
1. C
2. Rust
3. (g)Forth
4. Haskell
And, finally:
5. Lisp
1. C
#include <stdio.h>
int main() {
char input[100];
while (fgets(input, sizeof(input), stdin)) {
printf("%s", input);
}
return 0;
}
2. Rust
use std::io::{self, Write};
fn main() {
let mut input = String::new();
while io::stdin().read_line(&mut input).unwrap() > 0 {
print!("{}", input);
input.clear();
}
}3. (g)Forth
: repl
BEGIN
TIB DUP >IN !
0 WORD COUNT TYPE
AGAIN ;
4. Haskell
main :: IO ()
main = do
input <- getLine
putStrLn input
main
And, finally:
5. Lisp
(loop (print (eval (read))))
😁5❤🔥2❤1
The problem is that coding isn’t fun if all you can do is call things out of a library, if you can’t write the library yourself. If the job of coding is just to be finding the right combination of parameters, that does fairly obvious things, then who’d want to go into that as a career?
Donald Knuth in an interview with Peter Seibel. Unfortunately, the answer Knuth would get today is: everybody.
❤1💯1
Forwarded from Symptoms
Symptoms
Photo
Wark,_McKenzie_Hacker_Manifesto_Harvard_University_Press_2009.pdf
3.3 MB
McKenzie Wark, A Hacker Manifesto (2009)
Forwarded from Deputy Sheriff The Viking Programmer
: birthday 0 100 do ." Happy Birthday Chuck " cr next ;
birthday
Happy birthday Chuck, aka Charles H. Moore, the inventor of Forth and subsequently the concatenative programming paradigm, the threaded code model, and much more.
Forwarded from Mathematics Channel
Interactive Mathematical applets and animations
https://www.dynamicmath.xyz/
"A mathematical formula should never be 'owned' by anybody!"
Donald Knuth, Digital Typography, ch1, p. 8 (1999).
#site
https://www.dynamicmath.xyz/
"A mathematical formula should never be 'owned' by anybody!"
Donald Knuth, Digital Typography, ch1, p. 8 (1999).
#site
Dynamic Mathematics
Interactive Mathematical Applets and Animations
Forwarded from Mathematics Channel
https://virtualmathmuseum.org/
3D-XplorMath is a freely available Mathematical Visualization program.
The group in charge of the 3D-XplorMath software development project and the related Virtual Mathematics Museum website project is the 3DXM Consortium, an international volunteer group of mathematicians.
#site #software
3D-XplorMath is a freely available Mathematical Visualization program.
The group in charge of the 3D-XplorMath software development project and the related Virtual Mathematics Museum website project is the 3DXM Consortium, an international volunteer group of mathematicians.
#site #software
❤🔥2❤1