Type: Difference between revisions
Jump to navigation
Jump to search
no edit summary
Miraheze>Adám Brudzewsky (Created page with "{{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 elements. I...") |
Miraheze>Adám Brudzewsky No edit summary |
||
Line 6: | Line 6: | ||
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: | ||
<source lang=apl> | <source lang=apl> | ||
↑ 0 ⍴ ⊂ 1 2 'ab' | |||
┌─┬─┬──┐ | ┌─┬─┬──┐ | ||
│0│0│ │ | │0│0│ │ | ||
└─┴─┴──┘ | └─┴─┴──┘ | ||
</source> | </source> | ||
{{Works in|[[Dyalog APL]] with [[migration level]] | {{Works in|[[Dyalog APL]] with [[migration level]]≥2, [[APL2]], [[APLX]]}} | ||
<source lang=apl> | <source lang=apl> | ||
⊃ 0 ⍴ ⊂ 1 2 'ab' | |||
┌─┬─┬──┐ | ┌─┬─┬──┐ | ||
│0│0│ │ | │0│0│ │ | ||
└─┴─┴──┘ | └─┴─┴──┘ | ||
</source> | </source> | ||
{{Works in|[[Dyalog APL]] with [[migration level]] | {{Works in|[[Dyalog APL]] with [[migration level]]<nowiki>=</nowiki>1}} | ||
{{APL built-ins}} | {{APL built-ins}} |