JavaScript: generating a function with runtime data from a declared function (tsenkov.net) 1 points by tsenkov 12y ago ↗ HN
[–] lutusp 12y ago ↗ It's called "regression analysis". Nothing to see here, move along. :) [–] tsenkov 12y ago ↗ I don't get it, what is? [–] lutusp 12y ago ↗ Using a data set to create a function able to produce that data set.http://en.wikipedia.org/wiki/Regression_analysis
[–] tsenkov 12y ago ↗ I don't get it, what is? [–] lutusp 12y ago ↗ Using a data set to create a function able to produce that data set.http://en.wikipedia.org/wiki/Regression_analysis
[–] lutusp 12y ago ↗ Using a data set to create a function able to produce that data set.http://en.wikipedia.org/wiki/Regression_analysis
[–] sigilworks 12y ago ↗ I think there are some errors in the final solution code, as it doesn't do what you describe.Were you aiming at something like this?var generated = function(value) { return new Function( "return (" + function(valueToSwap) { return { prop: valueToSwap }; } + ")(" + value + ");" ); };
4 comments
[ 3.5 ms ] story [ 32.0 ms ] threadhttp://en.wikipedia.org/wiki/Regression_analysis
Were you aiming at something like this?
var generated = function(value) { return new Function( "return (" + function(valueToSwap) { return { prop: valueToSwap }; } + ")(" + value + ");" ); };