3 ms·
I'm a mathematician and I'll be the first to say, this "declarative = mathematical" meme is completely inaccurate. If you look at most mathematical theorems an
by xamuel 11y ago
I'm a mathematician and I'll be the first to say, this "declarative = mathematical" meme is completely inaccurate. If you look at most mathematical theorems and proofs, they are mostly imperative.
Take for example the proof there are infinitely many primes. "Assume there are only finitely many primes (assume: imperative). Let them be called p_1,...,p_n (let: imperative). Let q=(p_1...p_n)+1 (let: imperative). Then q is not divisible by any of p_1,...,p_n, so q is prime (this is the only non-imperative line in the proof). Contradiction, discard the assumption and conclude there are infinitely many primes (imperative)."
The biggest "non-imperative" feature of mathematics is the way functions are first-class objects. But that's only considered to be "non-imperative" because of a historical fluke, there's no intrinsic reason why "first class functions" = "non-imperative", it's just that the early languages happened to be that way.