Mix: Difference between revisions

Jump to navigation Jump to search
511 bytes added ,  06:15, 4 September 2021
Added examples
(→‎Documentation: BQN link)
(Added examples)
Line 39: Line 39:
| [[BQN]]                          || Merge    || <code>></code> || [[Shape]]          || {{No}}  || {{No}}
| [[BQN]]                          || Merge    || <code>></code> || [[Shape]]          || {{No}}  || {{No}}
|}
|}
== Examples ==
<source lang="apl">
      x ← (0 1 2) (3 4 5) (9 9)
      ⍴x ⍝ x is a nested array, i.e. array of array
3
      ↑x
0 1 2
3 4 5
9 9 0 ⍝ note that 0 is automatically added at the back due to auto-padding
      ⍴↑x ⍝ ↑x is a non-nested 2-d array
3 3
</source>
Example application, to find the longest common prefix:
<source lang="apl">
      lcp←{(+/(^/⊃=⊢)¨↓⍉↑⍵)↑⊃⍵}
      lcp 'flowers' 'flow' 'flip'
fl
      lcp 'choco' 'choky' 'chom'
cho   
</source>


== External links ==
== External links ==
24

edits

Navigation menu