Function-operator overloading: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Line 1: Line 1:
In [[APL syntax]], '''function-operator overloading''' (sometimes '''schizophrenia'''<ref>The term ''schizophrenia'' used to be associated with [[wikipedia:split personality|''split personality'']] by the general population but that usage went into decline when it became known as a separate disorder. The informal usage has lived on in APL circles when referring to the "split personality" exhibited in primitives affected by function-operator overloading.</ref>) is the practice of using a single [[glyph]] for both a [[primitive function]] and a [[primitive operator]], which is then characterised as a '''hybrid''' primitive. Dialects with this feature include [[Dyalog APL]], [[NARS2000]], [[A+]], and [[GNU APL]]. Most commonly it refers to one of the slash glyphs (such as <source lang=apl inline>/</source> for [[Replicate]] or [[Reduce]]), but [[assignment]] may also be handled in a similar manner because ordinary assignment has the form of a [[dyadic function]] while [[modified assignment]] works like a [[monadic operator]] applied dyadically. It may apply only to the glyphs themselves, or to their values as well: for example, in [[Dyalog APL]] the assignments <source lang=apl inline>r←/</source> and even <source lang=apl inline>r←/[3]</source> create variables <source lang=apl inline>r</source> which exhibit overloading.
In [[APL syntax]], '''function-operator overloading''' (sometimes '''schizophrenia'''<ref>The term ''schizophrenia'' used to be associated with [[wikipedia:split personality|''split personality'']] by the general population but that usage went into decline when it became known as a separate disorder. The informal usage has lived on in APL circles when referring to the "split personality" exhibited in primitives affected by function-operator overloading.</ref>) is the practice of using a single [[glyph]] for both a [[primitive function]] and a [[primitive operator]], which is then characterised as a '''hybrid''' primitive. Dialects with this feature include [[Dyalog APL]], [[NARS2000]], [[A+]], and [[GNU APL]]. Most commonly it refers to one of the slash glyphs (such as <source lang=apl inline>/</source> for [[Replicate]] or [[Reduce]], but not <source lang=apl inline>⍉</source> for [[Transpose]]), but [[assignment]] may also be handled in a similar manner because ordinary assignment has the form of a [[dyadic function]] while [[modified assignment]] works like a [[monadic operator]] applied dyadically. It may apply only to the glyphs themselves, or to their values and derivations as well: for example, in [[Dyalog APL]] the assignments <source lang=apl inline>r←/</source> and even <source lang=apl inline>r←/[3]</source> create variables <source lang=apl inline>r</source> which exhibit overloading.


The following glyphs may be subject to function-operator overloading:
The following glyphs may be subject to function-operator overloading:

Navigation menu