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

Added a procedure for getting all the keys in a hashmap #741

Merged
merged 13 commits into from Oct 24, 2023

Conversation

degawa
Copy link
Contributor

@degawa degawa commented Oct 13, 2023

To add a procedure for getting all the keys in a hashmap, the subroutine get_all_keys is added to the hashmap types.

get_all_keys is implemented as a subroutine rather than a function to maintain consistency with the other procedures, especially get_other_data.

The tasks done are summarized as follows:

  • Added a deferred procedure to hashmap_type
  • Implemented the type-bound procedure for chaining_hashmap_type and open_hashmap_type.
  • Added some tests and an example.
  • Updated the specification document for hashmaps.

closes #732

Copy link
Member

@jvdp1 jvdp1 left a comment

Choose a reason for hiding this comment

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

Thank you @degawa for this PR. LGTM! I have only a few minor suggestions.

example/hashmaps/example_hashmaps_get_all_keys.f90 Outdated Show resolved Hide resolved
example/hashmaps/example_hashmaps_get_all_keys.f90 Outdated Show resolved Hide resolved
@@ -1148,6 +1154,9 @@ Procedures to modify the content of a map:

Procedures to report the content of a map:

* `map % get_all_keys( all_keys )` - Returns all the keys
presented in the map;
Copy link
Member

Choose a reason for hiding this comment

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

Should it be "present" or "presented"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I use "presented in" to mean "located in," "existing in," or "contained in" here.
I cannot answer whether "present" or "presented" is correct due to my poor English skills, so I need help to create a natural expression, especially a phrase referring to "keys in a hash map."

Copy link
Member

Choose a reason for hiding this comment

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

@milancurcic Any idea how it should be written?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jvdp1
The following expression is used in the documentation of Map in Java:

keySet()
Returns a Set view of the keys contained in this map.

So, I would like to change "presented" to "contained" to follow this expression. I would appreciate your comments.
Thank you.

Copy link
Member

Choose a reason for hiding this comment

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

@degawa "contained" sounds good to me. Please, go ahead!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you, @jvdp1, for giving me a supportive push forward.
I fixed the documentation for the get_all_keys and pushed it.
I would appreciate a review.

example/hashmaps/example_hashmaps_get_all_keys.f90 Outdated Show resolved Hide resolved
Copy link
Member

@jvdp1 jvdp1 left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you for this PR @degawa !

@jvdp1 jvdp1 merged commit b8fbb3c into fortran-lang:master Oct 24, 2023
17 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.

Adding a procedure getting all keys in the hashmaps
2 participants