[m-rev.] for review: fix bug with impure lambda expressions

Zoltan Somogyi zs at cs.mu.OZ.AU
Thu Aug 11 08:50:07 AEST 2005


On 10-Aug-2005, Julien Fischer <juliensf at cs.mu.OZ.AU> wrote:
> +    % Partition the lists of arguments and variables into lists
> +    % of non-output and output arguments and variables.
> +    %
> + :- pred partition_args_and_lambda_vars(
> +    module_info::in, list(prog_term)::in,
> +    list(prog_var)::in, list(mode)::in,
> +    list(prog_term)::out, list(prog_term)::out,
> +    list(prog_var)::out, list(prog_var)::out) is semidet.
> +
> +partition_args_and_lambda_vars(_, [], [], [], [], [], [], []).
> +partition_args_and_lambda_vars(ModuleInfo, [ Arg | Args ],
> +            [ LambdaVar | LambdaVars ],
> +            [Mode | Modes], InputArgs, OutputArgs,
> +            InputLambdaVars, OutputLambdaVars) :-
> +        partition_args_and_lambda_vars(ModuleInfo, Args, LambdaVars, Modes,
> +            InputArgs0, OutputArgs0, InputLambdaVars0, OutputLambdaVars0),
> +        ( mode_is_output(ModuleInfo, Mode) ->
> +            InputArgs        = InputArgs0,
> +            OutputArgs       = [Arg | OutputArgs0],
> +            InputLambdaVars  = InputLambdaVars0,
> +            OutputLambdaVars = [ LambdaVar | OutputLambdaVars0 ]
> +        ;
> +            InputArgs        = [ Arg | InputArgs0],
> +            OutputArgs       = OutputArgs0,
> +            InputLambdaVars  = [ LambdaVar | InputLambdaVars0 ],
> +            OutputLambdaVars = OutputLambdaVars0
> +        ).

arg_info.m already contains a bunch of predicates that do similar jobs.
Use one of them if possible. If not, move this predicate to arg_info.m.
Otherwise, the diff looks fine.

Zoltan.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list