From: Ramakrishnan Muthukrishnan Date: Fri, 2 Jul 2010 07:18:02 +0000 (+0530) Subject: solution to 2.24. Please look at the correctness of the box and arrow diagram X-Git-Url: https://git.rkrishnan.org/vdrive/%5B/%5D%20/uri/%22news.html/statistics?a=commitdiff_plain;h=f9c3b38ffb04b6053d9273614541cbf70d3cdcf8;p=sicp.git solution to 2.24. Please look at the correctness of the box and arrow diagram --- diff --git a/src/sicp/ex2_24.clj b/src/sicp/ex2_24.clj new file mode 100644 index 0000000..b027573 --- /dev/null +++ b/src/sicp/ex2_24.clj @@ -0,0 +1,34 @@ +; -*-text-*- +(comment +(list 1 (list 2 (list 3 4))) +;;=> (1 (2 (3 4))) +) + +;; box and arrow notation + + --- --- --- --- + | | |--> | | \ | + --- --- --- --- + | | + | | + -> 1 | + --- --- --- --- + | | |--> | | \ | + --- --- --- --- + | | + | | + -> 2 | + --- --- --- --- + | | |--> | | \ | + --- --- --- --- + | | + | | + -> 3 -> 4 + +The key to draw box-and-arroy diagram is to look at the list and draw +the outermost level elements in the top and then work innerwards (downwards) +from there. So, (1 (2 (3 4))) has two elements at the top : +1 and (list 2 (list 3 4)) + +(2 (3 4)) has two elements in it: 2 and (list 3 4) and then we have (3 4). +This translated to the above diagram.