From 4bb59df548b0e722556430393936abaa52849795 Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Sat, 22 Dec 2018 21:30:26 -0500 Subject: Add (net ricketyspace sicp two twentyone). --- net/ricketyspace/sicp/two/twentyone.scm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 net/ricketyspace/sicp/two/twentyone.scm (limited to 'net') diff --git a/net/ricketyspace/sicp/two/twentyone.scm b/net/ricketyspace/sicp/two/twentyone.scm new file mode 100644 index 0000000..8ad559e --- /dev/null +++ b/net/ricketyspace/sicp/two/twentyone.scm @@ -0,0 +1,14 @@ +;;;; License: CC0-1.0 + +(define-module (net ricketyspace sicp two twentyone) + #:export (square-list-v1 + square-list-v2)) + +(define (square-list-v1 items) + (if (null? items) + items + (cons (* (car items) (car items)) + (square-list-v1 (cdr items))))) + +(define (square-list-v2 items) + (map (lambda (x) (* x x)) items)) -- cgit v1.2.3