News for hackers. Stuff that matters.
Re:Translating math into code with examples in Java, Racket,... by hyperjeff on Tuesday May 28, 2019 @04:12PM (#20033881)
Yes, well said. Math is not any form of programming, and programming is not math. Studying the relations between the two can be very helpful, and the difference itself is interesting. One may have specific reasons to us FP to cleanly decouple from certain kinds of side-effects, but there’s nothing un-mathy about mutability, and there are times when it’s a fine choice.
Re:Translating math into code with examples in Java, Racket,... by mruts on Wednesday May 29, 2019 @07:16AM (#20038758)
I mean, that’s exactly what the Curry-Howard Isomorphism says: that math and programming are equivalent.

Both can express and are equivalent to Turing machines.

Re:Translating math into code with examples in Java, Racket,... by pron on Thursday May 30, 2019 @05:51AM (#20049692)
That is not what the Curry-Howard Isomorphism -- AKA propositions-as-types -- says. Propositions-as-types is the observation that the typing rules of certain type systems follow the inference rules of certain logics (largely because they were designed this way), and that in general typing rules and inference rules can be made to mimic one another, so that a type system can represent propositions in some logic, and type checking represent proof-checking.

That arbitrary mathematical proofs can be equivalently made by Turing machines (and conversely, that predicate calculus is Turing complete) is a lemma by Turing, published in the same 1936 paper in which he introduced the notion of computation, Turing machines and proved what today is known as the halting problem.

Re:Translating math into code with examples in Java, Racket,... by brianberns on Tuesday May 28, 2019 @06:07PM (#20034902)
Can you provide an example of mutability in, say, high school or undergraduate math?
Re:Translating math into code with examples in Java, Racket,... by mlevental on Tuesday May 28, 2019 @06:53PM (#20035208)
any sum with an index of summation requires mutability
Re:Translating math into code with examples in Java, Racket,... by chobytes on Tuesday May 28, 2019 @07:18PM (#20035373)
"requires" is a strong word. the only explicit definition ive seen given for n-ary summations and products products was recursive.
Re:Translating math into code with examples in Java, Racket,... by brianberns on Wednesday May 29, 2019 @09:05AM (#20039625)
I don't think so. For example, sum of first 5 integers:

    sum i = 1 to 5 of i -> 1 + 2 + 3 + 4 + 5 = 15
Nothing mutable there. In functional programming this is done with a `fold`, which doesn't use mutation.
Re:Translating math into code with examples in Java, Racket,... by pron on Wednesday May 29, 2019 @11:39AM (#20041448)
We're talking about notation. Anything could be described in any Turing complete language. It's uncommon to have something similar to mutation in ordinary mathematical notation, but summation is one example where it's used.