Typing functions
Object.as
[type:string]→Object
Result: The As
function only provides a reference for the type inference mechanism. The result of the expression is considered to be of type <type>. As
is ignored in the actual formula evaluation.
Beispiele
Example1: Object.As
["depot"]
Example2: Object.As
["list(unknown)"]
Object.IfIs
[Type:String;Then:Expression;Else:Expression]→Object
Result: Type distinction. If the object is of type "Type", the "Then" expression is applied to the object with the IfIs
function, otherwise the "Else" expression is applied and the corresponding result is returned. At the same time, the type definition in the "Then" branch indicates that the object has the specified type and, if applicable, in the "Else" branch that the object does not have the specified type.
Beispiel 1
$x.WP.IfIs["Fund";Redemption;Close]
is roughly equivalent to
With[$x.WP](if(Is["Fund"];As["Fund"].Redemption;As[<type of $wp without "Fund">].Close)
Beispiel 2
Object.Is
[Type:String]→Βoolean
Result: The Is
function tests whether the object corresponds to the specified type.
Beispiele
Example1: Object.Is
["share"]
Example2: Object.Is
["number"]