From f5a91ad7773bef2789b58549fe8ca7d75770b781 Mon Sep 17 00:00:00 2001 From: Ramakrishnan Muthukrishnan <vu3rdd@gmail.com> Date: Sun, 17 Oct 2010 01:10:54 +0530 Subject: [PATCH] solution to 2.33 in scheme --- src/sicp/ex2_33.rkt | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/sicp/ex2_33.rkt diff --git a/src/sicp/ex2_33.rkt b/src/sicp/ex2_33.rkt new file mode 100644 index 0000000..312ea07 --- /dev/null +++ b/src/sicp/ex2_33.rkt @@ -0,0 +1,24 @@ +#lang racket + +(require "utils.rkt") + +(define (map f coll) + (accumulate (lambda (x y) (cons (f x) y)) + '() + coll)) + +(map square '(1 2 3 4 5)) + +(define (append seq1 seq2) + (accumulate cons + seq2 + seq1)) + +(append '(1 2 3) '(4 5 6)) + +(define (length seq) + (accumulate (lambda (x y) (+ 1 y)) + 0 + seq)) + +(length '(1 2 3 4 5)) \ No newline at end of file -- 2.45.2