Skip to content
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

Getting the part2 result as a by-product of solving part1 #49

Open
joncol opened this issue Oct 16, 2020 · 2 comments
Open

Getting the part2 result as a by-product of solving part1 #49

joncol opened this issue Oct 16, 2020 · 2 comments

Comments

@joncol
Copy link

joncol commented Oct 16, 2020

Does someone have a good suggestion on how to organize the code when your solution of part1 also yields the answer to part2? Would I use a global to store the part2 result, and then just return that in the part2 function? Or is there a cleaner way to do it?

@gobanos
Copy link
Owner

gobanos commented Oct 16, 2020

Your part1 function is a standard function, you should be able to call it from part2

@joncol
Copy link
Author

joncol commented Oct 16, 2020

I was just thinking of a nice way to store the result, so I don't have to do the same calculations twice. Maybe there's some nice memoization crate I could use.

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

No branches or pull requests

2 participants