From 020c1e77489b772f854bb3288b9c8d2818a6bf9d Mon Sep 17 00:00:00 2001
From: EuAndreh <eu@euandre.org>
Date: Fri, 18 Apr 2025 02:17:12 -0300
Subject: git mv src/content/* src/content/en/

---
 .../pastebins/2021/06/08/reading-session-pt1.adoc  | 66 ++++++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 src/content/en/pastebins/2021/06/08/reading-session-pt1.adoc

(limited to 'src/content/en/pastebins/2021/06/08/reading-session-pt1.adoc')

diff --git a/src/content/en/pastebins/2021/06/08/reading-session-pt1.adoc b/src/content/en/pastebins/2021/06/08/reading-session-pt1.adoc
new file mode 100644
index 0000000..d9f1f91
--- /dev/null
+++ b/src/content/en/pastebins/2021/06/08/reading-session-pt1.adoc
@@ -0,0 +1,66 @@
+= Debit Reading Session - SICP solutions pt.1
+
+[source,scheme]
+----
+;; 1.41
+(define (double f)
+  (lambda (x)
+    (f (f x))))
+
+
+:;; 1.42
+(define (compose f g)
+  (lambda (x)
+    (f (g x))))
+
+
+;;; 1.43
+(define (repeated f n)
+  (if (= 1 n)
+    identity
+    (comp (repeated f (dec n)))))
+
+
+;;; 2.27
+(define (map-tree node-fn leaf-fn tree)
+  (cond
+   ((null? tree) tree)
+   ((not (pair? tree)) (leaf-fn tree))
+   (else
+    (node-fn
+     (cons (map-tree node-fn leaf-fn (car tree))
+           (map-tree node-fn leaf-fn (cdr tree)))))))
+
+(define (map-nodes f tree)
+  (map-tree f identity tree))
+
+(define (deep-reverse x)
+  (map-nodes reverse x))
+
+
+;;; 2.28
+(define (flatten tree)
+  (define (rec acc t)
+    (cond
+     ((null? t) acc)
+     ((not (pair? t)) (cons t acc))
+     (else
+      (rec (rec (cdr t) acc)
+           (car t)))))
+  (rec nil tree))
+
+
+;;; 2.30
+(define (square-tree tree)
+  (map-leaves square tree))
+
+
+;;; 2.31
+(define square-tree map-leaves) ; ha!
+
+
+;;; 2.32
+TODO
+----
+
+FYI: I just typed those in, I didn't yet test them yet.
-- 
cgit v1.2.3

