基本操作之——集合基本操作
dev_clear_window()
TupleInt1 := [3,1,2,9,1]
dev_disp_text('整形数组操作', 'window', 60, 0, 'white', 'box_color', '#00ffff4c')
dev_disp_text('数组TupleInt1包含元素'+TupleInt1, 'window', 80, 0, 'white', 'box_color', '#00ffff4c')
TupleInt2 := [10,2,4,3,2]
dev_disp_text('数组TupleInt2包含元素'+TupleInt2, 'window', 80, 280, 'white', 'box_color', '#00ffff4c')
tuple_union (TupleInt1, TupleInt2, UnionInt)
dev_disp_text('数组TupleInt1与TupleInt2的并集包含'+UnionInt, 'window', 280, 0, 'white', 'box_color', '#00ffff4c')
tuple_intersection (TupleInt1, TupleInt2, IntersectionInt)
dev_disp_text('数组TupleInt1与TupleInt2的交集包含'+IntersectionInt, 'window', 480, 0, 'white', 'box_color', '#00ffff4c')
tuple_difference (TupleInt1, TupleInt2, DifferenceInt)
dev_disp_text('数组TupleInt1与TupleInt2的差集包含'+DifferenceInt, 'window', 580, 0, 'white', 'box_color', '#00ffff4c')
tuple_symmdiff (TupleInt1, TupleInt2, SymmDiffInt)
dev_disp_text('数组TupleInt1与TupleInt2的对称差集包含'+SymmDiffInt, 'window',680, 0, 'white', 'box_color', '#00ffff4c')
* 类似操作算子
UnionIntHDev := union(TupleInt1,TupleInt2)
IntersectionIntHDev := intersection(TupleInt1,TupleInt2)
DifferenceIntHDev := difference(TupleInt1,TupleInt2)
SymmDiffIntHDev := symmdiff(TupleInt1,TupleInt2)
实现效果同上tuple相关操作算子
2.浮点型数组操作
*浮点数组操作
dev_clear_window()
TupleFloat1 := real([3,1,2,9,1])
dev_disp_text('整形数组操作', 'window', 60, 0, 'white', 'box_color', '#00ffff4c')
dev_disp_text('数组TupleFloat1包含元素'+TupleFloat1, 'window', 80, 0, 'white', 'box_color', '#00ffff4c')
TupleFloat2 := real([10,2,4,3,2])
dev_disp_text('数组TupleFloat2包含元素'+TupleFloat2, 'window', 80, 280, 'white', 'box_color', '#00ffff4c')
tuple_union (TupleFloat1, TupleFloat2, UnionFloat)
dev_disp_text('数组TupleFloat1与TupleFloat2的并集包含'+UnionFloat, 'window', 280, 0, 'white', 'box_color', '#00ffff4c')
tuple_intersection (TupleFloat1, TupleFloat2, IntersectionFloat)
dev_disp_text('数组TupleFloat1与TupleFloat2的交集包含'+IntersectionFloat, 'window', 480, 0, 'white', 'box_color', '#00ffff4c')
tuple_difference (TupleFloat1, TupleFloat2, DifferenceFloat)
dev_disp_text('数组TupleFloat1与TupleFloat2的差集包含'+DifferenceFloat, 'window', 580, 0, 'white', 'box_color', '#00ffff4c')
tuple_symmdiff (TupleFloat1, TupleFloat2, SymmDiffFloat)
dev_disp_text('数组TupleFloat1与TupleFloat2的对称差集包含'+SymmDiffFloat, 'window',680, 0, 'white', 'box_color', '#00ffff4c')
3.字符操作
*字符数组操作
dev_clear_window()
TupleString1 := ['ab','a','s','a','1']
TupleString2 := ['1','ab','a','c']
dev_disp_text('字符数组操作', 'window', 0, 0, 'white', 'box_color', '#00ffff4c')
dev_disp_text('TupleString1 := [\'ab\',\'a\',\'s\',\'a\',\'1\']', 'window', 20, 0, 'white', 'box_color', '#00ffff4c')
dev_disp_text('TupleString2 := [\'1\',\'ab\',\'a\',\'c\']', 'window', 40, 0, 'white', 'box_color', '#00ffff4c')
tuple_union (TupleString1, TupleString2, UnionString)
dev_disp_text('并集包含'+UnionString, 'window', 60, 0, 'white', 'box_color', '#00ffff4c')
tuple_intersection (TupleString1, TupleString2, IntersectionString)
dev_disp_text('交集包含'+IntersectionString, 'window', 200, 0, 'white', 'box_color', '#00ffff4c')
tuple_difference (TupleString1, TupleString2, DifferenceString)
dev_disp_text('差集包含'+DifferenceString, 'window', 280, 0, 'white', 'box_color', '#00ffff4c')
tuple_symmdiff (TupleString1, TupleString2, SymmDiffString)
dev_disp_text('对称差集包含'+SymmDiffString, 'window', 340, 0, 'white', 'box_color', '#00ffff4c')
4.混合型数组操作
* 混合型数组操作
dev_clear_window()
TupleMixed1 := [0,2.9,5,'a',3,5,'s']
TupleMixed2 := ['s',5,1,3.0,2.9]
dev_disp_text('混合型数组操作', 'window', 0, 0, 'white', 'box_color', '#00ffff4c')
dev_disp_text('TupleMixed1 := [0,2.9,5,\'a\',3,5,\'s\']', 'window', 20, 0, 'white', 'box_color', '#00ffff4c')
dev_disp_text('TupleMixed2 := [\'s\',5,1,3.0,2.9]', 'window', 40, 0, 'white', 'box_color', '#00ffff4c')
tuple_union (TupleMixed1, TupleMixed2, UnionMixed)
dev_disp_text('并集包含'+UnionMixed, 'window', 60, 0, 'white', 'box_color', '#00ffff4c')
tuple_intersection (TupleMixed1, TupleMixed2, IntersectionMixed)
dev_disp_text('交集包含'+IntersectionMixed, 'window', 200, 0, 'white', 'box_color', '#00ffff4c')
tuple_difference (TupleMixed1, TupleMixed2, DifferenceMixed)
dev_disp_text('差集包含'+DifferenceMixed, 'window', 280, 0, 'white', 'box_color', '#00ffff4c')
tuple_symmdiff (TupleMixed1, TupleMixed2, SymmDiffMixed)
dev_disp_text('对称差集包含'+SymmDiffMixed, 'window', 340, 0, 'white', 'box_color', '#00ffff4c')
5.复杂嵌套操作
* 复杂嵌套操作
dev_clear_window()
TupleMixed1 := [0,2.9,5,'a',3,5,'s']
TupleMixed2 := ['s',5,1,3.0,2.9]
dev_disp_text('复杂嵌套操作', 'window', 0, 0, 'white', 'box_color', '#00ffff4c')
dev_disp_text('TupleMixed1 := [0,2.9,5,\'a\',3,5,\'s\']', 'window', 20, 0, 'white', 'box_color', '#00ffff4c')
dev_disp_text('TupleMixed2 := [\'s\',5,1,3.0,2.9]', 'window', 40, 0, 'white', 'box_color', '#00ffff4c')
dev_disp_text('TupleString1 := [\'ab\',\'a\',\'s\',\'a\',\'1\']', 'window', 60, 0, 'white', 'box_color', '#00ffff4c')
dev_disp_text('TupleString2 := [\'1\',\'ab\',\'a\',\'c\']', 'window', 80, 0, 'white', 'box_color', '#00ffff4c')
Combined1 := union(intersection(TupleMixed1,TupleMixed2),intersection(TupleString1,TupleString2))
Combined2 := intersection(symmdiff(TupleMixed1,TupleMixed2),intersection(TupleString1,TupleString2))
dev_disp_text('union(intersection(TupleMixed1,TupleMixed2),intersection(TupleString1,TupleString2))包含'+Combined1, 'window', 140, 0, 'white', 'box_color', '#00ffff4c')
dev_disp_text('intersection(symmdiff(TupleMixed1,TupleMixed2),intersection(TupleString1,TupleString2))包含'+Combined2, 'window', 340, 0, 'white', 'box_color', '#00ffff4c')
------------------------------------
承接
**视觉检测软件开发及调试
**工业软件开发
**上位机软件开发
wechat:luoran2024
qq:565934058
email:taoyuansu@qq.com
海量教育资源及影视资源下载
微信公众号:EFun科技
------------------------------------
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!