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

strain: Add parameters to exercise placeholder #642 #698

Merged
merged 2 commits into from
Nov 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion exercises/strain/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ For example, given the collection of numbers:

- 1, 2, 3, 4, 5

And the predicate:
And the predicate:

Note: _a predicate P(x) will be true or false, depending on whether x belongs to a set._ [Wikipedia - Predicate](https://en.wikipedia.org/wiki/Predicate_(mathematical_logic)))

- is the number even?

Expand Down
4 changes: 2 additions & 2 deletions exercises/strain/strain.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
def keep():
def keep(sequence, predicate):
Copy link
Contributor

@ilya-khadykin ilya-khadykin Oct 4, 2017

Choose a reason for hiding this comment

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

I like your variant, it's a good one.
But I think not everyone knows a concept of predicate. Maybe it's better to change it to lambda_expression?

The other option is to add hint for the exercise explaining a concept of predicate (preferable)

What are your thoughts on this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, It seems from the problem statement that a predicate is requried. I don't really think it's necessary for the predicate to be a lambda function, it just has to be any function that takes the item from the list and returns a boolean.

I agree that a hint would be better, I found this little snippet from wikipedia:

a predicate P(x) will be true or false, depending on whether x belongs to a set.

https://en.wikipedia.org/wiki/Predicate_(mathematical_logic)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh, perhaps just add the predicate definition in the README.md?

Copy link
Contributor

@ilya-khadykin ilya-khadykin Oct 7, 2017

Choose a reason for hiding this comment

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

I am not sure actually, since there is an ability to generate these doc files from special templates. It helps staying in sync with https://github.com/exercism/problem-specifications/ and stuff like that.

Looks like this track uses old approach and I'll have to do a bit of research on what is the best way to add hints to exercises and come back to you. Is it Ok?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ya, when I get some more time I can take a look too.

pass


def discard():
def discard(sequence, predicate):
pass