How do I compose two vectorized functions?

```
julia> A = [1.0, 2.0, 3.0]
3-element Array{Float64,1}:
1.0
2.0
3.0
julia> sin.(cos.(A))
3-element Array{Float64,1}:
0.5143952585235492
-0.4042391538522658
-0.8360218615377305
julia> (sin. β cos.)(A)
ERROR: syntax: missing comma or ) in argument list
Stacktrace:
[1] top-level scope at REPL[8]:0
```

cossio
September 21, 2019, 11:16am
#2
```
julia> (sin β cos).(A)
3-element Array{Float64,1}:
0.5143952585235492
-0.4042391538522658
-0.8360218615377305
```

1 Like

Thank you.

So i should compose the two functions first then vectorized the resultant function on the data

`sin.(cos.(A))`

already βfusesβ the functions into a single pass over the data, essentially equivalent to `(sin β cos).(A)`

: More Dots: Syntactic Loop Fusion in Julia

4 Likes