metaeducation / rebol-issues

6 stars 1 forks source link

unique could work on typesets too #819

Open rebolbot opened 15 years ago

rebolbot commented 15 years ago

Submitted by: meijeru

this is purely in the spirit of generalization: it is the only set-theoretical function not implemented for typesets (apart from clear and empty? but I would be the first to say these are less than useful)

CC - Data [ Version: alpha 54 Type: Wish Platform: All Category: n/a Reproduce: Always Fixed-in:alpha 55 ]

rebolbot commented 15 years ago

Submitted by: BrianH

Typesets are like bitsets for types, so their contents are already and always unique. This operation would always return true. It's a noop, and would only be included for coverage.

rebolbot commented 15 years ago

Submitted by: meijeru

I see your point, the internal storage is always unique -- I was thrown by the observed duplication of types in function specs (that is purely on the text level)

but.. continuing this reasoning, unique should not be defined on bitsets either, or should it ;-)
rebolbot commented 15 years ago

Submitted by: BrianH

Noops aren't necessarily a bad thing, but that is something we need to consider as well. I don't see the harm in including it, especially if UNIQUE is considered one of a set of functions that could be supported as a group.

rebolbot commented 15 years ago

Submitted by: Ladislav

My preference is to exclude the noops in this case, since they may become a source of confusion for newcomers. (Why don't they work?)

rebolbot commented 15 years ago

Submitted by: Carl

This is an interesting question, isn't it? At first, I agreed with Ladislav that a beginner could be confused. But, how many new users will be doing data-set operations on things like typesets? Very few.

I think no-ops are useful if they help minimize code, especially in abstract higher-level functions. To allow UNIQUE as a no-op means that the implementer does not need to special case the code when a bitset or typeset is provided. The right thing will happen.

Therefore, I will support the request. It is added.