ch08ex04.pro

来自「prolog,人工智能推理程序,运行环境prolog」· PRO 代码 · 共 22 行

PRO
22
字号
/*
   Turbo Prolog 2.0 Chapter 8, Example Program 4
   
   Copyright (c) 1986, 88 by Borland International, Inc
   
*/
    
trace
domains
   list = integer*

predicates
   add1(list, list)

clauses
   add1([], []). /* boundary condition */
   add1([Head|Tail], [Head1|Tail1]) :- /* separate the head */
 /* from the rest of the list */
      Head1= Head+1, /* add 1 to the first element */
      add1(Tail, Tail1). /* call element with the rest of the
list */

⌨️ 快捷键说明

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