Skip to content
Discussion options

You must be logged in to vote

fixed 😊

:- use_module(clpz).


from_to(To, To).
from_to(From, To) :-
    From #< To,
    From #> 0,
    NextFrom #= From + 1,
    from_to(NextFrom, To).


?- from_to(From, 5).
%@    From = 5
%@ ;  From = 4
%@ ;  From = 3
%@ ;  From = 2
%@ ;  From = 1
%@ ;  false.

https://git.sr.ht/~whereiseveryone/prolog-scratch/tree/master/loop.pl#L12

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by jgarte
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants