From: "Nathaniel Gray" <n8gray@gmail.com>
To: "Robert Fischer" <robert@fischerventure.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Preferred Way to Split a List
Date: Fri, 2 Nov 2007 20:06:59 -0700 [thread overview]
Message-ID: <aee06c9e0711022006o5239e217lc6451644f8ad2c0b@mail.gmail.com> (raw)
In-Reply-To: <47272F1D.1030703@fischerventure.com>
On Oct 30, 2007 6:18 AM, Robert Fischer <robert@fischerventure.com> 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 -->
next prev parent reply other threads:[~2007-11-03 3:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-29 23:33 Robert Fischer
2007-10-30 0:45 ` [Caml-list] " Matthew William Cox
2007-10-30 13:18 ` Robert Fischer
2007-11-03 3:06 ` Nathaniel Gray [this message]
2007-10-30 1:20 ` Julien Moutinho
2007-10-30 1:38 ` Karl Zilles
2007-10-30 5:46 ` skaller
2007-10-30 7:58 ` Alain Frisch
2007-10-29 9:34 ` Christophe Raffalli
2007-10-30 11:31 ` skaller
2007-10-30 12:30 ` David Allsopp
2007-10-30 15:03 ` Christophe Raffalli
2007-10-30 11:15 ` skaller
2007-10-30 13:05 ` Brian Hurt
2007-10-30 7:50 ` Jon Harrop
2007-10-30 13:20 ` Robert Fischer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aee06c9e0711022006o5239e217lc6451644f8ad2c0b@mail.gmail.com \
--to=n8gray@gmail.com \
--cc=caml-list@yquem.inria.fr \
--cc=robert@fischerventure.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox