10 ms·
The Science of Functional Programming [pdf]
- Tade0 7y agoIt requires a certain amount of mathematical experience and is not suitable for people who are unfamiliar with school-level algebra, or unwilling to learn difficult concepts through prolonged mental concentration and effort. Why do materials on functional programming always have to be at least somewhat condescending towards the reader? Or maybe: why such sentences seems to appear only in them?
- ssivark 7y agoMaybe they’re defensive because readers keep complaining about not understanding the math they use?
- Tade0 7y agoSo the retort is to imply that they didn't understand the math they had in school? To me it comes off as somewhat douchy.
- rowanG077 7y agoHow is it douchy? If I write a book about calculus and people say it's too hard, because they don't know what a function is, is it then not more then fair to say to them they should first know some basic math before attempting to understand my book? That's basically just helping the reader to me and not condescending in any way.
- deleted 7y ago[deleted]
- happytoexplain 7y agoI don't really agree that the sentence is condescending. It's mostly accurate and the problem is described fairly neutrally.
- jayd16 7y agoThis is saying "btw this subject isn't for lazy illiterates", presumably unlike other literature the reader is familiar with. What value does that add exactly?
- Jonathanks 7y agoWhen I gave this book an attempt, I appreciated the author's honesty about the difficulty of the material. I went with Real World Ocaml instead, intending to reattempt SoFP in the future. Today I suggested an addition to a section in Real World OCaml, and the author pointed out that the section was already so dense that adding the extra content would require more explanation. I now appreciate the difficulty in making such a technical material approachable by a less technical audience, and a heads up is appropriate. Edit: (in light of another reply that mentioned the lambda calculus). The addition to Real World OCaml that I suggested was to call out the implementation of the Y combinator in the section on Memoization. The explanation used the Y combinator to work up to an implementation of memoization, and it was so intuitive that I felt it should be noted, but that won't easily fit into an already dense chapter.
- BucketSort 7y agoIt's a good warning. I would only consider that condescending if I had some insecurity about my abilities.
- AnimalMuppet 7y agoTo me, it seems that the "is not suitable" phrase was a bit condescending. Re-word that, and the warning may be fine.
- Tade0 7y agoWho is it targeted at though? Because I find it hard to imagine somebody "unfamiliar with school-level math" picking it up in the first place.
- phaus 7y agoI never even made it to pre-calc and I suck at Algebra but I'm teaching myself CS and functional programming. The title made me interested and the warning tells me I'm probably not ready for it.
- deleted 7y ago[deleted]
- classified 7y agoTo understand how and why a C compiler works you don't need all that much algebra. If you thoroughly understand assembly, you're basically good to go. To understand how and why an FP language compiler works you need to grok the lambda calculus (as a bare minimum). I'd call that algebra. To even understand what problems are being solved by closures, I really had to “learn difficult concepts through prolonged mental concentration and effort”. Giving newbies a heads-up that competent use of such a tool requires nontrivial knowledge is only fair.
- iamaelephant 7y agoWhy do I need to understand how the compiler works, at that level of detail? I don't see why understanding closures requires so much mental effort. Just using them a few times should give you a practical understanding of how they work. Closures are not a complicated concept - a bunch data your function has access to outside of its own scope.
- ScottBurson 7y agoThey're certainly no harder a concept than pointers in C! They also don't cause crashes that can be very difficult to debug.
- classified 7y ago> Why do I need to understand how the compiler works How do you propose to master the language if you don't understand the principal tool that embodies that language? Of course it's always an option to use a language without really understanding it, if that's your thing. > Closures are not a complicated concept The first lectures introducing closures after their discovery had CS professors in the audience who didn't understand what they were good for. Functions could access a bunch of data outside their local scope before that.
- jfoutz 7y agoeh, i dunno. i think anybody with a decent grip on any language can whip up a scheme compiler way faster than a C compiler. [1] is a very readable guide to scheme and its implementation. Will it be the fastest gun in the west? no. Is it a simple workable foundation that, like, anybody who can put together 100 lines of working code, in any language, can build? for sure. Compilation isn't magic. Lambda calculus won't hurt. Implementing scheme (which imho is pretty darn close to the lambda calculus) really just requires understanding some operational semantics and you're good to go. [1] (http://agl.cs.unm.edu/~williams/cs491/three-imp.pdf http://agl.cs.unm.edu/~williams/cs491/three-imp.pdf)
- traderjane 7y agoWould it be less condescending if it didn't discuss requirements or difficulty?
- Tade0 7y agoHow many people "unfamiliar with school-level math" do you know? Seems like an odd group to target in such a warning.
- uoaei 7y agoWorking in tech obscures the proportion of how many people truly are stuck when asked to do algebra of any flavor.
- Tade0 7y agoOk, but can you imagine such a person being interested in this book?
- ssivark 7y agoMany, I would argue. Just a statement of fact, no judgement. When I took advanced physics classes in 3rd year of undergrad, I was surprised to note that many of my very smart friends who were computer science majors had lost touch with high-school and introductory college math (particularly calculus) because of an immersion in different kinds of stuff for 2-3 years. Similarly, I've sat in on machine learning classes where CS grad students have little knowledge of probabilistic reasoning or linear algebra (both of which I would consider high-school math, or early college level). It's not surprising that someone who's not written code for a decade will have a tough time jumping in to start programming right away. So, what's so special about math? It just so happens that some texts on functional programming use a different starting point to approach programming, with different pre-requisites. I wouldn't be surprised if people lose touch with these things after a decade of not using/needing them.
- rowanG077 7y agoMost people I know are unfamiliar with school-level math. They had it one or two decades ago and forget most of it. It's not a skill that is used day-to-day.
- DonaldPShimoda 7y agoFunctional programming is programming from a mathematical perspective — that's the essence of all of FP. Giving the unfamiliar a warning that "hey, this material is very math-y, and if you don't like math then this isn't for you" is a reasonable disclaimer.
- Iwan-Zotow 7y agoFP is basically algebra in some unusual form, therefore ...
- coldtea 7y ago>Why do materials on functional programming always have to be at least somewhat condescending towards the reader? Or maybe: why such sentences seems to appear only in them? Because who else will get to put in such a sentence? A PHP tutorial, or some Javascript one? On what intellectual grounds would they even be able to justify it? Besides, the accusation is not even true. You can find many C tutorials that are equally "somewhat condescending towards the reader" -- eg. for not understanding pointers, not knowing how the metal works, etc...
- nn3 7y agoAt least part of the reason d'etre for FP is to make people who took a lot of math courses at university feel like they didn't waste their education.
- austincheney 7y agoYeah, this is completely unnecessary. All programming is algebra as algebra is the math logic and instructions. I tell people who do analysis and planning for work they are doing calculus all day without realizing it as calculus is the math of continuous change. As a result an analyst who has never programmed before may find the concept of lambda calculus far easier to understand in practice without being a math scholar.
- deleted 7y ago[deleted]
- deleted 7y ago[deleted]
- blondin 7y agohaha, i was going to count and report the number of analogies to beauty, nature, painting, etc. but Chrome gave up on me. (come now Chrome, a PDF inside an HTML page making you crawl like a baby turtle!) glad to find this comment though. it's the other thing that's a little bothersome with the FP community -- at least for me. to be honest, i don't think they realize they are doing any of this. they just seem like the PHD level mathematicians, so to speak, of the programming community!
- agumonkey 7y agoBecause people do struggle on the topic. It's a fair warning.
- qwerty456127 7y agoIt hang my PC and I had to use the reset button. The CPU load went 100% and never fallen back (I waited for about 15 minutes). The PC became so extremely slow I couldn't even log-in to another Linux console. I retried on Windows an it (the download button) worked just fine however.
- shmageggy 7y agoThis page completely hung my Android phone too
- boznz 7y agoThe web page kills a chromebook.. wtf
- blunte 7y agoIt choked my Mac too. Apparently there's an embedded PDF viewer or PDF->HTML viewer in the Github page, and clearly it is not designed for a 450+ page PDF file.
- lewisjoe 7y agoI put together a list of links that helped me get a hang of things on my journey understanding the theories behind languages and their design - https://docs.google.com/document/d/1hFch8y9RVab9A7U6ocUzfmPQVOJSEoki4AF7Z2vE6X8/edit?usp=sharing https://docs.google.com/document/d/1hFch8y9RVab9A7U6ocUzfmPQ... The list isn't ordered or complete yet. I just started the doc today. I'll be adding stuff as I move along.
- mlevental 7y agoi haven't read this book but in undergrad I skimmed his linear algebra and it was great. it's still the clearest introduction to wedge and exterior products I've ever seen.
- Sam_Harris 7y agoBad link?
- baby 7y agoHere's the direct download link: https://github.com/winitzki/sofp/raw/master/sofp-src/sofp.pdf https://github.com/winitzki/sofp/raw/master/sofp-src/sofp.pd...
- amelius 7y agoPerhaps pedantic, but mathematics is not science, and neither is functional programming. See: https://undsci.berkeley.edu/article/mathematics https://undsci.berkeley.edu/article/mathematics > Mathematics is such a useful tool that science could make few advances without it. However, math and standard sciences, like biology, physics, and chemistry, are distinct in at least one way: how ideas are tested and accepted based on evidence. Math doesn't rely on testing ideas against evidence from the natural world in the same way that other sciences do. Mathematical ideas are often accepted based on deductive proofs, while ideas in other sciences are generally accepted based on the accumulation of many different observations supporting the idea.
- BlueGh0st 7y agoExtremely pedantic. In fact, contradicted by your own reference. >The answer depends on one's philosophical views on the nature of mathematics — and in this area, philosophers and mathematicians have not reached a consensus >... >Now it's up to you. How is math similar to and different from science?
- seanmcdirmid 7y agoFrom Wikipedia: > Science (from the Latin word scientia, meaning "knowledge") is a systematic enterprise that builds and organizes knowledge in the form of testable explanations and predictions about the universe. > Mathematics (from Greek μάθημα máthēma, "knowledge, study, learning") includes the study of such topics as quantity (number theory), structure (algebra), space (geometry), and change (mathematical analysis). It has no generally accepted definition. One of those words is a bit more defined than the other. I’m not sure how the above qualifies as science.
- goatlover 7y agoScience is an investigation of the empirical, and as such relies on induction, whereas math is deductive and non-empirical. Even if Platonism is true, we don't gain knowledge of math via the senses (mathematical truths are not out there in the world but rather some non-material realm).
- 7y ago
- russellbeattie 7y agoThis is a real question for anyone who might know: Have mathematicians as a whole ever thought about moving from the age-old formulas using various Greek symbols to something more akin to a programming language? What I mean is, instead of writing π to instead use "pi", or "summation()" rather than using the capital sigma? Functions like sin(), cos(), etc. already look like that, I wonder why the derivative sign and others haven't been changed. Superscript and subscript as well, and prime marks. It all seems superfluous. I guess what I'm asking is there an alternative to traditional mathematical notation that's commonly used?
- dodobirdlord 7y agoNone that are widely used. What you're suggesting has no advantage over the existing approach and would significantly reduce the speed at which practitioners can read and write mathematical expressions. This is somewhat evident in your example of sin() and cos(). Even in situations like the trig functions where concepts aren't represented with special sigils (because there are too many of them and it would be silly), they are abbreviated in standard ways. sine -> sin() cosine -> cos() tangent -> tan() cotangent -> cot() secant -> sec() hyperbolic sine -> sinh() hyperbolic cotangent -> coth() etc.
- BeetleB 7y ago>What I mean is, instead of writing π to instead use "pi", or "summation()" rather than using the capital sigma? Mathematicians would like to use one symbol for one entity. Is pi the same as π or just p multiplied by i? As for summation vs Sigma? It'd take much longer to write, and probably a bigger pain to read. Having double summations is extremely common, and triple summations are fairly common as well. If you're doing mathematical manipulations/derivations with these, you'll have them on each line. The terse syntax exists for a reason - it's efficient. If you read fairly old math books (e.g. from the Arabs, or even more resent), you'll see that they were very expressive. The use of symbols for algebra was a significant advancement in math.
- agumonkey 7y agoMIT SICM book does try this. Iirc sussman (and maybe Steele), weren't happy about the syntax. Thus re-expressing Lagrangian mechanics in a scheme.
- nafizh 7y agoCan anyone please comment on the book as a learning material for practical functional programming? All of the comments here are going on tangents (which is ok, but please also comment on the source material).