Menu

#37 More operations on compound types.

open
nobody
None
5
2007-04-12
2007-04-12
No

Currently, the set() function is very nice because it
distinguishes between set(x) and set(L) (where L is a
list and x isn't) in a 'reasonable' way. I'd like to
see other functions (and operators?) also behave
'reasonably'. For example, min() and max() work
reasonably with numerics and strings, but unreasonably
with lists, sets, and tables. That is:

S := set(1,2,3)
write(min(S))

generates a runtime error. Conversely:

Sx := min(set(1,2,3),set(3))

assigns what is effectively an arbitrary set
(ok, it's not arbitrary, but it might as well be as
it's really based on the order in which the sets are
created).

It would be really nice if

write(min([3,2,1])

and

write(min(set(1,2,3)))

both resulting in '1' being output.

Of course, min() and max() are just examples, the
entire suite of functions should be looked at to
determine those that could be more 'reasonable'.

Discussion


Log in to post a comment.