conj()

Read(328) Label: conj,

Here’s how to use conj() function.

A .conj()

Description:

Get concatenation of all sequence-type members in a sequence.

Syntax:

A.conj(x)

Note:

The function generates a new sequence by concatenating all the sequence-type members in sequence A; compute expression x by loop and then concatenate the results when parameter x is present.

Options:

@r

Recursively concatenate members until there isn’t any sequence members

Parameters:

A

A sequence whose members are sequences

x

An expression that returns a sequence as the result

Return value:

The new sequence by concatenating all the members in sequence A

Example:

 

A

 

1

=[[1,2,3],[4,5,6]].conj()

[1,2,3,4,5,6]

2

=[[1,[2,3]],[2,5,6]].conj()

[1,[2,3],2,5,6]

3

=[[1,2,3],[3],[7]].conj()

[1,2,3,3,7]

4

=[[1,[2,3]],[2,5,6]].conj@r()

[1,2,3,2,5,6]

5

=demo.query("select * from EMPLOYEE where GENDER = 'M' order by NAME")

 

6

=demo.query("select * from EMPLOYEE where GENDER = 'F' order by NAME")

 

7

=[A5,A6].conj(~.(NAME))

[Rebecca,Ashley,…] Form a sequence by concatenating NAME field of A1 and A2

Related functions:

A.union()

A.diff()

A.isect()

A.xunion()

ch .conj()

Description:

Split each of the records in a channel, union the members and return the resulting union as a channel.

Syntax:

ch.conj()

Note:

The function computes a given expression over the records in channel ch to split each of them into a sequence or a records sequence, union the members and return the resulting union as a channel. This is an attached computation.

Parameters:

ch

Channel

An expression that returns a record sequence/table sequence

Return value:

Channel

Example:

 

A

 

1

=demo.cursor("select * from GYMNASTICSWOMEN")

The above is the content of GYMNASTICSWOMEN table

2

=channel()

Create a channel

3

=A2.conj(create(ID,NAME,COUNTRY,SUBJECT,SCORES).record([ID,NAME,COUNTRY,"VAULT",VAULT,ID,NAME,COUNTRY, "UNEVENBARS",UNEVENBARS,ID,NAME,COUNTRY,"BALANCEBEAM",BALANCEBEAM,ID,NAME,COUNTRY,"FLOOR",FLOOR]))

Split up the records in A2’s channel into a sequence, union the records and return the union result as a channel

3

=A2.fetch()

Attach ch.fetch() function that gets the final result set to A2’s channel to fetch and store the existing data in the channel

4

=A1.push(A2)

Be ready to push data in A1’s cursor into the channel, but the action needs to wait; data in A1’s cursor is pushed into the channel and operations are performed as the fetch() operation is performed over A1

5

=A1.fetch()

 

6

=A2.result()

cs .conj()

Description

 Split each of the records in a cursor, union the members and return the original cursor.

Syntax

cs.conj()

Note

The function computes the expression over the records in cursor cs to split each of them into a sequence or a record sequence, union the members and return the original cursor. Support a multicursor.

Parameters

cs

A cursor

An expression that returns a record sequence (or a table sequence)

Return value

The original cursor cs

Example

 

A

 

1

=demo.cursor("select * from GYMNASTICSWOMEN")

The above is the content of GYMNASTICSWOMEN table

2

=A1.conj(create(ID,NAME,COUNTRY,SUBJECT,SCORES).record([ID,NAME,COUNTRY,"VAULT",VAULT,ID,NAME,COUNTRY, "UNEVENBARS",UNEVENBARS,ID,NAME,COUNTRY,"BALANCEBEAM",BALANCEBEAM,ID,NAME,COUNTRY,"FLOOR",FLOOR]))

 

3

=A2.fetch()