Hi, is it possible to get a condensed stack trace where recursive calls are
collapsed into one line in the printout of the stack trace? For example
suppose that I have :

***************************************************************
(* test.ml *)
PolyML.Compiler.debug := true;
open PolyML.Debug;
breakAt("test.ml",12);

fun is_divisible(n : int, currentDivisor : int) =
  if currentDivisor <= n - 1 then
    n mod currentDivisor = 0
    orelse
    is_divisible(n, currentDivisor + 1)
  else
    false; (* This is line 12 *)

fun is_prime(n : int) : bool =
  if n = 2 then
    true
  else
    not(is_divisible(n, 2));

fun main() =
  is_prime(11);
***************************************************************

Then upon running as follows :

> poly

> use "test.ml";

> main();
test.ml  line:12 function:is_divisible
    false; (* This is line 12 *)

> stack();
> test.ml  line:12 function:is_divisible
  test.ml  line:8 function:is_divisible
  test.ml  line:8 function:is_divisible
  test.ml  line:8 function:is_divisible
  test.ml  line:8 function:is_divisible
  test.ml  line:8 function:is_divisible
  test.ml  line:8 function:is_divisible
  test.ml  line:8 function:is_divisible
  test.ml  line:8 function:is_divisible
  test.ml  line:8 function:is_divisible
  test.ml  line:18 function:is_prime
  test.ml  line:21 function:main
  test.ml  line:4 function:?
val it = (): unit
debug >

The recursive call to "is_divisible" takes up most of the space of the
printout of the stack trace. Is it a possible to get a condensed form of
this printout, for example something like :

  test.ml  line:12 function:is_divisible
  test.ml  line:8 function:is_divisible [***repeated 9 times***]
  test.ml  line:18 function:is_prime
  test.ml  line:21 function:main
  test.ml  line:4 function:?

Thanks
_______________________________________________
polyml mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Reply via email to