Book Image

Mastering Julia

Book Image

Mastering Julia

Overview of this book

Table of Contents (17 chapters)
Mastering Julia
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Composite types


A composition type is a collection of named fields, grouped together and treated as a single entity; these are termed records and structures in some programming languages.

If the type can also have functions (methods) associated with them the resulting collection is termed an object and the languages which support them (Java, C++, Python, Ruby, and so on) as object-oriented.

In Julia, functions are not bundled up with the data structures they operate on. The choice of the method a function uses is termed dispatch. When the types of ALL of a function's arguments are considered when determining the method employed, this is termed multiple dispatch and Julia uses this rather than the single dispatch we associated with object methods. We will be considering the implication of multiple dispatch in detail in the next chapter.

Composite type details are defined with the type keyword, followed by a list of field names, optionally annotated with the :: operator and terminated with end...