Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

[Scala] Extract concepts of v2 hamming exercise #399

Merged
merged 2 commits into from
Jan 30, 2020

Conversation

ricemery
Copy link
Member

Initial attempt at extracting hamming concepts. Refs #295

@ricemery ricemery requested a review from a team January 28, 2020 03:45
@aimorris aimorris changed the title Initial attempt at extracting hamming concepts. Refs #295 [Scala] Extract concepts of v2 hamming exercise Jan 28, 2020
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.

I like it! Left some comments to think about.

languages/scala/reference/exercise-concepts/hamming.md Outdated Show resolved Hide resolved
- 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
Copy link
Member

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".

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good.

languages/scala/reference/exercise-concepts/hamming.md Outdated Show resolved Hide resolved
- 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
Copy link
Member

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?

Copy link
Contributor

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

Copy link
Member

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.

languages/scala/reference/exercise-concepts/hamming.md Outdated Show resolved Hide resolved
# Using range and count to count differences

- range: define range of indexes to stream over
- count: count number of lambda calls that return true
Copy link
Member

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
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe - "collections - length"?

Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member Author

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.

Copy link
Member

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants