Hi, I’m currently using PrettyTables, and I’m not sure what’s going on with my codes below. I defined a custom tf as follows:
using JuliaDB
using PrettyTables
tf_compact2 = TextFormat(up_right_corner = '─',
up_left_corner = '─',
bottom_left_corner = '─',
bottom_right_corner = '─',
up_intersection = '─',
left_intersection = '─',
right_intersection = '─',
middle_intersection = '─',
bottom_intersection = '─',
column = ' ',
row = '─',
hlines = [:begin,:header,:end],
vlines = :all);
pretty_table works fine:
a = table((x=collect(1:10), y=collect(11:20)));
pretty_table(a, tf=tf_compact2)
─────────────────
x y
Int64 Int64
─────────────────
1 11
2 12
3 13
4 14
5 15
6 16
7 17
8 18
9 19
10 20
─────────────────
But I wanted to declare this custom tf globally, so this is can be done using @ptconf:
@ptconf tf=tf_compact2
@pt a
which gives me the following error,
UndefVarError: tf_compact2 not defined
Stacktrace:
[1] top-level scope at In[150]:1
[2] include_string(::Function, ::Module, ::String, ::String) at ./loading.jl:1091
Built-in tf_compact works though,
@ptconf tf=tf_compact
@pt a
------- -------
x y
Int64 Int64
------- -------
1 11
2 12
3 13
4 14
5 15
6 16
7 17
8 18
9 19
10 20
------- -------
However, redefining this to new variable, won’t work
tf2 = tf_compact
@ptconf tf=tf2
@pt a
UndefVarError: tf2 not defined
Stacktrace:
[1] top-level scope at In[153]:1
[2] include_string(::Function, ::Module, ::String, ::String) at ./loading.jl:1091
I’m beginner on macros.