packages feed

ychr-0.1.0.0: test/golden/bounded_cycle_three_nodes/bounded_cycle_three_nodes.chr

:- module(bounded_cycle_three_nodes, [result/1]).
:- use_module(library(prelude)).

:- chr_constraint result(int).

% Forbidden: f -> g -> h -> f. The cycle is longer than two nodes,
% exercising the cycle reconstruction path in dfs ('qn : reverse
% (takeWhile (/= qn) path) ++ [qn]') with a non-trivial 'path' length.
:- function f(T) -> T requiring g(T) -> T.
:- function g(T) -> T requiring h(T) -> T.
:- function h(T) -> T requiring f(T) -> T.

f(X) -> X.
g(X) -> X.
h(X) -> X.

result(R) <=> R is f(1).