0

I am currently working on a script where within a function, key-value pairs are being added to a dictionary x - consider x as a single dictionary of different inputs used to query data, and different key-values are appended to this depending on certain conditions being fulfilled.

However, when I load in the script into my session with some new assignment logic added, I am hitting a 'constants error. This is despite all assignments being kept to this dictionary x. When these two new assignments within x are commented out, the script will load in successfully.

I know the 'constants error usually refers to the max number of constants within a certain scope being exceeded, but surely this shouldn't be happening when all assignment is happening within this dictionary x. Is there a way to get around this? What is causing this issue?

Cathal O'Neill
  • 2,522
  • 1
  • 6
  • 17
cman14
  • 1

1 Answers1

1

I think you are trying to do too much in one function. I think you are indexing or assigning values to the dictionary with too many constants. Below code will return the constants error:

dict:(10 + til 100)!til 100
value (raze -1_"{","dict[",/:(string[10+til 97],\:"];")),"}"

// with til 96
{dict[10];dict[11] ... dict[104]}

It's the code that is indexing the dictionary is causing the issue rather than the dictionary itself.

Matt Moore
  • 2,705
  • 6
  • 13