import strutils
import sequtils
import sugar
echo "A".toLower
echo ["A", "B", "C", "D"].map(x => toLower(x))
echo ["A", "B", "C", "D"].map(toLower)
works fine
however, the last line of
echo 'A'.ord
echo ['A', 'B', 'C', 'D'].map(x => ord(x))
echo ['A', 'B', 'C', 'D'].map(ord)
says
R:\WHY.NIM(12, 31) Error: 'ord' cannot be passed to a procvar
so what makes this difference? Thanks
And you can do instead:
echo ['A', 'B', 'C', 'D'].mapIt(ord(it))