1. Factorial on RosettaCode

Okay, some of you aren't going to like the over-the-top way I did it, but it was an interesting experience all the same.

Kind regards, Bruce.

new topic     » topic index » view message » categorize

2. Re: Factorial on RosettaCode

bruce1961 said...

Okay, some of you aren't going to like the over-the-top way I did it, but it was an interesting experience all the same.

Well, not so much as 'over the top' but not a good example of how Euphoria should be used to solve these problems. Your approach is a novelty and not really what I'd recommend to anyone who actually was considering Euphoria for problem solving.

new topic     » goto parent     » topic index » view message » categorize

3. Re: Factorial on RosettaCode

Am I being particularly obtuse? I'd have thought the function would be simply:

function factorial(integer n) 
atom f f=1 while n do f*=n n-=1 end while return f 
end function 

Putting in it's fewest lines, that is? Or is there a particularly nice Euphorian way to do that?

new topic     » goto parent     » topic index » view message » categorize

4. Re: Factorial on RosettaCode

DerekParnell said...

but not a good example of how Euphoria should be used to solve these problems. Your approach is a novelty and not really what I'd recommend to anyone who actually was considering Euphoria for problem solving.

Hmmmm ... you do make a good case, Derek. I feel a bit embarrassed now.

Bruce.

new topic     » goto parent     » topic index » view message » categorize

5. Re: Factorial on RosettaCode

Hah! Finally, some justification for answering with more than just the bare minimum of code:

"As with any puzzle, try to do it in as creative/concise/comical a way as possible (simple, obvious solutions allowed, too)." - RosettaCode 99 Bottles of Beer

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu