-
-
Notifications
You must be signed in to change notification settings - Fork 58
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
Approaches for leap
#330
Approaches for leap
#330
Conversation
42256b9
to
aad677d
Compare
Awesome job! |
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.
One small suggestion, but feel free to ignore and merge.
[The match form][match-form] compares an expression to a series of patterns describing its shape. | ||
For this exercise, this takes the form of creating a list containing three Boolean values representing whether a year is divisible by 4, 100, or 400. | ||
The first three patterns describe a three-element list, but each one encodes a literal `#t` to be matched in a different location. The other elements can be any value due to `_`. | ||
The first pattern accepts any value for the first two slots but requires `#t` in the third. | ||
This means any year divisible by 400 will match this pattern regardless of whether it's also divisible by 4 or 100. | ||
The second pattern accepts any value for the first and last slot but requires `#t` in the second slot. | ||
This means any year that's divisible by 100 but not by 400 matches this pattern. | ||
If it were divisible by 400, the first pattern would have matched. | ||
The third pattern operates similarly, and finally any remaining value that didn't match the previous patterns will satisfy the last pattern. |
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.
My only suggestion would be to maybe copy-paste (part of) the pattern matching code in the description, to prevent students from having to scroll up for the code reference.
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.
I'll take care of that tonight. Thanks for the review.
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.
Lovely!
No description provided.