跳轉到內容

Prolog/內建謂詞

來自華夏公益教科書,開放的書,開放的世界

ISO Prolog 中內建謂詞列表。

術語統一

[編輯 | 編輯原始碼]
=/2
Prolog 統一
unify_with_occurs_check/2
(\=)/2
不可 Prolog 統一

型別測試

[編輯 | 編輯原始碼]
var/1
如果術語當前是變數,則為真
atom/1
如果術語繫結到原子,則為真
integer/1
如果術語繫結到整數,則為真
float/1
如果術語繫結到浮點數,則為真
atomic/1
如果術語繫結到原子、整數或浮點數,則為真
compound/1
如果術語繫結到複合項,則為真
nonvar/1
如果術語不是變數,則為真
number/1
如果術語繫結到整數或浮點數,則為真

術語比較

[編輯 | 編輯原始碼]
(@=<)/2
術語小於或等於
(==)/2
術語相同
(\==)/2
術語不同
(@<)/2
術語小於
(@>)/2
術語大於
(@>=)/2
術語大於或等於

術語建立和分解

[編輯 | 編輯原始碼]
functor/3
arg/3
(=../2)
copy_term/2

算術運算

[編輯 | 編輯原始碼]
is/2

算術比較

[編輯 | 編輯原始碼]
'=:='/2
算術等於
'=\='/2
算術不等於
'<'/2
算術小於
'=<'/2
算術小於或等於
'>'/2
算術大於
'>='/2
算術大於或等於

子句檢索和資訊

[編輯 | 編輯原始碼]
clause/2
current_predicate/1

子句建立和銷燬

[編輯 | 編輯原始碼]
asserta/1
assertz/1
retract/1
abolish/1

所有解決方案

[編輯 | 編輯原始碼]
findall/3
bagof/3
setof/3

輸入和輸出

[編輯 | 編輯原始碼]

流選擇和控制

[編輯 | 編輯原始碼]
current_input/1
current_output/1
set_input/1
set_output/1
open/4, open/3
開啟流
close/1, close/2
關閉流
stream_property/2
at_end_of_stream/1, at_end_of_stream/0
set_stream_position/2

字元輸入輸出

[編輯 | 編輯原始碼]
get_char/2, get_char/1
get_code/2, get_code/1
peek_char/2, peek_char/1
peek_code/2, peek_code/1
put_char/2, put_char/1
put_code/2, put_code/1
nl/0, nl/1

從二進位制流中讀取

[編輯 | 編輯原始碼]
get_byte/2, get_byte/1
peek_byte/2, peek_byte/1
put_byte/2, put_byte/1

術語輸入和輸出

[編輯 | 編輯原始碼]
read_term/2, read_term/3
read/1, read/2

寫入術語

[編輯 | 編輯原始碼]
write_term/3, write_term/2
write/1, write/2
writeq/1, writeq/2
write_canonical/1, write_canonical/2

運算子

[編輯 | 編輯原始碼]
op/3
current_op/3

字元轉換

[編輯 | 編輯原始碼]
char_conversion/2
current_char_conversion/2

邏輯和控制

[編輯 | 編輯原始碼]
(\+)/1
不可證偽
once/1
repeat/0

原子處理

[編輯 | 編輯原始碼]
atom_length/2
atom_concat/3
sub_atom/5
atom_chars
atom_codes/2
char_code/2
number_chars/2
number_codes/2

實現定義的鉤子

[編輯 | 編輯原始碼]
set_prolog_flag/2
current_prolog_flag/2
halt/0, halt/1

可評估的函子

[編輯 | 編輯原始碼]
(+)/2
加法
(-)/2
減法
(*)/2
乘法
(//)/2
整數除法
(/)/2
除法
(rem)/2
餘數
(mod)/2
(-)/1
否定
(abs)/1
絕對值
(sign)/1
符號
(float_integer_part)/1
整數部分
(float_fractional_part)/1
小數部分
(float)/1
浮點數強制轉換
(floor)/1
向下取整
(truncate)/1
截斷
(round)/1
四捨五入
(ceiling)/1
向上取整

其他算術和按位運算函子

[編輯 | 編輯原始碼]
(**)/2
乘方
sin/1
正弦
cos/1
餘弦
atan/1
反正切
exp/1
指數
log/1
對數
sqrt/1
平方根
(>>)/2
按位右移
(<<)/2
按位左移
(/\)/2
按位與
(\/)/2
按位或
(\)/1
按位取反


華夏公益教科書