Wednesday, January 11, 2023

Re: Vim9 Create its own Lambda Def Function

Yess a lot it helps. Thank you Mr Halim.

Big Thank to Bram.


Le mercredi 11 janvier 2023 à 22:02:30 UTC+1, Salman Halim a écrit :


On Wed, Jan 11, 2023 at 3:33 PM N i c o l a s <niva...@gmail.com> wrote:
Hi,

Is it possible to create its own lambda function ?

I explain I got this def func :

def OutBufAdd(outbuf: list<string>, str: string)
  EchoMsg(str)
  outbuf->add(str)
enddef

Client code is using it as this :
OutBufAdd(outbuf, 'foo')
....
OutBufAdd(outbuf, 'bar')
....
OutBufAdd(outbuf, 'barfoofoo')
....
OutBufAdd(outbuf, 'barbar')

Regarding this, it is always in this case OutBufAdd(outbuf, somestring)

Is it possible to modify OutBufAdd(outbuf,  somestring  ) to OutBufAdd->(somestring) ?

Thank you for all
Nicolas

:help Partial

You should be able to do this or a variation thereof from here:

var Adder: func: any = function('OutBufAdd', [outfbuf])

Adder(something)

Hope this helps,

Salman 

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/bb476276-6213-47e4-a137-9a97e9de2f71n%40googlegroups.com.

No comments: