Thanks a lot everyone. I'm glad it's so simple. :-) I thought I had tried this,
but it seems I didn't. (On the other hand, defining the proc as an anonymous
one actually was something I tried.)
Now I have a follow-up question. To replace my lengthy proc with the template,
I have to create a cmp proc from the field name _given as a string_ , but in
the experiment in the Nim playground I used an identifier. Is there a
_relatively easy_ way to change the template so that it accepts the field name
as a string? So instead of
tasks = sorted(tasks, cmp = cmpTaskField(isComplete))
Run
I'd like
tasks = sorted(tasks, cmp = cmpTaskField("isComplete"))
Run
I say "relatively easy" above because if this requires a macro that is much
longer and complicated than my original proc, I'd rather use the proc in my
code than the macro. :-)