summaryrefslogtreecommitdiffstats
path: root/net/ricketyspace
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2019-06-30 12:45:21 -0400
committerrsiddharth <s@ricketyspace.net>2019-06-30 12:45:21 -0400
commitcf005bd0c4b79167e2d97e6a51fc95fbb6fa820f (patch)
tree4d1bb8df365c3f6f95a3c7957eb8f7d352807442 /net/ricketyspace
parentd548d2a4d08896dfd8d55e9909cebcb744234947 (diff)
Add (net ricketyspace sicp two twentyeight).
* net/ricketyspace/sicp/two/twentyeight.scm: New file.
Diffstat (limited to 'net/ricketyspace')
-rw-r--r--net/ricketyspace/sicp/two/twentyeight.scm21
1 files changed, 21 insertions, 0 deletions
diff --git a/net/ricketyspace/sicp/two/twentyeight.scm b/net/ricketyspace/sicp/two/twentyeight.scm
new file mode 100644
index 0000000..dbba0e0
--- /dev/null
+++ b/net/ricketyspace/sicp/two/twentyeight.scm
@@ -0,0 +1,21 @@
+;;;; License: CC0-1.0
+
+(define-module (net ricketyspace sicp two twentyeight)
+ #:export (fringe))
+
+(define (fringe x)
+ (cond ((null? x) '())
+ ((not (pair? x)) (list x))
+ (else (append (fringe (car x))
+ (fringe (cdr x))))))
+
+
+;;; Guile REPL
+
+;;; scheme@(guile-user)> ,use (net ricketyspace sicp two twentyeight)
+;;; scheme@(guile-user)> (define x (list (list 1 2) (list 3 4)))
+;;;
+;;; scheme@(guile-user)> (fringe x)
+;;; $12 = (1 2 3 4)
+;;; scheme@(guile-user)> (fringe (list x x))
+;;; $13 = (1 2 3 4 1 2 3 4)