Function syntax

question
#1

I encounter a code snippet like this

struct F
   matt::Mtype
   latt::LType
end
function (U::F)(x::Tuple)
    idx = getindex(U.latt, x)
    getindex(U.matt, idx...)
end

I can call the function using an instance of F, say A=F(), and A((3,2)) gives some sensible answer.
methods(A) gives 1 method for for generic function "(::F)"
I couldn’t find where this type of usage is documented and how to understand this syntax. Any pointer will be appreciated.

2 Likes

#2

here it is :wink:
https://docs.julialang.org/en/v1/manual/methods/#Function-like-objects-1

3 Likes

#3

Thanks!

0 Likes