I have a list of triplets:
list = {{1, 3, 5}, {4, 5, 1}, {4, 9, 2}}
How can I apply a function f to the last element of each triplet when f the last and second-to-last elements of each triplet as arguments? The result should look like:
{{1, 3, f[3, 5]}, {4, 5, f[5, 1]}, {4, 9, f[9, 2]}}
I tried:
list /. {a_, b_, c_} :> {a, b, f[b, c]}
But the result comes out as
{{1, 3, 5}, {4, 5, 1}, {f[4], f[9], f[2]}}