NOTA BENE: This email is about `=`, the assignment operator (e.g. {a=1}
which is equivalent to { `=`(a,1) } ), not `=` the named-argument syntax
(e.g. f(a=1), which is equivalent to
eval(structure(quote(f(1)),names=c('','a'))).
As far as I can tell from the documentation, assignment with = is precisely
equivalent to assignment with <-. Yet they call different primitives:
> `=`
.Primitive("=")
> `<-`
.Primitive("<-")
(Perhaps these are different names for the same internal function?)
Also, the difference is preserved by the parser:
> quote({a=b})
{
a = b
}
> quote({a<-b})
{
a <- b
}
even though in other cases the parser canonicalizes variant syntax, e.g. ->
to <-:
> quote({a->b})
{
b <- a
}
> `->`
Error: object "->" not found
Is there in fact some semantic difference between = and <- ?
If not, why do they use a different operator internally, each calling a
different primitive?
Or is this all just accidental inconsistency resulting from the '=', '<-',
and '->' features being added at different times by different people working
off different stylistic conventions?
-s
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.