<< Prev | - Up - | Next >> |
We start with domains whose elements are atoms or integer. These can be created as follows:
fun{Make Es} %% list(feature) -> domain
IndTable = {List.toTuple unit Es} %% record(int:feature)
fun{ToElement Ind}
IndTable.(Ind+1)
end
Size = {Length Es}
EleTable = {MakeRecord unit Es} %% record(feature:int)
%% the fields of EleTable are still free variables
for I in 0..Size-1 do
EleTable.{ToElement I} = I
end
fun{ToIndex Ele}
EleTable.Ele
end
in
unit(toIndex : ToIndex
toElement: ToElement
size : Size)
end
<< Prev | - Up - | Next >> |