Hacker News Comments on
The Haskell Road to Logic, Maths and Programming. Second Edition (Texts in Computing)
·
8
HN comments
- This course is unranked · view top recommended courses
Hacker News Stories and Comments
All the comments and stories posted to Hacker News that reference this book.I like Julia for all of the libraries, the Lisp underneath, however, from the article:"Many of the encodings are as immutable, purely functional data structures (even in imperative languages), a topic unfortunately omitted from many computer science curricula."
Julia and similar PLs don't express math like APL, J[1], Haskell[2], Scheme[3] or even Clojure can with immutable structures and function composition to name a couple. Sure you can write it in Julia, but I don't think the article is about creating math output in the Latexify.jl example, but how to code these math structures where certain languages can express them out of the box in an easier manner.
[1] https://www.jsoftware.com/books/pdf/
[2] https://www.amazon.com/Haskell-Logic-Programming-Second-Comp...
[3] https://mitpress.mit.edu/sites/default/files/titles/content/...
⬐ adamnemecekIdk why apl or haskell would be any better.⬐ new4thaccount⬐ ddragonI'm not as opinionated on Haskell, but APL is both a programming language AND executable math notation. It's just the notation is different than what most are already used to.Can you explain it better? I do agree with Haskell due to laziness by default and arrow types for example, but against Scheme and Clojure the only aspect seels like it would be the more strict rebinding/shadowing rules (which doesn't limit what you can express, just that you can also express non-mathematical expressions).Primitive types (like pretty much all languages) are immutable and structs in Julia are immutable by default (which includes pretty much every math type like complex numbers), and all math operators are non mutating (in fact mutating operators should have a ! in the name).
Function composition is just as simple in this scenario:
f(x) = x + 2
g(x) = 2x
h = g ∘ f
h(3) == 10
⬐ eggy@ddragon your points are well taken. I will look further into Julia. I still think when I wrote "out of the box" with APL in mind as far as expressing math, or J for that matter if you learn the ASCII symbols. I've seen other examples since your post on Julia that show similar math expressiveness, but they seem to rely on libraries or the syntactic sugar provided by the libraries. I haven't tried your example, but it looks like vanilla Julia. My familiarity with Matlab makes Julia an easy choice for me too.Here is a simple example in J:
+/ % #
The above is an average function in J. It is a fork, where you fold right over the input (+/), and divde (%) by the tally (#) or count of items, so that
(+/ % #) 4.5 3 2 12
produces 5.375 as the average of the input vector. Notice the array-based language deals with singular quantities or scalars, vectors, and multi-dimensional arrays as fundamentals of the PL.
You could also define it as:
average =: +/ % #
for those who make the readability argument, however, you learn math symbols and read math papers full of them, and not lengthy verbal descriptions of these math formulas (average is equal to the "sum all of the input elements, and divde by the count or tally of input items").
The fact that a highly-functional APL program can fit on one screen negates the argument that you need readability, so that when you pick up or someone else picks up, your 110K lines of JavaScript code they can make a change. You may have to do a refresh read in APL and J, but because it is terse, you can deal it pretty quickly. Well-commented code in the 100k to 1 million lines of code scale will never allow one person to see the whole picture.
The work by Aaron Hsu in APL is amazing. Here is a link to the slides from a talk he gave. It's a bit lengthy but I found it very interesting and appropriate to this topic:
https://sway.office.com/b1pRwmzuGjqB30On
The YouTube link to the talk is here:
I loved working through Ken Iverson's, the creator of APL, books in J: "Calculus", "Algebra", and the "Concrete Math Companion" (a companion Knuth and Patashnik's book "Concrete Math" in J)[1].I also like the Physics and Math in SICM (Structure and Interptretation of Classical Mechanics), and Scheme maps well to math equations, at least for me [2].
Julia does follow the way math is written, but I prefer Haskell. The book "The Haskell Road to Logic, Math and Programming" [3] is great, and this article on Geometric Algebra (GA) in Haskell is excellent [4].
[1] https://www.jsoftware.com/books/pdf/
[2] https://mitpress.mit.edu/sites/default/files/titles/content/...
[3] https://www.amazon.com/Haskell-Logic-Programming-Second-Comp...
The 2nd edition (2012) fixes this and recommends ghci -- http://www.amazon.com/Haskell-Programming-Second-Edition-Com...Worth the purchase!
While there is no "royal road" to mathematics for programmers who don't care about proofs, there is a programmer's road to proofs for those interested in Math.In fact, the book is even called "The Haskell Road to Logic, Maths and Programming" [0]. It covers mathematical notation, proof construction, and lots of interesting portions of discrete math that should be of interest to programmers. And large portions of the results are demonstrated or used in interesting Haskell programs.
[0] http://www.amazon.com/Haskell-Programming-Second-Edition-Com...
⬐ dysocoThat book is on my to-read list, yet I don't know what to think of a book that starts like this: http://i.imgur.com/rSc0fpw.png⬐ hcarvalhoalves⬐ rplacdBoth Haskell and LISP are in the "top-down" approach (approaching programming from an abstract angle, without concerns about the underlying machine), as opposed to the "bottom-up" approach (where you are explicitly managing I/O, memory, and the underlying machine is not abstracted away), like C or Ada.⬐ JulianMorrisonlambda calculus --> Haskell \--> LISP --> Scheme \--> Common Lisp
⬐ ef4The validity of that statement depends on your historical perspective.To the modern eye, we see radically different type systems and conclude they are as different as night and day.
But there was a time when the world was divided into people who thought anything higher-level than C or FORTRAN was stupid and impractical, and those who aspired to build more abstract languages. LISP was one of the rallying cries of the latter group. Haskell clearly falls into that group too.
⬐ slurryI' m not sure it makes a ton of sense either, even for an older book. OTOH, knowing a lot about programming language history/politics and knowing a lot about math and rigorous CS theory tend to be negatively correlated in my experience.I know I should be demonstrating that assertion with hard numbers, but in my defense I do know a lot about programming language history and politics. ;)
⬐ dysocoHm, that makes some sense, the book might be old, that's why.⬐ andrewflnr⬐ j2kunIt can't be that old, since according to Wikipedia Haskell itself is only about 23 years old. http://en.wikipedia.org/wiki/Haskell_(programming_language)And before that, there were the people who thought anyone using an assembler was wasting precious CPU cycles, and something like FORTRAN was considered heresy.The Acknowledgements has an interesting anecdote - Thierry Coquand, apparently, found the original lecture notes that would become the book out the blue and seems to have offered quite a bit.⬐ mathattackI would add that Project Euler (www.projecteuler.net) is a fun place to practice.To your point, many of the best solutions are done in Haskell. They make it seem so easy!
⬐ elviejoThe Haskell Road to Logic is a pretty good.I took a class on discrete mathematics only with formulas. I didn't understand any of it.
Then I read this book and all of it made sense.
"What I cannot program, I cannot understand.." (with my apologies to Feynman)
There is a really nice book trying to teach exactly this (among other things) called "The Haskell Road To Logic, Maths and Programming":http://www.amazon.com/Haskell-Logic-Maths-Programming-Comput...
⬐ gtaniavailable for free, according to
For those interested in learning Haskell, I can recommend the lesser known "Haskell Road to Logic, Maths, and Programming":http://www.amazon.com/Haskell-Logic-Maths-Programming-Comput...
It's great to go over old and new math concepts and do so while exploring Haskell.
⬐ gtirloniI've read numerous Haskell docs online and they are pretty good. However I felt the need for a more in-depth book and I chose "Haskell: The Craft of Functional Programming" (3rd edition) and I'm LOVING it. It's excellent and I recomment it for anyone starting on Haskell.ps.: I'm not a professional coder and my experience has been on using Python/Shell Script for sysadmin stuff only. However, I constantly read C code to figure out issues and how the book tries to make a parallel between FP and Imperative is quite nice for me.
⬐ twfarlandI'm going through this now. I've no math/logic background but wish to learn, so is perfect for where I'm at. Interactivity is a great learning tool. The book's focus isn't on real world software engineering though, so anyone expecting that should look elsewhere.⬐ darklajidI don't know. For me this sounds like a very bad idea.What is putting me off (tried building small things in Haskell a couple of times) is the already heavily buzzword compliant community, throwing not only a new language with new concept at me, but adding words that at first seem to be made up on the spot.
Additionally, as others have said here, I'm having most troubles interacting with the world (IO!). Pure functions (Math!) are ~easy~ to represent.
You suggest starting with that language and learning 'new math concepts' on the go?
(I'm sure this works for some people and hats off to you guys, but for me this increases the mental complexity immensely)
⬐ AdaptiveI think you raise a good point and I wouldn't want to put others off if this isn't commensurate with their learning style. I suspect the overlap between math geeks and haskell learners is pretty big, but one should, as you are, evaluate one's own preferred learning style against this approach.I find human languages are the same for me. I have always liked to approach them from a bottom up linguistic direction, but this means largely self-structured study.
> My goal is really to add math to my diet, ...I've started reading "The Haskell Road to Logic, Maths and Programming", maybe that's something for you or some other lurker here that would like to improve on math.
There is a review [2] that gives an interesting impression on the book. The other ones at amazon might also be interesting.
The table of contents + first chapter is available as a postscript file[3]. This should give you an idea what to expect from the book.
[1] http://www.amazon.com/Haskell-Logic-Maths-Programming-Comput...
[2] http://www.amazon.com/review/R3CL50MCVEO7UA/ref=cm_cr_pr_per...
⬐ jinfiestoI have this book as well has "How to Prove it." They cover virtually the same material, however I found the prose in "The Haskell Road" to be stilted and sometimes confusing. I got much more out of "How to Prove it."⬐ lostmypwInteresting; thank you for providing your perspective. Both books indeed share most of the topics, although from glancing at both TOCs HR seems to add Polynomials and Corecursion. I'll gladly keep this in mind should I get stuck with HR.⬐ jinfiestoThis isn't to say that HR is bad, on the contrary it's quite good. Be prepared to use Google though. How to Prove it is much more self-contained.It is true that HR covers Polynomials and Corecursion. If I were you, I'd order both and use How to Prove it if you get stuck with The Haskell Road. They're both very inexpensive.
this is sort of discrete math with haskell exampleshttp://www.amazon.com/Haskell-Logic-Maths-Programming-Comput...