lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, Jun 5, 2014 at 12:45 AM, steve donovan
<steve.j.donovan@gmail.com> wrote:
> On Thu, Jun 5, 2014 at 9:18 AM, Coroutines <coroutines@gmail.com> wrote:
>> I don't know how that could be made less confusing from the parsers'
>> perspective, though.  I think you can do this in Haskell with \+ to
>> refer to the function of the operator itself.
>
> Nimrod resolves this issue by backquotes: `<` (which is also the form
> used to define an operator as a function)
>
> A bit hacky, but pl.List allows quoted operator strings in place of functions:
>
>> ls = List{10,2,5,20}
>> = ls:sorted '<'
> {2,5,10,20}
>> = ls:sorted '>'
> {20,10,5,2}
>

Hmm.  now I'm daydreaming about backticks being used to define inline
chunks without the load(): table.sort(some_table, `... < select(2,
...)`)

(we'd need backticks so chunks can't be confused as just strings that
will fail to load() -- it shows intent)  -- whee ducktyping woes ~