Message from discussion
PART ONE: Lisp & Education: Re: Norvig's latest paper on Lisp
Received: by 10.66.84.161 with SMTP id a1mr635183paz.47.1353016495167;
Thu, 15 Nov 2012 13:54:55 -0800 (PST)
Path: 6ni83173pbd.1!nntp.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!spln!extra.newsguy.com!newsp.newsguy.com!enews4
From: "WJ" <w_a_x_...@yahoo.com>
Newsgroups: comp.lang.lisp
Subject: Re: PART ONE: Lisp & Education: Re: Norvig's latest paper on Lisp
Date: 15 Nov 2012 21:54:17 GMT
Organization: NewsGuy - Unlimited Usenet $19.95
Lines: 18
Message-ID: <k83oa90toe@enews4.newsguy.com>
NNTP-Posting-Host: p6aa75268b99649d5f9ed08e13f7ddce36a6f0f0554cb2e775a7f06e85c48982c.newsdawg.com
Mime-Version: 1.0
User-Agent: XanaNews/1.18.1.6
X-Antivirus: avast! (VPS 121115-0, 11/15/2012), Outbound message
X-Antivirus-Status: Clean
X-Received-Bytes: 1294
Content-Type: text/plain; charset=iso-8859-1
Ed L. Cashin wrote:
> Good luck. I'm happy so far. Some people diss the"loop" macro, but
> I've been delighted by it. This kind of thing is a real treat for me
> (it was ugly as sin when I did it in Java):
>
> (loop for c in player-cards
> sum (card-blackjack-value c) into n
> count (is-ace c) into n-aces
> finally (return (if (and (> n-aces 0) (< n 12))
> (+ n 10)
> n)))))
Clojure:
(let [n (apply + (map card-blackjack-value player-cards))]
(+ n (if (and (some is-ace player-cards) (< n 12)) 10 0)))