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 Kotlin I/O operations to fix #736 #762

Merged
merged 2 commits into from
Nov 1, 2024

Conversation

cduarte3
Copy link
Contributor

What GitHub issue does this PR apply to?

Resolves #736

What changed and why?

As per my assigned issue, I've added Kotlin 1.5's input and output operations documentation.

  • Added file io.json in the web/thesauruses/Kotlin/1.5 directory
  • Removed "name" fields in the file before committing and pushing PR as mentioned in the issue

Checklist

  • I claimed any associated issue(s) and they are not someone else's
  • I have looked at documentation to ensure I made any revisions correctly
  • I tested my changes locally to ensure they work
  • For language files, I have validated the edited files are valid JSON and data shows up correctly
  • For website code edits, I have added or edited any appropriate unit tests for my changes

Any additional comments or things to be aware of while reviewing?

Kotlin docs were used in resolving this issue.

Code was researched as best I could, if there are any typos, mistakes, adjustments to comments or syntax fixing needed, please let me know.

Copy link
Member

@geekygirlsarah geekygirlsarah left a comment

Choose a reason for hiding this comment

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

Make tweak some of your examples and I'd be happy to merge this in!

(If you're doing Hacktoberfest, it should still count towards Hacktoberfest since it was opened in October)

Comment on lines 24 to 31
"read_char": {
"code": [
"val variable_name = readln()",
"val first_char = variable_name[0]"
],
"comment": [
"First character can be read by accessing the first element of the string"
]
Copy link
Member

Choose a reason for hiding this comment

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

Generally I've tried to keep the best practice that if you're writing code to replicate a function that doesn't exist, it shouldn't be in here. So if there's no built-in way to do that, it should probably be not-implemented: true

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Has been changed to:

image

Comment on lines 47 to 52
"list_directory": {
"code": [
"val dir = File(\".\")",
"val files = dir.listFiles()",
"file?.forEach { println(it.name) }"
]
Copy link
Member

Choose a reason for hiding this comment

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

Similarly, as a reference tool, this should probably be just dir.listFiles or like File(".").listFiles() to show the form of how it works, not the full example.

(Similar to others below)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Has been changed to:

image

@cduarte3
Copy link
Contributor Author

cduarte3 commented Nov 1, 2024

Other changes:

Read_directory_info has been changed to reflect unavailability as there are no in built operations. Stats are not present, and size or length must be calculated manually.

image


Update_file has been changed to reflect unavailability as there are no set operations for this. Operations require modifying the lines of the file, and appending all plus newline char to the end of the list of strings.

New:

image

Old:

image

Copy link
Member

@geekygirlsarah geekygirlsarah left a comment

Choose a reason for hiding this comment

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

Sweet! I'll merge this in if the checks pass. Thanks for contributing!

Happy (belated) Hacktoberfest!

@cduarte3
Copy link
Contributor Author

cduarte3 commented Nov 1, 2024

Please let me know if everything looks okay now, I am happy to make any further changes.

The only section I am on the fence about now is the read_file_stream.

image

@geekygirlsarah
Copy link
Member

The Docker check fails for a dependency issue, which isn't the fault here. So I'm merging it.

@geekygirlsarah geekygirlsarah merged commit 688123e into codethesaurus:main Nov 1, 2024
4 of 5 checks passed
@cduarte3
Copy link
Contributor Author

cduarte3 commented Nov 1, 2024

Alright, thanks for letting me know, and thanks for the help!

@geekygirlsarah
Copy link
Member

The only section I am on the fence about now is the read_file_stream.

Because of the two ways to do it? Yeah, this happens. I think this works!

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.

[Kotlin] Add input/output
2 participants