This generic provides the logic for printing vectors in `glimpse()`

.

The output strives to be as unambiguous as possible,
without compromising on readability.
In a list, to distinguish between vectors and nested lists,
the latter are surrounded by `[]`

brackets.
Empty lists are shown as `[]`

.
Vectors inside lists, of length not equal to one,
are surrounded by `<>`

angle brackets.
Empty vectors are shown as `<>`

.

format_glimpse(x, ...)

x | A vector. |
---|---|

... | Arguments passed to methods. |

A character vector of the same length as `x`

.

format_glimpse(1:3)#> [1] "1" "2" "3"#> [1] "<1, 2, 3>"#> [1] "1" "<2, 3>"#> [1] "[1]" "[<2, 3>]"#> [1] "[1]" "[2, 3]"#> [1] "<>"#> [1] "<NULL>"#> "a" #> "b" #> "c"#> "A" #> "B, C"#> a #> b #> c#> "A" #> "B, C"