views:

143

answers:

5

I was wondering what language to use when talking about a function that takes in a specific object, acts on it and returns something else. Clearly they're functions, but I was wondering if there's a more specific term.

A couple examples of Python built-in functions that fit this spec are: 'len', 'dir', 'vars'

I thought it was 'predicate', but apparently that's specific to functions that return a boolean value.

+5  A: 

There isn't really a generic term for these kinds of functions, although Python internally uses 'inquiry' for this kind of function. I rarely see them described as anything other than just plain 'function', though.

Thomas Wouters
+4  A: 

Call them functions. That's something everyone will understand. You could also call them subroutines, methods, or procedures, but sometimes those have specific and different meanings in different languages. But "Function" is something most people will understand, no matter then language (even though there may be slight differences from one programming language to the next).

FrustratedWithFormsDesigner
+1  A: 

I'd call them intrinsic functions.

Brenda Holloway
Is there any reason why you would call them that?
Chuck
because I misread the question as asking for another name for built-in functions ><.
Brenda Holloway
+2  A: 

They're unary functions, since they have a single parameter, but they're nothing more special than that.

outis
+2  A: 

This is the traditional meaning of "function" in the mathematical sense. What you're describing, more than anything else, should be called a function. To distinguish it from a function that has side effects, you can also call it a "pure function" — this means the function will always return the same result given the same argument and won't affect anything else.

Chuck