Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Multiple Word Conditional?

From: al:bri:xtra at: 19-Nov-2000 21:53

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/