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

Transforming a list of entries (key-value pairs) generated from a dict, "Entries", into a list of strings (nearly) ready for output and appending them to an open difference list.

The homepage for this module is at


 lineify(+Entries, +SettingsDict, ?LinesTip, ?FinalFin)
Given the list of entries Entries, which is a list of pairs -(KeyString,Lineified), and an "open difference list" LinesTip-FinalFin as receiver, generate a string (a "line") for each entry in Entries and add it to the growing list rooted at LinesTip. The "fin2 of the open difference list will be unified with FinalFin.

All we do here is concatenate keys (strings), separators (strings) and values (either strings or lists of strings) into lines (a list of strings).

A diagram for orientation. The | are not in the result, they have been added for legibility. Note that a line from a poly/1 compound term may be longer than MaxMonoWidth as it may contain arbitrary results of prettyprinting subdicts.

           keys                              values
  |<---- MaxKeyWidth --->|<--Sep-->|<-----MaxMonoWidth---->|
  |KKKKKKKKKK            |    :    |VVVV                   |    from mono("VVVV")
  |KKKKKKKKKKKKKKKKKKKKKK|    :    |VVVVVVV                |    from mono("VVVVVVV")
  |KKKKKK                |    :    |VVVVVVVVVVV            |    from mono("VVVVVVVVVVV")
  |KKKKKKKKKK            |    :    |poly#1PPPPPPPPPP       |    from poly([str,str,str])
  |                      |         |poly#2PPPPPPPPPPPPPPPPPPPPPPPPP
  |                      |         |poly#3PPPPPPPPPPPPPPPPPPPP