summaryrefslogtreecommitdiffstats
path: root/net/ricketyspace
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2018-11-16 20:17:31 -0500
committerrsiddharth <s@ricketyspace.net>2018-11-16 20:17:31 -0500
commit197c46b80ec621938fbac8e3926fa2efb83aa07f (patch)
treead3279d7143b02105e35f1c73203929bb1c891db /net/ricketyspace
parent73ef53b87b5756e9fcb45f5c2851431a7c8d1422 (diff)
Add (net ricketyspace sicp two eighteen).
Diffstat (limited to 'net/ricketyspace')
-rw-r--r--net/ricketyspace/sicp/two/eighteen.scm14
1 files changed, 14 insertions, 0 deletions
diff --git a/net/ricketyspace/sicp/two/eighteen.scm b/net/ricketyspace/sicp/two/eighteen.scm
new file mode 100644
index 0000000..f2ac60e
--- /dev/null
+++ b/net/ricketyspace/sicp/two/eighteen.scm
@@ -0,0 +1,14 @@
+;;;; License: CC0-1.0
+
+(define-module (net ricketyspace sicp two eighteen)
+ #:use-module (net ricketyspace sicp two seventeen)
+ #:export (sicp-reverse))
+
+(define (sicp-append list1 list2)
+ (if (null? list1)
+ list2
+ (cons (car list1) (sicp-append (cdr list1) list2))))
+
+(define (sicp-reverse items)
+ (cond ((null? items) '())
+ (else (sicp-append (sicp-reverse (cdr items)) (list (car items))))))