Be Lazy

Wait! I’m not telling you to put the book away and pass the entire day watching movies. I’m talking about lazy evaluation in programming. Lazy evaluation is when we write a series of instructions that won’t be executed right now. Instead, they will wait for a trigger that will tell them the right moment to run. It’s like if a friend of yours is cooking a roast turkey for Christmas and gives you an instruction to remove it from the oven. You can’t take it out right when she tells you—that would be too soon. Instead, you need to wait for that little red thing in the turkey to pop up; that’s the right moment.

Lazy operations provide alternative techniques of programming and creating efficient programs. In functional programming, higher-order ...

Get Learn Functional Programming with Elixir 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.