弱弱的问一个pascal的语法,关于集合类型的表达式

bigpig 2004-11-22 09:54:54
我在看一个算法,这个算法是pascal写的,可惜我没系统学过他,而且手头没书,大家给看看这个代表什么意思?
......
for i:=1 to len do l[i]=[1..n]-l[i]
......
前面是说做len次循环完成do后面的语句,不明白的就是后边的表达式
其中l为某集合的一维数组,这个集合的定义是 set of 1.....maxn 其中maxn为一常数=50
...全文
209 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
bigpig 2004-11-22
  • 打赏
  • 举报
回复
多谢wr960204(武稀松)
和楼上几位
bigpig 2004-11-22
  • 打赏
  • 举报
回复
应该是集合运算的范畴了,我好像找到了部分资料
http://www.cxsyzx.com/ReadNews.asp?NewsID=150
结贴了。
bigpig 2004-11-22
  • 打赏
  • 举报
回复
wr960204(武稀松)
是说将[1..n]这个集合中属于集合l[i]的元素去掉,然后再将余下的元素赋给l[i],这样l[i]中只有与[1..n]中不同的元素了,我这么理解对么?
yinzhiw 2004-11-22
  • 打赏
  • 举报
回复
没看懂
jinjazz 2004-11-22
  • 打赏
  • 举报
回复
The following operators take sets as operands.

Set operators
Operator Operation Operand types Result type Example
+ union set set Set1 + Set2
- difference set set S - T
* intersection set set S * T
<= subset set Boolean Q <= MySet
>= superset set Boolean S1 >= S2
= equality set Boolean S2 = MySet
<> inequality set Boolean MySet <> S1
in membership ordinal, set Boolean A in Set1
The following rules apply to +, -, and *.

An ordinal O is in X + Y if and only if O is in X or Y (or both). O is in X - Y if and only if O is in X but not in Y. O is in X * Y if and only if O is in both X and Y.
The result of a +, -, or * operation is of the type set of A..B, where A is the smallest ordinal value in the result set and B is the largest.

The following rules apply to <=, >=, =, <>, and in.

X <= Y is True just in case every member of X is a member of Y; Z >= W is equivalent to W <= Z. U = V is True just in case U and V contain exactly the same members; otherwise, U <> V is True.
For an ordinal O and a set S, O in S is True just in case O is a member of S.
武稀松 2004-11-22
  • 打赏
  • 举报
回复
[1..n]是一个集合,就是通过循环把这个集合中去掉1.....maxn其中1-Len之间的元素
hottey 2004-11-22
  • 打赏
  • 举报
回复
也许是我笨看不懂,我觉得上面的写法不正确

16,748

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 语言基础/算法/系统设计
社区管理员
  • 语言基础/算法/系统设计社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