You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 *)
The text was updated successfully, but these errors were encountered:
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).
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.
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 *)
The text was updated successfully, but these errors were encountered: