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=2.4 required=5.0 tests=AWL,DNS_FROM_RFC_POST, SPF_NEUTRAL autolearn=disabled version=3.1.3 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id E1A6CBC37 for ; Wed, 1 Jul 2009 06:43:40 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmEBAKuGSkrRVd22mGdsb2JhbACYRD8BAQEBAQgJDAcTpGCBGpBKAQMCBIQLBQ X-IronPort-AV: E=Sophos;i="4.42,321,1243807200"; d="scan'208";a="42719779" Received: from mail-qy0-f182.google.com ([209.85.221.182]) by mail4-smtp-sop.national.inria.fr with ESMTP; 01 Jul 2009 06:43:40 +0200 Received: by qyk12 with SMTP id 12so126783qyk.1 for ; Tue, 30 Jun 2009 21:43:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:from:date:message-id :subject:to:content-type:content-transfer-encoding; bh=XaK3/HTDP29hZyhUIci66ie3Fdakdfxa9Fwisx3WDP8=; b=qOyNPl5k2COa/7KCfLLutR7UWCrVes3xbR+ULJ8g42lyAR3F3sMH6qBtiU9tg1HxKR CmUS5fufENycO5bFHVwnIZB6BMg4y4R6jZj2oKw7GCVQo4oMOCiSBpzbYIjjUyQBRjjU 9GZxMT7iU4rJX7pVXS7q2cXcv9RsMPZxPrhs8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type :content-transfer-encoding; b=LbGjq9YLXnHt5jhrh8SFCkz1S2h3h+fU56t2zOINtxv8g76J/W9/9PhKWGTAehNlPT UiiYGhXl1VaP6UsOyXTf67XjYh7lhGA1UXbcwPRMgHmv5ZJk14mnEhwl9qn8TihEsnDJ hxuPs8+OdoQ88zI8J7+ovT1/2LK7srSQfM3PU= MIME-Version: 1.0 Received: by 10.224.3.13 with SMTP id 13mr7556455qal.341.1246423419220; Tue, 30 Jun 2009 21:43:39 -0700 (PDT) From: Roland Zumkeller Date: Wed, 1 Jul 2009 11:43:19 +0700 Message-ID: Subject: List.combine stack overflow To: caml-list@yquem.inria.fr Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; recursion:01 stdlib:01 stack:01 stack:01 rec:01 rec:01 match:02 arg:03 library:03 let:03 let:03 overflow:03 overflow:03 compiled:04 fails:05 Hi, List.combine fails in this example: # let rec ulist = function 0 -> [] | n -> () :: ulist (n-1);; ... # let x = ulist 30000;; ... # List.combine x x;; Stack overflow during evaluation (looping recursion?). However, with a *copy* of 'combine' from stdlib/list.ml it suddenly works: # let rec combine l1 l2 = match (l1, l2) with ([], []) -> [] | (a1::l1, a2::l2) -> (a1, a2) :: combine l1 l2 | (_, _) -> invalid_arg "List.combine";; ... # combine x x;; [((), ()); ((), ()); ((), ()); ((), ()); ((), ()); ((), ()); ...] Why does 'combine' in the standard library behave differently from its own copy? Is it compiled with different options? Best, Roland