From 197c46b80ec621938fbac8e3926fa2efb83aa07f Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Fri, 16 Nov 2018 20:17:31 -0500 Subject: Add (net ricketyspace sicp two eighteen). --- net/ricketyspace/sicp/two/eighteen.scm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 net/ricketyspace/sicp/two/eighteen.scm (limited to 'net/ricketyspace') 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)))))) -- cgit v1.2.3