function

Mechanism of a function in Scheme

Hello! Here it is a strange function in Scheme: (define f (call/cc (lambda (x) x) ) ) (((f 'f) f) 1 ) When f is called in the command line, the result displayed is f . What is the explanation of this mechanism ?.. Thanks! ...

Flash, ActionScript 3: how do you give a the EventListener a function With parameters?

I am trying to to attach a function with parameters to the timer but it says "unrelated type function" is there any way to get around this?? code example: var redoTimer:Timer = new Timer(50); redoTimer.addEventListener(TimerEvent.TIMER, saySomething("helloo")); redoTimer.start(); this wont seem to work but is there a way to pass on ...

javascript new self invoking function

Hey, I've got a question about self invoking functions in javascript. What I'm doing is something similar to the following myNamespace = {}; //namespace for holding any objects/functions //helpModule as an example myNamespace.HelpModule = new (function(){ this.abc = '123'; //lots of other code in here... })(); now I'm abl...

C# Function returning two values

Hi, I would like to have a function in which I will input an array and as a result i need another array and an integer value. Is this possible? Example: private int[] FunctionName (int[] InputArray) { //some function made here int intResult = xxxxx int[] array = xxxxx return intResult; //but here i need also to pass t...

Delphi: trouble calling function returning interface

I'm trying to call a function returning an interface from another unit; for instance consider the following: program intf_sb1; {$APPTYPE CONSOLE} uses myunit in 'myunit.pas'; var MyBL: ISomeInterface; begin MyBL := GetInterface; end. where the content of myunit.pas is as follows: unit myunit; interface type ISomeInterface = i...

One php file not working in membership script

My membership script is working except this one file. When I type username and password in the login form the check.php gives me this message "Please enter all information". The only information on the login form is username and password. The action of the login form is posted on check.php I need this script to check the username a...

Indexing hash tables

I am just starting to learn hashtables, and so far, I know that you take the object you want to hash and put it through an hash function, then use the index it returns to get the corresponding object you want. There is something I don't understand though: What structure do you use to store the objects in so you can quickly index them wi...

Uses for Haskell id function

Which are the uses for id function in Haskell? ...

[python] Passing all arguments of a function to another function

I want to pass all the arguments passed to a function(func1) as arguments to another function(func2) inside func1 This can be done with *args, *kwargs in the called func1 and passing them down to func2, but is there another way, Orignially def func1(*args, **kwargs): func2(*args, **kwargs) but if my func1 signature is def func1...

How to run gradient descent algorithm when parameter space is constrained?

I would like to maximize a function with one parameter. So I run gradient descent (or, ascent actually): I start with an initial parameter and keep adding the gradient (times some learning rate factor that gets smaller and smaller), re-evaluate the gradient given the new parameter, and so on until convergence. But there is one proble...

C++ pointer question

Hi, still working at C++, but this came up in my book and I don't understand what it's for: MyClass * FunctionTwo (MyClass *testClass) { return 0; } My question is what is the signifigance of the first indirection operator (MyClass *[<- this one] FunctionTwo(MyClass *testClass))? I tried making a function like it in codeblocks...

How to use a function generating an image?

I have a php code which generate an gif-image defined by a set of parameters. I wrote this code as a function and now I want to insert an image into a html page. My problem is that whenever I use an img tag I need to specify a name of the file containing an image but I do not have an image in a file. The file containing a function for g...

Why do I get an error message that .replace is not a function?

I have this function: function countLitreKgSums(cProductIds){ var cLitreKgSums = new Array(); var cWeek = 0; for(i=0;i<cProductIds.length;i++){ var cLitreKgSum = 0; $("#plan_table td[class='week']").each(function(){ cWeek = $(this).html(); var cLitreKgValue = $("input[name*='plan_table_week" + cWeek...

R: using a list for ellipsis arguments

I have run into a situation where I need to take all the extra arguments passed to an R function and roll them into an object for later use. I thought the previous question about ellipses in functions would help me, but I still can't quite grasp how to do this. Here is a very simple example of what I would like to do: newmean <- functio...

Function calling itself not working (infinite loop, Javascript)

I'm trying to wait and then get a message when all images in an array have completed loading (using .complete), per the answer here. As such I set up an infinite loop like the below. however, when I run this I get an error that checkForAllImagesLoaded() is not defined. This code is being run through a bookmarklet, and as such it's all ...

I am looking for C++ wrapper around built-in Perl functions

Hi, A while ago I found a library that allowed calling individual built-in Perl functions in C++, I cannot find it now. Can you tell me where I can find it on the net? Thanks. ...

inline a function inside another inline function in C

I currently have inline functions calling another inline function (a simple 4 lines big getAbs() function). However, I discovered by looking to the assembler code that the "big" inline functions are well inlined, but the compiler use a bl jump to call the getAbs() function. Is it not possible to inline a function in another inline funct...

Shortening a repeating sequence in a string

I have built a blog platform in VB.NET where the audience are very young, and for some reason like to express their commitment by repeating sequences of characters in their comments. Examples: Hi!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3 LOLOLOLOLOLOLOLOLOLOLOLOLLOLOLOLOLO...

JQuery how to turn this into re useable function

I have a simple function: var total = 0.00; $("#basket .txt").each(function() { total += parseFloat($(this).html()); }); $('#total').text('Total: ' + total.toFixed(2)); That is used in 3 places on a script. How do I turn it into a function that can be called in the relevant places a bit like: getTotal(); rather than use the "fi...

Can list.findall reference a variable?

Such as: mylist.FindAll(Function(item) item.property = variable) The reason I ask is if I use syntax like this, I tend to get a string to whatevever conversion error, which makes me think "variable" is being treated literally as a string. Thanks. ...