Factor Language Blog

No math

Monday, December 18, 2006

I find it interesting that relatively few Factor words in the standard library directly call arithmetic words.

  { + - * / /f /i < <= > >= shift bitand bitor bitxor bitnot neg recip }
  [ usage ] map concat prune length .
405
  all-words length .
6561
  6561 405 /f .
16.2

That is, less than 1 out of 16 words directly calls an arithmetic word.

What about APL-style vector math?

  { v+ v- v* n*v v*n v/ v. norm vneg vmax vmin }
  [ usage ] map concat prune length .
55

Right now vector math is mostly only used in the UI, however it is used to great effect. Layout calculations become much simpler.

Many (most?) source files don’t even USE: the math vocabulary.

Kind of makes the arguments about postfix arithmetic not being intuitive a moot point.