Monday, December 18, 2006

No math

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 .
all-words length .
6561 405 /f .

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 .

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.

1 comment:

Anonymous said...

Good point. I guess for 99% of programmers out there this is true.