Subject: Re: [SWIPL] keysort

From: Jonathan D Johnston <[email-masked]>
Date: Mon, 19 Feb 2001 21:14:41 -0500

On Tue, 20 Feb 2001 11:33:53 +1300 (NZDT) ",
Richard A. O'Keefe" <[email-masked]> wrote:
---------- >8 snip 8<-------------------------------
>     last_keys([], []) :- !.                % Green cut for inverse use
>     last_keys([L|Ls], [K-L|KLs]) :-
>         last(K, L),
>         last_keys(Ls, KLs).
> 
---------- >8 snip 8<-------------------------------
>     triple_keys([], []) :- !.                % Green cut for inverse
use
>     triple_keys([L|Ls], [K-L|KLs]) :-
>         L = [_,_,K],
>         triple_keys(Ls, KLs).
---------- >8 snip 8<-------------------------------

Dear Richard A. O'Keefe,

Would you explain your use of cut in the above predicates?
Also, why do you refer to them as "Green" cuts? During my
(limited) testing of these predicates, I didn't see any difference
with or without the cut. For those more experienced with
Prolog, this is probably an obvious question. For myself, though,
I must confess that I am still sometimes confused by when
to use cut.

Thank you for your insightful contributions to this mailing list.
I always look forward to reading your postings.

Jonathan D Johnston
________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today!  For your FREE software, visit:
http://dl.www.juno.com/get/tagj.