Skip to content

Latest commit

 

History

History
7 lines (4 loc) · 1.45 KB

3.md

File metadata and controls

7 lines (4 loc) · 1.45 KB

Day 6

Today I began by reading a comment that Tim Macdonald wrote on my commit yesterday. In it he answered my question about "why don't all languages use code and data interchangeably like Lisps do" and also gave a pretty nice explanation and examples of macros and when and why you you would use them.

His explanation cleared it up a bit for me. It seems that basically you use macros in a circumstance where you want to write a function to do something but, to execute that function successfully, you need to make it so that the code being handed off to the evaluator is altered in some systematic way. Because of this, you can have the reader edit code however you want before it's sent off to the evaluator. So you can have the reader systematically write code for you under certain circumstances. Absolutely brilliant.

Outside of that, I read part of Chapter 5 of PCL which talks about functions. Some of it had already been covered in Chapter 3 through the use of example (how to define a function and using keyword parameters), but I did learn how to write optional parameters (using the &optionalsymbol) and how to write a function that takes a variable number of parameters (using the &rest symbol). I stopped at the section titled "Mixing Different Parameter Types." I'm wiped right now, so I'm gonna stop for the night and finish up this chapter tomorrow.