Displaying 2 results from an estimated 2 matches for "my2valuefun".
2023 Mar 11
1
Multiple Assignment built into the R Interpreter?
There are some other considerations too (apologies if these were mentioned
above and I missed them). Also below are initial thoughts, so apologies for
any mistakes or oversights.
For example, if
[a, b] <- my2valuefun()
works the same as
local({
tmp <- my2valuefun()
stopifnot(is.list(tmp) && length(tmp) == 2)
a <<- tmp[[1]]
b <<- tmp[[2]]
})
Do we expect
[a[1], b[3]] <- my2valuefun()
to also work? That doesn't sound very fun to me, personally, but obviously
the "single val...
2023 Mar 11
3
Multiple Assignment built into the R Interpreter?
Thanks Duncan and Ivan for the careful thoughts. I'm not sure I can follow
all aspects you raised, but to give my limited take on a few:
> your proposal violates a very basic property of the language, i.e. that all statements are expressions and have a value.
> What's the value of 1 + (A, C = init_matrices()).
I'm not sure I see the point here. I evaluated 1 + (d =