users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Impressed but confused, gluing a list together...


From: Sean Charles
Subject: Re: Impressed but confused, gluing a list together...
Date: Tue, 1 Oct 2013 23:05:04 +0100

I get it… so that's a green cut then?

On 1 Oct 2013, at 23:01, "Michał Bieliński" <address@hidden> wrote:

> Dnia 1 Października 2013, 23:50, Wt, Sean Charles napisał:
>>> I added a cut to avoid the solution with trailing glue.
>>> join([X], _, [X]) :- !.
>> 
>> I am confused at the cut.. I have not yet experienced trailing glue,
>> that was the point of the second rule!?
> 
> When I compiled your initial example and tested it GNU Prolog returned two
> results.  I wanted only one.  The behavior without cut is this:
> 
> GNU Prolog 1.4.4 (32 bits)
> Compiled Apr 29 2013, 20:41:58 with gcc
> By Daniel Diaz
> Copyright (C) 1999-2013 Daniel Diaz
> 
> | ?- join("ABC", "Z", X).
> 
> X = [97,[122],98,[122],99] ? ;
> 
> X = [97,[122],98,[122],99,[122]]
> 
> yes
> 
> 
> With cut gprolog is satisfied with telling me the first solution.
> 
> -- 
> Michał Bieliński
> 
> 
> _______________________________________________
> Users-prolog mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/users-prolog




reply via email to

[Prev in Thread] Current Thread [Next in Thread]