From b9d1712fb39a98a537d7ed83f2b8fdfb49fdc154 Mon Sep 17 00:00:00 2001 From: "the Phoeron\" Colin J.E. Lupton" <thephoeron@protonmail.com> Date: Thu, 1 Sep 2022 09:40:01 -0400 Subject: [PATCH] Restructure and Revise Exercise 1.4.2, Consing --- 1-04-02-consing.md | 21 +++++++++++++++++---- CHANGELOG.md | 36 +++++++++++++++++++++--------------- 2 files changed, 38 insertions(+), 19 deletions(-) diff --git a/1-04-02-consing.md b/1-04-02-consing.md index d07a93f..2e4f78f 100644 --- a/1-04-02-consing.md +++ b/1-04-02-consing.md @@ -2,19 +2,32 @@ ## Consing -One way to create a Cons-Cell is using the `cons` function. +As we saw in the previous exercise, Cons-Cells can be created with the `cons` function. This operation is called *consing*. + +### In the REPL + +Let's try consing a few pairs of objects together. ```lisp -* (cons 'a 'b) -(A . B) +(cons 'a 'b) + +(cons 1 2) + +(cons "one" "two") ``` -They can hold any `type` of data, not just symbols. +### What You Should See + +The `cons` function returns a fresh Cons-Cell every time it is called. Since a Cons-Cell is just a pair of pointers it can combine any two Lisp objects into a pair, no matter what their type is. ```lisp +* (cons 'a 'b) +(A . B) + * (cons 1 2) (1 . 2) * (cons "one" "two") ("one" . "two") ``` +Notice the special syntax of the Cons-Cell returned at the REPL? This is called Dot-Notation and we'll learn more about it in the next exercise. diff --git a/CHANGELOG.md b/CHANGELOG.md index 5337b97..421ddb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,20 @@ # CHANGELOG +## 2022-09-01 + +- Normalized use of tense in the CHANGELOG +- Chapter 1.4, "Lists and List Operations" + - Revised Exercise 1.4.2, restructuring into separate "In the REPL and What You Should See" subsections + ## 2022-08-31 -- Update README.md for the LLTHW source-control repository +- Updated README.md for the LLTHW source-control repository ## 2022-08-30 - Chapter 1.4, "Lists and List Operations" - Revised Exercise 1.4.1, restructuring into separate "In the REPL" and "What You Should See" subsections the way LxTHW books are supposed to be - - Split all exercises into separate documents and adjust Markdown formatting accordingly + - Split all exercises into separate documents and adjusted Markdown formatting accordingly - Renamed Exercise 1.4.10 from "Push and Pop" to "Stacks" - Renamed Exercise 1.4.11 from "Pop" to "PUSH and POP" - Update TODO list @@ -22,13 +28,13 @@ ## 2022-08-29 - Exercise 1.1.8, "Configuring Your Development Environment" - - Revise subsection on choice of text editors because my information was woefully out-of-date - - Minor clarifications to subsection on being comfortable at the command-line as I think exactly how to word it + - Revised subsection on choice of text editors because my information was woefully out-of-date + - Clarified subsection on being comfortable at the command-line as I think exactly how to word it ## 2022-08-26 -- Fix syntax highlighting for Exercise 1.5.12, "More Tries" -- Update callout blocks to use "hints" plugin: +- Fixed syntax highlighting for Exercise 1.5.12, "More Tries" +- Updated callout blocks to use "hints" plugin: - Exercise 1.2.3, "Unicode and Strings" - Exercise 1.2.5, "More Characters" - Exercise 1.2.6, "Character Codes" @@ -40,17 +46,17 @@ ## 2022-08-25 - Exercise 1.1.8, "Configuring Your Development Environment" - - Clean-up inline hints - - Remove deprecated section about the in-browser REPL - - Clarify download and installation instructions for SBCL and Quicklisp - - Rewrite and simplify section on choosing a text editor to avoid all talk + - Cleaned-up inline hints + - Removed deprecated section about the in-browser REPL + - Clarified download and installation instructions for SBCL and Quicklisp + - Rewrote and simplified section on choosing a text editor to avoid all talk of Emacs and Vim (like I should have done in the first place) ## 2022-08-24 -- Add book.json to manually define GitBook configuration and fix some outstanding oddities -- Reorganize SUMMARY.md to generate a better TOC for "folding-chapters" plugin -- Add GitBook plugins: +- Added book.json to manually define GitBook configuration and fix some outstanding oddities +- Reorganized SUMMARY.md to generate a better TOC for "folding-chapters" plugin +- Added GitBook plugins: - "hints" - "folding-chapters" - "localized-footer" @@ -58,8 +64,8 @@ ## 2022-08-23 -- Add CHANGELOG and TODO chapters -- Deprecate and remove old "Draft Progress at a Glance" section from title page +- Added CHANGELOG and TODO chapters +- Deprecated and removed old "Draft Progress at a Glance" section from title page ## 2022-08-22 -- GitLab