Browse thread
List.combine stack overflow
- Roland Zumkeller
[
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: | List.combine stack overflow |
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