lua-users home
lua-l archive

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


One more variation for the road:

    [: arglist | explist :]
    [: arglist : statements | explist :]

Thats how I like my functions: symmetric, with familiar special
characters and guarded by smiling borgs :-].

I said that in jest, but there has been a lot of research on the
effect of subliminal exposure to smiling faces (see [1-3]).

compare

    [: arglist | explist :]

with

    :[ arglist | explist ]:

The problem is that a happy mood, while improving the performances in
creative tasks, is derogatory to analytical problem solving (see
[4,5]). What about a neutral syntax (without comas in the arglist,
thay are not necessary)?

    |: x y | explist :|
    |: a b c : statements | explist :|


BTW, there was a mistake in the proposed compilation of the outer
return statement:

    function foo()
        local bar = |:: return "whatever"|
        return bar
    end

becomes

    function foo()
        local _R = true

        local bar = |::
            if _R then
                 _R = nil
                return "whatever"
            else
                error()
            end
        :|

        _R = nil
        return bar
    end

-- Pierre-Yves

1. http://psihologija.ffzg.hr/uploads/or/XT/orXTM_yBsRKas9LMIG3ZEw/Monahan2000mereexposure.pdf
2. http://www.psy.ucsd.edu/~dhuber/murphy_zajonc_1993.pdf
3. http://arno.unimaas.nl/show.cgi?fid=2436

4. http://books.google.be/books?hl=en&lr=&id=kB19aJKJLoEC&oi=fnd&pg=PA288&ots=trpv7r4C8u&sig=SSW6EgasZeItzcTqMKLJ20rx8x8#v=onepage&q&f=false

5. http://books.google.be/books?hl=en&lr=&id=LwVF17_xtPEC&oi=fnd&pg=PA55&ots=CcT2rUVYTw&sig=oF6Znt4vkL53KBHiDwlNN6yrm-c#v=onepage&q&f=false