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

Sync exercise markdown files and metadata #662

Merged
merged 1 commit into from
Feb 14, 2024

Conversation

BNAndras
Copy link
Member

No description provided.

@BNAndras BNAndras changed the title Sync exercise files Sync exercise markdown files and metadata Aug 29, 2023
@BNAndras BNAndras force-pushed the sync-exercise-files branch from 2eed747 to 309383a Compare January 28, 2024 18:06
@BNAndras
Copy link
Member Author

@exercism/julia, can I get a review? I pulled down the latest docs and metadata.

@cmcaine
Copy link
Contributor

cmcaine commented Jan 28, 2024

Can you provide the exact code that you ran to do the sync so that I can confirm I get the same output without having to eyeball that huge diff?

Bob's conversational partner is a purist when it comes to written communication and always follows normal rules regarding sentence punctuation in English.
- **"Sure."**
This is his response if you ask him a question, such as "How are you?"
The convention used for questions is that it ends with a question mark.
Copy link
Contributor

Choose a reason for hiding this comment

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

This has poor grammar (questions is plural => "they" rather than "it"). Please consider opening a PR on the problem-spec repo.

Suggested change
The convention used for questions is that it ends with a question mark.
Questions end with a question mark.

Comment on lines 31 to 41
- conversion and promotion of integers to rationals. Read the manual's chaper on [conversion and promotion](https://docs.julialang.org/en/v1/manual/conversion-and-promotion/) for details about how and why to do this.
- addition, subtraction, multiplication and division of two rational numbers
- absolute value, exponentiation of a given rational number to an integer power, exponentiation of a real number to a rational number
- comparison (less than, equals, etc.) of two rational numbers, comparison of a rational number and an integer

In Julia, there are fallback methods already defined for many arithmetic methods, comparisons, etc, especially for subtypes of `Real`.
You do not need to write your own method for `>=` if you have already defined `<`; nor do you need to define `^(::RationalNumber, ::Integer)` if you have provided a method for multiplication; etc.
You can examine the fallback methods for a given function by entering `methods(abs)` or `edit(abs, (RationalNumber, RationalNumber))` at the REPL.

Your implementation of rational numbers should always be reduced to lowest terms. For example, `4/4` should reduce to `1/1`, `30/60` should reduce to `1/2`, `12/8` should reduce to `3/2`, etc. To reduce a rational number `r = a/b`, divide `a` and `b` by the greatest common divisor (gcd) of `a` and `b`. So, for example, `gcd(12, 8) = 4`, so `r = 12/8` can be reduced to `(12/4)/(8/4) = 3/2`.
The reduced form of a rational number should be in "standard form" (the denominator should always be a positive integer). If a denominator with a negative integer is present, multiply both numerator and denominator by `-1` to ensure standard form is reached. For example, `3/-4` should be reduced to `-3/4`
Copy link
Contributor

Choose a reason for hiding this comment

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

There's Julia-specfic stuff in here that should be retained. Without these hints the exercise is harder and students will probably learn less.

Copy link
Contributor

Choose a reason for hiding this comment

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

The first set of bullet points also contains content that should be retained:

- conversion and promotion of integers to rationals. Read the manual's chaper on [conversion and promotion](https://docs.julialang.org/en/v1/manual/conversion-and-promotion/) for details about how and why to do this.
- comparison (less than, equals, etc.) of two rational numbers, comparison of a rational number and an integer

IMO, it is important to keep hinting to the student that conversion and promotion is the first thing they should do. If you want to move this into the .append file then please find some way of making it more prominent.

Otherwise, maybe just revert the changes to the files in this directory.

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'd rather move the Julia-specific information to an append as long as we're not duplicating information in the instructions. That's the suggested workflow in the Exercism docs and I don't see a good reason to deviate. Editing the instructions in place just delays the issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

I appreciate your work in revising this PR. Are you saying that you intend to move those two lines into a .append file?

As I say below, I think that's fine so long as the advice to start with conversion and promotion is made prominent (ideally even more prominent than it is now).

