2,150 questions
0
votes
1
answer
61
views
Is there a way to make an anonymous that takes the left argument and the right argument?
For example, this function:
f:{x+y}
Is not what I want because to call the function, f[2;3] is required instead of 2 f 3. Is there a way to make the function such that 2 f 3 work?
I am using ngn/k, ...
0
votes
0
answers
81
views
How to include two named functions sequentially in one anonymous function
How do you include two named functions, which are not nested, in one anonymous function?
For example, say I have a file mainFunction.m which contains
function varargout = mainFunction(in1)
% in1 is ...
-2
votes
1
answer
93
views
Is it legal to declare a lambda after the last return in a C# function? [duplicate]
I was looking through the code of AutoMapper ASP.NET Core dependency injection, and in the AddAutoMapperClasses, I saw that they declared a lambda expression after the last return:
private static ...
4
votes
1
answer
73
views
Is there a way to make an anonymous function without output? [duplicate]
Is there a way to make an anonymous function without output?
I have variable for function_handle whose starting, default value is to do nothing. So I am doing func=@()[];. But I am also curious if ...
4
votes
1
answer
67
views
How to evaluate a MATLAB anonymous function that takes an arbitrary number of variables n, given a n-dimensional vector?
I'm relatively new to MATLAB so perhaps there's something I'm missing.
The task is the following: we must program a certain algorithm for optimizing a continuous function f: Rn ---> R. The thing is,...
0
votes
1
answer
99
views
How are closures implemented in Rust?
In many languages closures are implemented using a structure in combination with a standard associated function (with a fixed name) which provides a method of making the object "callable".
...
0
votes
0
answers
42
views
Anonymous function in array causes fatal error [duplicate]
I have the following class
<?php
namespace Core;
class Router
{
public $routes = [
[
'url' => '/register',
'controller' => BASE_PATH . 'controllers/registration/register....
0
votes
1
answer
56
views
Typing of anonymous function in nested dicts
I have a nested dict like this
function_dict_1 = Dict(
:f => Dict(
:func1 => x -> x^2
)
)
I want to call a strongly typed function, which receives this dict as an argument.
...
1
vote
1
answer
52
views
How to get anonymous function parameters information?
// normal function
fun something(a: String, b: String): String {
return "$a $b"
}
println(::something.parameters) <- not empty
but
// anonymous function
var something = fun(a: ...
1
vote
2
answers
94
views
Why does narrowing become forgotten inside a function expression?
I wish to define a function in a different way depending on whether a field in the provided value is null. I expect that the provided value's type will be appropriately narrowed inside the function ...
0
votes
2
answers
94
views
In PHP, how to recurse through a Closure when the variable name holding the anonymous function is a variable-variable
I have a list of about 100 articles, and within each article is a list of clauses. The clauses are a list of varying levels deep.
$clauses = array(
[
'Fields' => ['Clause' => 'clause 1', '...
0
votes
1
answer
51
views
Execute anonymous block from procedure
I have a table which consist of anonymous block in the column rule,
which needs to be executed from procedure.
Here is the sample data which looks like the real scenario.
Table emp:
create table emp (...
2
votes
3
answers
131
views
Trying to use an anonymous object in Perl
I have this script
use strict;
use warnings;
use Data::Dumper;
package Foo;
sub new {
bless { 'a' => 1,
'b' => sub { return "foo" }
}, $_[0]
};
my $foo = Foo-...
-1
votes
2
answers
99
views
Where are anonymous callback functions to setTimeout stored?
I have a simple program that looks like this:
console.log("Start of the program execution!");
setTimeout(() => {
console.log("I ran after a second!");
}, 1000);
console....
0
votes
1
answer
38
views
imap-ing over multiple glmers in R: Anonymous functions
I have this function:
mweFitModelsGLMER <- function(longData,
strModelName = "ID Rand Model",
strFormula = "phMeta_Toxicity ~ ...