@@ -55,7 +55,7 @@ defmodule Dict do
55
55
Dict.keys d #=> [:a,:b]
56
56
57
57
"""
58
- @ spec keys ( t ) , do : [ key ]
58
+ @ spec keys ( t ) : : [ key ]
59
59
def keys ( dict ) do
60
60
elem ( dict , 0 ) . keys ( dict )
61
61
end
@@ -69,7 +69,7 @@ defmodule Dict do
69
69
Dict.values d #=> [1,2]
70
70
71
71
"""
72
- @ spec values ( t ) , do : [ value ]
72
+ @ spec values ( t ) : : [ value ]
73
73
def values ( dict ) do
74
74
elem ( dict , 0 ) . values ( dict )
75
75
end
@@ -83,7 +83,7 @@ defmodule Dict do
83
83
Dict.size d #=> 2
84
84
85
85
"""
86
- @ spec size ( t ) , do : non_neg_integer
86
+ @ spec size ( t ) : : non_neg_integer
87
87
def size ( dict ) do
88
88
elem ( dict , 0 ) . size ( dict )
89
89
end
@@ -98,7 +98,7 @@ defmodule Dict do
98
98
Dict.has_key?(d, :b) #=> false
99
99
100
100
"""
101
- @ spec has_key? ( t , key ) , do : boolean
101
+ @ spec has_key? ( t , key ) : : boolean
102
102
def has_key? ( dict , key ) do
103
103
elem ( dict , 0 ) . has_key? ( dict , key )
104
104
end
@@ -115,8 +115,8 @@ defmodule Dict do
115
115
Dict.get d, :b, 3 #=> 3
116
116
117
117
"""
118
- @ spec get ( t , key ) , do : value | nil
119
- @ spec get ( t , key , value ) , do : value
118
+ @ spec get ( t , key ) : : value | nil
119
+ @ spec get ( t , key , value ) : : value
120
120
def get ( dict , key , default // nil ) do
121
121
elem ( dict , 0 ) . get ( dict , key , default )
122
122
end
@@ -132,7 +132,7 @@ defmodule Dict do
132
132
Dict.get d, :b #=> raises KeyError[key: :b]
133
133
134
134
"""
135
- @ spec get! ( t , key ) , do : value | no_return
135
+ @ spec get! ( t , key ) : : value | no_return
136
136
def get! ( dict , key ) do
137
137
elem ( dict , 0 ) . get! ( dict , key )
138
138
end
@@ -148,7 +148,7 @@ defmodule Dict do
148
148
#=> [a: 3, b: 2]
149
149
150
150
"""
151
- @ spec put ( t , key , value ) , do : t
151
+ @ spec put ( t , key , value ) : : t
152
152
def put ( dict , key , val ) do
153
153
elem ( dict , 0 ) . put ( dict , key , val )
154
154
end
@@ -166,7 +166,7 @@ defmodule Dict do
166
166
Dict.delete d, :a #=> [b: 2]
167
167
168
168
"""
169
- @ spec delete ( t , key ) , do : t
169
+ @ spec delete ( t , key ) : : t
170
170
def delete ( dict , key ) do
171
171
elem ( dict , 0 ) . delete ( dict , key )
172
172
end
@@ -185,7 +185,7 @@ defmodule Dict do
185
185
#=> [a: 3, b: 2, d: 4]
186
186
187
187
"""
188
- @ spec merge ( t , t ) , do : t
188
+ @ spec merge ( t , t ) : : t
189
189
def merge ( dict1 , dict2 ) do
190
190
merge ( dict1 , dict2 , fn ( _k , _v1 , v2 ) -> v2 end )
191
191
end
@@ -204,7 +204,7 @@ defmodule Dict do
204
204
#=> [a: 4, b: 2, d: 4]
205
205
206
206
"""
207
- @ spec merge ( t , t , fun ( key , value , value , do: value ) ) , do : t
207
+ @ spec merge ( t , t , fun ( key , value , value ) :: value ) : : t
208
208
def merge ( dict1 , dict2 , fun ) do
209
209
elem ( dict1 , 0 ) . merge ( dict1 , dict2 , fun )
210
210
end
@@ -220,7 +220,7 @@ defmodule Dict do
220
220
#=> [a: -1, b: 2]
221
221
222
222
"""
223
- @ spec update ( t , key , fun ( value , do: value ) ) , do : t
223
+ @ spec update ( t , key , fun ( value ) :: value ) : : t
224
224
def update ( dict , key , fun ) do
225
225
elem ( dict , 0 ) . update ( dict , key , fun )
226
226
end
@@ -237,15 +237,15 @@ defmodule Dict do
237
237
#=> [a: 1, b: 2, c: 3]
238
238
239
239
"""
240
- @ spec update ( t , key , value , fun ( value , do: value ) ) , do : t
240
+ @ spec update ( t , key , value , fun ( value ) :: value ) : : t
241
241
def update ( dict , key , initial , fun ) do
242
242
elem ( dict , 0 ) . update ( dict , key , initial , fun )
243
243
end
244
244
245
245
@ doc """
246
246
Returns an empty dict of the same type as `dict`.
247
247
"""
248
- @ spec empty ( t ) , do : t
248
+ @ spec empty ( t ) : : t
249
249
def empty ( dict ) do
250
250
elem ( dict , 0 ) . empty ( dict )
251
251
end
@@ -254,7 +254,7 @@ defmodule Dict do
254
254
Returns a list of key-value pairs stored in `dict`.
255
255
No particular order is enforced.
256
256
"""
257
- @ spec to_list ( t ) , do : list
257
+ @ spec to_list ( t ) : : list
258
258
def to_list ( dict ) do
259
259
elem ( dict , 0 ) . to_list ( dict )
260
260
end
0 commit comments