Book Image

Getting Started with Julia

By : Ivo Balbaert
Book Image

Getting Started with Julia

By: Ivo Balbaert

Overview of this book

Table of Contents (19 chapters)
Getting Started with Julia
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
The Rationale for Julia
Index

Chapter 7. Metaprogramming in Julia

Everything in Julia is an expression that returns a value when executed. Every piece of the program code is internally represented as an ordinary Julia data structure, also called an expression. In this chapter, we will see that by working on expressions, how a Julia program can transform and even generate the new code, which is a very powerful characteristic, also called homoiconicity. It inherits this property from Lisp, where code and data are just lists, and where it is commonly referred to with the phrase: "code is data and data is code". We will explore this metaprogramming power by covering the following topics:

  • Expressions and symbols

  • Eval and interpolation

  • Defining macros

  • Built-in macros

  • Reflection capabilities