The audacity to do such a thing…

    • OmnipotentEntity@beehaw.org
      link
      fedilink
      arrow-up
      32
      ·
      edit-2
      9 months ago

      Or sometimes even just an array. The first time I thought I wanted to do this was 2003 and I was writing a perl script, and I was trying to loop through some sort of array, and write the outputs of some calculations to $val0 $val1 and so on, and I was neck deep into some horrible dark constructs like ${"val" . $i} before I actually realized that I really just wanted an array, you know, like the one I was already using.

      It took me forever to understand map (the metafunction).

    • CompassRed@discuss.tchncs.de
      link
      fedilink
      arrow-up
      13
      ·
      9 months ago

      It depends. If the variable names are arbitrary, then a map is best. If the variable names are just x_1, x_2, x_3, …, x_n, then a list or dynamic array would be more natural. If n is constant, then a vector or static array is even better.