RobinHankin / freegroup

The free group in R
https://robinhankin.github.io/freegroup/
0 stars 0 forks source link

order of symbols in cumsum() #34

Open RobinHankin opened 1 year ago

RobinHankin commented 1 year ago

Look:

library(freegroup)
#> Loading required package: plyr
#> 
#> Attaching package: 'freegroup'
#> The following object is masked from 'package:plyr':
#> 
#>     id
(x <- as.free(c("a","aaax","bcd")))
#> [1] a     a^3.x b.c.d
cumsum(x)
#> [1] a           a^4.x       a^4.x.b.c.d
backwards(cumsum(backwards(x)))
#> [1] a             a^3.x.a       b.c.d.a^3.x.a

Created on 2023-06-26 with reprex v2.0.2

There is no particular reasson AFAICS for the first one to be prefereable over the second one. Also, see:

https://github.com/RobinHankin/onion/issues/24