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=1.0 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr 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 13C5CBC6B for ; Sat, 3 Nov 2007 04:07:02 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAP+BK0fRVca/i2dsb2JhbACOagIBCAIGJAU X-IronPort-AV: E=Sophos;i="4.21,365,1188770400"; d="scan'208";a="18887807" Received: from rv-out-0910.google.com ([209.85.198.191]) by mail4-smtp-sop.national.inria.fr with ESMTP; 03 Nov 2007 04:07:01 +0100 Received: by rv-out-0910.google.com with SMTP id k20so833149rvb for ; Fri, 02 Nov 2007 20:06:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=GrbZnhsi6c5kC4FNKlXo3bD/z1dX7nk2GDHcbXvR9ZI=; b=hPJTRc3FD8YUaEYy9q01kfSIF3Hs1bfn/BqzIf/Ff2jv3wmFrwrAliV4Dvk4Fe6wNa6kPYsjnt0F+SAVxG1On2903MEoFEldUfr71KhNHMELegFSb9CsHxSic36itJKktgdGdpFLc5F9zJnSe1qCOi5aP+rl8UQhwnYjD7X3+go= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Y2aAEX2/unHpUb3+/jVhZ6sb7g6EicZrZ5oi922OnqnQo8mtHzRM6ktLYm7fzlsUMN8i+nD0JlKyyhQv4ClsqtIM+BNNNwETJ2Ql+LpFUSYFre19e8WdoYXFYZDp0ceZkguXO16JmtvMTWtz34a6mrQpF1iepNyUoiuQpDBn1/w= Received: by 10.142.191.2 with SMTP id o2mr725516wff.1194059219750; Fri, 02 Nov 2007 20:06:59 -0700 (PDT) Received: by 10.143.7.13 with HTTP; Fri, 2 Nov 2007 20:06:59 -0700 (PDT) Message-ID: Date: Fri, 2 Nov 2007 20:06:59 -0700 From: "Nathaniel Gray" To: "Robert Fischer" Subject: Re: [Caml-list] Preferred Way to Split a List Cc: caml-list@yquem.inria.fr In-Reply-To: <47272F1D.1030703@fischerventure.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <47266DB7.1020009@SmokejumperIT.com> <20071030004558.GA3860@iron.mattcox.ca> <47272F1D.1030703@fischerventure.com> X-Spam: no; 0.00; cheers:01 wrote:01 exception:01 caml-list:01 tail:01 constraints:03 preserve:03 let:03 let:03 raise:03 shorter:04 hmm:04 caltech:05 caltech:05 probably:07 On Oct 30, 2007 6:18 AM, Robert Fischer wrote: > > > Do you need to preserve ordering in the sublists? > > > Yes. > > Do they need to be roughly equivalent lengths? > No -- the head list will probably be shorter than the tail list. Hmm... let fast_list_splitter = function | h :: t -> [h], t | [] -> [], [] (* Or maybe raise an exception? *) Or if you're really shooting for speed: let golly_it's_fast_list_splitter lst = [], lst I win. Seriously, you must have *some* further constraints! Cheers, -n8 -- >>>-- Nathaniel Gray -- Caltech Computer Science ------> >>>-- Mojave Project -- http://mojave.cs.caltech.edu -->