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

📄 fig23_12.pl

📁 超多的prolog源代码 具体内容见压缩包里面的programs.txt
💻 PL
字号:
%  Figure 23.12  A pattern-directed program to find the greatest 
%  common divisor of a set of numbers.

%  The follwing directive is required by some Prologs:

:-  dynamic num/1.

%  Production rules for finding greatest common divisor (Euclid algorithm)

:-  op( 800, xfx, --->).
:-  op( 300, fx, num).

[ num X, num Y, X > Y ]  --->
[ NewX is X - Y, replace( num X, num NewX) ].

[ num X]  --->  [ write( X), stop ].


%  An initial database

num 25.
num 10.   
num 15.   
num 30.

⌨️ 快捷键说明

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