Lesson plan
Direct function
A direct function (dfn, pronounced "dee fun") is an alternative way to define a function and operator (a higher-order function) in the programming language APL. A direct operator can also be called a dop (pronounced "dee op"). They were invented by John Scholes in 1996. They are a unique combination of array programming, higher-order function, and functional programming, and are a major distinguishing advance of early 21st century APL over prior versions. A dfn is a sequence of possibly guarded expressions (or just a guard) between {{code| |apl}}, separated by or new-lines, wherein denotes the left argument and the right, and denotes recursion (function self-reference). For example, the function tests whether each row of is a Pythagorean triplet (by testing whether the sum of squares equals twice the square of the maximum). PT← {(+/⍵*2)=2×(⌈/⍵)*2} PT 3 4 5 1 x 4 5 3 3 11 6 5 13 12 17 16 8 11 12 4 17 15 8 PT x 1 0 1 0 0 1 The factorial function as a dfn: fact← {0=⍵:1 ⋄ ⍵×∇ ⍵-1} fact 5 120 fact¨ ⍳10 ⍝ fact applied to each element of 0 to 9 1 1 2 6 24 120 720 5040 40320 362880
Article summary
A direct function (dfn, pronounced "dee fun") is an alternative way to define a function and operator (a higher-order function) in the programming language APL. A direct operator can also be called a dop (pronounced "dee op"). They were invented by John Scholes in 1996. They are a unique combination of array programming, higher-order function, and functional programming, and are a major distinguishing advance of early 21st century APL over prior versions. A dfn is a sequence of possibly guarded expressions (or just a guard) between {{code| |apl}}, separated by or new-lines, wherein denotes the left argument and the right, and denotes recursion (function self-reference). For example, the function tests whether each row of is a Pythagorean triplet (by testing whether the sum of squares equals twice the square of the maximum). PT← {(+/⍵*2)=2×(⌈/⍵)*2} PT 3 4 5 1 x 4 5 3 3 11 6 5 13 12 17 16 8 11 12 4 17 15 8 PT x 1 0 1 0 0 1 The factorial function as a dfn: fact← {0=⍵:1 ⋄ ⍵×∇ ⍵-1} fact 5 120 fact¨ ⍳10 ⍝ fact applied to each element of 0 to 9 1 1 2 6 24 120 720 5040 40320 362880
Key claims
- release date: 1997 — source: Wikipedia, revision 1374649097, retrieved 2026-10-20 · confidence 0.95
Discussion questions
- Summarise the article in your own words. Which single claim would you verify first, and why?
- The record states that the release date is "1997". What evidence would count against this claim?
- Which claim in this article is most likely to be revised as the sources update? How would you check its current status?
- If two sources disagreed about one of these facts, what would you need in order to trust one over the other?
Bibliography
- Wikipedia, “Direct function”, revision 1374649097, retrieved 2026-10-20 https://en.wikipedia.org/w/index.php?oldid=1374649097
Key claims and bibliography are generated from the same tracked claims and sources as the article page.