From 971264ecf253a7907d24ed3af49db57f56dfe372 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Sun, 12 Dec 2021 10:47:10 -0500 Subject: =?UTF-8?q?Use=20/=E2=81=BC=20instead=20of=20/=E2=81=BC=E2=88=A7?= =?UTF-8?q?=20where=20appropriate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/doc/replicate.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docs/doc/replicate.html') diff --git a/docs/doc/replicate.html b/docs/doc/replicate.html index 77fcb44e..13dda8d5 100644 --- a/docs/doc/replicate.html +++ b/docs/doc/replicate.html @@ -221,13 +221,13 @@ ⟨ 3 2 1 ⟩

Finding how many times each index appears in a list of indices is often a useful thing to do, and there are a few ways to do it:

-↗️
    +˝˘ (5) = 224120  # Inefficient
+↗️
    +˝˘ (5) = 224120  # Inefficient
 ⟨ 1 1 3 0 1 ⟩
 
     ¨ 224120
 ⟨ 1 1 3 0 1 ⟩
 
-    / 224120
+    / 224120
 ⟨ 1 1 3 0 1 ⟩
 
-

For / to work, the argument has to be sorted: otherwise it won't be a valid result of /. But sorting with is no problem, and / will probably be faster than ¨ in the absence of special handling for either combination.

+

The last of these is an extension defined in the language specification. As we said, the result of Indices is always sorted, so properly there's no argument that could return 224120. But the index-counting function is very useful, so / is defined to implicitly sort its argument (which is still required to be a list of natural numbers). Since / is implemented as a single operation, it's the best way to perform this counting task.

-- cgit v1.2.3