RobinHankin / permutations

https://robinhankin.github.io/permutations/
5 stars 3 forks source link

c() gotcha #20

Closed RobinHankin closed 2 years ago

RobinHankin commented 4 years ago

this caught me out just now:

> data(megaminx)
> a <- c(W*R, W*Pu)
> a <- c(W*R, W)
Error in c.word(W * R, W) : all arguments must be the same class
> 

In the first case, both objects are the same class, c("permutation","word") but in the second, the class of W is c("permutation","cycle").

It is not clear to me whether this is a bug or a feature, but in any event it is not adequately documented.

RobinHankin commented 2 years ago

Now we get

> c(rperm(), as.cycle(rperm()))
Error in c.word(rperm(), as.cycle(rperm())) : 
  all arguments must be the same class
>