IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Do you not understand Regression?
The equations can be stored anywhere.
It's easy enuf to store the equations - IF YOU HAVE THE EQUATIONS! That's your problem, you're assuming that all you are doing is storing coefficients.

// assumes equation has "a" and "b" in it
a = prompt("Enter A:")
b = prompt("Enter B:")
There's your problem. Your program is not smart enuf to figure out the coefficients A && B. What if I give you a table of:

CREATE TABLE MyData(x INT, y INT)
INSERT INTO MyData VALUES(1,0)
INSERT INTO MyData VALUES(3,1)
INSERT INTO MyData VALUES(5,2)

and I told you the equation was of the form:

y = mx + b

Now give me a program that uses the above data to derive m and b. Don't give me a program asking the end user to give me m & b. When you get that done, then start changing the form of the equation around, adding more variables and various combinations of power orders. Something simple like:

y = a + b*x + c*x*x + d*x*z + e*z*z + f*z

And don't ask the operator to supply the a,b,...f coefficients.
New Eval can be used to compute arbitrary function
with arbitrary number of arguments.

It's really inconvenient, but possible, because most evals have access to global variables (and some even to local scope variables). So you do something like this:

getFunctionValue(string f, real x[], real a[]) {
idx = 0;

foreach anX in x {
eval("x" . idx . " = " . x);
}

idx = 0;

foreach anA in a {
eval("a" . idx . " = " . a);
}

return eval(f);
}

And then you build your "f"s so that they use x0, x1 and so on for argument names, and a0, a1 and so forth for parameter names.

And then you can look for minimum sum of squares by calling getFunctionValue in the known data points x[] and varying a[].

And then you throw up in disgust at this slow unvieldy buggy contraption and choose a language that supports real anonymous functions. You do. But not Bryce. He is happy. He has just achieved another triumph of Eval.
--

Less Is More. In my book, About Face, I introduce over 50 powerful design axioms. This is one of them.

--Alan Cooper. The Inmates Are Running the Asylum
New Eval is "good enuf" for occassional use.
It's really inconvenient, but possible, because most evals have access to global variables (and some even to local scope variables).

In the languages I am familiar with, they had the *same* scope as if the expression itself was there in the code where the Eval function was. It is just like a code replacment. I suppose I should have stated that assumption, but I have yet to see it otherwise.

And then you throw up in disgust at this slow unvieldy buggy contraption and choose a language that supports real anonymous functions.

Buggy? You have not identified any specific bugs. True, you get no compile-time checking, but if we are generating stuff during run-time, we don't have that anyhow. Slow? Perhaps. But I don't use it for finite element simulations or the like.

You seem to be agreeing with me that Eval is "good enough" for occassional usage, which is my point. If code was littered with eval's or dynamic execute's, then one might find closures would clean up the scoping issues more.

And no, I *don't* remember multiple regression. That was many many moons ago. My brain does a pretty good job of house-cleaning, except that it never asks permission before tossing. Kinda like my wife. Maybe if I studied your code long enuf I might figure it out, but I have other more practical things I would rather study if I go into study mode.
________________
oop.ismad.com
New You are not familiar with Ruby then
In the languages I am familiar with, they had the *same* scope as if the expression itself was there in the code where the Eval function was. It is just like a code replacment. I suppose I should have stated that assumption, but I have yet to see it otherwise.

Ruby has several different eval functions running around. They vary in terms of whose scope they evaluate in. After all your code running in my package may do something very different from your code running in your package. Ruby gives you choice.

If you want to do something more sophisticated than the basic built-in options, there is even the notion of a binding, which can be taken anywhere, and then from anywhere else you can eval with that binding.

