Factors of an integer: Difference between revisions

m
→‎fac.m: Forgot to change to a more meaningful name.
(→‎fac.m: Improved argument processing to minimize the non-relevant code and to tie the predicate/function declarations closer to the point of definition.)
m (→‎fac.m: Forgot to change to a more meaningful name.)
Line 1,342:
main(!IO) :-
io.command_line_arguments(Args, !IO),
list.foldl(print_argprint_factors, Args, !IO).
 
:- pred factor(int::in, list(int)::out) is det.
Line 1,365:
 
:- pred print_arg(string::in, io::di, io::uo) is det.
print_argprint_factors(Arg, !IO) :-
(string.to_int(Arg, N) ->
factor(N, X),