Anonymous functions use a block of code as a value, defining it as an inline function without a name.
-1
votes
2answers
28 views
Replacement variable inside of the replacing variable
I have a function, that check user language and write it down in a variable. After a time, i come of idea to merge they, so that i need a call the function anytime before the first use of a variable, ...
5
votes
2answers
36 views
Difference between $.proxy, bind, call, apply
The old way:
var self = this;
setTimeout(function(){
console.log(self);
}, 5000);
With jQuery:
setTimeout($.proxy(function(){
console.log(this);
}, this), 5000);
With bind:
...
2
votes
2answers
45 views
How to nest anonymous functions in Matlab?
I have a file funcs.m that stores anonymous functions. They must be usable by the files in the directory where it is. Currently, I use the anonymous functions so that I execute the file funcs.m in ...
0
votes
1answer
33 views
Adding a PHP anonymous function to an object
Is it possible to add an anonymous function to an object, and call it within the object. See below for example code. Calling closure assigned to object property directly and Anonymous function for a ...
-1
votes
5answers
36 views
Why does this call to anonymous function does not work?
Why does this
$( '#someid' ).click( function() {
getdata( 'listing' , function( data ) {
showlist( data );
}, 'string' , 1 );
});
work but this one doesn't
$( '#someid' ).click( ...
0
votes
4answers
33 views
array_walk and anonymous function
I'm trying to apply ucfirst to the words in an array using array_walk and an anonymous function. I want to change the values of the "original" array $fruits. Since I can't use pass by reference, what ...
4
votes
1answer
40 views
Recursive function call wrapped in anonymous function can't be found
Note: This is mostly a theoretical practice.
function one() {
return [1, function() { one(); }];
}
console.log((one()[1])());
The output gives undefined. Why?
0
votes
2answers
32 views
Named function and anonymous function having different effects
My problem:
I'm refactoring some of my code, and giving names to some long anonymous function. Unfortunately, it breaks the app in ways I don't understand.
The code
Anonymous version works fine,
...
0
votes
2answers
35 views
Return value from anonymous function to parent function
I have a setup like this:
function test(){
function(){
return "testing!";
};
return;
}
echo test();
And I'm trying to get the test() function to return "testing" (in this ...
1
vote
2answers
36 views
Memory size of function handle - MATLAB
One of the fields in my structure is a function handle:
strct.handl=@(arg1,arg2)handl(arg1,arg2,par1,par2)
Now, arg1 and arg2 are defined every time I use the handle, but par1 and par2 are stored ...
4
votes
3answers
94 views
How can I write a Func without Lambde expression?
I am just thinking how to convert this:
List.Where(X=>X>5); to non-lambda expression code.
I cannot figure out how to get Func working here.
0
votes
1answer
42 views
Node.JS / Javscript Async Call back issue
I am trying to accomplish the following (should be quite basic and I must be missing something trivial):
1. Call a function with string that has a select statement
2. Wait until the DB call completes ...
2
votes
0answers
33 views
How to Bind dropdown from anonymous class values
I want to populate a dropdown with values A,Band C.The below code works for create only,not for edit.
ViewBag.UserType = new[] { new SelectListItem { Text = "A", Value = "1", Selected = false }, ...
0
votes
3answers
35 views
Class variables in JavaScript and setInterval
Since I need to pass an anonymous function to setInterval if I want parameters, I tried using the below code. Originally I had it calling this.countUp, but as that returned NaN I did some reading and ...
0
votes
1answer
29 views
Length of a vector output by an anonymous function in MATLAB
So I've created some anonymous function, say,
thisguy=@(x) [1,x,3]
I would say that the length of the output of thisguy should be 3; i.e. it is a 1x3 vector. Now, suppose that I have such a ...