Skip to content

Commit

Permalink
Fix steadfasness issue in the difflist::flatten/2 library predicate
Browse files Browse the repository at this point in the history
  • Loading branch information
pmoura committed Mar 15, 2019
1 parent 5afc28c commit 1084630
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions docs/_sources/difflist_0.rst.txt
Expand Up @@ -9,8 +9,8 @@
Difference list predicates. Difference list predicates.


| **Author:** Paulo Moura | **Author:** Paulo Moura
| **Version:** 1.16 | **Version:** 1.17
| **Date:** 2019/3/8 | **Date:** 2019/3/15
| **Compilation flags:** | **Compilation flags:**
| ``static, context_switching_calls`` | ``static, context_switching_calls``
Expand Down
2 changes: 1 addition & 1 deletion docs/_sources/index.rst.txt
Expand Up @@ -17,4 +17,4 @@ Indices and tables
* :ref:`genindex` * :ref:`genindex`
* :ref:`search` * :ref:`search`


Generated on Fri Mar 15 14:59:37 WET 2019 Generated on Fri Mar 15 16:39:47 WET 2019
4 changes: 2 additions & 2 deletions docs/difflist_0.html
Expand Up @@ -313,8 +313,8 @@ <h1><code class="docutils literal notranslate"><span class="pre">difflist</span>
<p>Difference list predicates.</p> <p>Difference list predicates.</p>
<div class="line-block"> <div class="line-block">
<div class="line"><strong>Author:</strong> Paulo Moura</div> <div class="line"><strong>Author:</strong> Paulo Moura</div>
<div class="line"><strong>Version:</strong> 1.16</div> <div class="line"><strong>Version:</strong> 1.17</div>
<div class="line"><strong>Date:</strong> 2019/3/8</div> <div class="line"><strong>Date:</strong> 2019/3/15</div>
</div> </div>
<div class="line-block"> <div class="line-block">
<div class="line"><strong>Compilation flags:</strong></div> <div class="line"><strong>Compilation flags:</strong></div>
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Expand Up @@ -2860,7 +2860,7 @@ <h1>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Pe
<li><a class="reference internal" href="genindex.html"><span class="std std-ref">Index</span></a></li> <li><a class="reference internal" href="genindex.html"><span class="std std-ref">Index</span></a></li>
<li><a class="reference internal" href="search.html"><span class="std std-ref">Search Page</span></a></li> <li><a class="reference internal" href="search.html"><span class="std std-ref">Search Page</span></a></li>
</ul> </ul>
<p>Generated on Fri Mar 15 14:59:37 WET 2019</p> <p>Generated on Fri Mar 15 16:39:47 WET 2019</p>
</div> </div>




Expand Down
14 changes: 8 additions & 6 deletions library/difflist.lgt
Expand Up @@ -23,9 +23,9 @@
extends(compound)). extends(compound)).


:- info([ :- info([
version is 1.16, version is 1.17,
author is 'Paulo Moura', author is 'Paulo Moura',
date is 2019/03/08, date is 2019/03/15,
comment is 'Difference list predicates.', comment is 'Difference list predicates.',
see_also is [list, list(_), numberlist, varlist] see_also is [list, list(_), numberlist, varlist]
]). ]).
Expand Down Expand Up @@ -96,12 +96,14 @@
flatten(List-Back, Flatted-Back) :- flatten(List-Back, Flatted-Back) :-
flatten(List-Back, Back-Back, Flatted-Back). flatten(List-Back, Back-Back, Flatted-Back).


flatten(Var, Tail-Back, [Var| Tail]-Back) :- flatten(Var, Tail-Back, Flatted) :-
var(Var), var(Var),
!. !,
flatten(List-Back, Flatted, Flatted) :- Flatted = [Var| Tail]-Back.
flatten(List-Back, Acc, Flatted) :-
List == Back, List == Back,
!. !,
Flatted = Acc.
flatten(List-Back, Acc, Flatted) :- flatten(List-Back, Acc, Flatted) :-
!, !,
List \== Back, List \== Back,
Expand Down

0 comments on commit 1084630

Please sign in to comment.