From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 021E9BC3C for ; Tue, 16 Aug 2005 00:40:49 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j7FMenKV011650 for ; Tue, 16 Aug 2005 00:40:49 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id AAA29852 for ; Tue, 16 Aug 2005 00:40:48 +0200 (MET DST) Received: from mz2.forethought.net (mzpi4.forethought.net [216.241.36.13]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j7FMelZn032225 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Tue, 16 Aug 2005 00:40:48 +0200 Received: from [216.241.35.41] (helo=[10.0.0.2]) by mz2.forethought.net with esmtp (Exim 4.51) id 1E4ndN-0002CK-75 for caml-list@inria.fr; Mon, 15 Aug 2005 16:40:45 -0600 Message-ID: <43011A10.4090108@havenrock.com> Date: Mon, 15 Aug 2005 16:41:20 -0600 From: Matt Gushee User-Agent: Mozilla Thunderbird 1.0 (X11/20050108) X-Accept-Language: en-us, en MIME-Version: 1.0 To: caml-list@inria.fr Subject: Re: [Caml-list] Snd question References: <161F0D30A699A84A8B7435B62BCE33B30360E19F@APS-MSG-01.southpacific.corp.microsoft.com> In-Reply-To: <161F0D30A699A84A8B7435B62BCE33B30360E19F@APS-MSG-01.southpacific.corp.microsoft.com> X-Enigmail-Version: 0.86.1.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Miltered: at concorde with ID 430119F1.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 430119EF.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 anu:01 ocaml:01 'int:01 bool:01 'x':01 char:01 beginner's:01 ...:98 buzz:98 wrote:01 arbitrary:01 pair:01 tuples:01 tuples:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 Anu Engineer wrote: > Please forgive me if my question is very naïve, I am very new to Ocaml. I was > wondering why snd returns an error when I use it with more than 2 elements, why > not return the rest of the list when I apply to something larger than a pair ? Your question shows your misunderstanding: snd operates on tuples, not lists. If it did operate on lists the length wouldn't matter, because length doesn't affect the type of a list. I.e. [ 1; 2; 3; ... n ] is of type 'int list' whether it has 4 elements or 40,000,000. Whereas tuples have the same type if and only if they have the same number of members, and all members have the same types. E.g: VALUE TYPE (1, 2) int * int (1, 2, 4) int * int * int (57, false) int * bool ('x', "buzz") char * string There is no such thing as a tuple with an arbitrary number of members, thus no function that can operate on one. I hope that clarifies things a bit. By the way, this sort of question is probably best asked on the beginner's list (you'll see the address at the bottom of this message). -- Matt Gushee Englewood, CO, USA