Formatted the code so its easier to discuss about it.
genARandom must be some sort of residue or upcoming code as it stands now it makes little sense. For one its not really doing anything second you dont run the codes entire path anywhere.
line 19: function myFunc(){
mel doenst have the keyword function. the name is same asin your first procedure, proc
line 29: move $x $y $x ls -sl;
is also a syntax either you mean:
move $x $y $ ls -sl;
or
move $x $y $x (ls("-sl");
but the ls is obsolete since it allready operates on the selection, omitting it just runs faster
anyway i think you concebreate on the wrong thing.