123456789101112131415161718192021(******************************************************************************)(* _ __ * The Kappa Language *)(* | |/ / * Copyright 2010-2020 CNRS - Harvard Medical School - INRIA - IRIF *)(* | ' / *********************************************************************)(* | . \ * This file is distributed under the terms of the *)(* |_|\_\ * GNU Lesser General Public License Version 3 *)(******************************************************************************)type'at={waiting_elts:'alist;list:'alist}letempty={waiting_elts=[];list=[]}letis_emptyt=t.waiting_elts=[]&&t.list=[]letpushat={twithwaiting_elts=a::t.waiting_elts}letrecpopt=matcht.listwith|head::tail->{twithlist=tail},Somehead|[]->(matcht.waiting_eltswith|[]->t,None|list->pop{waiting_elts=[];list=List.revlist})