[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Roland Zumkeller <roland.zumkeller@g...> |
| Subject: | Re: [Caml-list] to merge list of lists |
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/