@@ -27,11 +27,13 @@ public struct ForkedArray<Value, Output> {
2727 self . filter = filter
2828 self . output = output
2929
30- let forkType = ForkedArray . split ( array: array)
31-
32- switch forkType {
30+ switch ForkedArray . split ( array: array) {
3331 case . none:
34- self . fork = Fork ( value: array, leftOutput: { _ in . none } , rightOutput: { _ in . none } )
32+ self . fork = Fork (
33+ value: array,
34+ leftOutput: { _ in . none } ,
35+ rightOutput: { _ in . none }
36+ )
3537 case . single( let value) :
3638 self . fork = Fork (
3739 value: value,
@@ -61,11 +63,12 @@ extension ForkedArray {
6163 array: [ Value ]
6264 ) -> ForkType {
6365 let count = array. count
64-
65- guard count > 0 else { return . none }
66- guard count > 1 else { return . single( array [ 0 ] ) }
67-
68- if count == 2 {
66+ switch count {
67+ case 0 :
68+ return . none
69+ case 1 :
70+ return . single( array [ 0 ] )
71+ case 2 :
6972 return . fork(
7073 Fork (
7174 value: array,
@@ -75,19 +78,19 @@ extension ForkedArray {
7578 rightOutput: ForkType . single
7679 )
7780 )
78- }
79-
80- let midPoint = count / 2
81-
82- return . fork (
83- Fork (
84- value : array ,
85- leftInputMap : { Array ( $0 [ 0 ..< midPoint ] ) } ,
86- rightInputMap : { Array ( $0 [ midPoint ... count - 1 ] ) } ,
87- leftOutput : split ( array: ) ,
88- rightOutput : split ( array : )
81+ default :
82+ let midPoint = count / 2
83+
84+ return . fork (
85+ Fork (
86+ value : array ,
87+ leftInputMap : { Array ( $0 [ 0 ..< midPoint ] ) } ,
88+ rightInputMap : { Array ( $0 [ midPoint ... count - 1 ] ) } ,
89+ leftOutput : split ( array : ) ,
90+ rightOutput : split ( array: )
91+ )
8992 )
90- )
93+ }
9194 }
9295
9396 private static func output(
0 commit comments