You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The title is a bit weird because I'm not sure how to describe it properly in brief BUT for the current AoC I tried RL once again and had some issues with the missing string functions so I tried building some myself, but due to how the variables work it's currently not possible. See my sample:
"// Last Updated: 2021.12.02""// RocketLang Version: 0.9.7""------------------------------------"letx=0;letdepth=0;leteach=fn(enumerable,yield,idx){if(idx==len(enumerable)){returnlen(enumerable);}yield(enumerable[idx]);each(enumerable,yield,idx+1);};"Does not work because you have to do push with let a = push(a, b)""which makes a a 'local' variable and thus breaks everything -.-"letsplit=fn(string,separator){letlist=[];letcurrent_word="";each(string,fn(char){puts(char==separator);if(char==separator){puts"Split found!"letlist=push(list,current_word);letcurrent_word="";}else{puts(current_word);puts("Another letter to the word: "+char);letcurrent_word=current_word+char;puts(current_word);}},0);letlist=push(list,current_word);returnlist;};split("Hello World"," ");"Simplified sample of split. super sad that this does not work :-("letchar_array=[];letcounter=0;each("Hello World",fn(c){let char_array =push(char_array,c);letcounter=counter+1;},0);puts(char_array);puts(counter);
In theory it should "fill" the outer variables with characters and strings because they are defined outside of the inner block but I can't do current_word = current_word + "Hello" because I have to write a let before which then makes it a local variable thus the house of cards crumble.
Not sure if this is solvable but a workaround might be to make push change the array itself rather than returning a new one, but I think you tried this already when I requested the push/pop functions....
The text was updated successfully, but these errors were encountered:
The title is a bit weird because I'm not sure how to describe it properly in brief BUT for the current AoC I tried RL once again and had some issues with the missing string functions so I tried building some myself, but due to how the variables work it's currently not possible. See my sample:
In theory it should "fill" the outer variables with characters and strings because they are defined outside of the inner block but I can't do
current_word = current_word + "Hello"
because I have to write alet
before which then makes it a local variable thus the house of cards crumble.Not sure if this is solvable but a workaround might be to make push change the array itself rather than returning a new one, but I think you tried this already when I requested the push/pop functions....
The text was updated successfully, but these errors were encountered: