-
-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add game-of-life
exercise
#347
Conversation
That made me think for a while! It seems that the Now that we have Thanks to stackoverflow for this fix. That still leaves the usual line-length linting problems, of course. |
I suspect @jonmcalder would have a better solution, if he is around. |
Also, using a matrix looks fine to me. Maybe my judgement is warped by long experience with Matlab and NumPy, but I don't see why it shouldn't also be idiomatic R. This data type has been in the base language for a long time. |
Thanks @colinleach! I'll wait for @jonmcalder to see if he agrees too, and then we I'll continue fixing things. |
Yes I agree that it makes sense to use a matrix implementation for this. Colin is correct that you can't use I don't have a different approach to suggest right now (and can't give more time to this) but I think there are some interesting approaches here if you want to explore a little more. The implementation and tests are the main thing and in my view the example solution only really needs to demonstrate a possible way to solve the exercise (ideally as elegantly and idiomatically as possible but that can be subjective). So I'm sure I'll be happy with whatever you guys decide here as long as you both are happy. |
17a15a4
to
c659a45
Compare
c659a45
to
8ad8655
Compare
Minor suggestion: maybe the linting should be moved to its own, separate GHA workflow. That will allow the contributor to verify that the tests are passing without having to satisfy the linter. |
I'll happily let others submit a PR to improve upon my solution :) |
Yes probably a good suggestion. Out of interest did you consider using {styler} and/or {precommit} to help avoid linting issues as outlined in the (now very outdated I'm sure) ReadMe? |
I hadn't done that. Probably should have. Sorry |
975a18d
to
8127c43
Compare
@jonmcalder I've fixed CI |
Yup that's fine. Thus far we've managed to get by with only base R (i.e. no tidyverse) for all example solutions so haven't needed it and it made sense to keep CI as lean as possible. But it's quite likely we'll rely on {dplyr} for one or more example solutions going forward so probably makes sense to include it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool - I'm happy with this implementation.
Still hoping someone will put up their hand to improve on Erik's example solution though - not sure if it's the nested functions or the mixing of operations on matrices and data frames with apply / expand.grid / dplyr::inner_join but it's not easy to read and seems like a bit of a code smell to me.
(no offence of course @ErikSchierboom - you're a polyglot so you're bound to approach things differently and code can be subjective - thanks for contributing this exercise!)
None taken! There must be someone that can do this a ton better. |
I'm merging this to have it be available, and then the updated example solution can be PR'ed later. |
I hadn't previously thought about the impact on CI, after adding I understand the bias towards keeping CI lean, but what are the practical implications of adding more packages? Slower? More expensive? |
I think this should work, but I can't seem to get the tests passing.
Also, let me know if using a matrix is a good idea here, or if I should use something else