function

Can you implement any pure LISP function using the ten primitives? (ie no type predicates)

This site makes the following claim: http://hyperpolyglot.wikidot.com/lisp#ten-primitives McCarthy introduced the ten primitives of lisp in 1960. All other pure lisp functions (i.e. all functions which don't do I/O or interact with the environment) can be implemented with these primitives. Thus, when implementing or porting lisp, the...

Proper way to call a database function from Django?

Hi, i'm triyng to make a full text search with postgresql and django So I've created a function search_client(text) which returns a list of clients. To call it from the DB i use something like this: SELECT * FROM search_client('something') and i'm not really sure how to call it from django. i know i could do something like cursor = c...

Calling the function in this php code

Hi, the code is below, I am trying to call the "RATE" function. RATE(120, -271.09, 20000) is how it is used in excel, with this code I think it should work the same. What am I doing wrong? how can I get it to work My code is here: http://pastebin.com/AbKqc8g1 ...

Use of anonymous function shows up as unknown type

When I attempt to use an anonymous function in PHP (As an available callback), there are no syntactical errors or the like but when I attempt to execute the callback, it errors out outputting that the function must be named. gettype returns a null value. Anyone have any experience with this? http://pastie.org/1088386 ...

jQuery .Last Function Return Boolean

Ok so heres whats going on: Whenever I click on an image nested in an unordered list, it moves to a different part on the page. But when it reaches the last li, I want it not to move. I am trying to find it out if there is anyway that the .last() function can return a boolean back? Thanks, Rohan ...

c++ return array in a function

Hi before someone storm "it's simple or duplicate" i swear i've searched but because it's pretty easy i couldn't find it between much more complex ones , unlucky maybe. Anyway my question is very simple , I have normal array int arr[5] that is passed to function fillarr(int arr[]) all i want is fixing the next code: int fillarr(int arr[...

Javascript Function instance is automatically casted to object and can't be called anymore

Hi, I'm working with a fairly complex Javascript program wich, at a given point, returns some nested anonymous functions. Sometimes, when I try to "apply" one of such anonymous functions ("f" in this example)... f.apply (this.context, args) ...I get an "f.apply is not a function" error. It's weird, because alert(f) displays the fun...

When to use Shared methods in .net

I'm kinda getting mixed messages about this so I'm hoping someone can clear this up for me. Should I be using Shared methods/functions in the following situation: I have a generic class named "Person". This class represents a person in the database. I have a manager class named "PersonManager". This class contains methods which adds, ...

Virtual Functions Object Slicing

Hi, My question is with reference to this question which explains how virtual functions work in case of object slicing which end up calling base class virtual function and Wikipedia article which explains the virtual table layout for a derived class for below code class A{ public: virtual void func(){ cout<<"\n In A:func"...

Why is C slow with function calls ?

Hi, I am new here so apologies if I did the post in a wrong way. I was wondering if someone could please explain why is C so slow with function calling ? Its easy to give a shallow answer to the standard question about Recursive Fibonacci, but I would appreciate if I knew the "deeper" reason as deep as possible. Thanks. Edit1 : Sorr...

What is the purpose of this inside functions?

Javascript compiles this code without error: function test() { property: true; alert('testing'); } test(); // Shows message 'testing' alert(test.property); // Shows 'undefined' Is the content of property accessible in any way? If not, what is the purpose of accepting this code? ...

$(doucment).ready(function(){}); and $(window).load(function() {}); confusion

Hello guys, My test product page over at http://www.marioplanet.com/product.htm has some odd behaviors which I could really use some help working out. Now, I had a problem previously with my image resizing, and someone here helped me out by saying that I should nest the image resize inside a $(window).load(function(){}); In order fo...

JavaScript: declaring and defining a function separately?

If I want to give a JavaScript variable global scope I can easily do this: var myVar; function functionA() { myVar = something; } Is there a similarly simple and clean way -- without creating an object -- to separate the "declaring" and the "defining" of a nested function? Something like: function functionB; // declared wi...

Pass instance as function argument

I wrote a nice little app that gets Yahoo weather info and posts it to Twitter. It worked flawlessly and now I want to rearrange the code into differently named files so it makes more sense. And that's when I hit some issues. Previously, I had a Class in libtweather.py. It was my account. It allowed me to do accountName.parseFeed() an...

Java string value change in function

Hey guys, I have this very akward question... void changeString(String str){ str = "Hello world": } main(){ String myStr = new String(""); changeString(myStr); } When main returns the value is still "" and not "Hello world" Why is that? Also, how do I make it work? Lets say I want my function changeString to change the...

Run the CommandTFlush command when a new file is written

Hi, I'm trying to make Vim run the command 'CommandTFlush' whenever a new file is writte. For those not using the Command-T plugin, the 'CommandTFlush' command is used to rebuild an index of files in the current directory. What I want to do is run the command after the file is written to disk, so that CommandTFlush will find the file ...

PHP: by-reference-function with boolean as return value – strange notice

I have a function which returns a referenced value by default – however, the function should return false if something went wrong during processing things in the function. The function is declared as follows. function &find($idx, $pref_array = false) { if ($pref_array === false) $pref_array = &$this->preferences; fore...

PHP regex replace expression with function run on its part

Hello, I have a simple text that is being parsed with PHP. In that text, I sometimes use following syntax: Here's the text... {$video:path/to/my/video.mp4} and here the text goes on. Now, what I need, is, by means regex, to replace this {$video:path/to/my/video.mp4} with the returned string of this: $someObject->processVideoSource('p...

CakePHP - Fatal error: Call to undefined function

I get the Error Fatal error: Call to undefined function getAvnet() in C:\xampp\htdocs\ems\app\controllers\queries_controller.php on line 23 when accessing the source file attached. The line is: $ret = getAvnet('de', $searchstring); supposably calling function getAvnet($country, $query) The Source File ...

C++: How do I prevent a function from accepting a pointer that is allocated in-line?

Couldn't figure out how to word the question accurately, so here's an example: Given this function prototype: void Foo(myClass* bar); I want to prevent this usage: Foo(new myClass()); and instead require a previously created object: myClass* bar = NULL; bar = new myClass(); Foo(bar); or myClass bar; Foo(&bar); Thanks. EDI...