[m-dev.] Re: change to library/queue.m

Andrew Bromage bromage at cs.mu.oz.au
Wed Oct 15 07:12:56 AEST 1997


You (Fergus Henderson) wrote:

> Maybe it would be worth implementing queue__put_list more efficiently.

How does this look?

queue__put_list(On0 - Off0, Xs, On - Off) :-
	( Off0 = [] ->
		On = On0,
		Off = Xs
	;
		Off = Off0,
		queue__put_list_2(Xs, On0, On)
	).

:- pred queue__put_list_2(list(T), list(T), list(T)).
:- mode queue__put_list_2(in, in, out) is det.

queue__put_list_2([], On, On).
queue__put_list_2([X | Xs], On0, On) :-
	queue__put_list_2(Xs, [X | On0], On).


Cheers,
Andrew Bromage



More information about the developers mailing list