% Smoke tests for the WAM-lite execution engine.
% Standalone Flowlog defaults to WAM; the directive below keeps this file stable
% if defaults change in the future.

:- catch(set_prolog_flag(flowlog_engine, wam), _, true).

fact(0, 1).
fact(N, F) :-
  N > 0,
  N1 is N - 1,
  fact(N1, F1),
  F is N * F1.

p(1).
p(2).

count(Count) :-
  findall(1, p(_), Ones),
  length(Ones, Count).

ok :-
  % length/2 should be able to instantiate an open list tail when N is fixed.
  length([a|T], 3),
  T = [_,_],
  fact(5, F),
  F = 120,
  count(C),
  C = 2.
