Long multiplication: Difference between revisions

m
→‎{{header|Python}} (Trans Haskell): Foregrounded main function
(→‎{{header|Python}} (Trans Haskell): Simplified one expression in terms of reduce, pylinted, added {Works with})
m (→‎{{header|Python}} (Trans Haskell): Foregrounded main function)
Line 4,384:
 
 
def digitslongmult(x, y):
'''DigitsLong of x as a list of integersmultiplication.'''
return [intreduce(c) for c in str(x)]
0digitSum,
polymul(digits(x), digits(y)), 0
)
 
 
def mult_tabledigitSum(xsa, ysx):
'''RowsLeft ofto allright productsdecimal digit summing.'''
return [[xa * y10 for+ x in xs] for y in ys]
 
 
Line 4,405 ⟶ 4,408:
 
 
def longmultmult_table(xxs, yys):
'''LongRows multiplicationof all products.'''
return reduce([[x * y for x in xs] for y in ys]
 
lambda acc, v: acc * 10 + v,
 
polymul(digits(x), digits(y)),
def digits(x):
0
'''Digits of x as a list of integers.'''
)
return [int(c) for c in str(x)]
 
 
9,659

edits