let (pivot, rest) = (array.first!, array.dropFirst())
let lessThan = rest.filter({ $0 < pivot })
let greaterThanOrEqual = rest.filter({ $0 >= pivot })
// Cannot use ‘[Int]' here, as in Swift 2.2
// Error says 'Int' is not convertible to '[Int]'
let pivotArray = [pivot]
return quickSort(lessThan) + pivotArray + quickSort(greaterThanOrEqual)
}
let (pivot, rest) = (array.first!, array.dropFirst())
let lessThan = rest.filter({ $0 < pivot })
let greaterThanOrEqual = rest.filter({ $0 >= pivot })
// Cannot use ‘[Int]' here, as in Swift 2.2
// Error says 'Int' is not convertible to '[Int]'
let pivotArray = [pivot]
return quickSort(lessThan) + pivotArray + quickSort(greaterThanOrEqual)
}
let (pivot, rest) = (array.first!, array.dropFirst())
let lessThan = rest.filter({ $0 < pivot })
let greaterThanOrEqual = rest.filter({ $0 >= pivot })
// If a separate the sorting into variables rather than
// calling them direct before 'return' it works
let lessThanSorted = quickSort(lessThan)
let greaterThanOrEqualSorted = quickSort(greaterThanOrEqual)
let (pivot, rest) = (array.first!, array.dropFirst())
let lessThan = rest.filter({ $0 < pivot })
let greaterThanOrEqual = rest.filter({ $0 >= pivot })
// Cannot use ‘[Int]' here, as in Swift 2.2
// Error says 'Int' is not convertible to '[Int]'
let pivotArray = [pivot]
return quickSort(lessThan) + pivotArray + quickSort(greaterThanOrEqual)
}
Hi Adriano,
This code compiles with the current git master. Could you
double-check and post the exact error you are getting?