diff --git a/docs/Array-model.md b/docs/Array-model.md index 151506e..ca2eaa4 100644 --- a/docs/Array-model.md +++ b/docs/Array-model.md @@ -521,6 +521,26 @@ The primitive rank operator `F⍤k` was introduced in Dyalog version 14.0. An AP } ``` +## An APL model of the rank operator +The primitive rank operator `F⍤k` was introduced in Dyalog version 14.0. An APL model compatible with earlier versions is as follows: +```APL + _Rank_←{ + ⍺←{⍵} + ⍺ ⍺⍺{⍺←{⍵} ⋄ ⍺ ⍺⍺ ⍵}{ + 0 1000::⎕SIGNAL ⎕EN + effrank←{0≤⍺:⍺⌊⍴⍴⍵ ⋄ 0⌈⍺+⍴⍴⍵} ⍝ effective rank + cells←{⊂[(-⍺ effrank ⍵)↑⍳⍴⍴⍵]⍵} + (m l r)←⌽3⍴⌽⍵⍵ + ⎕ML←0 ⍝ needed by ↑⍵ + 0=⎕NC'⍺':↑⍺⍺¨(m cells ⍵) ⍝ monadic case + x←l cells ⍺ + y←r cells ⍵ + ((⍴x)≡⍴y)⍱0=(⍴⍴x)⌊⍴⍴y:⎕SIGNAL 4+(⍴⍴x)≡⍴⍴y + ↑x ⍺⍺¨y ⍝ dyadic case + }⍵⍵{⍵}⍵ + } +``` + ## Reduce on an empty vector? For your interest, here are some reductions of note. Try to ask yourself why they give the results they do. Could they have been given different definitions? diff --git a/mkdocs.yml b/mkdocs.yml index 37e85f5..01c3294 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -12,7 +12,6 @@ markdown_extensions: - abbr extra_javascript: - javascripts/config.js - - https://polyfill.io/v3/polyfill.min.js?features=es6 - https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js theme: name: material @@ -23,6 +22,10 @@ theme: - navigation.instant extra_css: - style/main.css +plugins: + - privacy + - search + nav: - About: index.md - First Steps: First-steps.md