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

This module collects a few very simple and very specialized helper predicates dealing with strings in the context of dict prettyprinting, which just add noise to the main module. So they are here, in a separate module.

The homepage for this module is at

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

 pairs_to_entries(+Pairs, +SettingsDict, -Entries)
Iterates over the pairs Pairs obtained from the dict that shall be printed and transforms them into Entries, a list of structures described below.

Entries contains the transformed pairs in the order in which they appear in Pairs.

Each element in Entries (an "entry") is a pair KeyString-Lineified where:

  • KeyString is a string generated from the dict key (which is always an atom or an integer) The caller will want to justify this string when creating the final line of text.
  • Lineified is a compound term that is one of:
    • mono(String) : String is a single string generated by formatting the value; it can be printed "as is" after left/right/center justification.
    • poly(List) : List is a list of string generated by formatting a subdict; all the strings in List must be integrated into the lines generated for the current dict.
 get_padding_settings(+SettingDict, -PadTop, -PadBottom, -PadLeft, -PadRight)
Get multiple specific values, those for paddings, in one call. This predicate also checks that the retrieved values are all integers >= 0.
 get_padding_settings_clamped(+DecisionForPadding, +SettingsDict, -PadTop, -PadBottom, -PadLeft, -PadRight)
Get the settings for the padding, but clamp them all to 0 if DecisionForPadding is false.