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

Sean Charles <[email protected]>
Newsgroups gmane.comp.gnu.prolog.general
Message-ID <[email protected]>
I get it… so that's a green cut then?

On 1 Oct 2013, at 23:01, "Michał Bieliński" <[email protected]> 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
> [email protected]
> https://lists.gnu.org/mailman/listinfo/users-prolog


_______________________________________________
Users-prolog mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/users-prolog
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.