You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If <codeclass="code">i <= 0 <= length arr</code>;returns <codeclass="code">Some value</code> where <codeclass="code">value</code> is the item at index <codeclass="code">i</code>
138
+
If <codeclass="code">i <= 0 <= length arr</code>;returns <codeclass="code">Some value</code> where <codeclass="code">value</code> is the item at index <codeclass="code">i</code>
140
139
If <codeclass="code">i</code> is out of range;returns <codeclass="code">None</code><br>
return an empty array when <codeclass="code">n</code> is negative
344
+
return an empty array when <codeclass="code">n</code> is negative
346
345
return an array of size <codeclass="code">n</code> populated by <codeclass="code">f i</code> start from <codeclass="code">0</code> to <codeclass="code">n - 1</code><br>
<pre><spanid="VALsliceToEnd"><spanclass="keyword">val</span> sliceToEnd</span> : <codeclass="type">'a array -> int -> 'a array</code></pre><divclass="info ">
476
+
<divclass="not-examples">
477
+
<codeclass="code">sliceToEnd xs offset</code> creates a new array with the elements of <codeclass="code">xs</code> starting at <codeclass="code">offset</code>
478
+
<p>
479
+
480
+
<codeclass="code">offset</code> can be negative;and is evaluated as <codeclass="code">length xs - offset</code>
481
+
<codeclass="code">sliceToEnd xs -1</code> means get the last element as a singleton array
482
+
<p>
483
+
484
+
<codeclass="code">sliceToEnd xs 0</code> will return a copy of the array<br>
from array <codeclass="code">v1</code>;starting at element number <codeclass="code">o1</code>;to array <codeclass="code">v2</code>,
521
-
starting at element number <codeclass="code">o2</code>.
540
+
starting at element number <codeclass="code">o2</code>.
522
541
<p>
523
542
524
543
It works correctly even if
525
544
<codeclass="code">v1</code> and <codeclass="code">v2</code> are the same array;and the source and
526
545
destination chunks overlap.
527
546
<p>
528
547
529
-
<codeclass="code">offset</code> can be negative;<codeclass="code">-1</code> means <codeclass="code">len - 1</code>;if <codeclass="code">len + offset</code> is still
548
+
<codeclass="code">offset</code> can be negative;<codeclass="code">-1</code> means <codeclass="code">len - 1</code>;if <codeclass="code">len + offset</code> is still
<pre><spanid="VALpartitionU"><spanclass="keyword">val</span> partitionU</span> : <codeclass="type">'a array -> ('a -> bool [@bs]) -> 'a array * 'a array</code></pre>
706
+
<pre><spanid="VALpartition"><spanclass="keyword">val</span> partition</span> : <codeclass="type">'a array -> ('a -> bool) -> 'a array * 'a array</code></pre><divclass="info ">
707
+
<divclass="not-examples">
708
+
<codeclass="code">partition f a</code> split array into tuple of two arrays based on predicate f; first of tuple where predicate cause true, second where predicate cause false<br>
709
+
710
+
</div>
711
+
<divclass="examples">
712
+
<preclass="example"><preclass="codepre"><codeclass="code"> predicate [|1;2;3;4;5|] (fun x -> if x mod 2 = 0) = ([|2;4|], [|1;2;3|]);;
713
+
predicate [|1;2;3;4;5|] (fun x -> if x mod 2 <> 0) = ([|1;2;3|], [|2;4|]);;
714
+
</code></pre></pre>
715
+
</div>
716
+
</div>
717
+
718
+
673
719
<pre><spanid="VALreduceU"><spanclass="keyword">val</span> reduceU</span> : <codeclass="type">'b array -> 'a -> ('a -> 'b -> 'a [@bs]) -> 'a</code></pre>
0 commit comments