Skip to content

Commit 8400cff

Browse files
Merge pull request #113 from logic-building/Subset<Type>
Added function Subset<Type>
2 parents 46df19a + a8bf1b4 commit 8400cff

34 files changed

+2905
-1274
lines changed

fp/difference.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package fp
22

33
// DifferenceInt returns a set that is the first set without elements of the remaining sets
4+
// repeated value within list parameter will be ignored
45
func DifferenceInt(arrList ...[]int) []int {
56
if arrList == nil {
67
return []int{}
@@ -47,6 +48,7 @@ func DifferenceInt(arrList ...[]int) []int {
4748
}
4849

4950
// DifferenceIntPtr returns a set that is the first set without elements of the remaining sets
51+
// repeated value within list parameter will be ignored
5052
func DifferenceIntPtr(arrList ...[]*int) []*int {
5153
if arrList == nil {
5254
return []*int{}
@@ -93,6 +95,7 @@ func DifferenceIntPtr(arrList ...[]*int) []*int {
9395
}
9496

9597
// DifferenceInt64 returns a set that is the first set without elements of the remaining sets
98+
// repeated value within list parameter will be ignored
9699
func DifferenceInt64(arrList ...[]int64) []int64 {
97100
if arrList == nil {
98101
return []int64{}
@@ -139,6 +142,7 @@ func DifferenceInt64(arrList ...[]int64) []int64 {
139142
}
140143

141144
// DifferenceInt64Ptr returns a set that is the first set without elements of the remaining sets
145+
// repeated value within list parameter will be ignored
142146
func DifferenceInt64Ptr(arrList ...[]*int64) []*int64 {
143147
if arrList == nil {
144148
return []*int64{}
@@ -185,6 +189,7 @@ func DifferenceInt64Ptr(arrList ...[]*int64) []*int64 {
185189
}
186190

187191
// DifferenceInt32 returns a set that is the first set without elements of the remaining sets
192+
// repeated value within list parameter will be ignored
188193
func DifferenceInt32(arrList ...[]int32) []int32 {
189194
if arrList == nil {
190195
return []int32{}
@@ -231,6 +236,7 @@ func DifferenceInt32(arrList ...[]int32) []int32 {
231236
}
232237

233238
// DifferenceInt32Ptr returns a set that is the first set without elements of the remaining sets
239+
// repeated value within list parameter will be ignored
234240
func DifferenceInt32Ptr(arrList ...[]*int32) []*int32 {
235241
if arrList == nil {
236242
return []*int32{}
@@ -277,6 +283,7 @@ func DifferenceInt32Ptr(arrList ...[]*int32) []*int32 {
277283
}
278284

279285
// DifferenceInt16 returns a set that is the first set without elements of the remaining sets
286+
// repeated value within list parameter will be ignored
280287
func DifferenceInt16(arrList ...[]int16) []int16 {
281288
if arrList == nil {
282289
return []int16{}
@@ -323,6 +330,7 @@ func DifferenceInt16(arrList ...[]int16) []int16 {
323330
}
324331

325332
// DifferenceInt16Ptr returns a set that is the first set without elements of the remaining sets
333+
// repeated value within list parameter will be ignored
326334
func DifferenceInt16Ptr(arrList ...[]*int16) []*int16 {
327335
if arrList == nil {
328336
return []*int16{}
@@ -369,6 +377,7 @@ func DifferenceInt16Ptr(arrList ...[]*int16) []*int16 {
369377
}
370378

371379
// DifferenceInt8 returns a set that is the first set without elements of the remaining sets
380+
// repeated value within list parameter will be ignored
372381
func DifferenceInt8(arrList ...[]int8) []int8 {
373382
if arrList == nil {
374383
return []int8{}
@@ -415,6 +424,7 @@ func DifferenceInt8(arrList ...[]int8) []int8 {
415424
}
416425

417426
// DifferenceInt8Ptr returns a set that is the first set without elements of the remaining sets
427+
// repeated value within list parameter will be ignored
418428
func DifferenceInt8Ptr(arrList ...[]*int8) []*int8 {
419429
if arrList == nil {
420430
return []*int8{}
@@ -461,6 +471,7 @@ func DifferenceInt8Ptr(arrList ...[]*int8) []*int8 {
461471
}
462472

463473
// DifferenceUint returns a set that is the first set without elements of the remaining sets
474+
// repeated value within list parameter will be ignored
464475
func DifferenceUint(arrList ...[]uint) []uint {
465476
if arrList == nil {
466477
return []uint{}
@@ -507,6 +518,7 @@ func DifferenceUint(arrList ...[]uint) []uint {
507518
}
508519

509520
// DifferenceUintPtr returns a set that is the first set without elements of the remaining sets
521+
// repeated value within list parameter will be ignored
510522
func DifferenceUintPtr(arrList ...[]*uint) []*uint {
511523
if arrList == nil {
512524
return []*uint{}
@@ -553,6 +565,7 @@ func DifferenceUintPtr(arrList ...[]*uint) []*uint {
553565
}
554566

555567
// DifferenceUint64 returns a set that is the first set without elements of the remaining sets
568+
// repeated value within list parameter will be ignored
556569
func DifferenceUint64(arrList ...[]uint64) []uint64 {
557570
if arrList == nil {
558571
return []uint64{}
@@ -599,6 +612,7 @@ func DifferenceUint64(arrList ...[]uint64) []uint64 {
599612
}
600613

601614
// DifferenceUint64Ptr returns a set that is the first set without elements of the remaining sets
615+
// repeated value within list parameter will be ignored
602616
func DifferenceUint64Ptr(arrList ...[]*uint64) []*uint64 {
603617
if arrList == nil {
604618
return []*uint64{}
@@ -645,6 +659,7 @@ func DifferenceUint64Ptr(arrList ...[]*uint64) []*uint64 {
645659
}
646660

647661
// DifferenceUint32 returns a set that is the first set without elements of the remaining sets
662+
// repeated value within list parameter will be ignored
648663
func DifferenceUint32(arrList ...[]uint32) []uint32 {
649664
if arrList == nil {
650665
return []uint32{}
@@ -691,6 +706,7 @@ func DifferenceUint32(arrList ...[]uint32) []uint32 {
691706
}
692707

693708
// DifferenceUint32Ptr returns a set that is the first set without elements of the remaining sets
709+
// repeated value within list parameter will be ignored
694710
func DifferenceUint32Ptr(arrList ...[]*uint32) []*uint32 {
695711
if arrList == nil {
696712
return []*uint32{}
@@ -737,6 +753,7 @@ func DifferenceUint32Ptr(arrList ...[]*uint32) []*uint32 {
737753
}
738754

739755
// DifferenceUint16 returns a set that is the first set without elements of the remaining sets
756+
// repeated value within list parameter will be ignored
740757
func DifferenceUint16(arrList ...[]uint16) []uint16 {
741758
if arrList == nil {
742759
return []uint16{}
@@ -783,6 +800,7 @@ func DifferenceUint16(arrList ...[]uint16) []uint16 {
783800
}
784801

785802
// DifferenceUint16Ptr returns a set that is the first set without elements of the remaining sets
803+
// repeated value within list parameter will be ignored
786804
func DifferenceUint16Ptr(arrList ...[]*uint16) []*uint16 {
787805
if arrList == nil {
788806
return []*uint16{}
@@ -829,6 +847,7 @@ func DifferenceUint16Ptr(arrList ...[]*uint16) []*uint16 {
829847
}
830848

831849
// DifferenceUint8 returns a set that is the first set without elements of the remaining sets
850+
// repeated value within list parameter will be ignored
832851
func DifferenceUint8(arrList ...[]uint8) []uint8 {
833852
if arrList == nil {
834853
return []uint8{}
@@ -875,6 +894,7 @@ func DifferenceUint8(arrList ...[]uint8) []uint8 {
875894
}
876895

877896
// DifferenceUint8Ptr returns a set that is the first set without elements of the remaining sets
897+
// repeated value within list parameter will be ignored
878898
func DifferenceUint8Ptr(arrList ...[]*uint8) []*uint8 {
879899
if arrList == nil {
880900
return []*uint8{}
@@ -921,6 +941,7 @@ func DifferenceUint8Ptr(arrList ...[]*uint8) []*uint8 {
921941
}
922942

923943
// DifferenceStr returns a set that is the first set without elements of the remaining sets
944+
// repeated value within list parameter will be ignored
924945
func DifferenceStr(arrList ...[]string) []string {
925946
if arrList == nil {
926947
return []string{}
@@ -967,6 +988,7 @@ func DifferenceStr(arrList ...[]string) []string {
967988
}
968989

969990
// DifferenceStrPtr returns a set that is the first set without elements of the remaining sets
991+
// repeated value within list parameter will be ignored
970992
func DifferenceStrPtr(arrList ...[]*string) []*string {
971993
if arrList == nil {
972994
return []*string{}
@@ -1013,6 +1035,7 @@ func DifferenceStrPtr(arrList ...[]*string) []*string {
10131035
}
10141036

10151037
// DifferenceBool returns a set that is the first set without elements of the remaining sets
1038+
// repeated value within list parameter will be ignored
10161039
func DifferenceBool(arrList ...[]bool) []bool {
10171040
if arrList == nil {
10181041
return []bool{}
@@ -1059,6 +1082,7 @@ func DifferenceBool(arrList ...[]bool) []bool {
10591082
}
10601083

10611084
// DifferenceBoolPtr returns a set that is the first set without elements of the remaining sets
1085+
// repeated value within list parameter will be ignored
10621086
func DifferenceBoolPtr(arrList ...[]*bool) []*bool {
10631087
if arrList == nil {
10641088
return []*bool{}
@@ -1105,6 +1129,7 @@ func DifferenceBoolPtr(arrList ...[]*bool) []*bool {
11051129
}
11061130

11071131
// DifferenceFloat32 returns a set that is the first set without elements of the remaining sets
1132+
// repeated value within list parameter will be ignored
11081133
func DifferenceFloat32(arrList ...[]float32) []float32 {
11091134
if arrList == nil {
11101135
return []float32{}
@@ -1151,6 +1176,7 @@ func DifferenceFloat32(arrList ...[]float32) []float32 {
11511176
}
11521177

11531178
// DifferenceFloat32Ptr returns a set that is the first set without elements of the remaining sets
1179+
// repeated value within list parameter will be ignored
11541180
func DifferenceFloat32Ptr(arrList ...[]*float32) []*float32 {
11551181
if arrList == nil {
11561182
return []*float32{}
@@ -1197,6 +1223,7 @@ func DifferenceFloat32Ptr(arrList ...[]*float32) []*float32 {
11971223
}
11981224

11991225
// DifferenceFloat64 returns a set that is the first set without elements of the remaining sets
1226+
// repeated value within list parameter will be ignored
12001227
func DifferenceFloat64(arrList ...[]float64) []float64 {
12011228
if arrList == nil {
12021229
return []float64{}
@@ -1243,6 +1270,7 @@ func DifferenceFloat64(arrList ...[]float64) []float64 {
12431270
}
12441271

12451272
// DifferenceFloat64Ptr returns a set that is the first set without elements of the remaining sets
1273+
// repeated value within list parameter will be ignored
12461274
func DifferenceFloat64Ptr(arrList ...[]*float64) []*float64 {
12471275
if arrList == nil {
12481276
return []*float64{}

fp/everyerr_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package fp
22

33
import (
4-
"errors"
4+
"errors"
55
"testing"
66
)
77

fp/everyptrerr_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package fp
22

33
import (
4-
"errors"
4+
"errors"
55
"testing"
66
)
77

fp/filterPtr.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ package fp
44
// 1. Function: takes 1 argument of type int and returns bool
55
// 2. slice of type []*int
66
//
7-
// Returns:
7+
// Returns:
88
// new filtered list
99
func FilterIntPtr(f func(*int) bool, list []*int) []*int {
1010
if f == nil {
@@ -23,7 +23,7 @@ func FilterIntPtr(f func(*int) bool, list []*int) []*int {
2323
// 1. Function: takes 1 argument of type int64 and returns bool
2424
// 2. slice of type []*int64
2525
//
26-
// Returns:
26+
// Returns:
2727
// new filtered list
2828
func FilterInt64Ptr(f func(*int64) bool, list []*int64) []*int64 {
2929
if f == nil {
@@ -42,7 +42,7 @@ func FilterInt64Ptr(f func(*int64) bool, list []*int64) []*int64 {
4242
// 1. Function: takes 1 argument of type int32 and returns bool
4343
// 2. slice of type []*int32
4444
//
45-
// Returns:
45+
// Returns:
4646
// new filtered list
4747
func FilterInt32Ptr(f func(*int32) bool, list []*int32) []*int32 {
4848
if f == nil {
@@ -61,7 +61,7 @@ func FilterInt32Ptr(f func(*int32) bool, list []*int32) []*int32 {
6161
// 1. Function: takes 1 argument of type int16 and returns bool
6262
// 2. slice of type []*int16
6363
//
64-
// Returns:
64+
// Returns:
6565
// new filtered list
6666
func FilterInt16Ptr(f func(*int16) bool, list []*int16) []*int16 {
6767
if f == nil {
@@ -80,7 +80,7 @@ func FilterInt16Ptr(f func(*int16) bool, list []*int16) []*int16 {
8080
// 1. Function: takes 1 argument of type int8 and returns bool
8181
// 2. slice of type []*int8
8282
//
83-
// Returns:
83+
// Returns:
8484
// new filtered list
8585
func FilterInt8Ptr(f func(*int8) bool, list []*int8) []*int8 {
8686
if f == nil {
@@ -99,7 +99,7 @@ func FilterInt8Ptr(f func(*int8) bool, list []*int8) []*int8 {
9999
// 1. Function: takes 1 argument of type uint and returns bool
100100
// 2. slice of type []*uint
101101
//
102-
// Returns:
102+
// Returns:
103103
// new filtered list
104104
func FilterUintPtr(f func(*uint) bool, list []*uint) []*uint {
105105
if f == nil {
@@ -118,7 +118,7 @@ func FilterUintPtr(f func(*uint) bool, list []*uint) []*uint {
118118
// 1. Function: takes 1 argument of type uint64 and returns bool
119119
// 2. slice of type []*uint64
120120
//
121-
// Returns:
121+
// Returns:
122122
// new filtered list
123123
func FilterUint64Ptr(f func(*uint64) bool, list []*uint64) []*uint64 {
124124
if f == nil {
@@ -137,7 +137,7 @@ func FilterUint64Ptr(f func(*uint64) bool, list []*uint64) []*uint64 {
137137
// 1. Function: takes 1 argument of type uint32 and returns bool
138138
// 2. slice of type []*uint32
139139
//
140-
// Returns:
140+
// Returns:
141141
// new filtered list
142142
func FilterUint32Ptr(f func(*uint32) bool, list []*uint32) []*uint32 {
143143
if f == nil {
@@ -156,7 +156,7 @@ func FilterUint32Ptr(f func(*uint32) bool, list []*uint32) []*uint32 {
156156
// 1. Function: takes 1 argument of type uint16 and returns bool
157157
// 2. slice of type []*uint16
158158
//
159-
// Returns:
159+
// Returns:
160160
// new filtered list
161161
func FilterUint16Ptr(f func(*uint16) bool, list []*uint16) []*uint16 {
162162
if f == nil {
@@ -175,7 +175,7 @@ func FilterUint16Ptr(f func(*uint16) bool, list []*uint16) []*uint16 {
175175
// 1. Function: takes 1 argument of type uint8 and returns bool
176176
// 2. slice of type []*uint8
177177
//
178-
// Returns:
178+
// Returns:
179179
// new filtered list
180180
func FilterUint8Ptr(f func(*uint8) bool, list []*uint8) []*uint8 {
181181
if f == nil {
@@ -194,7 +194,7 @@ func FilterUint8Ptr(f func(*uint8) bool, list []*uint8) []*uint8 {
194194
// 1. Function: takes 1 argument of type string and returns bool
195195
// 2. slice of type []*string
196196
//
197-
// Returns:
197+
// Returns:
198198
// new filtered list
199199
func FilterStrPtr(f func(*string) bool, list []*string) []*string {
200200
if f == nil {
@@ -213,7 +213,7 @@ func FilterStrPtr(f func(*string) bool, list []*string) []*string {
213213
// 1. Function: takes 1 argument of type bool and returns bool
214214
// 2. slice of type []*bool
215215
//
216-
// Returns:
216+
// Returns:
217217
// new filtered list
218218
func FilterBoolPtr(f func(*bool) bool, list []*bool) []*bool {
219219
if f == nil {
@@ -232,7 +232,7 @@ func FilterBoolPtr(f func(*bool) bool, list []*bool) []*bool {
232232
// 1. Function: takes 1 argument of type float32 and returns bool
233233
// 2. slice of type []*float32
234234
//
235-
// Returns:
235+
// Returns:
236236
// new filtered list
237237
func FilterFloat32Ptr(f func(*float32) bool, list []*float32) []*float32 {
238238
if f == nil {
@@ -251,7 +251,7 @@ func FilterFloat32Ptr(f func(*float32) bool, list []*float32) []*float32 {
251251
// 1. Function: takes 1 argument of type float64 and returns bool
252252
// 2. slice of type []*float64
253253
//
254-
// Returns:
254+
// Returns:
255255
// new filtered list
256256
func FilterFloat64Ptr(f func(*float64) bool, list []*float64) []*float64 {
257257
if f == nil {

0 commit comments

Comments
 (0)