Materialise: Difference between revisions

Jump to navigation Jump to search
45 bytes added ,  21:51, 10 September 2022
m
Text replacement - "<source" to "<syntaxhighlight"
m (Text replacement - "</source>" to "</syntaxhighlight>")
m (Text replacement - "<source" to "<syntaxhighlight")
 
Line 1: Line 1:
{{Built-in|Materialise|⌷}} is a [[monadic]] [[primitive function]] which tries to cast the [[argument]] (which can be any object) into an APL array. If the argument is already an array, it is returned unmodified. It is only available in [[Dyalog APL]], which supports classes and .NET objects. Materialise shares its [[glyph]] <source lang=apl inline>⌷</syntaxhighlight> with [[Index (function)|Index]].
{{Built-in|Materialise|⌷}} is a [[monadic]] [[primitive function]] which tries to cast the [[argument]] (which can be any object) into an APL array. If the argument is already an array, it is returned unmodified. It is only available in [[Dyalog APL]], which supports classes and .NET objects. Materialise shares its [[glyph]] <syntaxhighlight lang=apl inline>⌷</syntaxhighlight> with [[Index (function)|Index]].


== Examples ==
== Examples ==
Line 5: Line 5:
Dyalog APL allows the user to define a class, which looks like the following:
Dyalog APL allows the user to define a class, which looks like the following:


<source lang=apl>
<syntaxhighlight lang=apl>
:Class cl
:Class cl
     :Property Default thing
     :Property Default thing
Line 18: Line 18:
If one property is declared as default, Materialise returns the value of the default property.
If one property is declared as default, Materialise returns the value of the default property.


<source lang=apl>
<syntaxhighlight lang=apl>
       ⊢cl  ⍝ It is an object
       ⊢cl  ⍝ It is an object
#.cl
#.cl
Line 29: Line 29:
Materialise can also be used on a .NET collection, which returns the underlying array of data.
Materialise can also be used on a .NET collection, which returns the underlying array of data.


<source lang=apl>
<syntaxhighlight lang=apl>
       ba←⎕NEW System.Collections.BitArray(⊂1 0 1 1 0)
       ba←⎕NEW System.Collections.BitArray(⊂1 0 1 1 0)
       ⍬≡⍴ba  ⍝ ba itself is a scalar object
       ⍬≡⍴ba  ⍝ ba itself is a scalar object
Line 39: Line 39:
Materialise is the same as [[Identity]] for APL arrays.
Materialise is the same as [[Identity]] for APL arrays.


<source lang=apl>
<syntaxhighlight lang=apl>
       (⌷≡⊢) 1 2 3 4 5
       (⌷≡⊢) 1 2 3 4 5
1
1

Navigation menu