Denotative vs Procedural

For users of dfns, both novice and expert

Denotative vs Procedural

Postby JohnS|Dyalog on Sun Jul 30, 2017 2:12 pm

In Thursday's Webinar I banged on a bit about Denotative vs Procedural thinking. It was not my intention to imply that one paradigm is superior to the other and I certainly didn't mean to "dis" procedural programming. There's megabucks to be made with the representation and manipulation of state, as shareholders in Oracle Corp will attest.

The point I was trying to make is that at the deepest level, and while each has its place, the two mindsets are profoundly different. I was first introduced to programming in the procedural (first do this, then do that, ...) mood and it feels very natural to me for many tasks. For such jobs, I would probably tend to use traditional APL (tradfns) with their control structures and multiple re-assignments. On the other hand, some tasks seem to lend themselves to expression as a set of definitions. For these I would choose dfns and try to avoid re-specifying names.

    Procedural thinking: Mutate variables towards the required result.
    Denotative (inc "Functional") thinking: Develop definitions for the required result.

The merge operation, traditionally supplied by indexed assignment, is the final area of Dyalog in which I was forced to change my mode of thinking while in the denotative mood. Now we have @, I can stay within that mindset while I'm constructing my definitions.

Terminology: I have started using the term "denotative" for a number reasons:

[a] Stephen Taylor, drawing on his degree in philosophy, remarked after a presentation where I was trying to vocalise ← as "is", that "denotes" would be more accurate.

[b] Peter Landin, who must have some claim to be one of the fathers of functional programming said: "The word "denotative" seems more appropriate than nonprocedural, declarative or functional. The antithesis of denotative is "imperative".

[c] "Denotative" has a slightly broader connotation than "functional". In the following definitions:
    avg1←{sum←+⌿⍵ ⋄ num←≢⍵ ⋄ sum÷num}
    avg2←{sum←+⌿ ⋄ num←≢ ⋄ (sum÷num)⍵}
both are denotative; the second is (arguably) "more functional".



Re: Denotative vs Procedural

Postby ray on Tue Aug 01, 2017 2:04 am

I am tempted to suggest
Code: Select all
avg3←{sum←+⌿ ⋄ num←≢ ⋄ avg←sum÷num ⋄ avg ⍵}
Ray Cannon
Please excuse any smelling pisstakes.
User avatar
Posts: 176
Joined: Wed Feb 24, 2010 12:24 am
Location: Blackwater, Camberley. UK

Return to Functional Programming

Who is online

Users browsing this forum: No registered users and 1 guest