@@ -4,15 +4,82 @@ This package overloads `Base.show` to change how numbers are printed:
44* Negative numbers are red
55* Zero is light gray
66* ` Inf ` , ` NaN ` and ` missing ` are yellow
7- * Low-precision numbers (like ` Float32 ` , ` Int16 ` ) are cyan, or magenta if negative.
7+ * Low-precision numbers (like ` Float32 ` , ` Int16 ` ) are cyan, or magenta if negative, and
8+ * Unsigned integers are printed both in hex and decimal.
89
9- In addition, vectors of real numbers are displayed with a bar graph alongside their values.
10- Vectors of complex numbers show their absolute value as a bar graph, and phase as a compass direction.
10+ The cutoff for "nearly zero" is controlled by e.g. ` threshold!(1e-16) ` .
11+
12+ It also changes how vectors numbers are printed:
13+ * Vectors of real numbers are displayed with a bar graph alongside their values.
14+ * Vectors of complex numbers show their absolute value as a bar graph, and phase as a compass direction.
15+ * Ranges print more detail, including the ` range ` constructor.
16+
17+ The point of this is to provide extra context while working at the REPL, without getting in your way.
18+ The bar graphs should occupy unused space to the right of the numbers in your terminal.
1119
1220## Examples
1321
1422![ REPL screenshot] ( readme.png )
1523
24+ Copying text from the REPL loses the colours but keeps the graph:
25+
26+ ``` julia
27+ julia> Float16[x... , Inf ]
28+ 15 - element Vector{Float16}:
29+ - 0.777 # ┥
30+ - 0.6323 # ┥
31+ - 0.3936 # ┥
32+ 0.0 # │
33+ 0.649 # ┝
34+ 1.719 # ┝╸
35+ 3.482 # ┝━
36+ 6.39 # ┝━╸
37+ 11.18 # ┝━━╸
38+ 19.08 # ┝━━━━
39+ 32.12 # ┝━━━━━━━
40+ 53.6 # ┝━━━━━━━━━━━━
41+ 89.0 # ┝━━━━━━━━━━━━━━━━━━━━
42+ 147.4 # ┝━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
43+ Inf # ╪═▶
44+
45+ julia> reverse (1 : 10 )
46+ 10 - element StepRange{Int64, Int64}:
47+ # range(10, 1, step=-1) === 10:-1:1
48+ 10 # ┝━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
49+ 9 # ┝━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╸
50+ 8 # ┝━━━━━━━━━━━━━━━━━━━━━━━━━━╸
51+ ⋮
52+ 3 # ┝━━━━━━━━━━
53+ 2 # ┝━━━━━━╸
54+ 1 # ┝━━━╸
55+ ```
56+
57+ For complex numbers, the graph shows phase and magnitude like this:
58+
59+ ``` julia
60+ julia> cis .(range (0 ,2pi ,9 )) .* logrange (1 / 3 ,3 ,9 ) .| > ComplexF32
61+ 9 - element Vector{ComplexF32}:
62+ 0.33333334f0 + 0.0f0im # │➡┝━━━╸
63+ 0.31020162f0 + 0.31020162f0im # │↗┝━━━━━
64+ 3.5352508f-17 + 0.57735026f0im # │⬆┝━━━━━━╸
65+ - 0.537285f0 + 0.537285f0im # │↖┝━━━━━━━━╸
66+ - 1.0f0 + 1.2246469f-16im # │⬅┝━━━━━━━━━━━
67+ - 0.9306049f0 - 0.9306049f0im # │↙┝━━━━━━━━━━━━━━╸
68+ - 3.1817257f-16 - 1.7320508f0im # │⬇┝━━━━━━━━━━━━━━━━━━━
69+ 1.6118549f0 - 1.6118549f0im # │↘┝━━━━━━━━━━━━━━━━━━━━━━━━━
70+ 3.0f0 - 7.3478806f-16im # │➡┝━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
71+ ```
72+
73+ Unsigned integers:
74+
75+ ``` julia
76+ julia> 0x0c9
77+ 0x00c9 # == 201
78+
79+ julia> - ans
80+ 0xff37 # == 65335
81+ ```
82+
1683## Elsewhere
1784
1885* [ OhMyREPL.jl] ( https://github.com/KristofferC/OhMyREPL.jl ) changes the text you type at the prompt, instead of what is printed.
0 commit comments