I don't think anybody has yet exploited the power of parameter default values 
for defining recursive functions:

   ((fact=n=>n>1 ?n*fact(n-1):1)=>(fact))()

Allen


On Mar 17, 2013, at 7:39 AM, Axel Rauschmayer wrote:

> ;-)
> 
> How about the following (about which I’m serious)?
> 
> function defineRec(f) {
>     return args => f(f, ...args);
> }
> 
> let factorial = defineRec((me, n) => n <= 1 ? 1 :  n * me(me, n-1))
> 
> 
> On Mar 17, 2013, at 14:33 , "Mark S. Miller" <[email protected]> wrote:
> 
>> Just in case anyone does not realize that this thread is humorous, 
>> 
>>     const factorial = n => n>1 ? n*factorial(n-1) : 1;
>> 
>> Yes, you can't use this as an expression. So what? After this declaration 
>> you can use factorial as an expression. Anonymous lambda expressions are a 
>> wonderful things. But in actual development, I have never yet encountered a 
>> recursive function I didn't want to name.
>> 
>> Ok, and now back to our irregularly scheduled humor...
>> 
>> 
>> 
>> 
>> On Sun, Mar 17, 2013 at 6:19 AM, Kevin Smith <[email protected]> wrote:
>> 
>> 
>> Sorry arrow functions but this isn't a better JS.
>> 
>> Bah.  Arrow functions are a huge usability win for JS.  Try them- you'll see!
>> 
>> { Kevin } 
>> 
>> 
>> 
>> _______________________________________________
>> es-discuss mailing list
>> [email protected]
>> https://mail.mozilla.org/listinfo/es-discuss
>> 
>> 
>> 
>> 
>> -- 
>>     Cheers,
>>     --MarkM
>> _______________________________________________
>> es-discuss mailing list
>> [email protected]
>> https://mail.mozilla.org/listinfo/es-discuss
> 
> -- 
> Dr. Axel Rauschmayer
> [email protected]
> 
> home: rauschma.de
> twitter: twitter.com/rauschma
> blog: 2ality.com
> 
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to