I'm trying to get into more advanced features of vimscript, so I'm trying to figure out how to use the map
function, so I thought I'd write a function that returns every character with ASCII values between two numbers. For example,
CharRange(65, 90)
would give
ABCDEFGHIJKLMNOPQRSTUVWXYZ
So I tried this:
echo map(range(65, 90), function('nr2char'))
But I got some very strange results. Instead of giving ASCII 65-90, it gave ASCII 1-25.
^A ^B ^C ^D ^E ^F ^G ^H ^K ^L ^M ^N ^O ^P ^Q ^R ^S ^T ^U ^V ^W ^X ^Y
(of course it gave unprintables rather than the carets followed by letters)
After this didn't work, I tried some other ways, but none of them worked right. For example, a lambda:
echo join(map(range(50, 100), {arg1 -> nr2char(arg1)}))
This gives the exact same results. What am I doing wrong?