SHARE
TWEET

Untitled

a guest Nov 27th, 2018 113 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. open Core
  2.  
  3. (* new_cps was originally new_cps xs = cps (ratio :: xs) however was changes to illustrate a point *)
  4.  
  5. let splitting_old_2 numerator denominator =
  6.   let rec loop mult ratio cps =
  7.     let new_cps xs = cps xs in
  8.     if mult = 1 then
  9.       new_cps
  10.     else
  11.       fun final ->
  12.       loop (pred mult) (succ ratio)
  13.            new_cps
  14.            (loop (pred mult) (succ ratio * ratio) ident final)
  15.   in
  16.   loop numerator denominator ident []
  17.  
  18. let splitting numerator denominator =
  19.   let rec loop mult ratio cps =
  20.     let new_cps xs = cps xs in
  21.     if mult = 1 then
  22.       new_cps
  23.     else
  24.       loop (pred mult) (succ ratio * ratio)
  25.            (loop (pred mult) (succ ratio) new_cps)
  26.   in
  27.   loop numerator denominator ident []
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top