From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id C8C73BC6B for ; Thu, 10 Jan 2008 20:49:32 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAD8FhkfAbSoIh2dsb2JhbACQHwEBAQgKKZkX X-IronPort-AV: E=Sophos;i="4.24,267,1196636400"; d="scan'208";a="7655208" Received: from concorde.inria.fr ([192.93.2.39]) by mail3-smtp-sop.national.inria.fr with ESMTP; 10 Jan 2008 20:49:32 +0100 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id m0AJnW6h009355 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Thu, 10 Jan 2008 20:49:32 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAD8FhkfAbSoIh2dsb2JhbACQHwEBAQgKKZkX X-IronPort-AV: E=Sophos;i="4.24,267,1196636400"; d="scan'208";a="7655207" Received: from einhorn.in-berlin.de ([192.109.42.8]) by mail3-smtp-sop.national.inria.fr with ESMTP; 10 Jan 2008 20:49:31 +0100 X-Envelope-From: oliver@first.in-berlin.de X-Envelope-To: Received: from einhorn.in-berlin.de (localhost [127.0.0.1]) by einhorn.in-berlin.de (8.13.6/8.13.6/Debian-1) with ESMTP id m0AJnVOa030272 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Thu, 10 Jan 2008 20:49:31 +0100 Received: (from www-data@localhost) by einhorn.in-berlin.de (8.13.6/8.13.6/Submit) id m0AJnVS1030270 for caml-list@inria.fr; Thu, 10 Jan 2008 20:49:31 +0100 X-Authentication-Warning: einhorn.in-berlin.de: www-data set sender to oliver@first.in-berlin.de using -f Received: from dslb-088-073-077-156.pools.arcor-ip.net (dslb-088-073-077-156.pools.arcor-ip.net [88.73.77.156]) by webmail.in-berlin.de (IMP) with HTTP for ; Thu, 10 Jan 2008 20:49:31 +0100 Message-ID: <1199994571.478676cb3ea26@webmail.in-berlin.de> Date: Thu, 10 Jan 2008 20:49:31 +0100 From: Oliver Bandel To: caml-list@inria.fr Subject: Re: [Caml-list] Annoying behaviour of OCaml References: <4786312A.1050003@functionality.de> <20080110152017.GA513@stratocaster.home> In-Reply-To: <20080110152017.GA513@stratocaster.home> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.6 X-Scanned-By: MIMEDefang_at_IN-Berlin_e.V. on 192.109.42.8 X-Miltered: at concorde with ID 478676CC.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; bandel:01 in-berlin:01 ocaml:01 arrays:01 10,:98 equality:01 char:01 wrote:01 oliver:01 oliver:01 caml-list:01 int:01 int:01 behaviour:01 unexpected:03 Zitat von Eric Cooper : > On Thu, Jan 10, 2008 at 02:52:26PM +0000, Thomas Fischbacher wrote: > > compare [|1;2;3|] [|4;5|];; (* ...but actially is not: this gives > 1, > > supposedly because the second list is > > shorter than the first. > > *) > > This is indeed unexpected behavior: > # compare "123" "45";; > - : int = -1 This is what I would expect. It's the way I know. check each char on equality. The first comparision gives you, that "1" < "5", and the comparison is done. > # compare [1;2;3] [4;5];; > - : int = -1 > # compare [|1;2;3|] [|4;5|];; > - : int = 1 ooops?! That's a point, where I would look into the the documentation now ;-) because it's also unexpected for me. Does comapre use different properties to comapare arrays and lists? Lists: compare element by element; Array: comapre length?! Ciao, Oliver