-
-
Notifications
You must be signed in to change notification settings - Fork 202
Port exercise/cars assemble #713
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
base: main
Are you sure you want to change the base?
Conversation
Response to reviewer comments
Clarified maximum and minimum value references for Kotlin types.
My recommendation is:
If you hate my version and want a total rewrite, that is a separate problem we will need to address! Also: I made some recent changes to PR #711 to address review comments, so it may be worth waiting until that is merged. |
"colinleach" | ||
], | ||
"contributors": [], | ||
"blurb": "Kotlin has a variety of integer and floating point types, and a math library to manipulate them." |
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.
"blurb": "Kotlin has a variety of integer and floating point types, and a math library to manipulate them." | |
"blurb": "Kotlin has a variety of integer and floating point types, and a math library to manipulate them." |
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 make changes in PR #711 (I can't edit this PR)
Assigning larger values will cause ["overflow"][wiki-overflow], causing either an exception (_bad_) or corrupted data (_worse_). | ||
|
||
- Integers can be `Byte`, `Short`, `Int` or `Long`, respectively 8, 16, 32 and 64 bits (1, 2 4, 8 bytes). | ||
- Unsigned integers have a `U` prefix: `UByte`, `UShort`, `UInt` or `ULong`. |
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 should explain signed versus unsigned at some point before this.
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.
There isn't much "before", so I tried to clarify these bullets.
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 am now reviewing this and I saw that is a suggestion I already made on the concept doc.
- Unsigned integers have a `U` prefix: `UByte`, `UShort`, `UInt` or `ULong`. | ||
- Floating point types are `Float` (32-bit) or `Double` (64-bit). | ||
|
||
Integer variables relying on type inference default to `Int`, even on 64-bit machines, but floating point variables default to `Double`. |
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.
Would students be expected to know what type inference is by this point?
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.
Yes, it was in Basics
val lightSpeed = 3.0e8 // scientific notation (units of m/s) | ||
``` | ||
|
||
Hexadecimal and binary literals are conventional: `0x7F` and `0b100101` respectively. |
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.
conventional relative to what? What makes them a hexadecimal or binary literal specifically?
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 am now reviewing this and I saw that is a suggestion I already made on the concept doc.
} | ||
|
||
@Test | ||
fun `calculate working cars per minute with 0 production rate`() { |
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.
fun `calculate working cars per minute with 0 production rate`() { | |
fun `calculate working cars per minute with 0 success rate`() { |
Response to comments in exercism#713 (@BNAndras)
This ports the cars assemble from the Go track. The reason for going with the Go version instead of Java is that the Java version uses
if
statements in the same exercise, which I thought could be a separate concept.This is a draft as it still missing an introduction (I plan on doing writing an introduction based on the concept introduction before taking this out of draft).