sicp

sicp sandbox.
git clone git://git.ricketyspace.net/sicp.git
Log | Files | Refs

commit 4bb59df548b0e722556430393936abaa52849795
parent 50b48911bdff2ee90c203b22baf3953d2b23b24a
Author: rsiddharth <s@ricketyspace.net>
Date:   Sat, 22 Dec 2018 21:30:26 -0500

Add (net ricketyspace sicp two twentyone).

Diffstat:
net/ricketyspace/sicp/two/twentyone.scm | 14++++++++++++++
1 file changed, 14 insertions(+), 0 deletions(-)

diff --git a/net/ricketyspace/sicp/two/twentyone.scm 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))