-
Notifications
You must be signed in to change notification settings - Fork 520
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
✨ (concepts) Add concept exercise interest-is-interesting
#1670
base: main
Are you sure you want to change the base?
✨ (concepts) Add concept exercise interest-is-interesting
#1670
Conversation
2fd1f3e
to
24f6be9
Compare
interest-is-interesting
d805196
to
796419c
Compare
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.
Just a couple of nits
exercises/concept/interest-is-interesting/.docs/instructions.md
Outdated
Show resolved
Hide resolved
Rust implements the IEEE 754-2008 "binary32" and "binary64" floating-point types | ||
as `f32` and `f64`, respectively. | ||
The f32 type is a single-precision float, and f64 has double precision. |
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.
A general comment that also applies to other documents: our style guide suggests using one sentence per line: https://exercism.org/docs/building/markdown/markdown#h-one-sentence-per-line
Rust implements the IEEE 754-2008 "binary32" and "binary64" floating-point types | |
as `f32` and `f64`, respectively. | |
The f32 type is a single-precision float, and f64 has double precision. | |
Rust implements the IEEE 754-2008 "binary32" and "binary64" floating-point types as `f32` and `f64`, respectively. | |
The f32 type is a single-precision float, and f64 has double precision. |
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 have auto wrap on my editor, that's probably what did it. Do you know of any automated way to format markdown paragraphs perhaps a linter or formatter doesn't necessarily need to have IDE integration.
let mut accumulating_balance = balance; | ||
let mut years = 0; |
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 checked to see if students know about the mut
keyword. It is mentioned in the introduction of the lasagna exercise, but I think adding a hints makes sense.
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 added assignment
as a prerequisites for this concept and, in cars-assemble
#1675 I do exactly that. Should I still include an intro here?
Based on my understanding of the state of rust syllabus & the issues around it. I decided not to rely on existing concept exercise implementations. All of my implementations are either completely independent or only build up on what I have added (& will add soon). My focus currently is to split them into much smaller chunks so later we can implement Rust specific concepts without hesitation.
796419c
to
b495f8b
Compare
} | ||
|
||
pub fn interest(balance: f64) -> f64 { | ||
return balance * interest_rate(balance) / 100.0; |
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.
return balance * interest_rate(balance) / 100.0; | |
balance * interest_rate(balance) / 100.0 |
} | ||
|
||
pub fn annual_balance_update(balance: f64) -> f64 { | ||
return balance + interest(balance); |
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.
return balance + interest(balance); | |
balance + interest(balance) |
years += 1; | ||
} | ||
|
||
return years; |
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.
return years; | |
years |
if balance < 0.0 { | ||
return 3.213; | ||
} | ||
|
||
if balance < 1000.0 { | ||
return 0.5; | ||
} | ||
|
||
if balance < 5000.0 { | ||
return 1.621; | ||
} | ||
|
||
return 2.475; |
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.
We can avoid explicit return
entirely.
if balance < 0.0 { | |
return 3.213; | |
} | |
if balance < 1000.0 { | |
return 0.5; | |
} | |
if balance < 5000.0 { | |
return 1.621; | |
} | |
return 2.475; | |
if balance < 0.0 { | |
3.213 | |
} else if balance < 1000.0 { | |
0.5 | |
} else if balance < 5000.0 { | |
1.621 | |
} else { | |
2.475 | |
} |
8fb941c
to
e830186
Compare
This is inspired by the same on csharp track. Provides introduction to while loops & floating point numbers.
The author of this PR has stopped responding in the discussions planning the work on the syllabus. But there's been a lot of work put into reviews already, so I'm keeping it open in case it can be salvaged in a future attempt to create a good syllabus. |
This is inspired by the same on csharp track. Provides introduction to while loops & floating point numbers.