⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fig7_4.pl

📁 超多的prolog源代码 具体内容见压缩包里面的programs.txt
💻 PL
字号:
% Figure 7.4   An implementation of the findall relation.


findall( X, Goal, Xlist)  :-
  call( Goal),                         % Find a solution
  assertz( queue(X) ),                 % Assert it
  fail;                                % Try to find more solutions
  assertz( queue(bottom) ),            % Mark end of solutions
  collect( Xlist).                     % Collect the solutions 

collect( L)  :-
  retract( queue(X) ), !,              % Retract next solution
  ( X == bottom, !, L = []             % End of solutions?
    ;
    L = [X | Rest], collect( Rest) ).  % Otherwise collect the rest 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -