dbo:abstract
|
- 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 <span class="kt">{</span><span class="w"></span> and <span class="kt">}</span><span class="w"></span>, separated by <span class="p">⋄</span><span class="w"></span> or new-lines, wherein <span class="bp">⍺</span> denotes the left argument and <span class="bp">⍵</span> the right, and <span class="bp">∇</span><span class="w"></span> denotes recursion (function self-reference). For example, the function <span class="nv">PT</span><span class="w"></span> tests whether each row of <span class="bp">⍵</span> 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 51 x 4 5 3 3 11 6 5 13 1217 16 811 12 417 15 8 PT x1 0 1 0 0 1 The factorial function as a dfn: fact← {0=⍵:1 ⋄ ⍵×∇ ⍵-1} fact 5120 fact¨ ⍳10 ⍝ fact applied to each element of 0 to 91 1 2 6 24 120 720 5040 40320 362880 (en)
|
dbo:thumbnail
| |
dbo:wikiPageID
| |
dbo:wikiPageLength
|
- 35442 (xsd:nonNegativeInteger)
|
dbo:wikiPageRevisionID
| |
dbo:wikiPageWikiLink
| |
dbp:wikiPageUsesTemplate
| |
dcterms:subject
| |
rdf:type
| |
rdfs:comment
|
- 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. PT← {(+/⍵*2)=2×(⌈/⍵)*2} PT 3 4 51 x 4 5 3 3 11 6 5 13 1217 16 811 12 417 15 8 PT x1 0 1 0 0 1 The factorial function as a dfn: (en)
|
rdfs:label
| |
owl:sameAs
| |
prov:wasDerivedFrom
| |
foaf:depiction
| |
foaf:homepage
| |
foaf:isPrimaryTopicOf
| |
is dbo:knownFor
of | |
is dbo:wikiPageRedirects
of | |
is dbo:wikiPageWikiLink
of | |
is foaf:primaryTopic
of | |