Issue FORMAT-TABULATE
Issue: FORMAT-TABULATE

Forum: Editorial

References: FORMAT, CLHS 22.3.6.1

Category: CLARIFICATION/CHANGE

Edit history: 2004-07-20, Version 1 by Bruno Haible

Status: For CLiki consideration

Problem Description:

CLHS 22.3.6.1, paragraph 1 describes what the ~T format directive does. If colnum is less than the current column, colinc is positive, and (mod (- curcol colnum) colinc) is 0, then it is unclear if this directive causes any spaces to be printed (and similarly for the case in PPRINT-TAB). Existing implementations do print at least one space in this case.

Proposal (FORMAT-TABULATE:AT-LEAST-ONE-SPACE):

Rewrite the sentence as "If the cursor is already at or beyond column colnum, and colinc is positive, it will output spaces to move it to column colnum+k*colinc for the smallest positive integer k possible; at least one space is output in this case. If the cursor is already at or beyond column colnum, and colinc is zero, no spaces are output."

Test case:

(format t "~%abcdef~3,3T|xyz") or (format t "~%abcdef~6,3T|xyz")

Rationale:

colinc = 0 is used when it is ok to output no spaces; therefore when colinc > 0, at least one space should be printed.

Current practice:

CLISP already implements proposal AT-LEAST-ONE-SPACE.

Cost to Implementors:

Small.

Cost to Users:

None.

Cost of Non-Adoption:

Some output may be lacking a space when this was not intended by the programmer.

Benefits:

Aesthetics:

Discussion:
  • Bruno Haible supports proposal AT-LEAST-ONE-SPACE.