pic
Personal
Website

3a. Overview and Goals

PhD in Economics

The upcoming Chapters 3 and 4 cover the core tools of programming: functions, conditional statements, and for-loops. Chapter 3 in particular focuses on functions, which are the backbone of Julia. Their use is tightly connected to achieving high performance. Given their importance, we'll spend a considerable amount of time discussing them.

The presentation of functions is structured into breaking them down into three:

  1. built-in functions (loaded by default),

  2. third-party functions, and

  3. user-defined functions.

The first two are made available in the workspace by loading packages (implicitly or explicitly). This is why the analysis of packages and running functions is tied together in Section 3b, relegating the subject of user-defined functions to Section 3c.

Studying functions also require a crisp understanding of global and local variables. This distinction sets the stage for discussing the view of functions as self-contained mini-programs representing a task. Taking advantage of this, we present both subjects together in Section 3d. This view of functions encourages good practices regarding their use, which will become more apparent as we apply them in subsequent chapters. For now, it's enough if you become familiar with this perspective.

Finally, the concept of broadcasting introduced in Section 3e is key. I recommend mastering this technique, which allows you to apply the same function to each element in a collection. Its use is widespread in the language.

this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible this is invisible