Used by many programming languages to mean "increment". Can be a prefix or postfix operator usually.

Example in a for loop:
for(int i=0; i < n; i++)
{ //stuff goes here
}

In C and derived language, ++ means increment. Example:

int main () {
int foo;
foo++;
}

When placed after a variable, it means "return value, then increment. Before a variable, it means "increment, then return value. See also the evil twin: --.

Also used in computer jargon to mean something is good or better because of the above meanings. This is why the programming language which evolved from C was called C++: literally better than C, as well as other occurances.

<baffo> Ah, thanks ... The_Cow++;
Chatterbox, 16:32 Thu Nov 30 2000, Server Time.

Having to do with Chatroom Karma

I have frequently seen this used in online chatrooms, IRC and, of course, the catbox. It usually follows a statement which someone considers to be outstanding, often humorous. An example is given below, to illustrate my point. I apologise that it relates to me.

<wertperch> call will be impressed to know that I am using lynx
Siobhan feeds wertperch some chocolate and sage-tea to make him feel better :-P
<call> wertperch++
wertperch feels all l33t now, and allows himself a small preen
Siobhan also wonders what this ++ business is about???
<wertperch> Siobhan: It's a kind of geek applause

It has to be said that the reverse is true, and the decrement operator -- does the reverse, momentarily damning the recipient with public humiliation of a minor sort.


Update

Here on E2 these days, E2D2 keeps track of all of these things, both the increments and the '--' decrements. In the chatterbox, you can discover someone else's karma by typing something along the lines of "E2D2, karma <username>" and in due course, he (for E2D2 is a male 'bot) will reply. Do not, however, be tempted to retrieve your own karma in this way. You have been warned




SharQ says re: ++: Also, in #everything, writing SharQ++, CowbotNeal keeps track of all the ++ and adds them to your karma. Writing "Cowbotneal, Karma SharQ" would return "SharQ has a Karma of 3", for example

Myrkabah says I always thought the "++" thing had to do with "doubleplusgood" from 1984.

As well as meaning 'increment', or 'up-karma', in the above cited contexts, ++ is also the symbol used in Haskell as the list concatenation operator.

As defined recursively in the standard prelude, the operator is right associative, and of precedence just below that of + and -, and above the comparison operators ==, /= etc:

infixr 5 ++

(++)             :: [a] -> [a] -> [a]
[]     ++ ys      = ys
(x:xs) ++ ys      = x:(xs++ys)

Line by line breakdown (I did say 'In plain English', but Oolong laughed at me):

infixr 5 ++
Defines ++ as a right associative infix operator, with precedence (an arbitrary integer) of 5. (the comparison operators have precedence 4, addition and subtraction precedence 6)
(++) :: [a] -> [a] -> [a]
Defines the type of the ++ operator: a function which takes two lists (of arbitrary but identical type elements), and returns a list of the same type. Or, equivalently, a function which takes a list, and returns a function which takes a list and returns a list... partial application being one of Haskell's specialties.
[] ++ ys = ys
The recursive base case. Bear in mind that the operator is right-associative. Defining the concatenation of the empty list with some other arbitrary list is, by definition, the other list.
(x:xs) ++ ys = x:(xs++ys)
The meat of the recursive definition. Where the first list to be concatenated is known to have some element, x, (ie. it is not the empty list) consed with a (possibly empty) list of other elements, xs, the concatenation of the two lists is x consed with the concatenation of the xs and the original second list. Since the left hand side operand of the concatenation in the result is one element smaller (that element being 'x') than that it the pattern on the left hand side, the 'xs' list will tend towards the empty list, at which point the expression matches with the base case and the evaluation is complete.

As an example... let's concatenate [1, 2] with [3, 4]... go on, you know you want to.

   [1, 2] ++ [3, 4]
== (1:[2]) ++ [3, 4]    (list syntax change)
== 1:([2] ++ [3, 4])    (recursive case of ++)
== 1:((2:[]) ++ [3,4])  (list syntax change)
== 1:2:([3,4])          (base case of ++)
== [1, 2, 3, 4]         (list syntax change)

So there we go, [1, 2] ++ [3, 4] == [1, 2, 3, 4]. QED

Log in or registerto write something here or to contact authors.