2014-08-14 0:17 GMT+02:00 Jon Purdy <evincarofaut...@gmail.com>: > Sigh. The formatting button in Gmail is directly next to the “Send” button. > Apologies, list. > > >> It seems like most of the overhead comes from fixed-point arithmetic, >> actually. Here’s a translation to Kitten with locals: > > def meanStd (float float float → float float): > > → sum2 sum invLen; > > sum ×. invLen → μ; > μ (sum2 ×. invLen −. μ square) sqrt > > You can write this in postfix: > > def meanStd (float float float → float float): > > → sum2 sum invLen; > > sum invLen (×.) → μ; > μ sum2 invLen (×.) μ square (−.) sqrt > > Then easily eliminate μ: > > def meanStd (float float float → float float): > > → sum2 sum invLen; > > sum invLen (×.) dup > { sum2 invLen (×.) } dip > square (−.) sqrt
Interesting! But what does the (x.) and (-.) words do? -- mvh/best regards Björn Lindqvist ------------------------------------------------------------------------------ _______________________________________________ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk