Chaz wrote:
> factorial: func [num][
>      fact: func [n a][
>          any [
>              all [lesser? n 0 print "I don't know"]
>              all [switch n [0 1 a]]
>              all [fact subtract n 1 multiply n a]
>              ]
>      ]
>      fact num 1
> ]

This can be better written as:

Factorial!: make object! [
    Fact: func [n a] [
        any [
            all [lesser? n 0 print "I don't know"]
            all [switch n [0 1 a]]
            all [fact subtract n 1 multiply n a]
            ]
        ]
    set 'Factorial func [num][
        Fact Num 1
        ]
    ]

Note that Fact is only defined once, in the 'Factorial! object, rather than
every time 'Factorial is executed.

I hope that helps!

Andrew Martin
Objective Rebol...
ICQ: 26227169
http://members.nbci.com/AndrewMartin/
-><-


-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to