Type: Difference between revisions

Jump to navigation Jump to search
862 bytes added ,  07:08, 9 July 2020
m (Text replacement - "{{APL built-ins}}" to "{{APL built-ins}}Category:Primitive functions")
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Built-ins|Type||}} is a [[monadic function]] which in the [[nested array model]] gives information about the type and structure of its argument array's [[element]]s. In normal cases, the result is identical to the argument, with all numbers replaced by zeros and all characters replaced by spaces, and the substitution is done recursively.
{| class=vertical-navbox style="float:right; font-size:500%; margin:0 1ex;"
|<code>∊</code> <code>⊤</code> <code>⍷</code>
|}
'''Type''' (<code></code>, <code></code>, <code>⍷</code>) is a [[monadic]] [[scalar function]] which in the [[nested array model]] gives information about the type and structure of its argument array's [[element]]s. In normal cases, the result is identical to the argument, with all numbers replaced by zeros and all characters replaced by spaces, and the substitution is done recursively.


== Support==
== Support==
Few dialects have Type as a [[primitive function]]. [[Dyalog APL]] uses <source lang=apl inline>∊</source> (as in ''prototypical '''e'''lement''), but only when [[migration level]] is 0, while [[NARS2000]] uses [[monadic]] <source lang=apl inline>⊤</source> (resembling the Latin letter '''T''' for '''''T'''ype''), which it inherited from [[NARS]].
Few dialects have Type as a [[primitive function]]. [[Dyalog APL]] uses <source lang=apl inline>∊</source> (as in ''prototypical '''e'''lement''), but only when [[migration level]] is 0, while [[NARS2000]] uses [[monadic]] <source lang=apl inline>⊤</source> (resembling the Latin letter '''T''' for '''''T'''ype''), which it inherited from [[NARS]]. [[Extended Dyalog APL]] uses monadic <source lang=apl inline>⍷</source> with the underscore indicating functionality of the corresponding non-underscored glyph from a non-default migration level.<ref>[[Partition]] is <source lang=apl inline>⊆</source> with migration level≤2 while the original glyph is <source lang=apl inline>⊂</source> as with migration level 3. Dyalog Language Reference Guide: [http://help.dyalog.com/latest/#Language/Symbols/Left%20Shoe.htm Left Shoe].</ref>


However, in all dialects that support nested arrays, the type can be determined by enclosing/boxing the array in an empty array, and then coercing out a fill value. Since the [[array prototype]] is used as fill element, the resulting array will be the type of the original array:
However, in all dialects that support nested arrays, the type can be determined by enclosing/boxing the array in an empty array, and then coercing out a fill value. Since the [[array prototype]] is used as fill element, the resulting array will be the type of the original array:
Line 19: Line 22:
</source>
</source>
{{Works in|[[Dyalog APL]] with [[migration level]]<nowiki>=</nowiki>1}}
{{Works in|[[Dyalog APL]] with [[migration level]]<nowiki>=</nowiki>1}}
 
== External links ==
{{APL built-ins}}[[Category:Primitive functions]]
=== Documentation ===
* [http://help.dyalog.com/latest/#Language/Primitive%20Functions/Type.htm Dyalog]
== References ==
<references/>
{{APL built-ins}}[[Category:Primitive functions]][[Category:Scalar monadic functions]]

Navigation menu