method_exists
.. method_exists(f, Tuple type) -> Bool
Determine whether the given generic function has a method matching the given :obj:`Tuple` of argument types.
.. doctest::
julia> method_exists(length, Tuple{Array})
true
Examples
The method_exists
function in Julia is used to determine whether a given generic function has a method matching a specific tuple of argument types.
julia> method_exists(f, Tuple type) -> Bool
Here's an example of how to use method_exists
:
julia> method_exists(length, Tuple{Array})
true
In this example, we check if the length
function has a method that takes an Array
as an argument. The method_exists
function returns true
if such a method exists and false
otherwise.
See Also
assert, backtrace, code_llvm, code_lowered, code_native, code_typed, code_warntype, :@which, compilecache, current_module, eval, finalize, finalizer, fullname, function_module, function_name, include_dependency, InterruptException, invoke, isconst, isdefined, isgeneric, methodswith, method_exists, module_name, module_parent, require, subtypes, unsafe_load, workspace, __precompile__,User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.