Skip to content

Locally defined niladic functions

Vector 18:1, page 89

programming techniques

Transcribed from the printed issue; not yet reviewed. Read it in the PDF of the issue, page 89

f00←{} ⋄ f01←{} ⋄ f02←{}

might be naff but I’ve used it on occasion to localise names when I actually found the need (or at least the usefulness) to have locally defined NILADIC functions in a dynamic one.

On Stefano’s point and once again (I may even start getting paranoid here) using DEFINED operations, I’ve always kept my (Ep) operator handy.

    ∇ r←(f Ep)r
[1]   ⍝ En Passant
[2]   ⍝ Useful for running non explicit fns
        under dynamic or defined operators.
[3]    f r
    ∇

It’s redundant in these cases now as ⎕FREPLACE and ⎕WC both return results (as all functions always should have) but my first uses were

z←data∘⎕FREPLACE Ep If(×⍴data)+tie,comp

and

z←name∘⎕WC Ep If(9≠⎕NC name)+settings

Just thought I’d let you know.