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 not explored. You are encouraged to use the same technique to examine other code structures. Understanding how the abstract syntax tree is structured is essential to writing good metaprogramming code. Next, we will see how we can evaluate these expressions.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.62.45