-
-
Notifications
You must be signed in to change notification settings - Fork 195
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
Add Bracket Push Exercise #513
Conversation
config.json
Outdated
@@ -110,6 +110,12 @@ | |||
] | |||
}, | |||
{ | |||
"slug": "bracket-push", | |||
"difficulty": 3, |
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.
Not 100% sure it is difficulty 3. Perhaps I'm overcomplicating it?
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.
It's true that once one realizes one can use a stack, it is easy. So the hard part is not writing the implementation. It is figuring out how to tackle the problem at all.
Because of this, I would actually rate higher, maybe 4 or 5.
If it helps to see how other tracks rated it:
for i in tracks/*/config.json; do echo $i; jq 'if any(.exercises[]; .difficulty != 1) then .exercises | map(select(.slug == "bracket-push")) else [] end' < $i; done
tracks/ceylon/config.json
[
{
"slug": "bracket-push",
"difficulty": 6,
"topics": [
"Parsing",
"Stacks",
"Strings"
]
}
]
tracks/csharp/config.json
[
{
"slug": "bracket-push",
"difficulty": 5,
"topics": [
"Parsing",
"Strings"
]
}
]
tracks/elixir/config.json
[
{
"slug": "bracket-push",
"difficulty": 3,
"topics": []
}
]
tracks/fsharp/config.json
[
{
"slug": "bracket-push",
"difficulty": 7,
"topics": [
"Parsing",
"Strings"
]
}
]
tracks/java/config.json
[
{
"slug": "bracket-push",
"difficulty": 5,
"topics": []
}
]
tracks/lua/config.json
[
{
"slug": "bracket-push",
"difficulty": 5,
"topics": [
"stacks",
"strings",
"algorithms",
"control-flow (if-else statements)",
"control-flow (loops)"
]
}
]
tracks/objective-c/config.json
[
{
"difficulty": 5,
"slug": "bracket-push",
"topics": [
"Strings",
"Conditionals",
"Looping"
]
}
]
tracks/ocaml/config.json
[
{
"slug": "bracket-push",
"difficulty": 4,
"topics": [
"Stacks"
]
}
]
tracks/rust/config.json
[
{
"slug": "bracket-push",
"difficulty": 4,
"topics": [
"From trait",
"stack or recursion"
]
}
]
tracks/swift/config.json
[
{
"difficulty": 7,
"slug": "bracket-push",
"topics": [
"Parsing",
"Strings"
]
}
]
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.
In that case, I'll include Stack
in the list of topics and increase its difficulty to 5. I agree it shouldn't go any higher than 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.
OK.
The only other exercise I can think of that would get Stack
in its topic list at the same time would be forth
.
f0df545
to
7539199
Compare
config.json
Outdated
@@ -110,6 +110,12 @@ | |||
] | |||
}, | |||
{ | |||
"slug": "bracket-push", | |||
"difficulty": 3, |
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.
It's true that once one realizes one can use a stack, it is easy. So the hard part is not writing the implementation. It is figuring out how to tackle the problem at all.
Because of this, I would actually rate higher, maybe 4 or 5.
If it helps to see how other tracks rated it:
for i in tracks/*/config.json; do echo $i; jq 'if any(.exercises[]; .difficulty != 1) then .exercises | map(select(.slug == "bracket-push")) else [] end' < $i; done
tracks/ceylon/config.json
[
{
"slug": "bracket-push",
"difficulty": 6,
"topics": [
"Parsing",
"Stacks",
"Strings"
]
}
]
tracks/csharp/config.json
[
{
"slug": "bracket-push",
"difficulty": 5,
"topics": [
"Parsing",
"Strings"
]
}
]
tracks/elixir/config.json
[
{
"slug": "bracket-push",
"difficulty": 3,
"topics": []
}
]
tracks/fsharp/config.json
[
{
"slug": "bracket-push",
"difficulty": 7,
"topics": [
"Parsing",
"Strings"
]
}
]
tracks/java/config.json
[
{
"slug": "bracket-push",
"difficulty": 5,
"topics": []
}
]
tracks/lua/config.json
[
{
"slug": "bracket-push",
"difficulty": 5,
"topics": [
"stacks",
"strings",
"algorithms",
"control-flow (if-else statements)",
"control-flow (loops)"
]
}
]
tracks/objective-c/config.json
[
{
"difficulty": 5,
"slug": "bracket-push",
"topics": [
"Strings",
"Conditionals",
"Looping"
]
}
]
tracks/ocaml/config.json
[
{
"slug": "bracket-push",
"difficulty": 4,
"topics": [
"Stacks"
]
}
]
tracks/rust/config.json
[
{
"slug": "bracket-push",
"difficulty": 4,
"topics": [
"From trait",
"stack or recursion"
]
}
]
tracks/swift/config.json
[
{
"difficulty": 7,
"slug": "bracket-push",
"topics": [
"Parsing",
"Strings"
]
}
]
@@ -0,0 +1,36 @@ | |||
module BracketPush (isPaired) where |
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 would just call the module Brackets
. the Push
is too much of an implementation detail and I don't even think it should go in the name: exercism/problem-specifications#693
I would maybe call the function arePaired
so that can read like Brackets.arePaired
, and this makes sense since it handles multiple brackets not just one pair.
exercises/bracket-push/stack.yaml
Outdated
@@ -0,0 +1 @@ | |||
resolver: lts-8.6 |
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.
same q as #511 (comment) - same across all exercises, or allow to be different?
exercises/bracket-push/test/Tests.hs
Outdated
|
||
-- Test cases adapted from | ||
-- `exercism/x-common/exercises/bracket-push/canonical-data.json` | ||
-- on 2017-03-29. |
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.
same q as #511 (comment) - how should we put the version in here?
thanks for the feedback @petertseng, they have been addressed. |
I think this will be ready if we make the Stack version uniform. |
5792a9c
to
337c2a9
Compare
d31e019
to
e94cc6f
Compare
e94cc6f
to
7246fd5
Compare
Port Bracket Push to the Haskell Track.
For the Example Solution, I tried to explore Data constructors and the Maybe type.