Is there a convenient way to replicate R's concept of 'named vectors' in Raku, possibly using Mixins?
8
Recent questions on StackOverflow pertaining to Mixins in Raku have piqued my interest as to whether Mixins can be applied to replicate features present in other programming languages. For example, in the R-programming language, elements of a vector can be given a name (i.e. an attribute), which is very convenient for data analysis. For an excellent example see: "How to Name the Values in Your Vectors in R" by Andrie de Vries and Joris Meys, who illustrate this feature using R 's built-in islands dataset. Below is a more prosaic example (code run in the R-REPL): > #R-code > x <- 1:4 > names(x) <- LETTERS[1:4] > str(x) Named int [1:4] 1 2 3 4 - attr(*, "names")= chr [1:4] "A" "B" "C" "D...