Difference between revisions of "Merge Functions in z^3 Sets/Arrays"

From ZCubes Wiki
Jump to navigation Jump to search
 
(3 intermediate revisions by the same user not shown)
Line 7: Line 7:
 
* mergecolumns
 
* mergecolumns
 
* mergeio
 
* mergeio
 +
  
 
'''1. merge'''
 
'''1. merge'''
Line 26: Line 27:
 
  b = [10,11,12;6,7,8];
 
  b = [10,11,12;6,7,8];
 
  c = a.mergerows(b)
 
  c = a.mergerows(b)
  '''c = [1 2  3  10 11 12'''
+
  '''c = '''
 +
      '''[1 2  3  10 11 12'''
 
       '''20 25 30  6  7 8]
 
       '''20 25 30  6  7 8]
  
Line 37: Line 39:
 
  b = [10,11,12;6,7,8];
 
  b = [10,11,12;6,7,8];
 
  c = a.mergecolumns(b)
 
  c = a.mergecolumns(b)
  '''c = 1 2  3'''
+
  '''c = '''
 +
    '''1 2  3'''
 
     '''20 25  30'''
 
     '''20 25  30'''
 
     '''10 11  12'''
 
     '''10 11  12'''
Line 43: Line 46:
  
 
'''4. mergeio'''
 
'''4. mergeio'''
 +
*mergeio merges the input that created an array such as (1..N) for a given function and outputs it into an array. So, the .input of the last calculation is appended with the output of the last calculation that caused  the array.
 +
'''c = a.mergeio()'''
 +
 +
For example:
 +
a = 1..10..2@SIN;
 +
c = a.mergeio()
 +
'''c ='''
 +
    '''1 0.8414709848078965'''
 +
    '''3 0.1411200080598672'''
 +
    '''5 -0.9589242746631385'''
 +
    '''7 0.6569865987187891'''
 +
    '''9 0.4121184852417566'''

Latest revision as of 10:18, 11 November 2016

Merge Functions


Description

There are 4 types of merges.

  • merge
  • mergerows
  • mergecolumns
  • mergeio


1. merge

  • This function facilitates the user to merge two array values using a function, such as SUM, CONCAT, etc...
c = a.merge(SomeOtherArray, SomeFunction) 
For example:
a = [1,2,3];
b = [4,5,6];
c = a.merge(b,SUM)
c = [5,7,9]

2. mergerows

  • This allows the user to merge the rows of two arrays.
c = a.mergerows(SomeOtherArray)
For example:
a = [1,2,3;20,25,30];
b = [10,11,12;6,7,8];
c = a.mergerows(b)
c =  
     [1 2  3  10 11 12
     20 25 30  6  7 8]

3. mergecolumns

  • This allows the user to merge the columns of two arrays.
c = a.mergecolumns(SomeOtherArray)
For example:
a = [1,2,3;20,25,30];
b = [10,11,12;6,7,8];
c = a.mergecolumns(b)
c = 
    1	 2   3
   20	25  30
   10	11  12
    6	 7   8

4. mergeio

  • mergeio merges the input that created an array such as (1..N) for a given function and outputs it into an array. So, the .input of the last calculation is appended with the output of the last calculation that caused the array.

c = a.mergeio()

For example:
a = 1..10..2@SIN;
c = a.mergeio()
c = 
    1	0.8414709848078965
    3	0.1411200080598672
    5	-0.9589242746631385
    7	0.6569865987187891
    9	0.4121184852417566