#Web designer
def factorial(x):
#-------------------------------------------------
#--- Code snippet from The Math Vault ---
#--- Calculate factorial (C) Arthur Smith 1999 ---
#-------------------------------------------------
result = str(1)
i = 1 #Thanks Adam
while i <= x:
#result = result * i #It's faster to use *=
#result = str(result * result + i)
#result = int(result *= i) #??????
result str(int(result) * i)
#result = int(str(result) * i)
i = i + 1
return result
print factorial(6)
class StandardMathematicsSystem(MathematicsSystem):
def __init__(self, ibase):
if ibase.getBase() != new (IntegralNumber, 2):
raise NotImplementedError
self.base = ibase.getBase()
def calculateFactorial(self, target):
result = new (IntegralNumber, 1)
i = new (IntegralNumber, 2)
while i <= target:
result = result * i
i = i + new (IntegralNumber, 1)
return result
print StandardMathematicsSystem.getInstance(new (InternalBase, new (IntegralNumber, 2))).calculateFactorial(new (IntegralNumber, 6))
OH JEEZ IVE NEVER SEEN THIS SORT OF THING BEFORE
WHAT A JOKE THAT ISNT TIRED
Name:
Anonymous2007-05-25 10:32 ID:K5cBcHMT
import c_math
fact = c_math.fact
print fact(6)
Wrong, that should be from c_math import fact
print fact(6)
Name:
Anonymous2007-05-25 10:33 ID:K5cBcHMT
Also shiichan is stupid.
Name:
Anonymous2007-05-25 10:53 ID:odf/TSv6
Don't complain about the board software, it's against the rules!
Name:
Anonymous2007-05-25 11:01 ID:pMRzngc6
>>5
i completely agrMySQL Error check your synta near '''
Name:
Anonymous2007-05-25 13:04 ID:e87L90K/
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\;DELETE FROM posts' at line 1
>>8
Yes, that was better. With reduce vs foldl, just what you're used to, but reduce is faster, should be preferred. With int.__mul__, it restricts what you do to to ints, but then again that's what you need, so that'd be a better one.
Thanks for posting to Reddit, wow, Anonymous getting famous. Glad you liked it.
Actually, I did that in a rush, and yeah, it was after reading the evolution of a Haskell programmer. At first I wanted to mock it a bit, but by the time I was writing EXPERT PROGRAMMER I got a few ideas to make it funny.
Name:
reddit2007-05-25 16:30 ID:U3wvE5Ua
You've got a typo in the web developer one: result str(int(result) * i)
#EXPERT PROGRAMMER
from c_math import fact
print fact(6)
#BRITISH EXPERT PROGRAMMER
from c_maths import fact
print fact(6)
#Web designer
def factorial(x):
#-------------------------------------------------
#--- Code snippet from The Math Vault ---
#--- Calculate factorial (C) Arthur Smith 1999 ---
#-------------------------------------------------
result = str(1)
i = 1 #Thanks Adam
while i <= x:
#result = result * i #It's faster to use *=
#result = str(result * result + i)
#result = int(result *= i) #??????
result = str(int(result) * i)
#result = int(str(result) * i)
i = i + 1
return result
print factorial(6)
class StandardMathematicsSystem(MathematicsSystem):
def __init__(self, ibase):
if ibase.getBase() != new (IntegralNumber, 2):
raise NotImplementedError
self.base = ibase.getBase()
def calculateFactorial(self, target):
result = new (IntegralNumber, 1)
i = new (IntegralNumber, 2)
while i <= target:
result = result * i
i = i + new (IntegralNumber, 1)
return result
print StandardMathematicsSystem.getInstance(new (InternalBase, new (IntegralNumber, 2))).calculateFactorial(new (IntegralNumber, 6))
Name:
Anonymous2007-05-25 16:43 ID:qjUouPUi
You morons, you linked world4chan on the biggest gathering place of EXPERT PROGRAMMERS. We'll be overrun by the rampant lack of interrogating for roughly an hour.