+
+int
+dict_for_each_by_length (dict_t *dict,
+ dict_action_t action,
+ void *closure)
+{
+ return dict_for_each_by_length_if (dict, action, closure, NULL);
+}
+
+static void
+dict_action_print (void *closure, char *word)
+{
+ int *length_of_last = closure;
+ int length = strlen (word);
+
+ if (length == *length_of_last)
+ printf(" ");
+ else if (*length_of_last)
+ printf("\n");
+
+ printf ("%s", word);
+
+ *length_of_last = length;
+}
+
+int
+dict_print (dict_t *dict)
+{
+ int length_of_last = 0;
+
+ return dict_for_each (dict,
+ dict_action_print, &length_of_last);
+}
+
+int
+dict_print_by_length (dict_t *dict)
+{
+ int length_of_last = 0;
+
+ return dict_for_each_by_length (dict,
+ dict_action_print, &length_of_last);
+}
+
+int
+dict_print_if (dict_t *dict,
+ dict_entry_predicate_t predicate)
+{
+ int length_of_last = 0;
+
+ return dict_for_each_if (dict,
+ dict_action_print, &length_of_last,
+ predicate);
+}
+
+int
+dict_print_by_length_if (dict_t *dict,
+ dict_entry_predicate_t predicate)
+{
+ int length_of_last = 0;
+
+ return dict_for_each_by_length_if (dict,
+ dict_action_print, &length_of_last,
+ predicate);
+}