RobinHankin / onion

R functionality to deal with quaternions and octonions
6 stars 1 forks source link

print methods #23

Closed RobinHankin closed 1 year ago

RobinHankin commented 1 year ago

The print method is sub-optimal:

> x <- 4 + 7*Oi - 2*Oil
> x
   [1]
Re   4
i    7
j    0
k    0
l    0
il  -2
jl   0
kl   0
> 

Wouldn't it be nice to be able to do this:

> x
> [1] 4  + 7*i - 2*il
RobinHankin commented 1 year ago

Reopening:

> a <- c(H1,Hi,Hall)
> a
[1] 1          1i         1+1i+1j+1k
> onion_to_string(a)
[1] 1             1NA           1+1NA+1NA+1NA
> 

The problem is that variables .quatnames and .octnames are (deliberately) not exported.