Changes

Jump to navigation Jump to search
836 bytes added ,  16:43, 10 June 2024
Line 10: Line 10:     
Once arrayfied, the function can take arrays as arguments, and for each of the cartesian product of the parameters, a result will be computed. For example, once arrayfied, v(1..2,3..4,1..10) will compute the value for v for each combination of the three parameter arrays.
 
Once arrayfied, the function can take arrays as arguments, and for each of the cartesian product of the parameters, a result will be computed. For example, once arrayfied, v(1..2,3..4,1..10) will compute the value for v for each combination of the three parameter arrays.
 +
 +
==# to split strings==
 +
 +
# splits strings into arrays.
 +
 +
If numbers are provided on the right of #, then splits can be done in a pattern. If regular expressions are provided on the right, the splits will be based on the regular expression.
 +
 +
<pre>
 +
"this"#              // Splits this to four separate elements, t, h, i and s.
 +
"this"#[3,3]        // Splits this to separate elements, of size 3, 3, etc.
 +
</pre>
    
==# to an index arrays, etc==  
 
==# to an index arrays, etc==  
 +
 +
# can be used to index arrays, as below. If the right argument is an array, it will extract all elements represented by the indices on the right. If a multi-dimensional index is required, provide a subarray, such as [[2,3]] instead of [2,3]. To get the length of elements along a particular dimension, use the notation nd (For example, 1d to extract the size along the 1st dimension).
    
<pre>
 
<pre>
(1..10)#0..2
+
(1..10)#0..2
 
(1..10)#2
 
(1..10)#2
 
(1..10)#22
 
(1..10)#22
Line 31: Line 44:  
[..4,..5]#[1,0]
 
[..4,..5]#[1,0]
 
[..4,..5]#[[1,3]]
 
[..4,..5]#[[1,3]]
+
 
2..10|.%|1..5
+
</pre>
+
<pre>
(1..10)@"SIN"!
+
 
  −
(1..100n)!
   
(1..12)#2
 
(1..12)#2
 
(1..12)#2..6
 
(1..12)#2..6
Line 59: Line 70:  
a#[["speed","weight"],[["details","size"]]] ;
 
a#[["speed","weight"],[["details","size"]]] ;
 
a#[[["details","size"]]] ;
 
a#[[["details","size"]]] ;
 +
</pre>
 +
==Other==
 +
<pre>
 +
 +
2..10|.%|1..5
 +
 +
(1..10)@"SIN"!
 +
 +
(1..100n)!
 
</pre>
 
</pre>
2,824

edits

Navigation menu