Questions tagged [function-call]

A function call is a line of code that executes a specific block of code defined as a function, that is, self-contained code that may optionally take arguments, defined for the purpose of code reuse.

A function call is a line of code that executes a specific block of code defined as a function, that is, self-contained code that may optionally take arguments, defined for the purpose of code reuse.

760 questions
6
votes
3 answers

Filter subsets based on length?

Trying to extract the subsets with length k using filter. Not sure how to approach it? The list has 100 elements. subsets :: [a] -> [[a]] subsets [] = [[]] subsets (x:xs) = [zs | ys <- subsets xs, zs <- [ys, (x:ys)]] If i use filter this is what i…
STOPIMACODER
  • 822
  • 2
  • 7
  • 19
6
votes
1 answer

Function without prototype called with non-compatible type

I read the Standard N1570 section 6.5.2.2 Function calls and was confused about the special meaning of the function type that includes prototype. Precisely 6.5.2.2(p6) If the function is defined with a type that does not include a prototype, and…
Some Name
  • 8,555
  • 5
  • 27
  • 77
6
votes
3 answers

Executing a function once the page is fully loaded in AngularJS

I would like to execute this function as soon as the page is fully loaded. vm.pointInvoice = () => { if ($stateParams.property == "INVOICE") { vm.invoiceEdit($stateParams.checkin) vm.invoiceFocus = true; …
torbenrudgaard
  • 2,375
  • 7
  • 32
  • 53
6
votes
1 answer

How to implement a function call with Antlr so that it can be called even before it is defined?

Once the AST is built, what is the best way implement the tree walker so that functions can be defined and called in whatever order? For example, this is valid in PHP:
Sébastien Le Callonnec
  • 26,254
  • 8
  • 67
  • 80
6
votes
2 answers

How to execute a call instruction with a 64-bit absolute address?

I am trying to call a function - that should have an absolute address when compiled and linked - from machine code. I am creating a function pointer to the desired function and trying to pass that to the call instruction, but I noticed that the call…
6
votes
2 answers

Call python from shell and capture output

I have written a program in shell. And inside this shell script, I am calling a python script. That is working fine. I want my python script to return the output to the shell script. Is it possible? (I didnt get any such way on google). Can you…
Aakash Goyal
  • 1,051
  • 4
  • 12
  • 44
6
votes
2 answers

C++: Code injection to call a function

First of all, I don't want to inject a dll. I want to inject code using WriteProcessMemory() (if this is even possible). I already used ReadProcessMemory() so I think writing is not a big deal. Well, lets say there is a function at…
Forivin
  • 14,780
  • 27
  • 106
  • 199
5
votes
2 answers

How to achieve @args splatting in an advanced function in Powershell?

Consider the following simple function: function Write-HostIfNotVerbose() { if ($VerbosePreference -eq 'SilentlyContinue') { Write-Host @args } } And it works fine: Now I want to make it an advanced function, because I want it…
mark
  • 59,016
  • 79
  • 296
  • 580
5
votes
4 answers

Why does an invalid use of C function compile fine without any warnings?

I'm more like C++ than C, but this simple example of code is big surprise for me: int foo() { return 3; } int main() { int x; foo(&x); return x; } https://godbolt.org/z/4ov9nTzjM No warnings, no linking issues still this code is…
Marek R
  • 32,568
  • 6
  • 55
  • 140
5
votes
1 answer

Function call overhead - why do builtin Python builtins appear to be faster than my builtins?

I've been interested in overheads, so I wrote a minimal C extension exporting two functions nop and starnop that do more or less nothing. They just pass through their input (the two relevant functions are right at the top the rest is just tedious…
Paul Panzer
  • 51,835
  • 3
  • 54
  • 99
5
votes
2 answers

Probability Mass Function of a Binomial Distribution in Python

I am using Python3 to compute the Probability Mass Function (PMF) of this wikipedia example: I tried to follow this scipy documentation: https://docs.scipy.org/doc/scipy-0.19.0/reference/generated/scipy.stats.binom.html The documentation clearly…
user7120460
5
votes
7 answers

How to maintain lists and dictionaries between function calls in Python?

I have a function. Inside that I'm maintainfing a dictionary of values. I want that dictionary to be maintained between different function calls Suppose the dic is: a = {'a': 1, 'b': 2, 'c': 3} At first call, say, I changed a['a'] to 100. Dict…
user46646
  • 153,461
  • 44
  • 78
  • 84
5
votes
1 answer

What is the difference between function call and goto &NAME in Perl?

I'm reading Perl which is quite interesting. But while reading goto from here in Perl I got a doubt. I know that goto statement has three types. goto LABEL. goto EXPR. goto &NAME. But in this three types, what is the use of third one goto…
Ganapathy
  • 545
  • 1
  • 6
  • 23
5
votes
3 answers

Find indirect calls to specific built-in MATLAB function

What do I want? I am looking for a way to detect all points in my code where a specific function is called. Why do I want it? Some examples: Some output comes out sorted or randomized, and I want to know where this happens I am considering to…
Dennis Jaheruddin
  • 21,208
  • 8
  • 66
  • 122
5
votes
2 answers

My event handler is executed before the event is fired, why?

I have a pop up window with a button. When I click the button I want something to happen, say an alert. The issue I am having is that the onclick event fires as soon as the popup is launched and not when the button is clicked. Here is the code. Any…
RCW
  • 121
  • 2
  • 6