Previous: Semantic functions, Up: Formal semantics [Contents][Index]
lookup⁡:U→Ide→L
lookup⁡=λ⁣ρ⁣I.ρ⁣I
extends⁡:U→Ide∗→L∗→U
extends⁡=
λ⁣ρ⁣I∗α∗.
#⁡I∗=0→ρ,
extends⁡(ρ⁡[(α∗↓1)/(I∗↓1)])⁣(I∗†1)⁣(α∗†1)
wrong⁡:X→C[implementation-dependent]
send⁡:E→K→C
send⁡=λ⁣ϵ⁣κ.κ⁡〈ϵ〉
single⁡:(E→C)→K
single⁡=
λ⁣ψ⁣ϵ∗.
#⁡ϵ∗=1→ψ⁡(ϵ∗↓1),
wrong⁡“wrong number of return values”
new⁡:S→(L+{error})[implementation-dependent]
hold⁡:L→K→C
hold⁡=λ⁣α⁣κ⁣σ.send⁡(σ⁣α↓1)⁣κ⁣σ
assign⁡:L→E→C→C
assign⁡=λ⁣α⁣ϵ⁣θ⁣σ.θ⁡(update⁡α⁣ϵ⁣σ)
update⁡:L→E→S→S
update⁡=λα⁣ϵ⁣σ.σ⁣[〈ϵ,true〉/α]
tievals⁡:(L∗→C)→E∗→C
tievals⁡=
λ⁣ψ⁣ϵ∗σ.
#⁡ϵ∗=0→ψ⁣〈〉⁣σ,
new⁡σ∈L→tievals⁡
(λ⁣α∗.ψ⁡(〈new⁡σ|L〉§α∗))
(ϵ∗†1)
(update⁡(new⁡σ|L)⁣(ϵ∗↓1)⁣σ),
wrong⁡“out of memory”⁣σ
tievalsrest⁡:(L∗→C)→E∗→N→C
tievalsrest⁡=
λ⁣ψ⁣ϵ∗ν.list⁡
(dropfirst⁡ϵ∗⁣ν)
(single⁡(λ⁣ϵ.tievals⁡ψ⁣((takefirst⁡ϵ∗⁣ν)§〈ϵ〉)))
dropfirst⁡=λ⁣l⁣n.n=0→l,dropfirst⁡(l†1)⁣(n−1)
takefirst⁡=λ⁣l⁣n.n=0→〈〉,〈l↓1〉§(takefirst⁡(l†1)⁣(n−1))
truish⁡:E→T
truish⁡=λ⁣ϵ.ϵ=false→false,true
permute⁡:Exp∗→Exp∗[implementation-dependent]
unpermute⁡:E∗→E∗[inverse ofpermute⁡]
applicate⁡:E→E∗→P→K→C
applicate⁡=
λ⁣ϵ⁣ϵ∗⁣ω⁣κ.ϵ∈F→(ϵ|F↓2)⁣ϵ∗⁣ω⁣κ,wrong⁡“bad procedure”
onearg⁡:(E→P→K→C)→(E∗→P→K→C)
onearg⁡=
λ⁣ζ⁣ϵ∗⁣ω⁣κ.
#⁡ϵ∗=1→ζ⁣(ϵ∗↓1)⁣ω⁣κ,
wrong⁡“wrong number of arguments”
twoarg⁡:(E→E→P→K→C)→(E∗→P→K→C)
twoarg⁡=
#⁡ϵ∗=2→ζ⁣(ϵ∗↓1)(ϵ∗↓2)⁣ω⁣κ,
threearg⁡:(E→E→E→P→K→C)→(E∗→P→K→C)
threearg⁡=
#⁡ϵ∗=3→ζ⁣(ϵ∗↓1)(ϵ∗↓2)(ϵ∗↓3)⁣ω⁣κ,
list⁡:E∗→P→K→C
list⁡=
λ⁣ϵ∗⁣ω⁣κ.
#⁡ϵ∗=0→send⁡null⁡κ,
list⁡(ϵ∗†1)⁣(single⁡(λ⁣ϵ.cons⁡〈ϵ∗↓1,ϵ〉⁣κ))
cons⁡:E∗→P→K→C
cons⁡=
twoarg⁡(λ⁣ϵ1⁣ϵ2⁣κ⁣ωσ.
new⁡σ∈L→
(λ⁣σ′.new⁡σ′∈L→
send⁡
(〈
new⁡σ|L,new⁡σ′|L,true〉
inE
κ
(update⁡(new⁡σ′|L)⁣ϵ2⁣σ′),
wrong⁡“out of memory”⁣σ′)
(update⁡(new⁡σ|L)⁣ϵ1⁣σ),
wrong⁡“out of memory”⁣σ)
less⁡:E∗→P→K→C
less⁡=
twoarg⁡(λ⁣ϵ1⁣ϵ2⁣ω⁣κ.
(ϵ1∈R∧ϵ2∈R)→
send⁡(ϵ1|R<ϵ2|R→true,false)⁣κ,
wrong⁡“non-numeric argument to<”)
add⁡:E∗→P→K→C
add⁡=
send⁡((ϵ1|R+ϵ2|R)inE)⁣κ,
wrong⁡“non-numeric argument to+”)
car:E∗→P→K→C
car=
onearg⁡(λ⁣ϵ⁣ω⁣κ.
ϵ∈Ep→car-internal⁡ϵ⁣κ,
wrong⁡“non-pair argument tocar”)
car-internal⁡:E→K→C
car-internal⁡=λ⁣ϵ⁣ω⁣κ.hold⁡(ϵ|Ep↓1)⁣κ
cdr:E∗→P→K→C[similar tocar]
cdr-internal:E→K→C[similar tocar-internal]
setcar:E∗→P→K→C
setcar=
ϵ1∈Ep→
(ϵ1|Ep↓3)→assign⁡
(ϵ1|Ep↓1)
ϵ2
(send⁡unspecified⁡κ),
wrong⁡“immutable argument toset-car!”,
wrong⁡“non-pair argument toset-car!”)
eqv:E∗→P→K→C
eqv=
(ϵ1∈M∧ϵ2∈M)→
send⁡(ϵ1|M=ϵ2|M→true,false)⁣κ,
(ϵ1∈Q∧ϵ2∈Q)→
send⁡(ϵ1|Q=ϵ2|Q→true,false)⁣κ,
(ϵ1∈H∧ϵ2∈H)→
send⁡(ϵ1|H=ϵ2|H→true,false)⁣κ,
send⁡(ϵ1|R=ϵ2|R→true,false)⁣κ,
(ϵ1∈Ep∧ϵ2∈Ep)→
(
(λ⁣p1⁣p2.(
(p1↓1)=(p2↓1)∧
(p1↓2)=(p2↓2))→true,
false)
(ϵ1|Ep)
(ϵ2|Ep))
κ,
(ϵ1∈Ev∧ϵ2∈Ev)→…,
(ϵ1∈Es∧ϵ2∈Es)→…,
(ϵ1∈F∧ϵ2∈F)→
((ϵ1|F↓1)=(ϵ2|F↓1)→true,false)
send⁡false⁡κ)
apply:E∗→P→K→C
apply=
ϵ1∈F→valueslist⁡ϵ2⁣(λ⁣ϵ∗.applicate⁡ϵ1⁣ϵ∗⁣ω⁣κ),
wrong⁡“bad procedure argument toapply”)
valueslist⁡:E→K→C
valueslist⁡=
λ⁣ϵ⁣κ.
ϵ∈Ep→
cdr-internal⁡
ϵ
(λ⁣ϵ∗.
valueslist⁡
ϵ∗
car-internal⁡
(single⁡(λ⁣ϵ.κ(〈ϵ〉§ϵ∗))))),
ϵ=null→κ〈〉,
wrong⁡“non-list argument tovalues-list”
cwcc
:E∗→P→K→C
[call-with-current-continuation]
cwcc=
ϵ∈F→
(λ⁣σ.
applicate⁡
〈
new⁡σ|L,
λ⁣ϵ∗⁣ω′⁣κ′.travel⁡ω′⁣ω(κ⁣ϵ∗)〉
inE〉
ω
(update⁡
(new⁡σ|L)
unspecified⁡
σ),
wrong⁡“out of memory”σ),
wrong⁡“bad procedure argument”)
travel⁡:P→P→C→C
travel⁡=
λ⁣ω1⁣ω2.travelpath⁡(
(pathup⁡ω1⁣(commonancest⁡ω1⁣ω2))§
(pathdown⁡(commonancest⁡ω1⁣ω2)⁣ω2))
pointdepth⁡:P→N
pointdepth⁡=
λ⁣ω.ω=root→0,1+(pointdepth⁡(ω|(F×F×P)↓3))
ancestors⁡:P→𝒫⁣P
ancestors⁡=
λ⁣ω.ω=root→{ω},{ω}∪(ancestors⁡(ω|(F×F×P)↓3))
commonancest⁡:P→P→P
commonancest⁡=
λ⁣ω1⁣ω2.
the only element of⁡
{ω′∣
ω′∈(ancestors⁡ω1)∩(ancestors⁡ω2),
pointdepth⁡ω′≥pointdepth⁡ω″
∀⁡ω″∈(ancestors⁡ω1)∩(ancestors⁡ω2)}
pathup⁡:P→P→(P×F)∗
pathup⁡=
ω1=ω2→〈〉,
〈(ω1,ω1|(F×F×P)↓2)〉§
(pathup⁡(ω1|(F×F×P)↓3)ω2)
pathdown⁡:P→P→(P×F)∗
pathdown⁡=
(pathdown⁡ω1(ω2|(F×F×P)↓3))§
〈(ω2,ω2|(F×F×P)↓1)〉
travelpath⁡:(P×F)∗→C→C
travelpath⁡=
λ⁣π∗⁣θ.
#⁡π∗=0→θ,
((π∗↓1)↓2)
〈〉((π∗↓1)↓1)
(λ⁣ϵ∗.travelpath⁡(π∗†1)θ)
dynamicwind:E∗→P→K→C
dynamicwind=
threearg⁡
(λ⁣ϵ1⁣ϵ2⁣ϵ3⁣ω⁣κ.(ϵ1∈F∧ϵ2∈F∧ϵ3∈F)→
ϵ1⁣〈〉⁣ω(λ⁣ζ∗.
ϵ2⁣〈〉⁣((ϵ1|F,ϵ3|F,ω)inP)
(λ⁣ϵ∗.applicate⁡ϵ3⁣〈〉ω(λ⁣ζ∗.κ⁣ϵ∗))),
values:E∗→P→K→C
values=λ⁣ϵ∗⁣ω⁣κ.κ⁣ϵ∗
cwv:E∗→P→K→C[call-with-values]
cwv=
twoarg⁡(λ⁣ϵ1⁣ϵ2⁣ω⁣κ.applicate⁡ϵ1⁣〈〉ω⁣(λ⁣ϵ∗.applicate⁡ϵ2⁣ϵ∗⁣ω))