X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;ds=sidebyside;f=helm%2Focaml%2Fmathql_interpreter%2Funion.ml;fp=helm%2Focaml%2Fmathql_interpreter%2Funion.ml;h=0000000000000000000000000000000000000000;hb=869549224eef6278a48c16ae27dd786376082b38;hp=e2d9fcb01a7e75be68bc141783eca03ccb1423bf;hpb=89262281b6e83bd2321150f81f1a0583645eb0c8;p=helm.git diff --git a/helm/ocaml/mathql_interpreter/union.ml b/helm/ocaml/mathql_interpreter/union.ml deleted file mode 100644 index e2d9fcb01..000000000 --- a/helm/ocaml/mathql_interpreter/union.ml +++ /dev/null @@ -1,52 +0,0 @@ -(* Copyright (C) 2000, HELM Team. - * - * This file is part of HELM, an Hypertextual, Electronic - * Library of Mathematics, developed at the Computer Science - * Department, University of Bologna, Italy. - * - * HELM is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * HELM is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with HELM; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, - * MA 02111-1307, USA. - * - * For details, see the HELM World-Wide-Web page, - * http://cs.unibo.it/helm/. - *) - -(* - * implementazione del comando UNION - *) - - -(* Merges two attribute group lists preserves order and gets rid of duplicates*) -let rec merge l1 l2 = - match (l1,l2) with - [],l - | l,[] -> l - | g1::tl1,g2::_ when g1 < g2 -> g1::(merge tl1 l2) - | g1::_,g2::tl2 when g2 < g1 -> g2::(merge l1 tl2) - | g1::tl1,g2::tl2 -> g1::(merge tl1 tl2) -;; - -(* preserves order and gets rid of duplicates *) -let rec union_ex rs1 rs2 = - match (rs1, rs2) with - [],l - | l,[] -> l - | (uri1,l1)::tl1,(uri2,_)::_ when uri1 < uri2 -> (uri1,l1)::(union_ex tl1 rs2) - | (uri1,_)::_,(uri2,l2)::tl2 when uri2 < uri1 -> (uri2,l2)::(union_ex rs1 tl2) - | (uri1,l1)::tl1,(uri2,l2)::tl2 -> if l1 = l2 then (uri1,l1)::(union_ex tl1 tl2) - else (uri1,merge l1 l2)::(union_ex tl1 tl2) -;; - -