Standards II

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

----------------------------------------
Joe Otto wrote :
"Don't put *all* math routines / constants into math.e." ... "Advanced,
infrequently used
functions, should be available in the standard library ... in separate include
files..."
"eg    math.e
        math_trig.e
        math_stats.e
        math_complex.e"

This is a good point and will probablely be adapted, however at the moment there
isn't
that there will be that many functions. For future compatibility it will
probabely be best to
adopt this stratergy from the on set.

----------------------------------------
Joe Otto wrote :
>Shouldn't at least some of the following functions return objects instead of
>atoms?
>        object abs (object)
>        object sign (object)
>        object max (sequence)
>        object min (sequence)

No one decisions have been made as to how these should act. Initially what they
returned wasn't
specified.

Roderick Jackson wrote :
>'min' and 'max' imply mathematical comparisons ... strings and comparisons
>(which is what
>'min' and 'max' really are) don't mix in Euphoria

I think that it function's in the math library should work on the assumption
that a sequence
is a sequence of atoms, or sequences. String and sequence manipulation is a
separate category
in my opinion. So that is why I guessed min(sequence) and max(sequence) as
returning atoms.
I thought they should take sequences over (atom, atom) as sequences offered
greater flexibility
and allowed you to do ret = max( { a, b } ) if you wanted.

----------------------------------------
As for abs and sign it is probably sencsical to make them return objects. Again
the syntax was
not specified.

----------------------------------------
Roderick Jackson wrote :
> Now 'sum' might present a problem. Assuming sub-sequences are allowed, how
> should they be evaluated? Would it be...
>   sum ({{1,2,3},{4,5,6},{7,8,9}}) --> yields 45
> or...
>   sum ({{1,2,3},{4,5,6},{7,8,9}}) --> yields {6,15,24}

That has to be decided.

----------------------------------------
To resolve the problems, of what a mathematical function accepts, returns and
how it functions,
I propose this definition :
" If a function can be applied to a single atom then it should accept and
    return objects
and should function as an application of that operation to each element in the
object. If a
function must be applied to and only to a set number of atoms it should accept a
set number
of atoms and return the result as applicable. If a function must be applied to
more than one,
but up to any number of  atoms it should accept a sequence and return the result
as applicable.
No function should do any implicit matrix, or complex number manipulation. Thus
if a function
accepts a sequence that sequence should only contain atoms."

It's a bit wordy so here's the summary: If a function is applied to :
* an atom it takes and returns objects.
* a set number of atoms it takes that number of atoms and returns whatever
* more than one atom it takes a sequence and returns whatever. Seq can't contain
anything but
atoms.
* No implicit matrix or complex math.
-------------------------
Sincerely,
Mathew Hounsell

mat.hounsell at excite.com

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

Search



Quick Links

User menu

Not signed in.

Misc Menu