@@ -57,7 +57,9 @@ julia> uprint(pac, :block)
57
57
▀▀██████▀▀
58
58
```
59
59
60
- It is also possible to pass a filtering function, filling values for which the function returns ` true ` , e.g. all even numbers in the following array:
60
+ When passing a filtering function,
61
+ UnicodeGraphics will fill all values for which the function returns ` true ` ,
62
+ e.g. all even numbers using ` iseven ` :
61
63
``` julia
62
64
julia> ghost = [
63
65
1 7 7 7 7 8 6 4 6 3 9 9 9 7
@@ -73,7 +75,7 @@ julia> ghost = [
73
75
4 2 6 4 2 6 8 6 6 2 8 8 8 8
74
76
8 2 3 6 6 8 9 1 2 4 8 5 4 8
75
77
8 3 7 3 8 6 9 3 6 6 1 9 1 6
76
- ];
78
+ ]; # a ghost is hidden in here
77
79
78
80
julia> uprint (iseven, ghost)
79
81
⢀⠴⣾⣿⠷⣦⡀
@@ -82,9 +84,8 @@ julia> uprint(iseven, ghost)
82
84
⠁⠀⠉⠀⠉⠀⠈
83
85
```
84
86
85
- Non-number type inputs are also supported,
87
+ Non-number type inputs are supported,
86
88
as long as the filtering function returns boolean values:
87
-
88
89
``` julia
89
90
julia> A = rand (" abc123" , 4 , 4 )
90
91
4 × 4 Matrix{Char}:
@@ -98,6 +99,28 @@ julia> uprint(isletter, A, :block)
98
99
▄▄ █
99
100
```
100
101
102
+ Instead of passing a function directly,
103
+ [ do-block syntax] ( https://docs.julialang.org/en/v1/manual/functions/#Do-Block-Syntax-for-Function-Arguments ) can be used:
104
+ ``` julia
105
+ julia> A = [x + y * im for y in 10 : - 1 : 1 , x in 1 : 10 ]
106
+ 10 × 10 Matrix{Complex{Int64}}:
107
+ 1 + 10im 2 + 10im 3 + 10im … 8 + 10im 9 + 10im 10 + 10im
108
+ 1 + 9im 2 + 9im 3 + 9im 8 + 9im 9 + 9im 10 + 9im
109
+ 1 + 8im 2 + 8im 3 + 8im 8 + 8im 9 + 8im 10 + 8im
110
+ ⋮ ⋱
111
+ 1 + 3im 2 + 3im 3 + 3im 8 + 3im 9 + 3im 10 + 3im
112
+ 1 + 2im 2 + 2im 3 + 2im 8 + 2im 9 + 2im 10 + 2im
113
+ 1 + 1im 2 + 1im 3 + 1im 8 + 1im 9 + 1im 10 + 1im
114
+
115
+ julia> uprint (A) do x
116
+ φ = angle (x)
117
+ φ < π/ 4
118
+ end
119
+ ⠀⠀⠀⢀⣴
120
+ ⠀⢀⣴⣿⣿
121
+ ⠐⠛⠛⠛⠛
122
+ ```
123
+
101
124
Multidimensional arrays are also supported:
102
125
``` julia
103
126
julia> A = rand (Bool, 4 , 4 , 1 , 2 )
0 commit comments