WJ 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)))))
Gauche Scheme:
(use srfi-42)
(let1 total (sum-ec (: c player-cards) (card-blackjack-value c))
(if (and (< total 12) (find is-ace player-cards))
(+ 10 total)
total))