Xah Lee wrote: • A Example of Mathematica's Expressiveness http://xahlee.org/UnixResource_dir/writ/Mathematica_expressiveness.html
On Dec 11, 3:53 am, "William James" <w_a_x_...@yahoo.com> wrote: > function normal( ary ) > { var div = Math.sqrt( > ary.map(function(x) x*x).reduce(function(a,b) a+b) ) > return ary.map(function(x) x/div) > > } I run your code in SpiderMonkey: // SpiderMonkey javascript. By William James. function normal(v) { var div=Math.sqrt(v.map(function(x) x*x).reduce(function(a,b) a+b)) return v.map(function(x) x/div) } print normal [3,4]; i got: /Users/xah/Documents/temp/xx.js:3: SyntaxError: missing { before function body: /Users/xah/Documents/temp/xx.js:3: var div=Math.sqrt(v.map(function(x) x*x).reduce(function(a,b) a+b)) /Users/xah/Documents/temp/xx.js: 3: ....................................^ Xah ∑ http://xahlee.org/ ☄ -- http://mail.python.org/mailman/listinfo/python-list