Re: reverting, you don't see a good reason to deviate from the suggested workflow.

The rational-numbers exercise, like several others on the Julia track, has a bunch of intentional differences from the upstream definitions in problem-specs. I think the julia-specific changes are good and that if we remove them it should be because they are bad for students or mentors, not because they are inconsistent with problem-specifications.

What is the cost of letting rational-numbers continue to differ from the problem-spec version? I don't work on this repo very much any more, is there a developer experience issue that I'm not seeing?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I've been making appends as we went through the changes.

Regarding deviation, I meant the website's docs say instructions.md and introduction.md should match what's in the problem specifications. configlet sync syncs the copy from problem specifications so if you add track-specific text to those two files, it'll be overwritten. configlet sync doesn't touch the .append files so any track-specific content there will be unaffected.

A problem with the appends is that they go beneath the upstream content on the site. Therefore, you can only clarify the upstream content, not modify text in it. Moving the Julia-specific edits to the bottom means the student loses some of their original context.

That said, using .appends simplifies track maintenance because it allows for easy syncing. This year, Erik and Jeremy are updating the upstream content almost every week.

Copy link
Contributor

@cmcaine cmcaine left a comment

Choose a reason for hiding this comment

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

Please retain the Julia-specific changes. Thanks!

@BNAndras
Copy link
Member Author

Can you provide the exact code that you ran to do the sync so that I can confirm I get the same output without having to eyeball that huge diff?

configlet sync —docs —metadata -uy from what I recall off hand.

Copy link
Contributor

@cmcaine cmcaine left a comment

Choose a reason for hiding this comment

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

Thanks for the new commit.

Please either:

  • revert the changes to rational-number,
  • or merge in the Julia-specific changes without a .append,
  • or find a good way of capturing all the Julia-specific stuff in the .append.

@cmcaine cmcaine mentioned this pull request Jan 30, 2024
@BNAndras
Copy link
Member Author

BNAndras commented Feb 2, 2024

I'll work on finishing this over the weekend.

@BNAndras
Copy link
Member Author

BNAndras commented Feb 5, 2024

For rational-numbers, the append currently contains the Julia-specific content discussing fallback methods. I'm not seeing anything else that needs to be captured in the append.

@cmcaine
Copy link
Contributor

cmcaine commented Feb 5, 2024

The append does not contain the extra bullet points that go under "implement the following...": https://github.com/exercism/julia/pull/662/files#r1470022604

Please either revert the changes to the rational numbers folder (contributors can just deal with configlet sync warning them about rational numbers) or find a way to include that information in a natural and high-profile way (I can't find a nice way of doing it, so I favour reverting the changes to that folder).

@BNAndras
Copy link
Member Author

BNAndras commented Feb 5, 2024

There isn’t a way to include that information inline with an append. Rational Numbers isn’t a featured #48in24 exercise so I’m not expecting new upstream content in the near future. So we can keep our version but just be aware of any configlet syncs in the future. I’d rather use the latest upstream content and add the Julia-specific bits into the files since there’s generally a good reason for the docs to have been updated upstream.

@cmcaine
Copy link
Contributor

cmcaine commented Feb 5, 2024

I'm fine with the julia specific instructions from those bullet points going into the .jl file instead. That could be a good place for them, otherwise, yes, please revert them and I'll merge this PR.

@BNAndras BNAndras force-pushed the sync-exercise-files branch from b40219a to 5405bb1 Compare February 14, 2024 06:12
@BNAndras
Copy link
Member Author

I reverted the sync for the rational-numbers documentation.

@cmcaine
Copy link
Contributor

cmcaine commented Feb 14, 2024

Thanks again for this contribution.

Because this is a force push, I can't easily see what changed in the commit, but I'm just going to trust you on it and merge it.

In future, please help me out by avoiding force pushes or rebases and making separate commits when responding to review.

@cmcaine cmcaine merged commit 4db8b37 into exercism:main Feb 14, 2024
11 checks passed
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