Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added SetReg method #324

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

added SetReg method #324

wants to merge 4 commits into from

Conversation

shewer
Copy link
Contributor

@shewer shewer commented Mar 30, 2024

  • Create obj

    • Set()
    • Set({})
    • Set( ...) --> Set({...})
  • methods

    • obj_set:keys() -- return list of key
    • obj_set:set(key) -- return self
    • obj_unset:(key) -- return self
  • operator

    • << : obj_set = Set() << key1 << key2 << key3 -- set
    • >> : obj_set = Set() >> key1 >> key2 ; -- unset
    • & : obj_set1 & obj_set2 --> return obj_set3
    • | : obj_set1 | obj_set2 --> return obj_set3
    • == : obj_set1 == obj_set2 --> return bool

Set()
* Create obj
  Set({})
  Set( ...) --> Set({...})
* methods
   obj_set:keys()  -- return list of key
   obj_set:set(key) -- return self
   obj_unset:(key) -- return self
* operator
 <<  : obj_set = Set() << key1 << key2 << key3 -- set
 >> : obj_set = Set() >> key1 >> key2 ; --  unset
  &  : obj_set1  & obj_set2 --> return obj_set3
  |  : obj_set1 | obj_set2 --> return obj_set3
  ==   :  obj_set1 == obj_set2 --> return bool
a=Set{'a','b'} 
b=Set{'a','b','c'}
c = a ~ b  -- {'c'}
d= b ~ a  --  {'c'}

a==b ---> 等同   c = a ~ b ; c:empty()
@hchunhui
Copy link
Owner

我觉得这些修改必要性不大。一方面是因为 SetReg 的功能已经完备了;另一方面 SetReg 原意只是一个最小的实现,方便 包装 C++ 接口,并不追求使用上的便利。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants