Let [x] be a label.
0 procedure tclose([x]) 1 if head([x]) is a token 2 then 3 tail = tclose(tail([x])); 4 closure = []; 5 for t in tail 6 closure = conc(conc(head([x]), t), 7 closure); 8 return closure; 9 else 10 closure = []; 11 for h in tclose(head([x])) 12 for t in tclose(tail([x]) 13 closure = conc(apnd(h, t), 14 closure); 15 return closure;