Skip to content
Prev 12632 / 398502 Next

style question: returning multiple arguments - structure orlist

"Thomas J Vogels" <tov at ece.cmu.edu> writes:
A little summer exercise: Can one write a list assignment function,
i.e. "list<-" so that

list(a,b,c) <- f()

would be equivalent to

r <- f()
a <- r[[1]]
b <- r[[2]]
c <- r[[3]]

Even better, do something useful with named list elements. (And what
are the odds of finding that this is really an exercise hidden
somewhere in a book by Venables and Ripley?)