I'm trying to remember a word, I think it's related to computational or database theory. The closest synonym is atomic but that's not exactly it. Basically it's a kind of computation that should produce the same result even when run multiple times in a row, meaning it doesn't create side effects for itself.

I specifically ran across this word in a Stack Overflow answer about a chmod command (or some other permission related operation).

Hopefully that's enough to go on. Poking around Wikipedia isn't much help.

  • 5
    It makes sense to specify whether you pass the same input to every call of operation or run every next operation on results of the previous call. – maxim1000 Apr 5 '13 at 4:34
  • 2
    @maxim1000 Agreed. Judging by the variety of answers, no one is sure which the OP meant. – ford Apr 5 '13 at 6:10
  • The problem here is that the question in the subject is not strictly the same as the question in the body. I answered the one in the subject but, looking again now, I'm pretty sure that's not what the poster wanted. Edits question, deletes answer – pdr Apr 5 '13 at 8:59
  • Are you asking about something like a GET request (where the same result is returned every time no matter what), or are you asking about something like the assignment operator (which does have an effect, but repeating the same assignment doesn't change anything)? – Izkata Apr 5 '13 at 13:28
up vote 80 down vote accepted

You might be thinking of "Idempotent".

Idempotence is the property of certain operations in mathematics and computer science, that they can be applied multiple times without changing the result beyond the initial application.

  • 14
    Basically, f is idempotent IFF f(f(x)) == f(x) FORALL x. – Jörg W Mittag Apr 5 '13 at 1:34
  • Interesting limitation of the description - The talk section of the linked page discusses Elevator buttons.. There must be 1000's of behaviors that can be described as "Idempotent" not related to Math or Comp Sci. – mattnz Apr 5 '13 at 6:46
  • From my understanding of the question, that's not at all what the OP is asking, as he doesn't speak of applying the algorithm on the results of the first iteration, but reapplying it on the same source data. Something more like if x=y, then F(x)=F(y) – Joubarc Apr 5 '13 at 7:48
  • 1
    @Joubarc yes idempotent has a slightly looser meaning in computing then the rest of maths, hence it is correct. en.wikipedia.org/wiki/Idempotent#Computer_science_meaning – jk. Apr 5 '13 at 9:00
  • I had read the page and I admittedly wasn't convinced at the time; but to be honest it's not concept of idempotence I had a problem with; rather, it was whether the question was about it or not. But now that I read it again, I admit I was wrong (especially given the chmod example which is a good case) – Joubarc Apr 5 '13 at 9:09

The general word is Idempotence which applies to both computers and to mathematics. It is not the same thing as Reentrant which it often gets confused with. Idempotence is precisely what you described, Reentrant is basically interruptible with the ability to pick up exactly where you left off.

Purely Functional languages like Haskell are built around the principle of being as close to Idempotent as is possible. The first three letters of the acronym ACID in Database Theory are Idempotence as applied to Databases.

You might be looking for a pure function.

As defined in the link, two conditions make a function pure:

  1. The function always evaluates the same result value given the same argument value(s).
  2. Evaluation of the result does not cause any semantically observable side effect or output, such as mutation of mutable objects or output to I/O devices.
  • 3
    Purity goes beyond simple idempotence: a pure function cannot have any side effects at all, while an idempotent one can have side effects as long as they don't cause subsequent runs to do different things. For example, a function that uses local mutable variables is not pure, but it is probably idempotent. You could even write a function that uses global variables and is still idempotent, as long as you make sure it guards those globals to make it reentrant. – tdammers Apr 5 '13 at 8:00
  • 2
    @tdammers Purity and idempotence are completely orthogonal: a pure function doesn’t have to be idempotent and vice versa. For instance, f(x) := x + 1 is pure but certainly not idempotent. – Konrad Rudolph Apr 5 '13 at 11:51

In linear algebra linear, idempotent functions are called projections. Maybe that's the word you're looking for. :)

http://en.wikipedia.org/wiki/Projection_(linear_algebra)

Another possibility is deterministic.

In computer science, a deterministic algorithm is an algorithm which, given a particular input, will always produce the same output, with the underlying machine always passing through the same sequence of states.

  • 1
    this has been in just deleted prior answer; comment that challenged this idea was: "This is wrong. For example, the algorithm which swaps two values is perfectly deterministic but running it twice will not produce the same result as running it once." – gnat Apr 5 '13 at 10:13
  • 1
    It's not clear whether or not this answers the original question, because the original question isn't very well phrased, but I've up-voted this reply because the word deterministic might well be the one that someone was searching for when they ended up here. – Richard Whitehead Jun 1 '17 at 8:44
  • If you mutate the input values prior to the next run, how can you claim that you provide the routine with the same exact argument values..? – Hein Haraldson Berg Sep 29 '17 at 10:42

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.