Home

Ask HN: Could C find a future in being used instead of pseudocode in papers?

1 pointsby kensaiabout 1 year ago
I recently came across a comment of someone asking the author of a blog post to consider writing his code examples (could have been also pseudocode) in Rust instead of C.<p>The answer of the blog author was: “I&#x27;m using C in lieu of imperative pseudocode. The benefit it has over pure pseudocode is that it compiles and doesn&#x27;t rely on some syntax I pulled out of nowhere. The benefit over higher-level languages is that it shows the mechanics of the calculation in a way that&#x27;s trivial to transpose to any other dialect. This can&#x27;t be said about code that uses cute but language-specific array manipulation and iteration idioms, e.g.:<p>WalshMatrix = Nest[ArrayFlatten@{{#, #}, {#, -#}} &amp;, 1, #] &amp;;”<p>Do you think C or some future version&#x2F;adaptation of it could be used to formally substitute all pseudocode examples in the future, especially in proofs&#x2F;papers?

1 comment

eesmithabout 1 year ago
No.<p>We have historical precedence in ALGOL. From its Wikipedia page, it &quot;was the standard method for algorithm description used by the Association for Computing Machinery (ACM) in textbooks and academic sources for more than thirty years.&quot;<p>When was the last time you saw ALGOL?<p>In parallel, we can also look to APL, which arose out of a mathematical notation for arrays. From <a href="https:&#x2F;&#x2F;codegolf.stackexchange.com&#x2F;questions&#x2F;162254&#x2F;generate-a-walsh-matrix" rel="nofollow">https:&#x2F;&#x2F;codegolf.stackexchange.com&#x2F;questions&#x2F;162254&#x2F;generate...</a> the Walsh matrix in APL (Dyalog Unicode) is (⍪⍨,⊢⍪-)⍣⎕⍪1. For those who think in APL, I suppose that makes obvious sense.<p>ALGOL users and APL users would never agree on a single language.<p>You will not get C and Mathematica users to agree in a single language.<p>You will not get Python and Rust users to agree on a single language.<p>People doing computer assisted proofs use tools like the Coq Theorem, which has its own language.