[plt-scheme] sicp exercise 2.23

From: Jason Wang (randomtalk at gmail.com)
Date: Tue Apr 29 14:50:52 EDT 2008

On Tue, Apr 29, 2008 at 2:03 AM, Jos Koot <jos.koot at telefonica.net> wrote:
>  The above form of cond has not yet been introduced either before reaching
> problem 2.23. Look at how you would implement map, then decide what to
> discard.
Well, in the book, they implemented map as follows:
(define (map proc items)
  (if (null? items)
      (cons (proc (car items))
            (map proc (cdr items)))))

I think you have to discard the cons form but other than the cond
implementation mentioned before, i'm not sure how to proceed to
implement it.

On Tue, Apr 29, 2008 at 12:35 PM, John Clements
<clements at brinckerhoff.org> wrote:
>  On Apr 28, 2008, at 11:04 PM, Jason Wang wrote:
> >
> > However, my problem is that SICP hasn't introduced begin yet...
> >
>  I don't have a copy of SICP handy (I guess I can just tear up my Schemer
> Membership Card right now...), but "begin" seems to me to be the natural
> choice to express what you want; it's true that there are other constructs
> that behave in a begin-like way, and in fact you can write begin as a
> function (for a fixed number of arguments) quite easily, but I would suggest
> just using 'begin', especially as you've been through HtDP already.

I wanted to understand what the intention of the author is in putting
this exercise here, there should be a perfectly fine implementation
with the knowledge in the proceeding sections, but i can't seem to
find it. Though i do understand that 'begin' is a rather natural way
to express this particular function.

Thanks a lot for all your help and any further help would be greatly

"It's a wonderful world hobbes ol' buddy, let's go explorin'!" -
Calvin in "Calvin and Hobbes"

Posted on the users mailing list.