Quantcast
Channel: Prolog return a list which contains only elements which are equal to head of the list - Stack Overflow
Browsing index pages (3 articles)
↧

Prolog return a list which contains only elements which are equal to head of...

Hello I would like to ask a doubt I have with the following code: principio([],[]). principio([H],[H]). principio([H,_|_],[H]). principio([H,H|C],P) :- principio([H|C],R),P=[H|R]. I would like a way...

View Article


Answer by false for Prolog return a list which contains only elements which...

Here is two ways how you can narrow down the problem. 1st, start from an unexpectedly failing query. 2nd, start from a query that should fail but rather succeeds. 1st Diagnose unexpected incompleteness...

View Article


Answer by tas for Prolog return a list which contains only elements which are...

In addition to the very nice answer provided by @false (+s(0)), I would point out the possibility to use DCGs for the task. They usually yield easily readable code when describing lists (see comments...

View Article
Browsing index pages (3 articles)


Latest Images