Skip to content

Commit b40bf3a

Browse files
committed
Merge branch 'hash_maps' of github.com:wclodius2/stdlib into hash_maps
2 parents cb5a6df + cf89d00 commit b40bf3a

File tree

1 file changed

+20
-27
lines changed

1 file changed

+20
-27
lines changed

doc/specs/stdlib_hashmaps.md

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,9 @@ is an `intent(out)` argument.
232232
copy_key, operator(==)equal_keys, key_type
233233
use iso_fortran_env, only: int8
234234
implicit none
235-
integer(int8), allocatable :: value(:)
235+
integer(int8) :: i, value(15)
236236
type(key_type) :: key_in, key_out
237-
integer(int_8) :: i
238-
allocate( value(1:15) )
239-
do i=1, 15
240-
value(i) = i
241-
end do
237+
value = [(i, i = 1, 15)]
242238
call set( key_in, value )
243239
call copy_key( key_in, key_out )
244240
print *, "key_in == key_out = ", key_in == key_out
@@ -281,11 +277,11 @@ is an `intent(out)` argument.
281277
implicit none
282278
type(other_type) :: other_in, other_out
283279
integer(int_8) :: i
284-
class(*), allocatable :: dummy
285-
type dummy_type
280+
class(*), allocatable :: dummy
281+
type dummy_type
286282
integer(int8) :: value(15)
287283
end type
288-
type(dummy_type) :: dummy_val
284+
type(dummy_type) :: dummy_val
289285
do i=1, 15
290286
dummy_val % value1(i) = i
291287
end do
@@ -473,13 +469,9 @@ is an `intent(out)` argument.
473469
copy_key, free_key, key_type, set
474470
use iso_fortran_env, only: int8
475471
implicit none
476-
integer(int8), allocatable :: value(:)
472+
integer(int8) :: i, value(15)
477473
type(key_type) :: key_in, key_out
478-
integer(int_8) :: i
479-
allocate( value(1:15) )
480-
do i=1, 15
481-
value(i) = i
482-
end do
474+
value = [(i, i=1, 15)]
483475
call set( key_in, value )
484476
call copy_key( key_in, key_out )
485477
call free_key( key_out )
@@ -922,7 +914,7 @@ is an `intent(out)` argument.
922914
`other`: shall be a scalar variable of type `other_type`. It
923915
is an `intent(out)` argument.
924916

925-
`value`: if the first argument is `key` `vaalue` shall be a default
917+
`value`: if the first argument is `key` `value` shall be a default
926918
character string expression, or a vector expression of type integer
927919
and kind `int8`, while for a first argument of type `other` `value`
928920
shall be of type `class(*)`. It is an `intent(in)` argument.
@@ -956,7 +948,7 @@ associated procedures and constants that implement two simple hash map
956948
types using separate chaining hashing and open addressing hashing. The
957949
derived type `hashmap_type` is the parent type to its two
958950
extensions: `chaining_hashmap_type` and `open_hashmap_type`.
959-
`chaining_hashmap_type`. The extension types provide
951+
The extension types provide
960952
procedures to manipulate the structure of a hash map object:
961953
`init`, `map_entry`, `rehash`, `remove_entry`, and
962954
`set_other_data`. They also provide procedures to inquire about
@@ -1011,7 +1003,7 @@ entities of kind `int_probes`. Currently `int_probes` has the value of
10111003

10121004
The constant `load_factor` is only used by the `open_hashmap_type`. It
10131005
specifies the maximum fraction of the available slots that may be
1014-
filled before expansion occurs. The current `load_factor = ).5625` so
1006+
filled before expansion occurs. The current `load_factor = 0.5625` so
10151007
the current implementation of `open_hashmap_type` can only hold a
10161008
little more than `2**29` entries.
10171009

@@ -1035,7 +1027,7 @@ the implementation of the `chaining_hashmap_type` public type. The
10351027
four private derived types, `open_map_entry_type`,
10361028
`open_map_entry_list`, `open_map_entry_ptr`, and `open_map_entry_pool`
10371029
are used in the implementation of the `open_hashmap_type` public
1038-
type:. Each of these types are described below.
1030+
type. Each of these types are described below.
10391031

10401032
#### The `hashmap_type` abstract type
10411033

@@ -1459,11 +1451,12 @@ Subroutine
14591451
`intent(out)` argument. If `true` an entry with the given `key`
14601452
exists in the map, if false `other` is undefined.
14611453

1462-
* The following is an example of the retrieval of other data
1454+
##### Example
1455+
1456+
The following is an example of the retrieval of other data
14631457
associated with a `key`:
14641458

14651459

1466-
##### Example
14671460

14681461
```Fortran
14691462
program demo_get_other_data
@@ -1485,11 +1478,11 @@ exists in the map, if false `other` is undefined.
14851478
call map % init( fnv_1_hasher )
14861479
call set( key, [ 0_int8, 1_int8, 2_int8, 3_int8, 4_int8 ] )
14871480
call set( other, data )
1488-
call map % map_entry( key, other. conflict )
1481+
call map % map_entry( key, other, conflict )
14891482
if ( .not. conflict ) then
14901483
call map % get_other_data( key, other )
14911484
else
1492-
stop 'Key is already present in the map.''
1485+
stop 'Key is already present in the map.'
14931486
end if
14941487
call get( other, data )
14951488
select type( data )
@@ -1514,7 +1507,7 @@ Initializes a `chaining_hashmap_type` object.
15141507

15151508
##### Syntax
15161509

1517-
`call [[stdlib_hashmaps:map%init]]( hasher [, slots_bits, status ] ] )`
1510+
`call [[stdlib_hashmaps:map%init]]( hasher [, slots_bits, status ] )`
15181511

15191512
####@# Class
15201513

@@ -1593,7 +1586,7 @@ Pure function
15931586
##### Argument
15941587

15951588
`map` (pass) - shall be an expression of class `chaining_hashmap_type`
1596-
or ``open_hashmap_type`. It is an `intent(in)` argument.
1589+
or `open_hashmap_type`. It is an `intent(in)` argument.
15971590

15981591
##### Result character
15991592

@@ -1860,7 +1853,7 @@ to be removed.
18601853
`existed` (optional): shall be a scalar variable of type default
18611854
logical. It is an `intent(out)` argument. If present with the value
18621855
`true` the entry existed
1863-
in the map before removal, if false the entry was not present to be
1856+
in the map before removal, if `false` the entry was not present to be
18641857
removed.
18651858

18661859
##### Example
@@ -2019,7 +2012,7 @@ Pure function
20192012
##### Argument
20202013

20212014
`map` (pass): shall be a scalar expression of class
2022-
`chaining_hashmap_type`. It is an `intent(in)` argument. It is the
2015+
`hashmap_type`. It is an `intent(in)` argument. It is the
20232016
hash map of interest.
20242017

20252018
##### Result character

0 commit comments

Comments
 (0)