Did you know ... | Search Documentation: |
Pack logtalk -- logtalk-3.85.0/ports/toychr/SCRIPT.txt |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % This file is part of Logtalk https://logtalk.org/ % SPDX-FileCopyrightText: 2020-2021 Paulo Moura <pmoura@logtalk.org> % SPDX-License-Identifier: GPL-2.0-or-later % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; if not, write to the Free Software % Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% start by loading the port:
| ?- logtalk_load(toychr(loader))
.
...
% load all the examples:
| ?- logtalk_load(toychr('examples/loader'))
.
...
% try some of the examples:
| ?- gcd::chr_is(GCD, (gcd(9), gcd(6)))
.
GCD = gcd(3)
yes
| ?- leq::chr_is(Result, (leq(X,Y), leq(Y,Z)))
.
Result = leq(X,Z)
, leq(Y,Z)
, leq(X,Y)
yes
| ?- fib::chr_is(Result, fib(5,N))
.
Result = (fib(1, 1)
, fib(0, 1)
, fib(2, 2)
, fib(3, 3)
, fib(4, 5)
, fib(5, 8)
),
N = 8
yes
| ?- primes::chr_is(Result, candidate(11))
.
Result = (prime(2)
, prime(3)
, prime(5)
, prime(7)
, prime(11)
)
yes
| ?- dom::chr_is(_, (dom(N, [1,2,3]), dom(N, [3,4,5])))
.
N = 3 yes.