The following is a sealer-unsealer pattern in the language E. This is Bill Frantz’s version of Kevin Reid’s version.
def makeBrandPair(){
var temp := null
def sealer(val){
def box(){
temp := [val, box]
}; return box;}
def unsealer(box){
temp:= null
box()
def temp2 := temp
temp := null
if(temp2[1] == box){
return temp2[0]
}else throw
}
return [sealer, unsealer]
}
Indeed there is an application of this function in the makeMint code in the article above.
Here is the more elaborate official sealer.