Languag...Factory(3)

πŸ“¦
version 0.10 Β· 2 versions
, in fedora 43

✨ 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 @terms and tail $tail. Yes bestie, it's unfinished on purpose, that's the whole point. ✨
  • prolog_functor($name, @terms) β€” returns a functor with name $name and 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 $atom to 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 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