Skip to content

Commit dda0d79

Browse files
committed
Make multiply(_:_:) function even more elegant
1 parent 087dc18 commit dda0d79

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Linear Regression/LinearRegression.playground/Contents.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ func average(_ input: [Double]) -> Double {
3333
return input.reduce(0, +) / Double(input.count)
3434
}
3535

36-
func multiply(_ input1: [Double], _ input2: [Double]) -> [Double] {
37-
return zip(input1, input2).map { $0.0 * $0.1 }
36+
func multiply(_ a: [Double], _ b: [Double]) -> [Double] {
37+
return zip(a,b).map { $0.0 * $0.1 }
3838
}
3939

4040
func linearRegression(_ xVariable: [Double], _ yVariable: [Double]) -> ((Double) -> Double) {

0 commit comments

Comments
 (0)