Constructs¶
Declaration d¶
init s₁ end¶
The init declaration specifies how to initialize a portfolio with the statement s₁.
Example¶
1 2 3 4 5 6 | init
update pol in Policies
with
pol.Reserve = 3
end
end
|
manage s₁ end¶
Example¶
1 2 3 4 5 6 | manage
update pol in Policies
with
pol.Reserve = 3
end
end
|
The manage declaration specifies how to manage a portfolio with the statement s₁.
Statements s¶
update x in e₁ [where e₂] with s₁ end¶
Iterates over the list e₁ and performs the update specified by s₁.
It is optional to specify where e₂ as a filter
Example¶
1 2 3 4 | update pol in Policies
with
pol.Reserve = 3
end
|
1 2 3 4 5 | update pol in Policies
where Reserve < -2
with
pol.Reserve = 3
end
|
let x = e₁¶
Declares the variable x with the value of e₁
Example
“”“”“”“”“”“
1 2 3 4 5 | update pol in Policies
with
let newReserve = 3 * 3
pol.Reserve = newReserve
end
|
Expressions e¶
e₁:Tag¶
Filters the list e₁ using Tag.
1 2 3 4 | update group in Groups:Interest
with
group.Reserve = 33
end
|
1 2 3 4 | update group in Groups:{Interest, Expense}
with
group.Reserve = 33
end
|
let x = e₁ in e₂ end¶
Binds the variable x to e₁ within e₂.
1 2 3 4 5 6 7 8 | update group in Groups:Interest
with
group.Reserve =
let newReserve = 33
in
newReserve * newReserve
end
end
|
if e₁ then e₂ else e₃¶
Returns e₂ when e₁ is true and e₃ when e₁ is false.
1 2 3 4 | fun absolute(v : Float) =
if v < 0
then v * 0 - 1
else v
|
match e₁ with | Tag xᵢ -> eᵢ end¶
Returns the value eᵢ with a tag matching the value of e₁.
1 2 3 4 5 6 | fun interestFee(group : Group) =
match group with
| Interest iGrp -> iGrp.Fee
| Expense eGrp -> 0
| Risk rGrp -> 0
end
|