Draft
Conversation
added 26 commits
September 4, 2023 14:57
…sts for conversions that should fail.
Khepu
reviewed
Sep 9, 2023
| [x] | ||
| (math-round (* x 255))) | ||
|
|
||
| (defn partition-string |
Contributor
There was a problem hiding this comment.
this might be easier to write by turning the string to a seq of characters, using the actual partition method and then mapping str over the output of it.
Khepu
reviewed
Sep 9, 2023
| "Normalizes a float 0 <= x <= 255 to 0 <= x <= 1." | ||
| [x] | ||
| (let [v (double (/ x 255))] | ||
| (if (= (double (int v)) v) |
Contributor
There was a problem hiding this comment.
You could just cast it to int directly, checking won't really save you anything
Khepu
reviewed
Sep 9, 2023
|
|
||
| (defn ratio?->double [x] | ||
| (cond (nil? x) 1 | ||
| (ratio? x) (double x) |
Contributor
There was a problem hiding this comment.
probably here too, you can just cast it to double if it's not nil. also mapping nil to 1 is a bit odd. did you mean 0?
Owner
Author
There was a problem hiding this comment.
It's used where you convert a ratio between 0 and 1 to a float between 0 and 1, if alpha is nil, the default value is 1. Honestly, it was also confused with it, I should change it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.