Skip to main content

All Questions

1 vote
1 answer
64 views

How to automatically detect and decurry a curried function at Runtime?

I am working with curried functions in TypeScript, and I want to figure out a way to automatically detect if a function is curried and, if it is, decurry it into a non-curried function. Problem: A ...
Sinan Ismail's user avatar
1 vote
1 answer
654 views

Is it possible to bypass/ignore an argument in a custom function [duplicate]

Just for clarification, not intended to reopen, as I will start a follow-up question: This not a question about using an ifelse in dplyr. This is a question about passing by an argument in a custom ...
TarJae's user avatar
  • 79.8k
1 vote
3 answers
91 views

Can someone help me passing a function as argument in python?

I have the following class in python. I want to pass the function get_priority as argument to access the object Task. I obtain the following error when adding the second task to taskManager: if ...
Claudio Gonçalves's user avatar
1 vote
0 answers
20 views

R: Obtaining the formal arguments of a function when applied to a specific object [duplicate]

Suppose I have a function f(x) applied to a data object x. I need to know whether f has a certain argument, a 'na.rm' argument to be precise. I could find out by calling names(formals(f)), but f, ...
Sebastian's user avatar
  • 1,379
3 votes
1 answer
3k views

Order of Evaluation of Arguments in Ocaml

I would like to know why does ocaml evaluate the calls from right to left, is that a FP principle or it doesn't matter at all to a FP language ? A quicksort example : let rec qs = function | [] -...
Oleg's user avatar
  • 1,559
2 votes
2 answers
50 views

Returning multiple objects and using them as arguments

I have a function which goes something like this: def do_something(lis): do something return lis[0], lis[1] and another function which needs to take those two return objects as arguments: ...
ayNONE's user avatar
  • 124
2 votes
3 answers
3k views

OCaml - Give a function of type (int -> int) -> int

I'm completely lost on this. It was explained that functions are right justified so that let add x y = x + y;; has a function type of int -> int -> int or int -> (int -> int). I'm not ...
stumped's user avatar
  • 3,293
0 votes
1 answer
52 views

Passing a function as argument which uses the argument of parent function but also has it's own argument

I just started playing around with functional programming and am trying to pass a function as an argument of another function. However the function that I am trying to pass also has arguments like so: ...
Fyxerz's user avatar
  • 169
1 vote
6 answers
1k views

Passing one subroutine to another subroutine

I have one function sub _where(\@ \&) which takes 2 arguments: the first is an array, and the second should be another function. This other function returns a boolean value, and I want to call it ...
Whizzil's user avatar
  • 1,364
3 votes
1 answer
647 views

How do I define a function def which accepts arguments and returns a value?

I would like to be able to define a function which accepts an argument (e.g. a File object), and returns something (e.g. a Boolean), and then pass that function (not the boolean!) to another function ...
root's user avatar
  • 491
7 votes
1 answer
3k views

Too many arguments for function

I'm starting to learn Lisp with a Java background. In SICP's exercise there are many tasks where students should create abstract functions with many parameters, like (define (filtered-accumulate ...
Stan Kurilin's user avatar
  • 15.8k
23 votes
3 answers
22k views

excel vba: Special Types - Functions as Arguments of Functions

There is no special type for functions in VBA. It is hard for me to see how to add functions as arguments to functions in Excel VBA. What I am trying to accomplish is something like this: function f(...
Roman Glass's user avatar