আমি আর শিখছি এবং বর্তমানে আমি এই বইটি পড়ছি । আমি ধারণাটি বুঝতে পেরেছি তা নিশ্চিত করার জন্য, আমি নিম্নলিখিত পরীক্ষাটি চালিয়েছিলাম যা আমার পক্ষে বেশ বিভ্রান্তিকর বলে প্রমাণিত হয়েছিল এবং আপনি যদি এটি পরিষ্কার করতে পারতেন তবে আমি প্রশংসা করব। এখানে পরীক্ষাটি দেওয়া হয়েছে, যা আমি টার্মিনাল থেকে সরাসরি আর শেলটিতে ছুটে এসেছি (আরস্টুডিও বা ইম্যাকস ইএসএস ব্যবহার না করে)।
> library(lobstr)
>
> x <- c(1500,2400,8800)
> y <- x
> ### So the following two lines must return the same memory address
> obj_addr(x)
[1] "0xb23bc50"
> obj_addr(y)
[1] "0xb23bc50"
> ### So as I expected, indeed both x and y point to the same memory
> ### location: 0xb23bc50
>
>
>
> ### Now let's check that each element can be referenced by the same
> ### memory address either by using x or y
> x[1]
[1] 1500
> y[1]
[1] 1500
> obj_addr(x[1])
[1] "0xc194858"
> obj_addr(y[1])
[1] "0xc17db88"
> ### And here is exactly what I don't understand: x and y point
> ### to the same memory address, so the same must be true for
> ### x[1] and y[1]. So how come I obtain two different memory
> ### addresses for the same element of the same vector?
>
>
>
> x[2]
[1] 2400
> y[2]
[1] 2400
> obj_addr(x[2])
[1] "0xc15eca0"
> obj_addr(y[2])
[1] "0xc145d30"
> ### Same problem!
>
>
>
> x[3]
[1] 8800
> y[3]
[1] 8800
> obj_addr(x[3])
[1] "0xc10e9b0"
> obj_addr(y[3])
[1] "0xc0f78e8"
> ### Again the same problem: different memory addresses
আপনি আমাকে বলতে পারেন যে আমার ভুলটি কোথায় এবং আমি এই সমস্যায় কী ভুল বুঝেছি?
obj_addr(x[1])দু'বার দৌড়াতেও আপনাকে আলাদা ফলাফল দেওয়া উচিত, কারণ প্রতিটি নতুন পূর্ণসংখ্যার নিজস্ব ঠিকানা থাকবে।