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

✨ (concepts) Add concept exercise interest-is-interesting #1670

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

devkabiir
Copy link

@devkabiir devkabiir commented Apr 8, 2023

This is inspired by the same on csharp track. Provides introduction to while loops & floating point numbers.

@devkabiir devkabiir force-pushed the concept-while-loops-if-statements branch from 2fd1f3e to 24f6be9 Compare April 10, 2023 14:22
@devkabiir devkabiir changed the title 🚧 (concepts) WIP floating-point-numbers concept exercise ✨ (concepts) Add concept exercise interest-is-interesting Apr 10, 2023
@devkabiir devkabiir marked this pull request as ready for review April 10, 2023 14:22
@devkabiir devkabiir force-pushed the concept-while-loops-if-statements branch 2 times, most recently from d805196 to 796419c Compare April 10, 2023 14:37
Copy link
Member

@ErikSchierboom ErikSchierboom left a 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

config.json Outdated Show resolved Hide resolved
exercises/concept/interest-is-interesting/.docs/hints.md Outdated Show resolved Hide resolved
Comment on lines 9 to 12
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.
Copy link
Member

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

Suggested change
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.

Copy link
Author

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.

Comment on lines +26 to +23
let mut accumulating_balance = balance;
let mut years = 0;
Copy link
Member

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.

Copy link
Author

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.

@devkabiir devkabiir force-pushed the concept-while-loops-if-statements branch from 796419c to b495f8b Compare April 14, 2023 20:26
}

pub fn interest(balance: f64) -> f64 {
return balance * interest_rate(balance) / 100.0;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return balance + interest(balance);
balance + interest(balance)

years += 1;
}

return years;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return years;
years

Comment on lines 2 to 14
if balance < 0.0 {
return 3.213;
}

if balance < 1000.0 {
return 0.5;
}

if balance < 5000.0 {
return 1.621;
}

return 2.475;

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.

Suggested change
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
}

@devkabiir devkabiir force-pushed the concept-while-loops-if-statements branch 2 times, most recently from 8fb941c to e830186 Compare May 1, 2023 20:23
This is inspired by the same on csharp track. Provides introduction to while loops & floating point numbers.
@senekor
Copy link
Contributor

senekor commented Dec 14, 2023

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.

@senekor senekor closed this Dec 14, 2023
@senekor senekor reopened this Dec 14, 2023
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.

4 participants