Using function() with a lambda function

10 views
Skip to first unread message

Yegappan Lakshmanan

unread,
Nov 30, 2021, 11:50:42 AM11/30/21
to vim_dev
Hi,

I see some unexpected behavior when trying to use function()
with the name of a lambda function:

let L = {s -> strlen(s)}

:echo L
function('<lambda>1')

:function <lambda>1
function <lambda>1(a, ...)
1 return strlen(a)
endfunction

:echo function('<lambda>1')
E129: Function name required
E475: Invalid argument: <lambda>1

I expected the last command to echo "'<lambda>1".

Regards,
Yegappan

Bram Moolenaar

unread,
Nov 30, 2021, 1:25:41 PM11/30/21
to vim...@googlegroups.com, Yegappan Lakshmanan
Yeah, that looks inconsistent. I'll make a patch.

--
LARGE MAN: Who's that then?
CART DRIVER: (Grudgingly) I dunno, Must be a king.
LARGE MAN: Why?
CART DRIVER: He hasn't got shit all over him.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages