Function definition

Next, we will see the structure for a function definition. Consider the following code:

The head node contains a function symbol. Then, the first argument contains a call expression with the arguments. The second argument is just a block expression. 

The call expression may seem a little odd because we have seen a similar expression object when a function is being called. This is normal because we are currently working at the syntax level. The syntax for function definition is indeed quite similar to the function call itself.

By now, we have seen enough examples. There are obviously many more code constructs that we have ...

Get Hands-On Design Patterns and Best Practices with Julia now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.