Mathematica 7 compares to other languages

Jon Harrop jon at ffconsultancy.com
Thu Dec 25 16:50:29 EST 2008


Xah Lee wrote:
>> >On Dec 10, 2:47 pm, John W Kennedy <jwke... at attglobal.net> wrote:
>> >> C:
>>
>> >> #include <stdlib.h>
>> >> #include <math.h>
>>
>> >> void normal(int dim, float* x, float* a) {
>> >>     float sum = 0.0f;
>> >>     int i;
>> >>     float divisor;
>> >>     for (i = 0; i < dim; ++i) sum += x[i] * x[i];
>> >>     divisor = sqrt(sum);
>> >>     for (i = 0; i < dim; ++i) a[i] = x[i]/divisor;
>>
>> >> }
> 
> Due to the low level of C, this C example should perhaps then accept a
> sequence of numbers separated by space...

In other words, you want a REPL.

Why don't we have another challenge that involves handling a non-trivial
input format, i.e. parsing?

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?u



More information about the Python-list mailing list