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

Add Bracket Push Exercise #513

Merged
merged 2 commits into from
Apr 7, 2017
Merged

Conversation

lpalma
Copy link
Contributor

@lpalma lpalma commented Mar 30, 2017

Port Bracket Push to the Haskell Track.

For the Example Solution, I tried to explore Data constructors and the Maybe type.

config.json Outdated
@@ -110,6 +110,12 @@
]
},
{
"slug": "bracket-push",
"difficulty": 3,
Copy link
Contributor Author

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?

Copy link
Member

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"
    ]
  }
]


Copy link
Contributor Author

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.

Copy link
Member

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.

@lpalma lpalma force-pushed the add-bracket-push branch 3 times, most recently from f0df545 to 7539199 Compare April 1, 2017 14:03
config.json Outdated
@@ -110,6 +110,12 @@
]
},
{
"slug": "bracket-push",
"difficulty": 3,
Copy link
Member

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

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.

@@ -0,0 +1 @@
resolver: lts-8.6
Copy link
Member

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?


-- Test cases adapted from
-- `exercism/x-common/exercises/bracket-push/canonical-data.json`
-- on 2017-03-29.
Copy link
Member

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?

@lpalma lpalma force-pushed the add-bracket-push branch from 7539199 to 70aa183 Compare April 2, 2017 12:48
@lpalma
Copy link
Contributor Author

lpalma commented Apr 2, 2017

thanks for the feedback @petertseng, they have been addressed.

@petertseng
Copy link
Member

I think this will be ready if we make the Stack version uniform.

@lpalma lpalma force-pushed the add-bracket-push branch from 70aa183 to c25f3d2 Compare April 6, 2017 16:05
@petertseng petertseng force-pushed the add-bracket-push branch 2 times, most recently from 5792a9c to 337c2a9 Compare April 7, 2017 10:10
@petertseng petertseng force-pushed the add-bracket-push branch 2 times, most recently from d31e019 to e94cc6f Compare April 7, 2017 10:24
@petertseng petertseng merged commit 7a26872 into exercism:master Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants