Egyptian division: Difference between revisions

m
→‎{{header|J}}: a couple comments on this approach
(J draft)
m (→‎{{header|J}}: a couple comments on this approach)
Line 501:
580 egydiv 34
17 2</lang>
 
Notes:
 
When building the doublings table, we don't actually know we've exceeded our numerator until we are done, so we do not include that row in our <code>doublings</code> result.
 
Our "fold" is actually not directly on the result of doublings - for our fold, we add another column where every value is the numerator. This conveniently makes it available for comparison at every stage of the fold and seems a more concise approach than creating a closure. (We do not include this extra value in our <code>ansacc</code> result, of course.)
 
=={{header|Haskell}}==
6,962

edits