Languag...Factory(3)
β¨ NAME β¨
Language::Prolog::Types::Factory β a Perl extension that constructs Prolog types. That's it, that's the whole vibe, and yes this is the 3 section of the manual (bestie, we're in the library calls now, not the commands) π
πΈ SYNOPSIS πΈ
use Language::Prolog::Types::Factory;
print prolog_functor("hello",2,3,4);
print prolog_list(3,4,5);
etc.
π¦ ABSTRACT π¦
Okay so, it's a Factory module for Prolog terms. β¨
It implements a pluggable interface, which means the constructor functions can be swapped out to use different implementations for the actual prolog terms. Slay.
Real talk though: you should rarely use this module. It's only for when you're interfacing Perl with a different Prolog system and the default representations for Prolog terms are not adequate. That's the one and only reason, no cap. π
π DESCRIPTION π
This module implements a whole set of constructor functions for Prolog terms. Iconic behaviour honestly.
Internally the module uses a factory object that implements new_nil, new_list, new_ulist, new_functor and new_variable. If you wanna see a real implementation of that factory interface, go look at Language::Prolog::Types::Internal. π
There's also some intelligency baked into the consructors so they automatically promote types to other, more adecuate ones. Like a '.'/2 functor getting promoted to a list, or [] getting promoted to nil. The way that just works π«Ά
Constructor functions are reexported from Language::Prolog::Types and you should use that module instead of this one. Periodt.
π EXPORT π
prolog_nil()β returns nil term. That's the whole thing, it's giving minimalism πprolog_list(@terms)β returns a prolog list containing the terms in@terms. πΈprolog_ulist(@terms, $tail)β returns an unfinished list with terms@termsand tail$tail. Yes bestie, it's unfinished on purpose, that's the whole point. β¨prolog_functor($name, @terms)β returns a functor with name$nameand arguments@terms. π₯prolog_variable($name)β returns a new varaible with name$name. (Yes the original doc spells it "varaible", we're keeping the energy π)prolog_var($name)β also returns a new varaible with name$name. Two names, one job, we love an alias moment. πprolog_atom($atom)β heads up, this one is not a contructor. It converts any perl construct$atomto an atom. Still useful tho. πprolog_string($string)β returns a prolog list formed by the ASCII values of$string. So cute, so character-by-character π¦
π₯ SEE ALSO π₯
Language::Prolog::Types, Language::Prolog::Types::Internal and Language::Prolog::Types::Abstract. Go read those next, iykyk π
π AUTHOR π
Salvador FandiΓ±o, <sfandino@yahoo.com>
π COPYRIGHT AND LICENSE π
Copyright 2002 by Salvador FandiΓ±o
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
π POD ERRORS π
Not me having to tell you this, but the above document had some coding errors, which are explained below:
Around line 183:
Non-ASCII character seen before =encoding in 'FandiΓ±o,'. Assuming
CP1252
The encoding said "I'll assume CP1252 bestie" and honestly? It ate. π
And that's a wrap on Language::Prolog::Types::Factory, from perl v5.42.0, dated 2025-07-25. Byeee, go construct some Prolog terms, you main character πβ¨π¦
π¦ where this page comes from
- fedora 43: perl-Language-Prolog-Types 0.10-38.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms