Exercise 1.6

Printer-friendly versionPrinter-friendly version

Alyssa P. Hacker doesn’t see why if needs to be provided as a special form. “Why can’t I just define it as an ordinary procedure in terms of cond?” she asks. Alyssa’s friend Eva Lu Ator claims this can indeed be done, and she defines a new version of if:

(define (new-if predicate then-clause else-clause)
  (cond (predicate then-clause)
        (else else-clause)))

Eva demonstrates the program for Alyssa:

(new-if (= 2 3) 0 5)
5

(new-if (= 1 1) 0 5)
0

Delighted, Alyssa uses new-if to rewrite the square-root program:

(define (sqrt-iter guess x)
  (new-if (good-enough? guess x)
          guess
          (sqrt-iter (improve guess x)
                     x)))

What happens when Alyssa attempts to use this to compute square roots? Explain.

Comments

It took me a while to get this new-if working in clojure, but here’s what I came up with. Any suggestions?

(def new-if (fn [predicate then-clause else-clause]
(cond predicate then-clause
:else else-clause)))

Birkenstock over 200birkenstock outlet

Choose the one with Chaussures Birkenstockthick sole birkenstock pas cherto provide discount birkenstock sandals,birkenstock clogs cheap,birki clogs,shoe clogs,men s birkenstocks, even BMX cyclistsarmani watches are using eh same kind of shoes, since it sticks well in the pedals andarmani watches uk its thick flat shoes is utilized as a brake. Furthermore, the shoes are popular because of its strength. These kinds of shoes are very expensive because of having high quality materialbirkenstock outlet used and the additional features which provide the shoes the advantages as compared to other brands. Also these shoes should be manufactured and designed Unisex Birkenstockaccording to the safety features associated with the sports. The price of these shoes will be according on the features which the shoes have.

At 73 years old,Birkenstock outlet he is still busy birkenstock kairomaking people look good. Giorgio Armani is one of the preeminentBirkenstock UK Italian fashion designers in the world,birkenstock homme still goingbirkenstock france strong after 33 years in the birkenstock kairoindustry. Known for his classically tailored, sleek power suits and clean,armani watches high quality fabrics, everyone from the who’s who of Hollywood to the bankers onarmani watches uk Wall Street have fallen in love with the Armani brand. Now, with over $1.5 billion armani ceramicain revenue and a retail empire that extends to more than 35 countries, Armani himself continues to maintain full control over his business. However, it has been a long, uphill journey for the designer to get where he is today. 

There ischeap barbour jackets no

doubt about it: when it comes to sports betting, and betting NBA games is one of the most popular choice.The NBA has attracted

hundreds of hundreds of sports betting in the regular season, after the playoffs to double that number.
cheap barbour jackets store
discount barbour jacketIf you like

to watch NBA games at home, or life, then you will like gambling you choose home part of the winning team - big, water

buffalo.These days, the popularity of NBA games on rising, you can find free sports betting skills, but you need the right

skills practice.
barbour jacket 2013
buy barbour jacket onlineSports

betting skills can be overwhelming.How do you go to gambling NBA games, we must find a different point of view.You need to do

is to keep cautious and wisdom through actual information, you received.

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <pre> <hr> <ul> <ol> <li> <dl> <dt> <dd> <img>
  • Lines and paragraphs break automatically.
  • Adds typographic refinements.

More information about formatting options