Skip to content

Conversation

@jimhester
Copy link
Member

The default print method for memoised functions wasn't very useful, as you couldn't see the function definition, just the memoised part.

This simply calls the input functions print method along with adding a note that the function in memoised.

R/memoise.r Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be a little simpler as

cat("Memoised function:\n")
print(environment(x)$f)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you are right, the current form was a holdover to my first iteration which used message() instead of cat(). I decided cat() was more consistent with the existing behavior, but did not re-simplify. Thanks!

@jimhester
Copy link
Member Author

jimhester@088416b is ready, I added a note to NEWS.md and ran roxygen, which fixed the previous error on travis due to an unexported print method.

jimhester added a commit that referenced this pull request Jan 19, 2016
Print method for memoised functions
@jimhester jimhester merged commit 1910fbb into r-lib:master Jan 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants