From a3070d80876b8480a3ee5c423cc3372b3d175a99 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Mon, 21 Dec 2020 16:55:41 -0500 Subject: Define Rank function in reference.bqn --- spec/reference.bqn | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/spec/reference.bqn b/spec/reference.bqn index b7a8f1cd..a3b9046b 100644 --- a/spec/reference.bqn +++ b/spec/reference.bqn @@ -15,14 +15,14 @@ # LAYER 0: Assumed functionality # IEEE 754, except NaN results cause an error and -0 is converted to 0. -# LIMITED to the stated cases and real number arguments. +# LIMITED to the stated cases and atomic arguments. + # Add - # Negate Subtract × # Multiply ÷ # Reciprocal Divide ⋆ # Exponential Power ⌊ # Floor -= # Rank Equals += # Equals ≤ # Less Than or Equal to # Other basic functionality that we need to assume @@ -53,6 +53,8 @@ Type # Unit (enclosed) prototype of 𝕩 ⊸ ← {(𝔽𝕨⊣𝕩)𝔾𝕩} ⟜ ← {(𝕨⊣𝕩)𝔽𝔾𝕩} +≢ ↩ IsArray◶⟨⟩‿≢ # LIMITED to monadic case + # LIMITED to numeric arguments for arithmetic cases √ ← 2⊸√ ⊘ (⋆⟜÷˜) ∧ ← × @@ -62,15 +64,18 @@ Type # Unit (enclosed) prototype of 𝕩 < ← {⟨⟩⥊⟨𝕩⟩} ⊘ (¬≤˜) > ← (¬≤) ≥ ← !∘0 ⊘ (≤˜) -≠ ← Length ⊘ (¬∘=) +≠ ← Length ⊘ (¬=) += ↩ Rank ⊘ = × ↩ 0⊸(<->) ⊘ × ⌊ ↩ ⌊ ⊘ {(𝕨>𝕩)⊑𝕨‿𝕩} ⌈ ← -∘⌊∘- ⊘ {(𝕨<𝕩)⊑𝕨‿𝕩} -≢ ↩ IsArray◶⟨⟩‿≢ # LIMITED to monadic case ¨ ← _eachm # LIMITED to monadic case and array 𝕩 ´ ← _fold +Rank ← 0⊑≢∘≢ +Length ← (0