002 - Pure, Functional, Financial Python Katas

This code is from here.

As with the last kata, rewrite it purely in terms of lambdas. You will find it is not possible to write a for-loop just with lambdas, probably best to use the map function.

def bond_price(par, T, ytm, coup, freq = 2):  
    freq = float(freq)
    periods = T * freq
    coupon = coup / 100. * par / freq
    dt = [(i+1)/freq for i in range(int(periods))]
    price = sum( [ coupon / (1 + ytm / freq) ** ( freq * t) for t in dt] ) + par / ( 1 + ytm / freq ) ** ( freq * T )
    return price