Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我有一套,S = { 1, 2, 3, 4 }(内容并不重要)
S = { 1, 2, 3, 4 }
我可以说forall x in set S & x mod 2 = 0,但这会给我一个布尔答案——里面的所有数字都是偶数吗?如果我想查看集合中x mod 2 = 0为真的所有成员怎么办?
forall x in set S & x mod 2 = 0
x mod 2 = 0
将谓词应用于它的语法是什么?如何过滤奇数、偶数、高于/低于 3.5 的数字等?
试试这个语法,它将返回谓词为真的集合的成员:
{x | x in set S & x mod 2 = 0}