[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Impressed but confused, gluing a list together...
From: |
Michał Bieliński |
Subject: |
Re: Impressed but confused, gluing a list together... |
Date: |
Wed, 2 Oct 2013 00:01:31 +0200 |
User-agent: |
SquirrelMail/1.4.21 |
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
- Impressed but confused, gluing a list together..., emacstheviking, 2013/10/01
- Re: Impressed but confused, gluing a list together..., emacstheviking, 2013/10/01
- Re: Impressed but confused, gluing a list together..., Michał Bieliński, 2013/10/01
- Re: Impressed but confused, gluing a list together..., Sean Charles, 2013/10/01
- Re: Impressed but confused, gluing a list together..., Sean Charles, 2013/10/01
- Re: Impressed but confused, gluing a list together...,
Michał Bieliński <=
- Re: Impressed but confused, gluing a list together..., Sean Charles, 2013/10/01
- Re: Impressed but confused, gluing a list together..., Sean Charles, 2013/10/01
- Re: Impressed but confused, gluing a list together..., Michał Bieliński, 2013/10/01
- Re: Impressed but confused, gluing a list together..., Sean Charles, 2013/10/01