arity Questions
5
Solved
In Javascript, how can one determine the number of formal parameters defined for a function?
Note, this is not the arguments parameter when the function is called, but the number of named argument...
Fidellia asked 31/1, 2011 at 6:21
2
Solved
How can I get the arity of an arbitrary function type used as a template parameter?
The function can be a normal function, a lambda or a functor. Example:
template<typename TFunc>
std::size...
1
I am wondering whether the following is possible in Scala:
Given some vector x = (x_1, x_2, ..., x_n) in R^n and a function f that maps R^n to R, I would like to replicate this concept in Scala. Th...
Thalassography asked 23/1, 2023 at 21:58
4
Solved
I want to perform a query like the following one:
SELECT id, name
FROM mytable
ORDER BY FIELD(name, 'B', 'A', 'D', 'E', 'C')
FIELD is a MySQL specific function, and 'B', 'A', 'D', 'E', 'C' are v...
2
Solved
I have a series of functions that accept a function as an argument (func), and the only difference in them is that func accepts different numbers of parameters.
def tryGet[T,A](func: (A) => T)...
2
Solved
I've come across a strange error message that I believe may be incorrect. Consider the following code:
public class Overloaded {
public interface Supplier {
int get();
}
public interface Proc...
Benedix asked 19/7, 2019 at 18:53
2
Solved
I am trying to specialize a templated function based on the arity of the lambda that I pass to it as an argument. This is what I have come up with for a solution:
template<typename Function, bo...
2
Solved
I've been doing some Genetic Programming and I've been separating functions into different function sets based on their arity; it's all rather complex.
I'd like to know if there's a simpler way to...
Procedure asked 17/3, 2013 at 19:23
1
Solved
Let's say I have something like:
Enum.map(list, fn(x) -> String.duplicate("a", someValue * x) end)
But instead, I'd like to pass the String.duplicate/2 function as an argument in orde...
Henchman asked 13/11, 2015 at 15:32
1
Solved
How to write arity-generic functions in Agda? Is it possible to write fully dependent and universe polymorphic arity-generic functions?
Cruciferous asked 21/3, 2015 at 5:14
2
Solved
I've got a generic type:
class DictionaryComparer<TKey, TValue> : IEqualityComparer<IDictionary<TKey, TValue>>
And a factory method that will (should) create an instance of this ...
Rexanna asked 22/9, 2010 at 2:46
1
I've been pounding my head for a few days trying to figure out how to make a class have a nice clean public interface to perform registration of callback mechanisms. The callbacks can be C++11 lamb...
Oribelle asked 25/12, 2013 at 2:55
4
I am trying to send the result of a method call's tuple, as part of the argument list for another method.
Target method
def printResult(title: String, result: Int, startTime: Long, endTime: Long...
Brimful asked 13/6, 2014 at 2:33
2
Solved
is there any way to define overload functions with different arity, e.g in C# I can just do:
foo(bar)
or
foo(bar, baz)
In Elixir, the only way to do that would be to put them in separate modules,...
Crespo asked 12/5, 2014 at 3:14
1
Solved
I'm a JavaScript developer who's learning Lua. I'm stuck with a problem of getting a function's arity in the Lua language.
In JavaScript, it's simple:
function test (a, b) {}
console.log(test.len...
Yepez asked 24/11, 2013 at 16:52
1
Solved
I have a java class that has 2 methods with same but different arities (one take no arguments, other takes 1 argument). I create a proxy that overrides both this methods. The problem is that if no-...
Hagiographer asked 30/10, 2012 at 7:43
2
Solved
This question has a longish prelude before I can actually ask it :)
Let's say type A and B represent categories, then the function
f :: B -> A
is a morphism between the two categories. We can ...
Hittel asked 24/9, 2012 at 19:0
1
Solved
Suppose you have three functions of arity 1, 2 and 3 as below:
(defn I [x] x)
(defn K [x y] x)
(defn S [x y z] (x z (y z)))
Does clojure have an evaluation function or idiom for evaluating:
(I ...
Hic asked 11/8, 2012 at 23:41
6
Solved
Is it possible to write a function arity :: a -> Integer to determine the arity of arbitrary functions, such that
> arity map
2
> arity foldr
3
> arity id
1
> arity "hello"
0
?
Hemingway asked 3/12, 2011 at 16:32
1
Solved
Is there a way to find out at runtime, how many inputs (arguments, parameters) a function has?
Say, I want to:
(define (my-function unknown-function)
...
(number-of-necessary-arguments unknown-...
5
Solved
I'm new to Scala, and being able to pass functions to other functions is pretty neat-- but can I pass an arbitrary function reference to another function? The arity of said functional parameter wil...
Perplexed asked 14/6, 2011 at 19:48
1
© 2022 - 2024 — McMap. All rights reserved.