aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2020-08-12 21:20:16 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2020-08-12 21:20:16 -0400
commit77b40d3ec3904846d9167d49b19bc7790b4fc84a (patch)
tree26b3a721636162f246b8d319488dff0a5af0117a
parentb3577ac65fd5ae9fc3c59e9c85053afa97b8314a (diff)
Non-pervasive Reverse and Rotate definitions
-rw-r--r--src/r.bqn8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/r.bqn b/src/r.bqn
index d84c93fb..c4b4651b 100644
--- a/src/r.bqn
+++ b/src/r.bqn
@@ -120,6 +120,9 @@ SelSub←{
}𝕩
}
+Reverse ← {!1≀=𝕩 β‹„ l←≠𝕩 β‹„ ((l-1)⊸-βŒœβ†•l) Select 𝕩}
+Rot ← {!Int𝕨 β‹„ l←≠𝕩 β‹„ 𝕨-↩lΓ—βŒŠπ•¨Γ·l β‹„ ((𝕨+⊒-lΓ—(l-𝕨)β‰€βŠ’)βŒœβ†•l) Select 𝕩}
+
_under_←{
i←↕l←1Γ—Β΄s←≒𝕩
v←β₯Šπ•¨π”½β—‹π”Ύπ•©
@@ -275,14 +278,11 @@ Windows←{
𝕨{(∾⟜(π•¨β‰ βŠΈβ†“β‰’π•©)βˆ˜β‰’β₯Š>)<βŒœβŠΈβŠβŸœπ•©Β¨s(Β¬+βŒœβ—‹Range⊒)β₯Šπ•¨}⍟(0<≠𝕨)𝕩
}
-Reverse ← {!1≀=𝕩 β‹„ (-β†•βŠΈΒ¬β‰ π•©)βŠπ•©}
-Rotate ← {!Int𝕨 β‹„ l←≠𝕩⋄(l|𝕨+↕l)βŠπ•©} _onAxes_ 0
-
Rep ← Indices⊸⊏
Replicate ← {0<=𝕨}β—Ά{π•¨βŒœβŠΈRep𝕩}β€Ώ{!𝕨=○≠𝕩⋄𝕨Rep𝕩} _onAxes_ (1-0=β‰ )
↕ ↩ Range ⊘ Windows
-⌽ ← Reverse ⊘ Rotate
+⌽ ← Reverse ⊘ (Rot _onAxes_ 0)
/ ← Indices ⊘ Replicate
Join←(1β‰ =)β—ΆβŸ¨βˆ¨Β΄1β‰ =⌜,1βŸ©β—Ά{