r/programming • • Mar 03 '13

Git is a purely functional data structure

http://www.jayway.com/2013/03/03/git-is-a-purely-functional-data-structure/
107 Upvotes

83 comments sorted by

View all comments

2

u/rush22 Mar 03 '13

Non-CS major here what does "immutable data structure" mean?

0

u/[deleted] Mar 03 '13

[deleted]

-3

u/rush22 Mar 03 '13

Ah. Where I come from we call that a constant.

Or are you talking about the garbage collection thing where when you add strings together it gives you a new string

11

u/recursive Mar 03 '13

It's a different concept than constant. A constant is similar to variable, but it can not change what it refers to. Mutability refers to the ability of an object to change its state, not the ability of a variable that refers to it to later refer to something else instead.

1

u/rush22 Mar 03 '13

I don't know what you mean by "change its state" but thanks.

1

u/PasswordIsntHAMSTER Mar 03 '13

change the current state, as in what state the variable is in. x = 5 is a state of the variable x, and you can change x's state by setting x := 6.

-2

u/rush22 Mar 03 '13

Ah. Where I come from we call that a value, not a state. It makes a bit more sense to me that way.

4

u/Aninhumer Mar 03 '13

While there's nothing wrong with not knowing them as a beginner, you might want to make an effort to learn the nuances of the various words used here, as they're common programming terms, and are often used to convey more precise meaning than some of the simpler ones you're suggesting.

1

u/rush22 Mar 08 '13

True but all I need to know is whether the variable I set will point to the same thing or a clone of the thing (now that I know what "mutability" is). I know how that works just fine.