如题,我找了他的gmail邮箱,写了如下内容给他,不知道他能看到?能看懂?(我英文写的不好)么?
有其他途径吗
Dear hadley,
I recently read your book advanced r programming on your adv website, and when i read your chapter Meta programming, in section expressions, in the logical_abbr function, i found a bug, in this statement:
<br />
else if (is.call(x) || is.pairlist(x)) {<br />
for (i in seq_along(x)) {<br />
if (logical_abbr(x[[i]])) return(TRUE)<br />
}<br />
}<br />
I think you should put a FALSE in the end of for
<br />
else if (is.call(x) || is.pairlist(x)) {<br />
for (i in seq_along(x)) {<br />
if (logical_abbr(x[[i]])) return(TRUE)<br />
}<br />
FALSE<br />
}<br />
because when i use your source code to treat code like this:
<br />
logical_abbr(quote(function(x=TRUE, na.rm = TRUE) 1 ))<br />
I found it trigger an error.</p>
That is because when it recursive, is.pairlist(x) is TRUE then loop in (x=TRUE, na.rm = TRUE) and either return TRUE so Nothing would be returned from the call logical_abbr(x) ,then in the outside ,if (...) will get nothing to judge,then get the error
If we put a FALSE, then after loop if not return TRUE then will return FALSE , your excise 2 in the modifying the call tree help me found it .