Re:Functional Programming Doesn’t Work (and what to do about...
by silentbicycle on Tuesday December 29, 2009 @09:01AM
(#1020463)
The "A1 = ..." thing is a convention from Prolog, from which Erlang inherited its single-assignment variables (and many other relatively unusual features). People who write code with several levels of X1 = ..., X2 = ... vars are probably writing Erlang (or Prolog) with a thick imperative accent. It's like writing Python for loops using integer indexes - unless there's a specific reason to do so, it's a sign that the author is probably new to Python.
While putting intermediate steps of a calculation into variables can help clean up the code, if there's any sort of conceptual significance to that value, it's worth choosing a better name than X1. "ATC" (with "Avg. Triangle Count" as an end-of-line comment), for example, would actually mean something.
While putting intermediate steps of a calculation into variables can help clean up the code, if there's any sort of conceptual significance to that value, it's worth choosing a better name than X1. "ATC" (with "Avg. Triangle Count" as an end-of-line comment), for example, would actually mean something.