From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by sympa.inria.fr (Postfix) with ESMTPS id E7DB97EEAF for ; Fri, 18 Jan 2013 08:08:21 +0100 (CET) Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of flux-caml@inside.org) identity=pra; client-ip=130.230.4.42; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="flux@modeemi.cs.tut.fi"; x-sender="flux-caml@inside.org"; x-conformance=sidf_compatible Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of flux@modeemi.cs.tut.fi) identity=mailfrom; client-ip=130.230.4.42; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="flux@modeemi.cs.tut.fi"; x-sender="flux@modeemi.cs.tut.fi"; x-conformance=sidf_compatible Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail.cs.tut.fi) identity=helo; client-ip=130.230.4.42; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="flux@modeemi.cs.tut.fi"; x-sender="postmaster@mail.cs.tut.fi"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AsoBALD0+FCC5gQqe2dsb2JhbABFFr40DgEBFiYEI4IfAQUnE08LISUPAQQYRIgZu3+OEIMpA5YMgRySJA X-IronPort-AV: E=Sophos;i="4.84,490,1355094000"; d="scan'208";a="190497341" Received: from mail.cs.tut.fi ([130.230.4.42]) by mail1-smtp-roc.national.inria.fr with SMTP; 18 Jan 2013 08:08:07 +0100 Received: from amavis2.cs.tut.fi (amavis2.cs.tut.fi [130.230.4.70]) by mail.cs.tut.fi (Postfix) with ESMTP id 0124D3C6 for ; Fri, 18 Jan 2013 09:08:07 +0200 (EET) Received: from mail.cs.tut.fi ([130.230.4.42]) by amavis2.cs.tut.fi (amavis2.cs.tut.fi [130.230.4.70]) (amavisd-maia, port 10024) with ESMTP id 14097-37 for ; Fri, 18 Jan 2013 09:08:06 +0200 (EET) Received: from modeemi.modeemi.fi (modeemi.modeemi.fi [130.230.72.134]) by mail.cs.tut.fi (Postfix) with SMTP id 5184C3C5 for ; Fri, 18 Jan 2013 09:08:06 +0200 (EET) Received: from coffee.modeemi.fi (coffee.modeemi.fi [130.230.72.140]) by modeemi.modeemi.fi (Postfix) with ESMTP id 559DD1690F for ; Fri, 18 Jan 2013 09:08:12 +0200 (EET) Received: by coffee.modeemi.fi (Postfix, from userid 17990) id 498912D6088; Fri, 18 Jan 2013 09:08:12 +0200 (EET) From: Erkki Seppala To: caml-list@yquem.inria.fr References: <871udjt7e1.fsf@golf.niidar.ru> <87r4ljrogn.fsf@golf.niidar.ru> Date: Fri, 18 Jan 2013 09:08:12 +0200 In-Reply-To: <87r4ljrogn.fsf@golf.niidar.ru> (Ivan Gotovchits's message of "Fri, 18 Jan 2013 10:32:08 +0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: Maia Mailguard 1.0.2 Subject: Re: [Caml-list] Removing repeating code Ivan Gotovchits writes: > let f = function | Strings a | Floats a -> Array.length a;; > ^^^^^^^^^^^^^^^^^^^^ > Error: This pattern matches values of type string array > but a pattern was expected which matches values of type float array Ah, sorry, I completely missed that they were different kind of arrays, which was of course the point of the example. But as far as I know, there is no way to remove code duplication in this case, barring tucking the code 'away' to another function or doing tricks with Obj.magic. (Well, unless the GADT support brings something to new the table related to this, but I wouldn't know.) -- _____________________________________________________________________ / __// /__ ____ __ http://www.modeemi.fi/~flux/\ \ / /_ / // // /\ \/ / \ / /_/ /_/ \___/ /_/\_\@modeemi.fi \/