% A module MyList using a record to return related operations declare MyList in local fun {Append Xs Ys} case Xs of nil then Ys [] X|Xr then X|{Append Xr Ys} end end fun {Length Xs} case Xs of nil then 0 [] X|Xr then 1+{Length Xr} end end in MyList=rec(append:Append length:Length) end {Browse {MyList.length [1 2 3 4]}} {Browse {MyList.append [a b] [c d e]}} declare App=MyList.append % A functor invocation returns a module declare fun {MyListFunctor} fun {Append Xs Ys} case Xs of nil then Ys [] X|Xr then X|{Append Xr Ys} end end fun {Length Xs} case Xs of nil then 0 [] X|Xr then 1+{Length Xr} end end in rec(append:Append length:Length) end declare MyList2={MyListFunctor} MyList3={MyListFunctor} {Browse {MyList3.append [1 2] [5 6]}} % Assuming file in MyList.oz compiled and in the right directory: declare [MyList]={Module.link ['./MyList.ozf']} {Browse {MyList.append [4 5] [6 7]}}