## Search found 4 matches

Tue Jun 27, 2017 11:43 pm UTC
Forum: Coding
Topic: Multi-line Anonymous Functions in Python
Replies: 32
Views: 38948

### Re: Multi-line Anonymous Functions in Python

Tue Jun 27, 2017 8:00 am UTC
Forum: Coding
Topic: Multi-line Anonymous Functions in Python
Replies: 32
Views: 38948

### Re: Multi-line Anonymous Functions in Python

What is the point of an anonymous function? Having written a function, why not give it a name and allow the code to be reused? What is the point of an anonymous integer? What is the point of an anonymous boolean? What is the point of an anonymous string? What is the point of an anonymous object? Le...
Sun Jun 25, 2017 9:46 pm UTC
Forum: Coding
Topic: Multi-line Anonymous Functions in Python
Replies: 32
Views: 38948

### Re: Multi-line Anonymous Functions in Python

Feel free to join in the shenanigans.
Sun Jun 25, 2017 2:00 pm UTC
Forum: Coding
Topic: Multi-line Anonymous Functions in Python
Replies: 32
Views: 38948

### Re: Multi-line Anonymous Functions in Python

First define the Y combinator: def Y(g): exp = lambda f: g(lambda arg: f(f)(arg)) return (exp)(exp) This will allow you to have 'named' (recursive) lambdas: Y(lambda fact: lambda n: 1 if n < 2 else n * fact(n - 1))(5) # => 120 So your code becomes: Y(lambda f: lambda a: 1 if a == 1 else (f(a/2) if a...