[m-dev.] for review: rewrite of termination analysis (part 2)
Christopher Rodd SPEIRS
crs at students.cs.mu.oz.au
Mon Dec 22 15:37:13 AEDT 1997
> +
> + at sp 1
> + at item --termination-single-argument-analysis @var{limit}
> + at itemx --term-single-arg @var{limit}
> +When performing termination analysis, try analyzing
> +recursion on single arguments in strongly connected
> +components of the call graph that have up to @var{limit} procedures.
Is it worth documenting that "setting this limit to zero disables single
argument termination analysis"?
>
> - % Given a bag, produce a sorted list with no duplicates
> + % Given a bag, produce a sorted list containing all the values in
> + % the bag. Each value will appear in the list once, with the
> + % associated value giving the number of times that it appears
> + % in the bag.
> +:- pred bag__to_assoc_list(bag(T), assoc_list(T, int)).
> +:- mode bag__to_assoc_list(in, out) is det.
> +
This comment should be clarified. Currently `value' is used to refer to
both the values stored in the bag, and the integer describing the number
of times each value occurs.
> +
> +list__take_upto(N, As, Bs) :-
> + (
> + N > 0
> + ->
> + N1 is N - 1,
> + (
> + As = [A | As1],
> + Bs = [A | Bs1],
> + list__take_upto(N1, As1, Bs1)
> + ;
> + As = [],
> + Bs = []
> + )
> ;
> Bs = []
> ).
Is there a particular reason that this predicate is not implemented as
list__take_upto(N, As, Bs) :-
( list__take(N, As, Bs0) ->
Bs = Bs0
;
Bs = As
).
It just seems like unnecessary code duplication.
Chris
More information about the developers
mailing list