Logtalk Documentation

repository·master·Indexed 19 days ago

https://github.com/logtalkdotorg/logtalk3

Logtalk is a declarative object-oriented logic programming language that extends Prolog with features such as classes, protocols, categories, and event-driven programming. It acts as a trans-compiler for various standards-compliant Prolog backends including SWI-Prolog, YAP, XSB, and others. The documentation covers the Logtalk Handbook, API references, Docker-based development environments for VSCode and VSCodium, and specialized libraries for ISO standards (3166, 4217, 639, 9362) and Unicode data.

Tokens
303K
Snippets
1.1K
Records
1.6K
Agent score
63%

What's inside Logtalk

  1. Overview of lgtdoc

    master

    lgtdoc is the default Logtalk documentation tool used to generate API documentation for libraries and applications. It uses the structural reflection API to extract documentation from source files, libraries, or directories and outputs it in XML format.

    Once the XML is generated, you can use provided Bash and PowerShell scripts (located in the lgtdoc/xml directory) to convert the XML into various final formats, including XHTML 1.1, HTML 4.01, HTML 5, PDF, Markdown, reStructuredText (for Sphinx), and plain text.

  2. Overview of the open_api library

    master

    The open_api library provides a first-pass implementation for deriving, parsing, generating, and structurally validating OpenAPI 3.1.0 documents. It is designed to work with objects that implement the open_api_provider_protocol protocol using a portable descriptor vocabulary.

    Key benefits of this implementation include:

    • Earlier validation: Malformed descriptors are rejected via functor shape and argument checks before JSON normalization.
    • Portability: Provider objects use a Logtalk-level vocabulary rather than raw OpenAPI field names.
    • Reuse: Descriptors can be used for both OpenAPI generation and future authentication or HTTP integration layers.
    • Cleaner code: Providers avoid raw camelCase OpenAPI keys and complex nested terms.
  3. Overview of VivoMind Prolog Unicode Resources

    master

    The unicode_data library provides a set of Prolog files converted from official Unicode Character Database (UCD) files (specifically UCD 6.1 and 6.2). It provides large Prolog tables and auxiliary predicates to access Unicode properties for code points.

    Key characteristics:

    • Code Point Representation: Uses ISO Prolog standard hexadecimal integer notation.
    • Data Granularity: Most tables define properties for ranges of code points, but auxiliary predicates are provided to query single code points.
    • Performance: For high-performance needs, users can use the provided predicates to generate custom, application-specific derived tables.
  4. Overview of open_ai library scope

    master

    The open_ai library provides a portable, OpenAI-compatible public non-admin API surface.

    Key Features:

    • Implements OpenAI wire-format routing, client request construction, and OpenAPI document generation.
    • Uses http_process_transport by default for HTTPS and WSS support.
    • Scope: Covers public non-admin endpoints from the official OpenAI OpenAPI 2.3.0 document (approximately 161 operations).
    • Exclusions: Organization and project administration paths are not supported.
    • Requirements: Backends must support sockets and unbound integer arithmetic. Supported backends include ECLiPSe, SICStus Prolog, SWI-Prolog, Trealla Prolog, and XVM.
  5. What is the adaptive_boosting_classifier library?

    master
    The adaptive_boosting_classifier library implements an Adaptive Boosting (AdaBoost) classifier using C4.5 decision trees as base learners. It uses the SAMME (Stagewise Additive Modeling using a Multi-class Exponential loss function) variant, which allows for multi-class classification. The library follows the classifier_protocol and requires datasets to implement the dataset_protocol.
  6. Overview of Logtalk

    master

    Logtalk is a declarative object-oriented logic programming language that extends Prolog. It is designed for large-scale programming by providing modern code encapsulation and reuse mechanisms while maintaining Prolog's declarative features.

    Key features include:

    • Support for both prototypes and classes.
    • Protocols (interfaces).
    • Categories (for component-based programming and hot-patching).
    • Event-driven programming.
    • Coinduction, lambda expressions, and high-level multi-threading.

    Logtalk acts as a trans-compiler, meaning it can use most modern, standards-compliant Prolog implementations as a backend compiler.

  7. Understand the scope and limitations of http_server_core

    master

    Scope

    http_server_core is a transport-neutral, stream-oriented layer. It sits above the wire parser/generator and provides:

    • read_request/2: Reads one request from a binary stream.
    • write_response/2: Writes one normalized response to a binary stream (supports streaming file-backed bodies).
    • dispatch/3: Calls a handler and converts failures to 500 Internal Server Error.
    • serve/3 and serve_connection/3: Orchestrates reading, dispatching, and writing.
    • WebSocket handshake helpers (accept_websocket/3, serve_websocket/4).

    What it does NOT do

    • It does not manage sockets, listen for connections, or handle concurrency. These must be implemented in higher layers.
    • It does not take ownership of upgraded WebSocket streams; it only performs the handshake.

    Limitations

    • Only the [chunked] transport coding sequence is recognized for streamed request bodies.
    • No built-in socket accept loops or connection pooling.
  8. Understand the scope and application areas of Logtalk

    master

    Logtalk is a superset of Prolog that extends its capabilities with object-oriented features. It is designed for several key application areas:

    • Logic and Object-Oriented Research/Teaching: Provides a smooth learning curve for Prolog programmers to learn OO concepts like protocols, components, and aspects via category-based composition. It supports both prototype and class-based systems.
    • Structured Knowledge Representations: Uses objects and event-driven programming to implement frame-like systems and structured knowledge bases.
    • Reactive and Agent-Based Systems: Supports the development of blackboard systems and agent-based systems through event-driven programming.
    • Highly Portable Applications: Provides a way to implement namespaces that avoids the porting issues common in various Prolog module systems. Platform-specific code can be isolated within objects with well-defined interfaces.
    • Alternative to Prolog Module Systems: Offers stronger encapsulation and reuse than standard Prolog modules, making it easier to port applications across different Prolog implementations.
    • Multi-language Integration: Facilitates high-level mapping between Prolog and object-oriented languages like C++, Java, or Smalltalk.
  9. Available entities in ccsds_frames

    master

    The ccsds_frames library consists of the following main entities:

    • ccsds_frame_protocol: Common protocol for transfer frame format objects.
    • ccsds_frames: A facade object for introspecting frame terms and bridging raw frame data fields with CCSDS space packets.
    • ccsds_tm_frames(FrameLength, SecondaryHeaderLength, HasFECF): Parametric object for CCSDS telemetry (TM) transfer frames.
    • ccsds_tc_frames(FrameLength, SegmentHeaderLength, HasFECF): Parametric object for CCSDS telecommand (TC) transfer frames.
    • ccsds_aos_frames(FrameLength, InsertZoneLength, HasOCF, HasFECF): Parametric object for CCSDS advanced orbiting systems (AOS) transfer frames.
    • ccsds_frames_types: Type definitions for TM, TC, and AOS transfer frame byte encodings and terms.
  10. How to use the open_api library

    master

    The open_api library is used to derive, parse, generate, and validate OpenAPI 3.1.0 documents. It is designed to work with objects implementing the open_api_provider_protocol.

    Integration Patterns

    • Standalone: Use it for parsing, generating, or validating OpenAPI documents.
    • With http_core: Pair it for request/response contract validation against normalized HTTP terms or wire sources.
    • With http_router: Pair it when router objects expose metadata via open_api_provider_protocol (derived from route/4, route_metadata/2, and route_produces/2).
    • With rest: Pair it for validation and derivation over high-level endpoint descriptors.
  11. Use the c45_classifier library

    master

    The c45_classifier library implements the C4.5 decision tree learning algorithm. It follows the classifier_protocol and is used to learn decision trees from datasets that implement the dataset_protocol.

    Key capabilities include:

    • Learning trees from discrete (categorical) and continuous (numeric) attributes.
    • Handling missing attribute values via majority voting during prediction.
    • Tree pruning using Pessimistic Error Pruning (PEP).
    • Exporting trees as predicate clauses or files.
    • Pretty-printing learned trees.
  12. Use the git library to access repository data

    master

    The git library provides access to the current branch and latest commit data (such as commit hashes and authors) of a git project.

    Note on Windows: Support for Windows operating systems is experimental and its functionality depends on the specific Prolog backend being used.

    All predicates in this library require a directory as the first argument. This directory must be either the root of a git repository or a sub-directory within a git repository.