From b1c7f72af59c0de4ed45f3cd182a899a49e3e0b4 Mon Sep 17 00:00:00 2001 From: Edoardo La Greca Date: Sun, 24 Aug 2025 18:10:14 +0200 Subject: add the rest of notes for lecture 6 --- lec06/notes.md | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lec06') diff --git a/lec06/notes.md b/lec06/notes.md index 85f5e7d..af5dcff 100644 --- a/lec06/notes.md +++ b/lec06/notes.md @@ -46,3 +46,13 @@ Although lazy evaluation works like this in theory, in practice GHC uses a more ## Consequences +(Summed up as a list below. The generic "it" pronoun, when used as a subject with otherwise ambiguous meaning, refers to "lazy evaluation".) + +- It forces the language to be pure. +- Determining space usage can get a little tricky, mostly due to thunks and recursion. +- It behaves interestingly, depending on how functions are defined, mainly due to short-circuiting. For example, some equivalent functions may take longer to compute if they make heavy use of pattern matching, while some others might even crash. +- It allows to define custom control structures. +- It allows to work with infinite data structures, or those large enough to not practically fit into memory (whatever the available size is). +- Pipelined incremental transformations of large data structures are memory-efficient. +- It eases the management of results for dynamic programming problems, especially the evaulation of the order of entries in a dynamic programming table. + -- cgit v1.2.3