[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Operators on functions
- From: "Pierre Chapuis" <catwell@...>
- Date: Wed, 20 Nov 2013 11:04:36 +0100
> On Mon, Nov 18, 2013 at 7:20 PM, Dirk Laurie <firstname.lastname@example.org>
>> What would be a sensible mapping of operators to metamethods?
> Functional programing hacks are fun, but I think it's not sensible
> encourage using them in Lua. Functional thinking mixes poorly with mutable
> values, and Lua tables are designed to be used through mutation rather
> than functionally.
I tend to agree. *Some* functional ideas are welcome in Lua,
for instance I consider defining a map() function and using
it with pure functions (e.g. tostring) idiomatic. Same with
Going futher and playing with things like composition often
results in confusing and inefficient code.
It can be fun as an experiment though, for instance: