Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
25 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 (...
MAK's user avatar
  • 7,136
2 votes
3 answers
101 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-...
Jim's user avatar
  • 4,265
0 votes
2 answers
74 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....
mukesharyal's user avatar
0 votes
1 answer
29 views

imap-ing over multiple glmers in R: Anonymous functions

I have this function: mweFitModelsGLMER <- function(longData, strModelName = "ID Rand Model", strFormula = "phMeta_Toxicity ~ ...
Rover Eye's user avatar
  • 205
0 votes
1 answer
54 views

Can I check if ReflectionType is instance of another type?

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
36 views

Capture the for-loop iteration value to create anonymous function for dynamically generated downloadHandler

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

In some cases, "this" in the function passed as an argument to the higher order function is Window or undefined. Please tell me the difference [duplicate]

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
22 views

Assigning a TProc inside a non-generic inline method leads to compiler error. Why?

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
  • 106
0 votes
0 answers
19 views

What is the difference between `function () {}` and `() => {}` in JavaScript?

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
118 views

PHP chaining callback functions

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
  • 17
2 votes
3 answers
123 views

Is it necessary to use lambda symbol in Common Lisp?

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

Why is my nested function not called from my anonymous function? [duplicate]

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,695
4 votes
0 answers
168 views

Why can't C# infer the type of anonymous delegates/functions in some cases?

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
  • 3,357
1 vote
1 answer
85 views

Attach an anonymous function to an "onclick" attribute of a link

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.1k
5 votes
1 answer
192 views

What is the difference between an anonymous function and a function handle in MATLAB?

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
  • 59.7k
1 vote
0 answers
40 views

Simplifying a function handle using another function handle with partially given variable in Matlab

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
81 views

Return data from async anonymous function that is an argument to a non-anonymous function

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
  • 105
1 vote
2 answers
104 views

Elegant solution to the "Lambdas" vs "Generics" problem?

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,536
2 votes
1 answer
133 views

How to read name of anonymous lambdas in Visual Studio call stack?

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
  • 1,693
3 votes
1 answer
69 views

How are closures actually sent for evaluation in lambda expression calls

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
2 votes
1 answer
138 views

In Julia, what is the type of an anonymous function when an outer scope is involved?

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
313 views

How to override anonymous function in JavaScript with Tampermonkey?

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
  • 649
1 vote
0 answers
52 views

PHP: Write anonymous function to file for later use

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
185 views

function gives "2nd argument: not valid character data" error

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
33 views

I can't set the "onclick" attribute of an element in JS

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
55 views

MATLAB optimization function variable assignment in anonymous function

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
  • 2,979
0 votes
1 answer
64 views

Is anonymous function expression?

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
71 views

How to execute/override a JavaScript function declared in anonymous function

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
73 views

delegate and cancellationtoken troubleshooting

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
91 views

Is it safe to use the reference result of a function within an anonymous function which is used as the parameter in C#?

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
  • 1,920
0 votes
2 answers
35 views

replacing elements of character vector with anonymous function does not return full vector

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
  • 10.6k
1 vote
1 answer
587 views

Binding variable in loop changes it's type

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
62 views

SciPy loadmat fails to load matlab structures with anonymous functions when simplify_cells=True

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
68 views

Typescript - Anonymous generic function

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
847 views

Use on parenthesis () or use curly brackets {} in react component

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
165 views

Per-iteration variable in Nim?

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 ...
init 1's user avatar
  • 29
1 vote
1 answer
47 views

Accessing the first index of an anonymous function [duplicate]

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
78 views

Create an Anonymous Function with no Parameter in Scala

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
371 views

value nonEmpty is not a member of Object

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
0 votes
0 answers
28 views

Why do I get an error when I try to use the format simplification of anonymous functions [duplicate]

In scala, if a parameter only appears once, can it be replaced by _, but why not here. i want to know why this way of coding is wrong,and what is the underlying principle? object ...
张子晗's user avatar
5 votes
1 answer
3k views

Generic function, can't be defined in form of anonymous?

e.g: func f[T any](t T) T { var result T return result } // this got error ! var fAnonymous = func[T any](t T) T { var result T return result } fAnonymous got error, it says: ...
Eric's user avatar
  • 24.1k
1 vote
1 answer
53 views

Types error when calling 2 functions inside a map

I'm quite new to Scala and trying to analyze some nice functional code for some exercises like below: object ArmstrongNumbers { def isArmstrongNumber(num: Int): Boolean = { val ...
Maciej Gajewski's user avatar
1 vote
1 answer
123 views

variable lifecycle in anonymous functions golang

im sorry if my question may has obvious or easy answer but i really cant undesrstand what is going on. this is my code: import "fmt" func main() { a := test() a() a() } func ...
aaryaa9978's user avatar
0 votes
1 answer
84 views

Python anonymous recursion without combinators

Is it possible to do some anonymous recursion in Python ? I mean, making a recursive lambda function, that does not call its name (so, it must work even if you don't assign the lambda). Also, I know ...
oskar's user avatar
  • 79
1 vote
1 answer
216 views

Generated Julia function seems to always recompile

I wrote a function in Julia that generates a bunch of anonymous functions, something like this: function gen_funcs() funcs = [] for i = 1:1000 txt = "(a, b) -> some code" ...
Fernando's user avatar
  • 645
0 votes
2 answers
986 views

React - why do I need to wrap functions called by useState in an anonymous function?

I have been taking a React performance training course and this code base is used as an example: https://github.com/stevekinney/wordman/blob/main/src/components/application.jsx#L10 When we call the ...
user1261710's user avatar
  • 2,639
1 vote
1 answer
365 views

Determine the function signature of an anonymous function in scala

The context is to register a UserDefinedFunction(UDF) in spark, where the UDF is an anonymous function obtained via reflection. Since the function signature of the function is determined at runtime, I ...
Hang Wu's user avatar
  • 15
1 vote
1 answer
86 views

In React, why can't I pass a function reference to onClick?

I usually split my React applications by having a JSX component with only UI on one side, and a singleton class for business logic on the other side. The UI component code would look like this: ...
Fumée Noire's user avatar
1 vote
3 answers
559 views

Why onTap function runs without tapping when it have arguments?

I am novice in programming. My question why this function is called without tap when I use arguments? String _gesture = 'No Gesture Detected'; _printgesture(var gestureName) { setState(() { ...
s4nk37's user avatar
  • 250
1 vote
2 answers
103 views

Scala Anonymous Function Defined as Composition of Two Functions

I am a beginner in Scala, and currently studying the fascinating concept of anonymous functions. However, my following attempt at defining one results in a compilation error: def double(f:Int => ...
이희원's user avatar
  • 135

1
2 3 4 5
43