Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* List.combine stack overflow
@ 2009-07-01  4:43 Roland Zumkeller
  0 siblings, 0 replies; only message in thread
From: Roland Zumkeller @ 2009-07-01  4:43 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-07-01  4:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-01  4:43 List.combine stack overflow Roland Zumkeller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox