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

New (much smaller) 2.4.1 exercise #95

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

michielp1807
Copy link
Collaborator

Exercise 2.4.1 was very long compared to the other exercises. I made a new exercise for 2.4.1, and moved the old exercise to 2.4.2 (and indicated it as a bonus exercise). I also restored 2.4.1.C (now 2.4.2.C), which was previously removed, likely in an attempt to make the exercise shorter, but without which some of the later exercises did not make sense.

The new 2.4.1 exercise makes you implement vector addition and dot products for a Vec2D type, which later have to be made generic to support multiple number types.

Things I considered including in the new 2.4.1 exercise but decided against:

  • Scalar multiplication: vec * n would work nicely, but n * vec is hard to implement generically because of E0210
  • Conversion between different Vec2D<T> types with From/Into (e.g. Vec2D<i32> to Vec2D<i64>): does not play nice with generics because of conflicting implementations from core

Any feedback or suggestions are welcome!

@michielp1807 michielp1807 linked an issue Sep 9, 2024 that may be closed by this pull request
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.

Exercise for 2.4
1 participant