Sunday, December 15, 2013

Sum of (item 1 & item 0) Seperately of Plurals Of Tuples


q:(sum of(substrings separated by "." of (concatenation of((substrings separated by " " of it) whose( it contains ".")))as integer),sum of(substrings separated by "," of (concatenation of((substrings separated by " " of it) whose( it contains ",")))as integer)) of (concatenation of ((item 0 of it as string) & ". " & (item 1 of it as string)& ", " ) of ((2,2);(22,226);(222,111)))
A: 246, 339
T: 0.249 ms
I: singular ( integer, integer )

Explanation

q: (concatenation of ((item 0 of it as string) & ". " & (item 1 of it as string)& ", " ) of ((2,2);(22,226);(222,111)))
A: 2. 2, 22. 226, 222. 111,
T: 0.112 ms
I: singular string

Source is prepared by separating the elements of tuples by adding ". " with items 0 and ", " with items 1 of the plural tuples(where " " serves as a level 1 separator and "." & "," serves as level 2 separators) and then concatenating them as a whole.
Using this source we can separate the item 1 and item 0 of plural tuples to perform operations.

q:(substrings separated by " " of it) of "2. 2, 22. 226, 222. 111,"
A: 2.
A: 2,
A: 22.
A: 226,
A: 222.
A: 111,
T: 0.076 ms
I: plural substring

" "(LEVEL 1 SEPARATOR) is used to get the various elements individually along with the level 2 separators attached to them.

q:(concatenation of(substrings separated by " " of it)whose( it contains ".")) of "2. 2, 22. 226, 222. 111,"
A: 2.22.222.
T: 0.099 ms
I: singular string

here, we have concatenated the elements which consists of a particular separator, i.e., "." so that we can again perform the substrings separation method for getting the separator free elements.

q: substrings separated by "." of (concatenation of(substrings separated by " " of it)whose( it contains ".")) of "2. 2, 22. 226, 222. 111,"
A: 2
A: 22
A: 222
A:
T: 0.111 ms
I: plural substring

now, we can easily convert the elements of item 0 of the plural tuples to integers and get the sum of them.

q: sum of ((substrings separated by "." of (concatenation of(substrings separated by " " of it)whose( it contains ".")) of "2. 2, 22. 226, 222. 111,") as integer)
A: 246
T: 0.290 ms
I: singular integer

 result..!!!

No comments:

Post a Comment