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

1 new exercise: binary-search #124

Closed
wants to merge 1 commit into from

Conversation

kapitaali
Copy link
Contributor

Doing separate pull requests for new exercises. The first one is binary-search.

Copy link

Hello. Thanks for opening a PR on Exercism 🙂

We ask that all changes to Exercism are discussed on our Community Forum before being opened on GitHub. To enforce this, we automatically close all PRs that are submitted. That doesn't mean your PR is rejected but that we want the initial discussion about it to happen on our forum where a wide range of key contributors across the Exercism ecosystem can weigh in.

You can use this link to copy this into a new topic on the forum. If we decide the PR is appropriate, we'll reopen it and continue with it, so please don't delete your local branch.

If you're interested in learning more about this auto-responder, please read this blog post.


Note: If this PR has been pre-approved, please link back to this PR on the forum thread and a maintainer or staff member will reopen it.

@github-actions github-actions bot closed this Apr 15, 2024
@kapitaali
Copy link
Contributor Author

Fixed config.json on my branch, I wonder if I can make this run again without starting all over?

@axtens
Copy link
Member

axtens commented Apr 15, 2024

Before we go any further i must ask to address the following issue: cobol arrays start with item #1, that is, cobol arrays are 1-based. Your .CUT file however shows that you are assuming that the first item is #0 the way it is for 0-based C-family programming languages.

Please change code and CUT to reflect a 1-based array layout.

@kapitaali
Copy link
Contributor Author

I don't see any reference to zero index. Can you point out the line number in the file?

@kapitaali
Copy link
Contributor Author

I don't see any reference to zero index. Can you point out the line number in the file?

In this file, https://github.com/kapitaali/exercism-cobol-track/blob/binary-search/exercises/practice/binary-search/tst/binary-search/binary-search.cut

doing ctrl-f for (0) brings up zero results.

@axtens
Copy link
Member

axtens commented Apr 16, 2024

L17-23 defines a 7-element array. Then you search for 6 (value of WS-ITEM). WS-RESULT is defined as 3, but in a 1-based array system, WS-RESULT should be 4. The 7-element array should be indexed from 1 to 7 but a WS-RESULT of 3 would only be returned if the 7-element array was indexed 0 to 6.

@kapitaali
Copy link
Contributor Author

Yes, those answers were directly from the .json file. If it is needed to have the results be in COBOL indexing, then I would need to change the code. Going to drop this for now if it's not acceptable.

@axtens
Copy link
Member

axtens commented Apr 16, 2024 via email

@axtens
Copy link
Member

axtens commented Apr 17, 2024

The problem specifications are written in JavaScript Object Notation and JavaScript is a 0-based language. Tests need to be rewritten for 1-based languages.

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