Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
66 views

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, ...
Fmbalbuena's user avatar
0 votes
0 answers
84 views

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 ...
Argyll's user avatar
  • 10.1k
-2 votes
1 answer
98 views

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 ...
Architek's user avatar
  • 135
4 votes
1 answer
83 views

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 ...
Argyll's user avatar
  • 10.1k
4 votes
1 answer
77 views

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,...
Pucho's user avatar
  • 43
0 votes
1 answer
125 views

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". ...
user2138149's user avatar
  • 18.7k
0 votes
0 answers
44 views

I have the following class <?php namespace Core; class Router { public $routes = [ [ 'url' => '/register', 'controller' => BASE_PATH . 'controllers/registration/register....
Konstantinos Papakonstantinou's user avatar
0 votes
1 answer
66 views

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. ...
wittn's user avatar
  • 320
1 vote
1 answer
56 views

// normal function fun something(a: String, b: String): String { return "$a $b" } println(::something.parameters) <- not empty but // anonymous function var something = fun(a: ...
dbwhddn10's user avatar
  • 115
1 vote
2 answers
99 views

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 ...
Ignat Insarov's user avatar
0 votes
2 answers
99 views

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', '...
FigureOfCode's user avatar
0 votes
1 answer
55 views

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 (...
MAK's user avatar
  • 7,355
2 votes
3 answers
132 views

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-...
Jim's user avatar
  • 4,529
-1 votes
2 answers
108 views

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....
mukesharyal's user avatar
0 votes
1 answer
39 views

I have this function: mweFitModelsGLMER <- function(longData, strModelName = "ID Rand Model", strFormula = "phMeta_Toxicity ~ ...
Rover Eye's user avatar
  • 259
1 vote
2 answers
111 views

I want to check if a callable's return type is an instance of another type. For example, let's say I a have: A class Pigeon which extends Animal. A function addSupplier() which takes a callable ...
Cardinal System's user avatar
0 votes
1 answer
48 views

I'm developing an R Shiny App building a list of graph and I want each data to be downloadable by a click on a button below each graph. My problem is that the anonymous function created to handle the ...
Lucas Duval's user avatar
0 votes
0 answers
33 views

class Foo { m(f) { f(); } } let foo = new Foo(); foo.m(function () { console.log(this); // Window }); class Foo { m(f) { f(); } } class Boo { m2() { let foo = new ...
unrest7972's user avatar
0 votes
0 answers
41 views

When trying to assign procedure begin end to a TProc in the code below, I get a compiler error: E2441 Inline function declared in interface section must not use local symbol '.TMyClass.DoesNotCompile$...
headfime's user avatar
  • 118
0 votes
1 answer
54 views

I am trying to add a method to the Person constructor function but keep getting an output of "Hello undefined" function Person(name, age) { this.name = name; this.age = ...
Abraham Abah's user avatar
2 votes
2 answers
158 views

I've encountered this code, but I can't understand its logic. Could someone explain why the output is the way it is? <?php $functions = [ function($next) { echo 'A' ....
Joel's user avatar
  • 21
2 votes
3 answers
206 views

I've been reading Paul Graham's ANSI Common Lisp recently, where he mentions In Common Lisp, you can express functions as lists, but they are represented internally as distinct function objects. So ...
CREIGHT888's user avatar
0 votes
0 answers
26 views

I tried accomplishing a small task in PHP 7.4 (a language I never use) and decided to use a nested utility function isReverseScored, to be called inside an "arrow function", like so: // ...
Andreas's user avatar
  • 2,744
4 votes
0 answers
209 views

I'm using C# 12. When assigning a function to an implicitly-typed (var) variable, C# can infer the type successfully, such as in this example: // Scenario A var func = () => "Hello World";...
user3163495's user avatar
  • 4,046
1 vote
1 answer
126 views

On various pages of a website I generate via JavaScript different click handlers attached to links in the innerHTML of an specific page element. I do it with a uitilty function like this: function ...
halloleo's user avatar
  • 10.9k
5 votes
1 answer
313 views

I hear these two terms, anonymous function and function handle being used to refer to something like f = @(x) x.^2 in MATLAB. But then I've also heard that these terms mean different things. How do ...
Cris Luengo's user avatar
  • 61.4k
1 vote
0 answers
45 views

With the following code in Matlab" f = @(a,x) a*x+3; g = @(x) f(4,x) I get g as a function handle of the function handle f. g = @(x)f(4,x) However, I want to get g as a function handle without ...
ObsidianBeacon's user avatar
0 votes
1 answer
178 views

I'm attempting to return the contents argument of an async anonymous function. The contents argument is populated within the anonymous functions block but on return it is undefined. I've attempted ...
Pis7ftw's user avatar
  • 115
2 votes
2 answers
119 views

I am looking for a prettier solution here. The problem is to combine Generics and Lambda Expressions. According to the Java Language Specification this it not possible the way I want. So my question ...
JayC667's user avatar
  • 2,660
3 votes
1 answer
202 views

It's always been challenging to me to track anonymous lambdas in the call stack, so I wrote some sandbox code in order to deal with the issue: int main() { [] { std::cout << "Hello ...
Kaiyakha's user avatar
  • 2,075
3 votes
1 answer
86 views

I'm trying to understand how closures are actually sent for lambda expressions calls: #include <stdio.h> #include <stdlib.h> int main(int argc, char **argv) { int *A = (int *) malloc((...
OrenIshShalom's user avatar
4 votes
1 answer
196 views

I can create an anonymous function within a list comprehension in Julia. I expect that this would create a type of Vector{Function}. Instead, the type is something like Vector{var"#2#4"}. ...
user292301's user avatar
0 votes
1 answer
490 views

I have a function I want to override in an anonymous function with Tampermonkey. (()=>{ /* other stuff */ function Zm(e) { let {visible: t, onCancel: n} = e; const ...
ZeroPhase's user avatar
  • 657
1 vote
0 answers
65 views

Let's assume, we have an array with anonymous functions as values. It has following contents: $fpool = [ 'f1' => function($a){ if($a > 0){ return [$a*$a, $a+$a]; }...
user2624744's user avatar
0 votes
1 answer
249 views

I am new to elixir and I am trying to make a recursive anonymous function, but for some reason my anynymous function that works on it's own as expected throws me "2nd argument: not valid ...
Djordje Vuckovic's user avatar
0 votes
0 answers
34 views

I'm working in vanilla JS. Here is my function as of now function displayQueue() { queueDiv.innerHTML = ""; for (var i = 0; i < queue.length; i++) { let newDiv = document....
Uperscuzzi's user avatar
0 votes
0 answers
78 views

I have an optimization problem in MATLAB and I'd like to be able to write an anonymous function to pass to the optimization function. The function I am minimizing is a function of x, but I am required ...
pheon's user avatar
  • 3,029
0 votes
1 answer
70 views

Is an anonymous function expression? if it is, why can not we use it wherever JavaScript expects an expression? Example : const result = String(function () { return 2; }); what variable returns : ...
radman's user avatar
  • 23
0 votes
0 answers
74 views

How can I execute a function that is defined in an anonymous function ? For example, I've this method "openProfile" declared in anonymous function. I would like to override it / call it ...
Сорок два's user avatar
0 votes
1 answer
80 views

I can't understand why I'm getting System.NullReferenceException: Object reference not set to an instance of an object. exception. I would like to pass the delegate ConnectAsyncDelegate to Commit ...
Alexey Alferov's user avatar
0 votes
1 answer
105 views

Is it safe to use the reference result of a function within an anonymous function which is used as the parameter? Following is a simplified example: ClassA result = null; result = instanceA....
ArtS's user avatar
  • 2,022
0 votes
2 answers
44 views

I'm confused by the following behaviour: y <- letters |> (\(x) x[stringr::str_which(x, "a|e")] <- c("1", "2"))() which returns [1] "1" "2" ...
deschen's user avatar
  • 11.6k
1 vote
1 answer
849 views

I'm trying to make some order in a script that uses nicegui. I'm using a dictionary to store all button labels and the pages they will redirect to. I'm iterating over all keys in pages dictionary and ...
redistor's user avatar
1 vote
0 answers
81 views

Scipy.io.loadmat fails to load matlab structures from .mat files when they contain anonymous functions if the simplify_cells switch is set to True. I believe the reason is because loadmat registers ...
Andrew Landau's user avatar
0 votes
1 answer
220 views

I've read quite a few things on the topic and got myself confused, if it turns out the answer is out there, I'll delete this question. Why would that not work: type SanitizeFunction = <T extends ...
Jonathan Adami's user avatar
1 vote
1 answer
1k views

I'm testing a react component, but have problems using an array map where is define an anonymous arrow function, and after arrow (=>) I use curly brackets. Then the inside code could not be ...
Dave's user avatar
  • 13
0 votes
1 answer
179 views

var functions: seq[proc(): int] = @[] functions.add(proc(): int = 233) for i in 1 .. 5: functions.add(proc(): int = i) for i in 1 .. 5: echo functions[i]() output 5 5 5 5 5 Seems like Nim stores ...
init 1's user avatar
  • 29
1 vote
1 answer
80 views

If I have an anonymous function in MATLAB, say f = @(t) [t, t+5]; and I wanted to create a new anonymous function g that accesses the first index of f, so that, in this example, g = @(t) t; how can ...
ShonenMind's user avatar
0 votes
1 answer
102 views

We know that in Scala reflection, we can invoke a method using clazz.getDeclaredMethod("method").invoke(instance, parameters) where the function signature of invoke is Object invoke(Object ...
Hang Wu's user avatar
  • 15
0 votes
2 answers
450 views

Below code works fine on Scala 2.11 and getting error "value nonEmpty is not a member of Object" on Scala 2.12. Can someone provide a solution? val ds = spark.createDataset(List("abc&...
Surya's user avatar
  • 21

1
2 3 4 5
43