Does Prolog use Eager Evaluation?

前端 未结 4 850
离开以前
离开以前 2021-01-12 04:42

Because Prolog uses chronological backtracking(from the Prolog Wikipedia page) even after an answer is found(in this example where there can only be one solution), would thi

4条回答
  •  广开言路
    2021-01-12 05:14

    from Wikipedia I got

    In eager evaluation, an expression is evaluated as soon as it is bound to a variable.

    Then I think there are 2 levels - at user level (our predicates) Prolog is not eager. But it is at 'system' level, because variables are implemented as efficiently as possible.

    Indeed, attributed variables are implemented to be lazy, and are rather 'orthogonal' to 'logic' Prolog variables.

提交回复
热议问题