From: Roland Zumkeller <roland.zumkeller@gmail.com>
To: caml-list@yquem.inria.fr
Subject: List.combine stack overflow
Date: Wed, 1 Jul 2009 11:43:19 +0700 [thread overview]
Message-ID: <d02dcb040906302143t2c96fd80t7a1da27cab99844c@mail.gmail.com> (raw)
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
reply other threads:[~2009-07-01 4:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=d02dcb040906302143t2c96fd80t7a1da27cab99844c@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