From 2afb23928e1984d475cc460e1672e8f6fa0e4dbe Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Wed, 11 Aug 2021 17:21:31 -0400 Subject: Allow clicking on header to get fragment link --- docs/doc/search.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'docs/doc/search.html') diff --git a/docs/doc/search.html b/docs/doc/search.html index accd54fa..7834a06d 100644 --- a/docs/doc/search.html +++ b/docs/doc/search.html @@ -4,7 +4,7 @@ BQN: Search functions -

Search functions

+

Search functions

@@ -133,7 +133,7 @@

The searched-for argument is 𝕩 in Index-of functions (⊐⊒) and 𝕨 in Member of (). Bins Up and Down (⍋⍒) are ordering functions but follow the same pattern as Index-of. It's split into cells, but not necessarily major cells: instead, the cells used match the rank of a major cell of the other (searched-in) argument. In the most common case, when the searched-in argument is a list, 0-cells are used for the search (we might also say elements, as it gives the same result).

The result is always an array containing one number for each searched-for cell. For Index of and Member of, every result is computed independently; for Progressive Index of the result for a cell can depend on earlier cells, in index order.

-

Member of

+

Member of

The simplest of the search functions, Member of () returns 1 if an entry in 𝕨 matches some entry in 𝕩, and 0 if it doesn't.

↗️
    "green""bricks""cow""blue"  "red""green""blue"
 ⟨ 1 0 0 1 ⟩
@@ -147,7 +147,7 @@
 "tal st"
 

These are the APL functions Intersect () and Without (~). Really, only 𝕩 is treated like a set, while the ordering and multiplicity of elements of 𝕨 are maintained. I think the explicit implementations show this well, since 𝕩 is only used as the right argument to , and prefer this clarity to the brevity of a single symbol.

-

Index of

+

Index of

Index of () returns the index of the first occurrence of each entry in 𝕨, or 𝕨 if an entry doesn't appear in 𝕨 at all.

↗️
    "zero""one""two""three"  "one""eight""two"
 ⟨ 1 4 2 ⟩
@@ -160,7 +160,7 @@
     "letters" (</˘⌜˜) "let"  # Many to many
 ⟨ ⟨ 0 ⟩ ⟨ 1 4 ⟩ ⟨ 2 3 ⟩ ⟩
 
-

Progressive Index of

+

Progressive Index of

Progressive Index of (), as the name and glyph suggest, is a more sophisticated variant of Index of. Like Index of, it returns either 𝕨 or an index of a cell from 𝕨 that matches the given cell of 𝕩. Unlike Index of, no index except 𝕨 can ever be repeated. Progressive Index of returns the index of the first unused match, provided there's still one left.

↗️
    "aaa"  "aaaaa"
 ⟨ 0 1 2 3 3 ⟩
@@ -192,7 +192,7 @@
 ↗️
    ˜ "anything at all"
 ⟨ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ⟩
 
- +

Search functions are designed to search for multiple elements at once, and return an array of results. This is the array-oriented way to do it, and can allow faster algorithms to be used for the computation.

↗️
    stuff  "tacks""paper""string""tape"
 
@@ -218,7 +218,7 @@
 2
 

For Member of, the equivalent is stuff<.

-

Higher ranks

+

Higher ranks

So far we've shown search functions acting on lists. Well, and one example with a unit array slipped into the last section. In fact, if the searched-in array is a list, then the searched-for argument can have any rank.

↗️
    ("high""rank")  "list arg"
 ┌─         
-- 
cgit v1.2.3