declare fun {NewQueue} X in q(0 X X) end fun {Insert q(N S E) X} E1 in E=X|E1 q(N+1 S E1) end fun {Delete q(N S E) X} S1 in S=X|S1 q(N-1 S1 E) end