function Questions

1

Solved

Consider this code (godbolt): #include <iostream> template<typename F> void call_by_val(F funct) { std::cout << "call_by_val(): "; funct(); } template<typename ...

4

I have three tables and I want to sum all the result columns of each table and return these values from the function I define to do all the process. Is it possible to return those three float summa...
Vestment asked 29/8, 2014 at 12:52

2

Solved

We know that, by default, gitlab ci runners uses set -o pipefail, as explained in coderwall.com this particular option sets the exit code of a pipeline to that of the rightmost command to exit with...
Moulding asked 8/1, 2019 at 9:12

1

Solved

I want to create a function that returns another function with a parameter from the former, e.g. foo1 <- function(y) function(x) x+y (Edit: I wrote foo1 <- function(y) function(x+y) original...
Phosphorescent asked 5/9 at 18:51

6

I am making a bash script and I have encountered a problem. So let's say I got this function create_some_array(){ for i in 0 1 2 3 .. 10 do a[i]=$i done } create_some_array echo ${a[*]} Is ...
Orthicon asked 12/2, 2013 at 18:24

4

Solved

I have an issue creating function that compare two zip files(if they are the same, not only by name). Here is example of my code: def validate_zip_files(self): host = '192.168.0.1' port = 2323 ...
Suu asked 24/6, 2015 at 12:59

4

Solved

I'm complitely new to Flood Fill algorithm. I checked it out from Wikipedia (http://en.wikipedia.org/wiki/Flood_fill). But didn't become that much wiser. I'm trying to use it in following situation...
Vulpine asked 7/11, 2013 at 15:34

3

Solved

I want to create a javascript object from a template. The problem is I don't know what the template is going to look like beforehand. As a simple example, if I had the template function template =...
Gavrila asked 21/4, 2014 at 9:15

1

Solved

I was trying to get the information about the borders of a range, doing so I tried the getBorders() function, but received the following error: Exception: Unexpected error while getting the method...

15

Solved

I need to write a function that will count words in a string. For the purpose of this assignment, a "word" is defined to be a sequence of non-null, non-whitespace characters, separated fr...
Riproaring asked 2/10, 2012 at 21:44

2

Solved

I recently learnt that constructors do not have names. I am also aware that a function has a type called a function type. For example, void func(int) { } In the above snippet, func has the functio...
Rime asked 3/4, 2022 at 9:59

4

I am trying to create a calculator, but I am having trouble writing a function that will subtract numbers from a list. For example: class Calculator(object): def __init__(self, args): self.args ...
Purgative asked 1/4, 2012 at 10:0

5

I started learning R a couple of weeks ago, so I'm still very very new to R coding; I was trying to order a dataframe numerically, but on top of the ordered dataframe, resulted from the execution o...
Bourassa asked 23/6, 2021 at 13:56

2

Solved

def func1(): return 5 def func2(param1, param2): var1 = func1() return param1 + param2 + var1 I want to use pytest to test the second function by mocking the first, but I am not sure how to...
Nations asked 11/7, 2022 at 18:23

10

I have a list of words: words=["alpha","omega","up","down","over","under","purple","red","blue","green"] I have two functions that are supposed to find the shortest and longest words in this list:...
Szabo asked 1/10, 2014 at 1:30

8

Solved

Why would one write a C++ lambda with a name so it can be called from somewhere? Would that not defeat the very purpose of a lambda? Is it better to write a function instead there? If not, why? Wou...
Escapement asked 9/8, 2018 at 6:16

3

Solved

I just switched to Python from Matlab, and I want to use lambda function to map function f1(x,y) with multiple arguments to one argument function f2(x) for optimization. I want that when I map the...
Lopsided asked 21/9, 2016 at 1:3

2

I want to ask if both are the same and if not, where's the difference between them: /** * @param int|null $id Any id. */ public function testSomething(int $id = null) {} and /** * @param int|nu...
Manor asked 23/9, 2020 at 8:54

23

I'm trying to ask the user to enter numbers that will be pushed into a vector, then using a function call to count these numbers. why is this not working? I'm only able to count the first number. t...
Domitian asked 4/12, 2011 at 18:43

6

Solved

I'm trying to replace a function defined within a class in order to modify its function (as in inner workings) without changing the actual code. I've never done this before, and, hence, am having s...
Christlike asked 30/5, 2018 at 7:44

11

Solved

Is there an elegant way to tell Harmony's slim arrow functions apart from regular functions and built-in functions? The Harmony wiki states that: Arrow functions are like built-in functions in ...

15

Solved

I've googled this a lot but i can't find any helpful functions based on my queries. What i want is: 100 -> 100 1000 -> 1,000 142840 -> 142,840 BUT 2023150 -> 2.023M ( i still want 3 ad...
Karleenkarlen asked 6/12, 2010 at 21:18

3

Solved

I am using Jquery tiptip plugin. I want to call deactive_tiptip function with clicking a href link. How can i do that ? I will call that function inside tooltip div. This is the code of tiptip pl...
Bowerbird asked 20/7, 2011 at 2:48

6

I have tried to make functions for turtle to make it extremely easy to draw shapes. The code looks like this: import turtle as t def square(): tw = t.Screen() for i in range(4): t.forward(100) ...
Wartburg asked 6/8, 2017 at 17:2

9

So I've been learning Python for some months now and was wondering how I would go about writing a function that will count the number of times a word occurs in a sentence. I would appreciate if som...
Audiophile asked 25/11, 2011 at 17:20

© 2022 - 2024 — McMap. All rights reserved.