January 2020
Intermediate to advanced
532 pages
13h 31m
English
A dispatch is the process by which a function is selected for execution. You may wonder why there is any controversy in selecting which function to execute. When we develop a function, we give it a name, some arguments, and a block of code that it should execute. If we come up with unique names for all functions in a system, then there will be no ambiguity. However, there are often times when we want to reuse the same function name and apply it to different data types for similar types of operation.
Examples are abundant in Julia's Base library. For example, the isascii function has three methods, and each one takes a different argument type:
isascii(c::Char) isascii(s::AbstractString) isascii(c::AbstractChar)
Depending ...
Read now
Unlock full access