0atman
0atman

Reputation: 3374

Is there a formalised high-level notation for Pseudocode?

I'd like to be able to reason about code on paper better than just writing boxes or pseudocode.

The key thing here is paper. On a machine, I can most likely use a high-level language with a linter/compiler very quickly, and a keyboard restricts what can be done, somewhat.

A case study is APL, a language that we semi-jokingly describe as "write-only". Here is an example:

m ← +/3+⍳4

(Explanation: ⍳4 creates an array, [1,2,3,4], then 3 is added to each component, which are then summed together and the result stored in variable m.)

Look how concise that is! Imagine having to type those symbols in your day job! But, writing iota and arrows on a whiteboard is fine, saves time and ink.

Here's its haskell equivalent:

m = foldl (+) 0 (map (+3) [1..4])

And Python:

reduce(add, map(lambda x: x+3, range(4)))

But the principle behind these concise programming languages is different: they use words and punctuation to describe high-level actions (such as fold), whereas I want to write symbols for these common actions.

Does such a formalised pseudocode exist?

Upvotes: 2

Views: 353

Answers (1)

EvansWinner
EvansWinner

Reputation: 158

Not to be snarky, but you could use APL. It was after all originally invented as a mathematical notation before it was turned into a programming language. I seem to remember that there was something like what I think you are talking about in Backus' Turing Award lecture. Finally, maybe Z Notation is what you want: https://en.m.wikipedia.org/wiki/Z_notation

Upvotes: 2

Related Questions