Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List.map length limit #7205

Closed
vicuna opened this issue Apr 1, 2016 · 2 comments
Closed

List.map length limit #7205

vicuna opened this issue Apr 1, 2016 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Apr 1, 2016

Original bug ID: 7205
Reporter: william
Assigned to: @alainfrisch
Status: resolved (set by @alainfrisch on 2017-02-24T14:57:37Z)
Resolution: suspended
Priority: normal
Severity: tweak
Platform: linux
OS: debian
OS Version: 8
Version: 4.02.3
Target version: undecided
Category: documentation

Bug description

Hello,
List.map works (on my platform) with a list length limit of 131033 elements.

  • List.map documentation should say that above this limit, there is a "Stack Overflow" exception (and for beginners it could be nice to indicate to use above this limit the "List.rev_map" function)

  • Or List.map documentation should refer to some other documentation parts explaining the limits of non tail recursive function, and wath is the limit of the "Stack"

  • same problem with recursive functions, it seems to be limited to 262065 calls

Best regards

Steps to reproduce

let rec make_n n = if n = 0 then [] else n::(make_n (n-1));;
let test i =
let lst = make_n i in
Printf.printf "ok\n%!";
List.map (fun i -> 0) lst;;

test 131033;;
test 131034;;
test 262065;; (* ok still printed )
test 262066;; (
ok not printed any more *)

@vicuna
Copy link
Author

vicuna commented Apr 1, 2016

Comment author: pcouderc

The number of recursive call limit is dependent of number of arguments and bytecode or native execution: on bytecode, the stack size can be changed using OCAMLRUNPARAM 1, while in native it is dependent of the OS.

For tail recursivity, it is actually stated at the beginning of the List module documentation 2 (it does not specifically state about the Stack_overflow exception though).

@vicuna
Copy link
Author

vicuna commented Feb 24, 2017

Comment author: @alainfrisch

Marking as suspended. The fact that List.map and other functions in List are non tail-rec is documented. Perhaps we should move to a version which support long lists, but this is another story.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants