aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-02-15 20:52:54 -0500
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-02-15 20:59:31 -0500
commit19d4e4da6a93deb398f87bb6b42b1b1ee3c4926e (patch)
treecba3ffb2e035aae2cc828d3289f5e586c2bd4589 /spec
parent4fd3566067b123ba53e0923520bdc8e19fad7d83 (diff)
Give an empty result, not an error, whenever 𝕨 is longer than 𝕩 in Find
Diffstat (limited to 'spec')
-rw-r--r--spec/primitive.md2
-rw-r--r--spec/reference.bqn4
2 files changed, 3 insertions, 3 deletions
diff --git a/spec/primitive.md b/spec/primitive.md
index 95fd9392..386b0dcf 100644
--- a/spec/primitive.md
+++ b/spec/primitive.md
@@ -197,7 +197,7 @@ Dyadic search functions check whether major cells of the *principal argument* (w
- **Index of** (`⊐`) gives the smallest index of a principal argument cell that matches the cell, or `≠𝕨` if there is no such cell.
- **Progressive Index of** (`βŠ’`) processes non-principal cells in ravel order, and gives the smallest index of a principal argument cell that matches the cell that hasn't already been included in the result. Again `≠𝕨` is returned for a given cell if there is no valid cell.
-**Find** (`⍷`) indicates positions where `𝕨` appears as a contiguous subarray of a `=𝕨`-cell of `𝕩`. It has one result element for each such subarray of `𝕩`, whose value is 1 if that subarray matches `𝕩` and 0 otherwise.
+**Find** (`⍷`) indicates positions where `𝕨` appears as a contiguous subarray of a `=𝕨`-cell of `𝕩`. It has one result element for each such subarray of `𝕩`, whose value is 1 if that subarray matches `𝕩` and 0 otherwise. Find cannot result in an error unless the rank of `𝕨` is higher than that of `𝕩`. If `𝕨` is longer along one axis than the corresponding trailing axis of `𝕩`, then the result has length 0 along that axis. Any atom argument to Find is automatically enclosed.
### Sorting
diff --git a/spec/reference.bqn b/spec/reference.bqn
index c3719144..adad4f13 100644
--- a/spec/reference.bqn
+++ b/spec/reference.bqn
@@ -414,8 +414,8 @@ MarkFirst←{
Find←{
r←=𝕨
! r≀=𝕩
- 𝕨 β‰‘βŽ‰r (≒𝕨) β†•βŽ‰r 𝕩
-}
+ 𝕨 β‰‘βŽ‰r ((1+r-βŠΈβ†‘β‰’π•©)βŒŠβ‰’π•¨)βŠΈβ†•βŽ‰r 𝕩
+}β—‹ToArray
ReorderAxes←{
𝕩↩<⍟(0=≑)𝕩