diff options
author | rsiddharth <s@ricketyspace.net> | 2019-06-30 12:45:21 -0400 |
---|---|---|
committer | rsiddharth <s@ricketyspace.net> | 2019-06-30 12:45:21 -0400 |
commit | cf005bd0c4b79167e2d97e6a51fc95fbb6fa820f (patch) | |
tree | 4d1bb8df365c3f6f95a3c7957eb8f7d352807442 /net | |
parent | d548d2a4d08896dfd8d55e9909cebcb744234947 (diff) |
Add (net ricketyspace sicp two twentyeight).
* net/ricketyspace/sicp/two/twentyeight.scm: New file.
Diffstat (limited to 'net')
-rw-r--r-- | net/ricketyspace/sicp/two/twentyeight.scm | 21 |
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) |