Did you know ... Search Documentation:
Pack onepointfour_basics -- prolog/space_stringy.pl
PublicShow source

This is specific to SWI-Prolog, which distinguishes "string" and "atom" as two distinct representations of "sequences of characters".

Homepage for this code

https://github.com/dtonhofer/prolog_code/blob/main/unpacked/onepointfour_basics/README_space_stringy.md

History

  1. 2020-07-XX: First version.
  2. 2021-05-27: Full review.
  3. 2021-06-10: Further review.
  4. 2021-06-11: Back up on github.
  5. 2021-06-17: Rewritten to take "StringyType" arg and generally be clearer code
 space_stringy(?N, ?Stringy, +StringyType)
Succeeds iff Stringy is a string of N SPACE characters having type StringyType (either 'atom' or 'string').

If both arguments N and Stringy are unbound, generates pairs (N,Stringy) with N monotonically increasing.

  • The predicate throws if bound arguments are out-of-type
  • the call fails for N an integer but N < 0 (any other value for Throw)
 space_stringy_smooth(?N, ?Stringy, ?StringyType)
As space_stringy/3 that only fails, never throws even if it is given out-of-type or out-of-domain arguments.
 space_stringy_lax(?N, ?Stringy, ?StringyType)
A space_stringy/3 that accepts negative N, and just unifies Stringy with an empty "" or '' in that case.
 space_stringy(?N, ?Stringy, ?StringyType, @Throw)
As space_stringy/3 but one can request that:
  • the call throws for N < 0 (Throw = true,throw)
  • the call fails for N < 0 (any other value for Throw)