Robert L. wrote:
> Krishna wrote:
>
> > The Forth entry on Rosetta Code for
> > computing the binomial coefficient is
> > beautiful. Compare its compactness of
> > implementation with those in other
> > languages. This is a very nice code example
> > in Forth. Although it meets the requirements
> > of the entry, single integers for 32 bit
> > word size quickly lead to failure, e.g. "60
> > 30 choose". The implementation is better
> > suited for 64-bit word size.
> >
> > : choose ( n k -- nCk ) 1 swap 0 ?do over i - i 1+ */ loop nip ;
> >
> > Good job, whoever submitted this to Rosetta Code!
>
> Not compact enough.
>
> choose=->n,r{r<1?1:(n-r+1)*choose[n,r-1]/r}295412093820
Rosetta code is not about compactness. I prefer readability, even if
that is slightly less compact.
--
Rudy Velthuis
http://www.rvelthuis.de
"Blessed is the man, who having nothing to say, abstains from
giving wordy evidence of the fact."
-- George Eliot (1819-1880)