5 ms·
Came across this just when I was looking to deep dive into calculus, typed lambda calculus, differentiation, etc. I somehow have a hunch learning these, will he
by lewisjoe 7y ago
Came across this just when I was looking to deep dive into calculus, typed lambda calculus, differentiation, etc. I somehow have a hunch learning these, will help me down my road on language design and implementing compilers.
Only midway, but hands down this is the best material I came across on the subject. As light-hearted as much as detailed.
Update: Thank you, all. I guess the dots would never connect down my road. But I'm midway and the topic's still interesting enough for me to keep going.
- mcncm 7y agoJust out of curiosity, why do you need to know differential calculus to write a compiler, and what does it have to do with lambda calculus? Learning it is a great thing to do, and it will certainly help you in other ways. But that kind of programming usually has little in common with the "mathematical analysis" kind of calculus (unless you're specifically interested in differentiable programming, which is actually kind of big these days). Anyway, happy studies!
- lewisjoe 7y agoOh, I have this bad habit of going down the rabbit hole of fundamentals if I feel I lack the basics of a concept. While I still haven't grasped the need for calculus in language design, I've come across pieces on how Lisp is based on lambda calculus vs Haskell based on typed lambda calculus. Also, that any problem that can be solved with turing machine, can be solved by lambda calculus as well. While not much about compilers, I guess it will solidify my understanding of language designs? I'm not sure. I'll rather learn and hope the dots will connect later than ignore the subject altogether.
- p0llard 7y agoJust to clarify, you do realise that lambda calculus is an entirely different field to the calculus of mathematical analysis? They really have very little in common apart from the name. Sorry if you already knew this, but it seemed like you were making a connection that wasn't there.
- wool_gather 7y agoLet's clarify here: "Calculus"[0] and the lambda calculus have almost nothing to do with one another. They just share a word in their name, like the Department of Mathematics and the Fire Department. There are several different things called "the X calculus". [0]:Could be called "numerical calculus" or "calculus of integration and differentiation", perhaps.
- JoelMcCracken 7y agoA while back I was trying to under why some things are called algebras and others calculus. The answer I got is that the term calculus is related to the introduction/reduction of variables or symbols, whereas an algebra is manipulation of existing symbols.
- mruts 7y agoI always thought it related to continuous variables and the highly useful concept of the infinitesimal. But maybe that definition works as well.
- User23 7y agoGood clarification, but I wouldn't say almost nothing. All are formal symbolic reasoning techniques. For example, The predicate calculus is invaluable for writing correct programs with mind-bogglingly large input domains, such as the set of all C++ programs.
- deleted 7y ago[deleted]
- mcncm 7y agoI guess... Well, maybe I'm misunderstanding what you're saying, but I just want to be clear that you know that the branch of math most people call "calculus" is almost completely unrelated to the branches of math called "lambda calculus", and "typed lambda calculus." The former, which this link is about, has very little to do with language design. In fact, there are all different kinds of math called "X calculus" and "calculus of Y", each of which has nothing to do with the other. Just "calculus" is short for "differential and integral calculus," which is about the local behavior of functions and the measure of objects in continuous spaces. Many people study this in high school (and earlier), since it's the underlying mathematical technology for much of the physical sciences. "Lambda calculus" is a logical system for manipulating symbols representing functions, and is indeed equivalent to Turing's symbol-manipulation system. So they both have to do with functions, but that's about where the similarity ends! I hope I'm not coming off as brusque or anything, I just don't want you to spend loads of time on something that isn't what you think it is! That said, lots of programmers are surprisingly weak in (differential/integral) calculus, and could use a good dose of it anyway :)
- deleted 7y ago[deleted]
- mruts 7y agoLambda calculus nor regular calculus are going to help you write a compiler. And certainly regular calculus isn’t going to help you design a language...
- jnbiche 7y agoIf you're writing a compiler for a functional language, lambda calculus is quite useful, and even necessary is some cases (understanding typed lambda calculus is pretty fundamental to statically typed functional languages from an implementation point of view).
- deleted 7y ago[deleted]
- jcranmer 7y agoAs a compiler developer: Integral and differential calculus is not useful at all [1]. Compilers are not very computation-heavy, and where they do require grinding through math, the interesting problems are discrete math rather than continuous variable problems, which means that integral and differential calculus very rarely offer insights. The math you usually want is algebra. Even then, the elementary algebra you learned in high school (or earlier) is usually sufficient. More complex domains in math are usually used for theoretical analysis and are less common in practice. Many dataflow optimizations can be described as monotonic functions over a semilattice, but they are rarely implemented as such. Type systems in functional languages can be understood more richly as applied category theory. Linear algebra is useful when multidimensional loop nests come into play. [1] Unless maybe you're building a neural network compiler.