This is explained at [link|http://www.pragmaticprogrammer.com/ruby/articles/dynacall.html|http://www.pragmatic...les/dynacall.html]

Cheers,
Ben
"good ideas and bad code build communities, the other three combinations do not"
- [link|http://archives.real-time.com/pipermail/cocoon-devel/2000-October/003023.html|Stefano Mazzocchi]
     Advanced programming languages - why are they not used? - (Arkadiy) - (104)
         question from a non programmer - (boxley) - (11)
             Second through fourth sentences are a blur - (Arkadiy) - (10)
                 sorry, I went from your specific - (boxley) - (9)
                     Well... - (Arkadiy) - (8)
                         I am not smart enough to detect the difference - (boxley) - (7)
                             In C++, "if" is simple - (Arkadiy) - (6)
                                 I think I disagree, maybe - (drewk) - (5)
                                     Re: I think I disagree, maybe - (Arkadiy) - (4)
                                         I was right - (drewk)
                                         Re: I think I disagree, maybe - (tuberculosis) - (2)
                                             Perl 6 will take that idea farther - (ben_tilly) - (1)
                                                 +5 Informative. - (static)
         I regard Smalltalk as a teaching language - (warmachine) - (5)
             Dixit. -NT - (Arkadiy)
             I regard it as the most powerful production tool I have - (tuberculosis)
             couple of comments - (ChrisR) - (2)
                 Re: couple of comments - (warmachine) - (1)
                     Documentation tool? - (ChrisR)
         Your brain is damaged - (tuberculosis) - (13)
             I am not saying - (Arkadiy) - (11)
                 Average guy? Come here and say that! :) - (warmachine) - (6)
                     Either you are, or... - (Arkadiy) - (1)
                         Yep! But give it more time. - (warmachine)
                     What's this got to do with the price of oil in Baghdad? - (tuberculosis) - (3)
                         Oops! You're right. - (warmachine) - (2)
                             You've missed something I think - (tuberculosis)
                             Re: Oops! You're right. - (JimWeirich)
                 OK that's true - (tuberculosis) - (3)
                     Smalltalk for Small Tykes - (JimWeirich)
                     Wrong sense of "narrative". - (Arkadiy) - (1)
                         (Oops) - (Arkadiy)
             modeling English - (tablizer)
         Re: Advanced programming languages - why are they not used? - (deSitter) - (1)
             I was going to mention Forth, - (Arkadiy)
         Bad Marketing - (tablizer) - (69)
             Re-implement these examples, please - (ben_tilly) - (56)
                 Problem description missing - (tablizer) - (55)
                     Problem description - (ben_tilly) - (54)
                         Arrays of arrays? There's your problem.Use relational tables -NT - (tablizer) - (53)
                             Why am I not surprised that you avoided the question? - (ben_tilly) - (52)
                                 hold on, cowboy - (tablizer) - (51)
                                     No, you never do say that you are done - (ben_tilly) - (50)
                                         Okay, I admit it was too sweeping - (tablizer) - (49)
                                             Re: Okay, I admit it was too sweeping - (deSitter)
                                             Thank you - (ben_tilly) - (47)
                                                 that is what I am looking for - (tablizer) - (46)
                                                     Re: that is what I am looking for - (admin) - (6)
                                                         What's that? - (deSitter) - (1)
                                                             Re: What's that? - (admin)
                                                         Actually Java Anonymous Inner Classes - (tuberculosis) - (3)
                                                             If I remember correctly, - (Arkadiy) - (2)
                                                                 Not entirely accurate. - (admin) - (1)
                                                                     Thanks - (Arkadiy)
                                                     ICLRPD (new thread) - (CRConrad)
                                                     How much are you willing to pay? - (ben_tilly) - (37)
                                                         If you don't have the evidence, then just say so -NT - (tablizer) - (36)
                                                             You win, again - (ben_tilly) - (35)
                                                                 Can't ANYBODY ever find a #@!* BIZ example? -NT - (tablizer) - (34)
                                                                     Ben's given me an idea. - (static) - (4)
                                                                         different "core"? - (tablizer) - (3)
                                                                             That's one way to think of it. - (static) - (2)
                                                                                 But if tree traversal was trivial, then it does not matter - (tablizer) - (1)
                                                                                     It's a matter of perspective. - (static)
                                                                     A TOP example - (johnu) - (19)
                                                                         re: transaction rollback - (tablizer) - (17)
                                                                             Why not just use a closure? - (johnu) - (16)
                                                                                 Eval () is a kind of closure - (Arkadiy) - (15)
                                                                                     Python supports it... - (admin)
                                                                                     topic is not about me, Mr. Insult - (tablizer)
                                                                                     Re: Eval () is NOT a kind of closure - (JimWeirich) - (12)
                                                                                         You are right. - (Arkadiy) - (11)
                                                                                             All? - (ben_tilly) - (10)
                                                                                                 I was thinking about - (Arkadiy) - (9)
                                                                                                     Thought you had missed those :-) - (ben_tilly) - (8)
                                                                                                         Re: Thought you had missed those :-) - (Arkadiy) - (7)
                                                                                                             That mostly works - (ben_tilly) - (6)
                                                                                                                 Re: That mostly works - (Arkadiy) - (3)
                                                                                                                     Think we are even then - (ben_tilly) - (2)
                                                                                                                         A function to produce list from range - (Arkadiy) - (1)
                                                                                                                             So? - (ben_tilly)
                                                                                                                 Fake Closures - (JimWeirich) - (1)
                                                                                                                     Wow - (Arkadiy)
                                                                         Re: A TOP example - (JimWeirich)
                                                                     Multivariate Regression Analysis - (ChrisR) - (8)
                                                                         Why not Eval()? - (tablizer) - (7)
                                                                             The problem is that the equations are part of the data - (ChrisR) - (5)
                                                                                 I am not following you - (tablizer) - (4)
                                                                                     Do you not understand Regression? - (ChrisR) - (3)
                                                                                         Eval can be used to compute arbitrary function - (Arkadiy) - (2)
                                                                                             Eval is "good enuf" for occassional use. - (tablizer) - (1)
                                                                                                 You are not familiar with Ruby then - (ben_tilly)
                                                                             Of course Eval()? - (JimWeirich)
             Re: Bad Marketing - (JimWeirich) - (11)
                 re: closures - (tablizer) - (10)
                     re: closures - (JimWeirich) - (9)
                         bottom bread - (tablizer) - (8)
                             Still waiting for examples - (JimWeirich) - (7)
                                 misunderstanding? - (tablizer) - (6)
                                     misunderstanding? ... Now I'm Confused - (JimWeirich) - (5)
                                         long blocks - (tablizer) - (4)
                                             Back to the Example ... - (JimWeirich) - (3)
                                                 auto-close - (tablizer) - (2)
                                                     Exceptions - (JimWeirich) - (1)
                                                         Warning: Discussing exceptions with me is a loooong topic -NT - (tablizer)

Your Spork God[tm] was HERE!
94 ms