-
Notifications
You must be signed in to change notification settings - Fork 162
[Scala] Extract concepts of v2 hamming exercise #399
Conversation
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 like it! Left some comments to think about.
- integer: `Int` is used as return result within `Option` | ||
- Option: `Option` is used as return result | ||
- math operations: `==` | ||
- zip: combine two strings into a sequence of tuples |
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 think this is an implementation of a more general concept. Something like "collections - combining".
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.
Sounds good.
- Option: `Option` is used as return result | ||
- math operations: `==` | ||
- zip: combine two strings into a sequence of tuples | ||
- count: count number of lambda calls that return true |
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.
Similar concept to before, where I think this is an implementation of a more general concept like "collections - folding" or "collections-reducing" or something like that?
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.
You said reduce
in my PRs i think
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.
Right. Whoops. I don't mind us not using the exact same terminology, we'll fix this when compiling the final list.
# Using range and count to count differences | ||
|
||
- range: define range of indexes to stream over | ||
- count: count number of lambda calls that return true |
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.
Similar comment to an earlier comment on implementation vs. general concept.
|
||
- filter: remove matching characters from zipped sequence | ||
- lambda: define lambda to compare characters | ||
- size: calculate size of sequence |
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.
Similar comment to an earlier comment on implementation vs. general concept.
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.
Maybe - "collections - length"?
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.
Ehm, isn't this a special case of "collections - reduce"? I.e. having a collection and reducing it to a single value?
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 not so sure. I see your point. But length/size seems like simple/native functionality on a collection. Where reduce seems like more advanced. A student could easily understand what length means without having any idea how to reduce a collection.
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 see. But is the Concept then maybe simply method types? The thing I'm getting at, is that there is not much special to the length of a collection in terms of Concepts.
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 see - then maybe this falls under a general "collections" concept? As opposed to "collections - reduce". I still think "reduce" is a different concept.
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 could have changed this @ErikSchierboom - you didn't have to merge with collections-length
in there.. If you still want me to change it to something else, it is not a problem.
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.
No worries, we can look at this later.
Initial attempt at extracting hamming concepts. Refs #295