Julia Community 🟣

Frederik Banning
Frederik Banning

Posted on • Originally published at fbanning.de

Julia ♥ ABM #3: What a difference a day makes

In the previous issue we have laid out the basic events that happen in our model - both as verbal descriptions in plain English and as algorithmic representations in simple Julia code. Sally and Richard are now not merely static pieces of data anymore but they can act in three different ways: work, eat, and trade.

However, today's lesson content will be a bit more technical in nature and deal with how we work with Julia. So far we had just written out the pieces of our modelling code in long blocks of for-loops that stood on their own and weren't really connected to each other. While it works great for simple examples, this will become increasingly harder to read. Furthermore, it is relatively complicated to reason about which pieces of our code belong to which category of actions. To take care of this, today we will primarily learn about two things:

  1. Writing our code in plain text files and including them in a running Julia REPL.
  2. Encapsulating our code in functions takes care of this and provides us with more options to easily structure our model code and even improve its performance.

So let us not hesitate any longer and start the refactoring.

Continue reading on blog...


Brief remark on future posts:

From now on, future issues in the Julia ❤️ ABM series will primarily be published on my personal blog and new issues will afterwards be announced here on Julia's Forem instance. This allows me to avoid the extra formatting work required to publish on here while still retaining the ability to get in touch with the community, especially through the comment section. This approach also gives me full control over how these posts are styled and structured and in the long run it also feels nice from an self-hosting/archiving perspective. Thanks for your understanding and happy reading. :)

Top comments (1)

Collapse
 
Sloan, the sloth mascot
Comment deleted