 let helloCountFunctional = greetings.reduce(0, combine: { $0 + ((string($1, contains:"hello")) ? 1 : 0) })
 
 print(helloCountFunctional)
+
 
 ///////////////////////////////////////////////////////
 

let myBandTransform = composeBandTransforms(setCanadaAsCountry, capitalizeName)
let formattedBands = bands.map { band in myBandTransform(band) }

print(originalBands)
print(formattedBands)

// Functional 3

let canada: BandPropertyTransform = { _ in return "Canada" };
let capitalize: BandPropertyTransform = { return $0.capitalizedString }

let setCanadaAsCountry = call(function: canada, onValueForKey: "country")
let capitalizeName = call(function: capitalize, onValueForKey: "name")

func formattedBands(bands: Array<Band>, functions: Array<BandTransform>) -> Array<Band> {
    return bands.map {
        band in
        
        functions.reduce(band) {
            (currentBand, function) in
            
            function(currentBand)
        }
    }
}

// OR shorthand:

func formattedBandsShorthand(bands: Array<Band>, functions: Array<BandTransform>) -> Array<Band> {
    return bands.map {
        functions.reduce($0) { $1($0) }
    }
}

print(bands)
print(formattedBands(bands, [setCanadaAsCountry, capitalizeName]))

// Functional 2

