@@ -21,7 +21,7 @@ go install github.com/logic-building/functional-go/gofp
21
21
```
22
22
[[constraint]]
23
23
name = "github.com/logic-building/functional-go"
24
- version = "8.13.0 "
24
+ version = "8.13.1 "
25
25
```
26
26
27
27
### Quick Start
@@ -280,7 +280,13 @@ Options on go:generate :
280
280
26. Neg<Type>P : Returns true if num is less than zero, else false
281
281
27. Odd<Type>P : Returns true if n is odd
282
282
28. PMap<Type> : Similar to Map<Type> with additional feature - function(1st) argument runs concurrently for each item in the list(2nd argument)
283
+ EX. PMapInt(squareInt, []int{v1, v2, v3})
284
+ PMapInt(squareInt, []int{v1, v2, v3}, Optional{FixedPool: 2, RandomOrder: true})
285
+
283
286
29. PMap<InputType><OutputType>: Similar to Map<InputType><OutputType> with additional feature - function(1st) argument runs concurrently for each item in the list(2nd argument)
287
+ EX. PMapIntInt64(plusOneIntInt64, []int{1, 2, 3}) // input: list(int), returns: list(int64)
288
+ PMapIntInt64(plusOneIntInt64, []int{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
289
+
284
290
30. Pos<Type>P : Returns true if num is greater than zero, else false
285
291
31. Range<Type> : Returns a new list of range between lower and upper value. Optional argument(3rd) will increment value by given number
286
292
32. Reduce<Type> : Reduces a list to a single value by combining elements via a supplied function
@@ -302,6 +308,11 @@ Options on go:generate :
302
308
303
309
### Functions in generated code for struct (user defined type)
304
310
```
311
+ Note:
312
+ Comparison logic for struct is based on == operator as long as the members of struct are of simple types.
313
+ But reflect.DeepEqual is used for struct comparison if the struct contains any slices, maps.
314
+ ```
315
+ ```
305
316
1. Difference : Returns a set that is the first set without elements of the remaining sets
306
317
2. Difference<struct>By<Field>
307
318
3. Distinct : Returns a new list with duplicates removed
@@ -959,10 +970,14 @@ distinct := fp.DistinctInt(list) // returns [8, 2, 0]
959
970
### Test Coverage
960
971
```
961
972
Tests Passed : 1217
962
- ok functional-go/fp 0.015s coverage: 100.0 % of statements
973
+ ok functional-go/fp 0.015s coverage: 99.7 % of statements
963
974
ok functional-go/set 0.031s coverage: 100.0% of statements
964
975
```
965
-
976
+ ### Test Counts
977
+ ```
978
+ go test ./... -v | grep -c RUN
979
+ 4762
980
+ ```
966
981
### BenchMark test:
967
982
```
968
983
Model Identifier: MacBookPro11,5
@@ -987,3 +1002,15 @@ BenchmarkMapStr-8 1000000 49438 ns/op
987
1002
PASS
988
1003
ok functional-go/fp 67.567s
989
1004
```
1005
+
1006
+ ### Benchmark test for PMap with fixed order and random order
1007
+ ```
1008
+ go test -benchtime=200x -bench=BenchmarkPMapInt
1009
+ goos: darwin
1010
+ goarch: amd64
1011
+ pkg: github.com/logic-building/functional-go/fp
1012
+ BenchmarkPMapInt-8 200 16224 ns/op
1013
+ BenchmarkPMapIntRandomOrder-8 200 10091 ns/op
1014
+ PASS
1015
+ ok github.com/logic-building/functional-go/fp 4.549s
1016
+ ```
0 commit comments