Factor Language Blog

New syntax for ratios

Wednesday, February 6, 2008

Since the very start Factor has supported exact arithmetic on rationals, however the results weren’t very readable:

123 321 * 987 / .
  13161/329

Now there’s a new syntax which factors out the whole part of the fraction:

123 321 * 987 / .
  40+1/329

40 and one 329th is a lot easier to think about than 13161ths of 329. Of course this syntax is symmetric so the reader supports it as well.