Here’s how to use conj() function.
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.
Option:
@r |
Recursively concatenate members until there isn’t any sequence members |
Parameter:
A |
A sequence whose members are sequences |
x |
An expression |
Return value:
The new sequence by concatenating all the members in sequence A
Example:
|
A |
|
1 |
=[[1,2,3],[4,5,6]].conj() |
Result: [1,2,3,4,5,6] |
2 |
=[[1,[2,3]],[2,5,6]].conj() |
Result: [1,[2,3],2,5,6] |
3 |
=[[1,2,3],[3],[7]].conj() |
Result: [1,2,3,3,7] |
4 |
=[[1,[2,3]],[2,5,6]].conj@r() |
Use @r option to recursively concatenate members until there isn’t any sequence members ; the result is [1,2,3,2,5,6] |
5 |
=demo.query("select EID,NAME,GENDER from EMPLOYEE where GENDER = 'M' and EID<15 order by NAME") |
|
6 |
=demo.query("select EID,NAME,GENDER from EMPLOYEE where GENDER = 'F' and EID<5 order by NAME") |
|
7 |
=[A5,A6].conj(~.(NAME)) |
Return a sequence of NAME values in both A5 and A6 |
Related function:
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.
Parameter:
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() |
|
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.
Parameter:
cs |
A cursor/multicursor |
… |
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() |
|