Hi,
2016/7/17 Sun 21:26:29 UTC+9 itchyny wrote:
> I additionally submit another test case.
>
> let Y = {f -> (({x -> f ({y -> x(x)(y)})}) ({x -> f ({y -> x(x)(y)})}))}
> let Fact = {f -> {x -> (x == 0 ? 1 : x * f(x - 1))}}
> echo Y(Fact)(5)
>
> I expect this script prints 120 but I got E110: Missing ')' in 7.4.2049 (and
> also with the experimental patch).
> Is there something wrong with the above code or is there some bug in the
> parsing code in eval.c?
>
> Here are the counterparts in Python
> Y = lambda f: (lambda x: f (lambda y: x(x)(y))) (lambda x: f (lambda y:
> x(x)(y)))
> Fact = lambda f: lambda x: (1 if x == 0 else x * f(x - 1))
> print Y(Fact)(5)
>
> and in JavaScript
> var Y = function(f){ return (function(x){ return f (function(y){ return
> x(x)(y); }); }) (function(x){ return f (function(y){ return x(x)(y); }); });
> };
> var Fact = function(f){ return function(x){ return (x == 0 ? 1 : x * f(x -
> 1)); }; };
> console.log(Y(Fact)(5));
>
> reference:
> https://en.wikipedia.org/wiki/Lambda_calculus#Recursion_and_fixed_points,
> https://en.wikipedia.org/wiki/Fixed-point_combinator#Fixed_point_combinators_in_lambda_calculus
I have updated the patch for the latest code:
https://bitbucket.org/k_takata/vim-ktakata-mq/src/006cdbbeef26201154d04b7dfe1aed119321acb1/lambda-update.patch?at=default
The SEGV on test_alot.vim seems fixed.
> let Y = {f -> (({x -> f ({y -> x(x)(y)})}) ({x -> f ({y -> x(x)(y)})}))}
This still causes errors. Not sure why. Simpler example would be better.
Regards,
Ken Takata
--
--
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.