I was pleased the other day to have cause to discover that this is valid matlab syntax:
make_energy_fun = @(x,f) @(y,w) energy(y,x,f,w);
My thoughts:
- This is great! I’m creating an anonymous function which takes two parameters and returns an anonymous function taking two parameters which evaluates the energy with the original two parameters baked in. Then the (original) anonymous function is assigned to the variable
make_energy_fun. - But… in a civilized programming language wouldn’t this be, literally, an easy problem on a freshman problem set?
- …Why is it that we don’t use civilized programming languages, again?
What do you mean by a “civilized” programming language?
Almost any modern language seems civilized in comparison. I’d like to, say, define more than one function in a file, have indices that start at 0, do cluster computing without having to worry about legal issues, or chain function evaluations. (In a “real” language, you could do something like A.Transpose().getLUfactorization().solve(b).) But matlab has libraries…