prolog-terms

Describes Prolog term taxonomy and demonstrates functor/3, arg/3, =../2, copy_term usage.

1|Updated Mar 15, 2026
One-click install
npx skills add https://github.com/hafley66/claude-research --skill prolog-terms
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prolog-terms
Source: https://github.com/hafley66/claude-research/tree/main/skills/prolog-terms
Command: npx skills add https://github.com/hafley66/claude-research --skill prolog-terms

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prolog has exactly one data type: the term. No objects, no structs. This skill clarifies the term taxonomy and how to inspect and manipulate atoms, numbers, variables, and compound terms, including the use of functor/3, arg/3, =../2 (univ), and copy_term.

Core Features & Use Cases

  • Term taxonomy: atoms, numbers, variables, and compound terms; explains arity, functor names, and how terms are composed.
  • Inspection & construction: use functor/3, arg/3, and =../2 to deconstruct and build terms, and copy_term to obtain fresh copies with independent variables.
  • Meta-programming & data representations: treat terms as data, perform dynamic goal construction, and serialize or transform term structures for analysis or transformation.

Quick Start

Explain the core Prolog term structures and demonstrate how to inspect, construct, and manipulate terms using functor/3, arg/3, and =../2.

Frequently Asked Questions about prolog-terms

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I inspect and manipulate Prolog term structure?

You inspect and manipulate Prolog term structure using core predicates like functor/3, arg/3, and =../2. These built-in tools allow you to deconstruct compound terms, extract arguments by position, and dynamically build new terms for meta-programming tasks.

What is the difference between atoms, numbers, and compound terms in Prolog?

In Prolog term taxonomy, atoms and numbers are simple, non-decomposable data types, while compound terms consist of a functor name and a fixed arity containing nested sub-terms. Variables act as placeholders, enabling unification and pattern matching across these structures.

How do I use =.. (univ) to construct and deconstruct terms in Prolog?

The =.. (univ) operator converts between a compound term and a Prolog list containing its functor and arguments. You use it to dynamically build goals from list elements or break down an existing term into a list for structural transformation and analysis.

When should I use copy_term in Prolog meta-programming?

Use copy_term in Prolog meta-programming when you need to duplicate a term containing variables while keeping the new variables independent from the original. This prevents unintended variable sharing during dynamic goal construction and term-based data representation transformations.

Can I use functor/3 and arg/3 to dynamically build goals in Prolog?

Yes, you can use functor/3 to dynamically create a term with a specific name and arity, and arg/3 to access or assign specific argument positions within that term. This combination is fundamental for generating dynamic goals and manipulating term-based data representations.

What are the limitations of using Prolog terms for data representation?

When using Prolog terms for data representation, you must manually manage functor arity and argument positions without compile-time type safety. Additionally, complex term manipulation requires careful handling of shared variables to avoid unintended unification side effects during structural transformations.