

I am unreasonably proud of this recursive anonymous quicksort done in Matlab - adambard
https://gist.github.com/2590371

======
ble
Nice.

I find it annoying to have to EITHER -write one file per function and
completely crap up a directory OR -write multiple functions in one file that
can only be called by code in that file (nested functions / subfunctions)

The clear solution is to write utility functions as anonymous functions. The
major limitation of anonymous functions is that they evaluate an expression
and cannot contain statements... unless you use eval()!

    
    
        %come to the dark side
    
        if_ = @(cond, then_fn, else_fn) ...
                eval('if(cond) then_fn(); else else_fn(); end');
        %this can make code better and it can make code terrible;
        %whether it is a better terrible than the MATLAB you have
        %to deal with on a regular basis is unclear.

------
VeejayRampay
Good stuff. I sometimes have to help my girlfriend who's a cognitive
psychologist set up her experiences on MATLAB and coming from the Ruby world,
it's always quite brutal.

