Friday, February 19, 2010

Re: How powerful is language build in vim compare with the language build in emacs?

On 20 February 2010 00:38, bill lam <cbill.lam@gmail.com> wrote:

> ven, 19 Feb 2010, Antony Scriven skribis:
> > Not 100% sure what you mean here, but writing HOFs
> > shouldn't be complex. I hope you don't mind me
> > switching to what is a more familiar language for me.
> >
> >    zipWith = function(fn,list1,list2)
> >        map(function(val) fn(val[0],val[1]), zip(list1,list2));
>
> the list1 and list2 are arguments that I meant to
> eliminite, that is, write a zipwith without explicit
> appearance of list1 and list2.
>
> something like this,
> http://en.wikipedia.org/wiki/SKI_combinator_calculus

Why you'd want to do that is anybody's guess! But if
ECMAScript properly supported currying you could write:

zipWith2 = function(fn)
compose(map(function(val) fn(val[0],val[1])), zip);

I wrote a curry function and faked compose and the above
does work, but you have to invoke it as
zipWith2(fn)(list1,list2), which is ugly but amounts to the
same thing. And now we're waaaay off-topic. --Antony

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments: