Did you know ... Search Documentation:
Pack logtalk -- logtalk-3.77.0/examples/ack/SCRIPT.txt

This file is part of Logtalk https://logtalk.org/ SPDX-FileCopyrightText: 1998-2023 Paulo Moura <pmoura@logtalk.org> SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ________________________________________________________________________

% load the example:

| ?- logtalk_load(ack(loader)). ...

% some example queries for backend Prolog compilers implementing the % time/1 timing predicate (e.g. SWI-Prolog or YAP; the adapter files % for these two systems ensure that a ::/2 goal in the argument of the % time/1 predicate is compiled prior to calling it):

?- time(true). % auto-load the predicate in the case of SWI-Prolog true.

?- time(ack::ack(2, 4, V)). % 98 inferences, 0.00 CPU in 0.00 seconds (0% CPU, Infinite Lips) V = 11.

?- time(ack::ack(3, 3, V)). % 2,451 inferences, 0.00 CPU in 0.00 seconds (0% CPU, Infinite Lips) V = 61.

?- time(ack::ack(3, 4, V)). % 10,326 inferences, 0.00 CPU in 0.00 seconds (0% CPU, Infinite Lips) V = 125.

% some example queries for other backend Prolog compilers:

?- ack::ack(2, 4, V). V = 11 yes

?- ack::ack(3, 3, V). V = 61 yes

?- ack::ack(3, 4, V). V = 125 yes