Re: Standard library praise and challenge

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

One can say {} is the empty sequence. True.

However that is not the case when you are comparing atoms. {} has no atom, nothing, NULL. Hence when the sequence is flattened the empty sub-sequences disappear (just as in SQL, NULLs are ignored).

It leaves the problem of what to do with max(NULL) and min(NULL). They should return nothing ({} or NAN). It is odd to call it an error since this would imply that min({{},1}) should also be an error as it is saying:

"which is smaller nothing or 1?"

Note the (inconsistent) treatment of NULL by compare:

include std/math.e 
 
 1: ? compare(MINF,MINF)             0 
 2: ? compare(MINF,min({}))         -1 * 
 3: ? compare(MINF,max({}))          0 ** 
 4: ? compare(MINF,PINF)            -1 
 5: ? compare(min({}),MINF)          1 * 
 6: ? compare(min({}),min({})        0 
 7: ? compare(min({}),max({}))       1 ** 
 8: ? compare(min({}),PINF)          0 ** 
 9: ? compare(max({}),MINF)          0 ** 
10: ? compare(max({}),min({}))      -1 ** 
11: ? compare(max({}),max({}))       0 
12: ? compare(max({}),PINF)          0 * 
13: ? compare(PINF,MINF)             1 
14: ? compare(PINF,min({}))          0 ** 
15: ? compare(PINF,max({}))          1 * 
16: ? compare(PINF,PINF)             0 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu