Skip to content
Prev 25080 / 398502 Next

language inconsistency puzzle (in the tradition of Bill V enables (Hi Bill) puzzle "what is x")

R allows you to dynamically extend a vector by assigning past the end. So if
a has length 10, then assigning to a[11] creates also a[11] with value
a2[11] NA. So a is now length 11, while a2 is still length 10. So the
occurrence of a[11] has a different meaning on the assigned-to side than on
the assigned-from side. E.g.
[1] 1 1 1 1 1 1 1 1 1 1 NA
[1] 1 1 1 1 1 1 1 1 1 1

This doesn't seem inconsistent to me; unavoidable yes, given that you want
vectors to be dynamically extendible. Have I missed something?

Reid Huntsinger

-----Original Message-----
From: oehl_list at gmx.de [mailto:oehl_list at gmx.de]
Sent: Thursday, November 07, 2002 2:11 PM
To: r-help at stat.math.ethz.ch
Subject: [R] language inconsistency puzzle (in the tradition of Bill
Venables (Hi Bill) puzzle "what is x")
[1] TRUE
[1] FALSE
WHAT IS a AND b ?

Hint: this "works" under 1.5.1 and 1.6.1. 
However, the final value of a will differ between 1.5.1 and 1.6.1 under
certain circumstances. Explain why it is both, DOUBLY INCONSISTENT AND
UNAVOIDABLE.

BTW, the prototype does the same. 

The serious side of this: I think the situation deserves at least a WARNING.

Best


Jens Oehlschl?gel