Re: Standard library praise and challenge
- Posted by euphoric (admin) Sep 13, 2011
- 3264 views
I would expect max/min to apply to top-level elements only.
So...
max( { "Head", "Tail" } ) -- "Tail" since it is higher alphabetically max( { 1, 2, 3 } ) -- 3 max( {} ) -- Error condition max( { {1}, {2} } ) -- {2} max( { {1,{1}}, {1,{2}} } ) -- {1,{2}} max( { 1, {1} } ) -- 1? now we're getting somewhere :)
To search deep like the current max() does for the largest atom can be useful but seems to be counter-intuitive. Maybe a max_deep() or something should do this instead so max() can get back its common intent.