chickadee » fmt » justify

justify <format> ...procedure

Like wrap-lines except the lines are full-justified.

  (define func
    '(define (fold kons knil ls)
       (let lp ((ls ls) (acc knil))
         (if (null? ls) acc (lp (cdr ls) (kons (car ls) acc))))))

  (define doc
    (string-append
      "The fundamental list iterator.  Applies KONS to each element "
      "of LS and the result of the previous application, beginning "
      "with KNIL.  With KONS as CONS and KNIL as '(), equivalent to REVERSE."))

  (fmt #t (columnar (pretty func) " ; " (justify doc)))

outputs

 (define (fold kons knil ls)          ; The   fundamental   list   iterator.
   (let lp ((ls ls) (acc knil))       ; Applies  KONS  to  each  element  of
     (if (null? ls)                   ; LS  and  the  result of the previous
         acc                          ; application,  beginning  with  KNIL.
         (lp (cdr ls)                 ; With  KONS  as CONS and KNIL as '(),
             (kons (car ls) acc)))))  ; equivalent to REVERSE.