4 ms·
"Maxwell's equations of software" examined (2008)
- deleted 2y ago[deleted]
- ChrisArchitect 2y ago(2008) Some previous discussion: 2022: https://news.ycombinator.com/item?id=30677834 https://news.ycombinator.com/item?id=30677834 2020: https://news.ycombinator.com/item?id=23321955 https://news.ycombinator.com/item?id=23321955
- ashton314 2y agoI think there's good reason why Lisp's `apply` and `eval` functions are the "Maxwell Equations" of CS. Going back to the Lambda Calculus, `apply` is the β-reduction rule, which is the basis for everything, and `eval` is how you cross the data-code boundary. Between the two you get a system that can 1.) perform any computable function, and 2.) easily work with its own structure.
- 082349872349872 2y agoLike Maxwell's original (8? 12?) equations, there are probably some simplifications we could arrive at given more recent notations; in particular `pairlis` instead of zip and the gratuitous sequentiality of `evcon`?
- lupire 2y ago'apply generates data from code. 'eval generates code from data.
- sfvisser 2y agoThis one feels more apt to me: the derivation of a single lambda calculus term in which you can express all other expressions. > The systematic construction of a one-combinator basis https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=85dcb022ea0e10e0d460aefbf24dca49bb095c4f https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&d...
- tromp 2y agoIt's not the shortest lambda term with that property though. That's λx λy λz. x z (y (λ_.z)) [1] [1] https://en.wikipedia.org/wiki/SKI_combinator_calculus https://en.wikipedia.org/wiki/SKI_combinator_calculus
- pkal 2y agoI don't get the impression that anyone is going into the "Maxwell's equations" part of the analogy. I didn't understand/think about it either until watching Sussman's "Programming is (should be) fun!"[0], where he explains the dualism and inter-action between `eval' and `apply' is supposed to be analogous to magnetic and electric fields in Maxwell's equations. The well known Ying-Yang picture containing `eval'/`apply' can (and does in his presentation) also be drawn with \vec{B} and \vec{E}. [0] https://www.youtube.com/watch?v=2MYzvQ1v8Ww https://www.youtube.com/watch?v=2MYzvQ1v8Ww, around minute 13
- 082349872349872 2y agoI tend to think of `eval` and `apply` as being fancier versions of `K` and `S`.
- vinnyvichy 2y agoAnd are the SKI uphill or downhill derivatives :)? To help you listen more productively to 孝德公 https://lirias.kuleuven.be/retrieve/678705 https://lirias.kuleuven.be/retrieve/678705 So that you can start thinking about the (full) SpeKtrum of gumi(←♦→)ity Btw, looking for a starting point to engage in patrocinium I discovered again your comment on patrocinium https://news.ycombinator.com/item?id=40691384 https://news.ycombinator.com/item?id=40691384 And to iterate: we need more than dichotomy (maybe three combinators?) I mean, why are you so sure that the ingredient necessary to break the "generalized (cognitive) prisoners dilemma" is not "an epsilon of payout (up to sign)"? Seems like undue arrogance to act or not act on your certainty? >We cannot rule out the possibility that this ambivalence may have been intentional on Philodemus’s part Boy someone needs to formalize this G
- vinnyvichy 2y ago(c'mon bro, admit it, you have empathy for the housecats) It's more crucial to have empathy for the pigeons
- 082349872349872 2y ago
- taneq 2y agoI’m always a little confused when people are blown away by the “the program IS data” revelation. What did they think the program was? Why is this seen as transcendental LISP enlightenment when it’s the main feature of a von Neumann architecture?
- blowski 2y agoThe closest I've come to being "blown away" by it was a project where I needed to clone the results of an Excel workbook onto the server, without installing Excel. I started with PHP as my normal language, but it ran into the ground when I had to deal with order of operations, new operators, and cell references. I'd never really used a Lisp-based language before, but I decided to give Clojure a try, and it was the first time I grokked the value of "the program is the data is the program". In PHP I had different "things" - operators, functions, scalar variables, class variables - and I needed to think about what was assigned and when. But in Clojure, everything was "data" that I could use to construct bigger pieces of data. Maybe that's obvious to better programmers than me, but my mind was blown.
- f1shy 2y agoOn a shallow level, is trivial; as in “a program is a file with ascii codes, like any other file, is data” A little deeper, you can think “an obj file are bytes, even called TEXT section, so the same, a program is data” But in Lisp the parallel comes at a much higher abstraction level. In the sense that you learn “algorithms AND data structures” like 2 different things, and when they conflate, that is the aha moment. It is interesting when you start to understand that data can affect flow control exactly as code, that you can generate code on the fly as needed, just as data (which is bot really possible in C- in an easy way, at least) and you even can generate code, which generates code, which gene… that runs at the end. Let me add another thing: probably you have heard “self modifying code is dark, dangerous, not recommended”. Now, if you really embrace the idea that data is code, code is data, then you start to be very cautious with variables. Any change in a variable, is changing code… I think that is the reason why people in functional languages value so much immutable data.
- aap_ 2y agoI think that's a really interesting point. I don't think there are many high level languages where code and data are fundamentally the same kind of thing. I'm aware of only lisp and tcl (funnily there's a thread about tcl on the front page right now). Also people probably don't think about machine code all that much and even if they do they probably don't consider self-modifying code. The only exception to this may be JIT compilation? Anyway, it seems to be a concept that's rare in high level languages so I understand the surprise.
- tromp 2y ago> a half-page of code is sufficient to define a basic Lisp interpreter in Lisp given a few primitives (car, cdr, cons, eq, atom). One line of code is sufficient to define the 206-bit BLC interpreter in BLC given no primitives whatsoever [1] : (λ11)(λλλ1(λλλλ3(λ5(3(λ2(3(λλ3(λ123)))(4(λ4(λ31(21))))))(1(2(λ12))(λ4(λ4(λ2(14)))5))))(33)2) This code tokenizes and parses (something the Lisp code skips) the binary encoding of a lambda term from an input bitstream and applies that term to the remainder of input. [1] https://tromp.github.io/cl/cl.html https://tromp.github.io/cl/cl.html