newRPL - build 1255 released! [updated to 1299]
|
02-18-2019, 08:21 PM
Post: #381
|
|||
|
|||
RE: newRPL - build 1089 released! [update:build 1158]
I did some more thinking on list variants, I thought I'd share. Think of this as a speculative dream, not a list of demands.
First, any list can be converted into "multiset" format. I'm not sure how this should be displayed, but mechanically it's basically two lists: One of elements, one of their multiplicities. ADDing two multiset lists would just add the multiplicities for elements they have in common. A new UNION command would instead take the MAX of the two multiplicities. INTERSECT (or some shorter name) would take their MIN instead. SSUB (set subtraction) would subtract the multiplicities, treating negative numbers as zero. (Naturally, a multiplicity of zero means being removed from the list.) (I've actually coded a version of set subtraction for regular lists in oldRPL. It has all sorts of unexpected uses!) There would be a command to split a multiset into two regular lists, one of elements and one of multiplicities. Also one to retrieve the multiplicity of a given element. (Incidentally, if multisets exist, they would be the natural way for FACTORS to output.) Sets would then just be multiset lists in which the multiplicities would be constrained to be at most one. I think multisets are actually more useful than sets, though harder to get working. You can immediately convert a multiset into a set by setting all multiplicities to 1. The question remains how multisets should respond to operations like '+' and '*'. I'm honestly not sure yet. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 8 Guest(s)