Did you know ... | Search Documentation: |
Pack logtalk -- logtalk-3.77.0/ports/metagol/SCRIPT.txt |
This file is part of Logtalk https://logtalk.org/
Copyright 2016 Metagol authors Copyright 2018-2019 Paulo Moura All rights reserved. SPDX-License-Identifier: BSD-3-Clause
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
% start by loading the example:
| ?- logtalk_load(metagol(loader))
.
...
% load all the examples:
| ?- logtalk_load(metagol('examples/loader'))
.
...
% try some of the examples:
| ?- family::learn.
% learning grandparent/2
% clauses: 1
% clauses: 2
% clauses: 3
grandparent(A,B)
:- grandparent_1(A,C)
, grandparent_1(C,B)
.
grandparent_1(A,B)
:- father(A,B)
.
grandparent_1(A,B)
:- mother(A,B)
.
yes
| ?- constants1::learn.
% learning p/2
% clauses: 1
% clauses: 2
% clauses: 3
p(4,A)
.
p(A,2)
.
p(1,A)
.
yes
| ?- higher_order1::learn.
% learning f/2
% clauses: 1
f(A,B)
:-map(A,B,my_succ)
.
yes
| ?- sequential::learn.
% learning parent/2
% clauses: 1
% clauses: 2
% learning grandparent/2
% clauses: 1
% learning great_grandparent/2
% clauses: 1
grandparent(A,B)
:-parent(A,C)
,parent(C,B)
.
great_grandparent(A,B)
:-parent(A,C)
,grandparent(C,B)
.
parent(A,B)
:-father(A,B)
.
parent(A,B)
:-mother(A,B)
.
yes
| ?- strings2::learn.
% learning f/2
% clauses: 1
% clauses: 2
% clauses: 3
% clauses: 4
% clauses: 5
f(A,B)
:-f_1(A,C)
,f_2(C,B)
.
f_1(A,B)
:-next_empty(A)
,f_2(A,B)
.
f_1(A,B)
:-f_2(A,C)
,f_1(C,B)
.
f_2(A,B)
:-write1(A,B,d)
.
f_2(A,B)
:-copy1(A,C)
,skip1(C,B)
.
yes
| ?- trains::learn.
% learning e/1
% clauses: 1
% clauses: 2
e(A)
:-has_car(A,B)
,e_1(B)
.
e_1(A)
:-short(A)
,closed(A)
.
yes