hi everyone !! i hope you are doing well …
so i have a problem i am trying to solve … i have a flattened array i am trying to turn into a non-flattened array and am having a hard time declaring the type for the array and returning a legitimate value …
so let’s imagine i have a flattened array like this ::
[“1”, “2”, “(”, “3”, “4”, “)”, “5”]
what i am hoping to return is an array that looks like this ::
[“1”, “2”, [ “3”, “4”], “5”]
it may honestly be just a brain problem, but i am having the hardest time “pushing” to the new array that is multidimensional – i keep getting type errors … for example ::
Error: no overload matches ‘Array(Array(Array(Int32) | Int32) | Array(Int32) | Int32)#push’ with type Array(Array(Array(Int32) | Int32) | Array(Int32) | Int32)
to back up a little, i create a temporary array and store the new values in there … when i get to the point of trying to push to the new array – i always get the above overload error …
what confuses me more is i when i peek at the object values and type right before the array.push, it sure seems legitimate to me, but i honestly do not know as this is day 10 for me with crystal …
current list: [1, 2] : Array(Array(Array(Int32) | Int32) | Array(Int32) | Int32)
nested list: [3, 4] : Array(Array(Array(Int32) | Int32) | Array(Int32) | Int32)
again, the goal at this phase is to push “nested” onto “current”, so the result would look like ::
[1, 2, [3, 4]]
any ideas on what i am doing wrong ?? any help you all can offer would be greatly appreciated … this isn’t my 1st strongly typed language, but my 1st go with crystal for sure and i feel like i am so close to making it work …
thanks so much for any help you can give me … it is greatly appreciated … again, my just be my brain and i am approaching it wrong … but i can’t get past this point for the life of me …
thanks !!