contain()

Read(3208) Label: contain,

Here’s how to use contain() function.

A.contain( x i ,… )

Description:

Check whether a given data object is a member of a certain sequence.

Syntax:

A.contain(xi,…)

Note:

The function checks whether parameter xi,… are members of sequence A or not; the number of parameters x is i. Return true if all parameters are members of sequence A, and false if not.

Parameter:

A

A sequence object or an expression that returns one

xi

Data object, which can be a number, a string or a sequence

Option:

@b

The option means that sequence A is ordered, based on which a binary search is performed in an ascending or descending order

@h

Use HASH method to increase computing efficiency; for scenarios where the sequence has a large amount of data

Return value:

Boolean value

Example:

 

A

 

1

=[1,2,8,4,5,6,7,8]

 

2

=A1.contain(8)

true.

3

=A1.contain(9)

false.

4

=[1,2,3,4,5,6,7,8,9].contain@b(8)

Use binary search when the sequence is ordered; the result is true.

5

=[[1,2,3,4,5,6,7,8],[3]].contain ([3])

true.

6

[1,3,6,aaa]

 

7

=A6.contain("aaa")

true.

8

=A1.contain(8,1)

true.

9

=A1.contain(8,9)

false.

 

 

A

B

C

 

1

10000

 

 

 

2

=to(A1)

 

 

 

3

>A2(1)=0

 

 

 

4

for A2

if A4>0

 

 

5

 

 

=A1.step(A4,A4).to(2,)

 

6

 

 

>A2(C5)=0

 

7

=A2.select(~>0)

 

 

A7’s result is a sequence consisting of prime numbers within 10,000.

8

=A7.contain@h(4447)

 

 

true; judge whether 4447 is a prime number, during which @h option is used to increase computing efficiency.

Related functions:

  A.pos()