|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Prolog - Find missing elements of an ordered list
Hi,
I am trying to write a predicate that accepts a list of integers. It sorts this list and then determines if there are any gaps in the sequence: ? - game([2,6,7,5],X). X = [3,4] Here is what I have so far: Code:
find_hole([],[]). find_hole([H|T],End):- Test is H +1, find_hole(T,Final), Test != Final, Test::End. game(List,Result) :- sort(List,Result), find_hole(Result,Done). Any idea on what I am doing wrong? Thanks for your help |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Other Programming Languages > Prolog - Find missing elements of an ordered list |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|