Did you know ... Search Documentation:
Pack logtalk -- logtalk-3.77.0/examples/modules/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.

% start by compiling and loading the Prolog module files as objects:

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

% call one of the module exported predicates using message sending:

| ?- test::names.

paulo carlos helena yes

% same goal as above but the call is made using a meta-predicate % imported from other module:

| ?- test::test.

paulo carlos helena yes

% test the compilation of the module export/1 directive; module % exported predicates become public predicates:

| ?- exports::current_predicate(Pred).

Pred = p/1 yes

| ?- exports::predicate_property(p(_), Prop).

Prop = public ; Prop = static ; Prop = declared_in(exports) ; Prop = defined_in(exports) yes

% call the module exported/public predicate using message sending:

| ?- exports::p(N).

N = 1 ; N = 2 ; N = 3 yes

% test the compilation and use of meta-predicates:

| ?- test::names(Names).

Names == [paulo, carlos, helena] yes

| ?- test::test(Names).

Names == [paulo, carlos, helena] yes