Re: we need official libs

new topic     » goto parent     » topic index » view thread      » older message » newer message

Roderick Jackson escribió:

> Colin Taylor[SMTP:cetaylor at compuserve.com] wrote:
>
> I see your point... it's definitely less messy that way, but I had assumed
> 'min' and 'max' would apply to sequences. For example:
>
>    i = min ({1,7,9,-11,33,0,4.6,-4}) -- -11 is assigned to i
>
> In fact, that's the only capacity in which I remember ever needing those
> functions. And in the actual instances I could have used them, the data
> values weren't stored conveniently in a single sequence anyway; making an
> "inlined" loop to find the min/max made more sense than writing a min/max
> function and then making a loop to construct the sequence of values.
>
> I could probably have made more use of a 2-element min/max function for
> limiting purposes in some of my types. But when writing types I generally
> optimize for speed over brevity or clarity, especially since types usually
> aren't that complex (at least, mine aren't.) So in types, I prefer coding
> things out in full rather than using a function call (unless that function
> call is for another type.)
>
> But all this begs the question... which format (min(atom,atom) versus
> min(seq)) would most people want? Myself, if min & max were included at
> all, I'd like to see the latter form.
>

What do you think about a function that return where is the min/max value in a
sequence

   i = min ({1,7,9,-11,33,0,4.6,-4}) -- 4 is assigned to i (minimum is fourth
position)
   i = max ({1,7,9,-11,33,0,4.6,-4}) -- 5 is assigned to i

Even an Eu Style max!!!

  s = max ( { 1, 2, {3, 4}, 0})   -- {{3,2}}is assigned.  The max is the
second element of the third element!!!!

When there are many elements whit the max value, return a sequence as:

 s = max {1, 2, 3, 4, {1, 2, 3, 4}}  -- {4, {5,4}} is assigned.

These are only ideas...

--
+-+-+-+-+-+-+-+-+-+
Marco A. Achury P.
http://members.xoom.com/achury
mailto:achury at eldish.net
ICQ: 19390207
Caracas, Venezuela

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu