Hi Douglas,<br><br>Thank you for the reply. That clarifies quite a bit.<br>But still, it does not explain the different behavior of those examples, does it? One moment ago, I was thinking that the L suffix might have made it constant and hence can't be modified. Looks like I am wrong. (And fun(1:3) gives the same result too.)<br>
<br>Zhongyi<br><br><div class="gmail_quote">On Fri, Aug 5, 2011 at 3:49 AM, Douglas Bates <span dir="ltr"><<a href="mailto:bates@stat.wisc.edu">bates@stat.wisc.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">On Fri, Aug 5, 2011 at 5:27 AM, Zhongyi Yuan <<a href="mailto:yuanzygoso@gmail.com">yuanzygoso@gmail.com</a>> wrote:<br>
> Dear useR's,<br>
><br>
> After I found Rcpp a few days ago, I've been very excited collecting<br>
> documents for learning. But still I find myself understand little.<br>
> Here's a question I want you to help me with.<br>
><br>
> In page 17 of Dirk and Romain's slides from part2 of the Apr 28 Rcpp<br>
> workshop (here's a link:<br>
> <a href="http://dirk.eddelbuettel.com/papers/rcpp_workshop_part_2_details.pdf" target="_blank">http://dirk.eddelbuettel.com/papers/rcpp_workshop_part_2_details.pdf</a>), I<br>
> can't figure out why the two examples behave differently.<br>
> And also, why are people using 1L:3L? What not just 1:3?<br>
<br>
</div>It happens that they are the same but only because 1:3 generates an<br>
integer sequence by default. Most of the time 1 gives a double<br>
precision floating point number whereas 1L is an integer. Those with<br>
long-time experience in writing R code tend to use the L when they<br>
know that an integer is wanted, just to bypass the conversion step.<br>
<div class="im"><br>
> Maybe I am asking silly question? But please do help me. I couldn't find an<br>
> answer on google.<br>
> Thank you.<br>
><br>
> Best,<br>
> Zhongyi<br>
><br>
><br>
</div>> _______________________________________________<br>
> Rcpp-devel mailing list<br>
> <a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a><br>
> <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
><br>
><br>
</blockquote></div><br>