caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Roland Zumkeller" <roland.zumkeller@gmail.com>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] to merge list of lists
Date: Wed, 7 Mar 2007 15:33:12 +0100	[thread overview]
Message-ID: <d02dcb040703070633ke4ac46er99b434ec2fd848cf@mail.gmail.com> (raw)
In-Reply-To: <200703050853.12223.jon@ffconsultancy.com>

On 05/03/07, Jon Harrop <jon@ffconsultancy.com> wrote:
> # let rec transpose list =
>     try map hd list :: transpose (map tl list) with _ -> [];;

Here is a slightly different version that raises an exception if the
given list is not quadratic:

let rec transpose xs =
  if for_all ((=) []) xs then [] else
    map hd xs :: transpose (map tl xs);;

-- 
http://www.lix.polytechnique.fr/~zumkeller/


  parent reply	other threads:[~2007-03-07 14:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-05  6:10 Pietro Abate
2007-03-05  8:37 ` [Caml-list] " skaller
2007-03-05  8:53   ` Jon Harrop
2007-03-05 19:02     ` skaller
2007-03-05 19:40       ` skaller
2007-03-07 14:33     ` Roland Zumkeller [this message]
2007-03-05  9:47 ` Zheng Li
2007-03-05 14:42   ` Zheng Li
2007-03-06  0:07 ` [Caml-list] " Pal-Kristian Engstad

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=d02dcb040703070633ke4ac46er99b434ec2fd848cf@mail.gmail.com \
    --to=roland.zumkeller@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    /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;
as well as URLs for NNTP newsgroup(s).