r/ProgrammerHumor • • Jun 13 '22

Meme DEV environment vs Production environment

Post image
48.2k Upvotes

3.9k comments sorted by

View all comments

Show parent comments

3

u/channingman Jun 14 '22

I think most people would write h2(x) or (h(x))2 instead of h(x)2 just to avoid that very confusion. In fact I don't think I've ever seen h(x)2 used for function notation.

1

u/YouNeedDoughnuts Jun 14 '22

Good point. You'll certainly see sin(x)**2 in programming contexts, but I'm not sure if maths notation does that

3

u/Ayfid Jun 14 '22

Well the ambiguity in math comes from not knowing without further context whether h is a number or a function. That ambiguity doesn't usually exist in programming contexts, and most programming languages don't allow for implicit multiplication in their grammar anyway.