GV1 wrote:Testing now. I'm not sure how I can make it more elegant except to contain it in a function ... that's a solid solution to be honest.
Thanks.
Definitely wrap it in a function. What got me was having to do the various gymnastics on i. From a programmer's POV, doing an i-- and then the "- 1" in the val[] offset seemed a bit crude, but it saved me from using a pair of braces and separately decrementing i (maybe). I was also thinking about a reverse-in-place on the array, but I was getting tired and wanted to post something that could be used (and understood and modified if necessary).
Just one of those things -- programming allows hundreds of different solutions, but it's always nice to find an elegant one if possible.
GV1 wrote:Actually it works for single numbers, but when I use the number 869 it will only print 86 and ignore the 9. I'll debug it and get it working
Hmm - the original worked for me across a wide range of numbers. Maybe in moving it to a function something got missed.
Anyway, your posted solution is nice and clean. The reason brevity is sometimes necessary is that there is a hard limit to the size of the .jzml files. Once you get a large application going, you'll be looking for ways to save space. Removing comments is an obvious first step, but even then it may not be enough.
For small templates, it's not an issue of course, but I have continually run into that limit when building the few editors/apps I've created.
GV1 wrote:Actually it works for single numbers, but when I use the number 869 it will only print 86 and ignore the 9. I'll debug it and get it working
Hmm - the original worked for me across a wide range of numbers. Maybe in moving it to a function something got missed.
Anyway, your posted solution is nice and clean. The reason brevity is sometimes necessary is that there is a hard limit to the size of the .jzml files. Once you get a large application going, you'll be looking for ways to save space. Removing comments is an obvious first step, but even then it may not be enough.
For small templates, it's not an issue of course, but I have continually run into that limit when building the few editors/apps I've created.
Ah yeah I forgot the Lemur is limited in memory. I've done a fair but of code golfing in the past but I don't know enough about Lemur scripting to be able to do that. Would be cool to create a transpiler eventually.