:: discount-value ( rate period payment -- discounted-value ) 1.0 rate 1.0 + period ^ / payment * ; :: discounted-payback-when ( rate investment cashflows -- period ) cashflows values [ :> ( pmt i ) rate i 1 + pmt discount-value ] map-index summation [ investment >= ] find drop ;