I read the following in a computer programming book:
In other languages, one would call such a value a constant.
However, the following appears grammatical:
In other languages, one would call such a value constant.
Which one is correct?
It's grammatical to say "a constant" in the first sentence. The indefinite article "a" is required because "constant" is a count noun.
In your second example, you're right, that is also grammatical. HOWEVER, "constant" is appearing as an adjective in that sentence, not as a noun. If you want to use "constant" as a noun, you need to put "a" beforehand in that sentence.
Both of your example sentences are grammatically correct, but they mean subtly different things.
"One would call such a value a constant" means that "a constant" is another name for a value with the characteristics referred to by "such".
"One would call such a value constant" means that "constant" is an adjective describing the quality possessed by values with the characteristics referred to by "such".
In this case, these two sentences say very nearly the same thing, because English often allows you to say "a [adjective]" to mean "an object with the quality [adjective]". However, this doesn't always work: "X is a constant" is fine but "*X is a red" demands the reply "A red what?" And, for the same reason, you can only say "One would call such a value red", not "*One would call such a value a red".
(Phrases marked with a * at the beginning are things that native speakers would never say.)
A constant is correct. In programming and mathematics, a constant is a kind of value that is characterized by being unchanging, as opposed to a variable, which is used as a placeholder for a variety of values.
To use a mathematical example, the generic equation of a line is y=ax+b. a and b are both constants, because for every specific line, they remain the same within that line: y=2x+1, for example. y and x are variables, because you can put any value in for one of them and then use the equation to find the value of the other one.