From 9e952ffd79f704ffd8b0e327a7c5afbaead7a213 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Thu, 3 Dec 2020 14:53:45 -0500 Subject: Code blocks can have function results now --- docs/doc/functional.html | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'docs') diff --git a/docs/doc/functional.html b/docs/doc/functional.html index 7e3b3900..fbba17dd 100644 --- a/docs/doc/functional.html +++ b/docs/doc/functional.html @@ -76,22 +76,23 @@ }

We can pass it the exponential function as an argument by giving it the name Exp and then referring to it in lowercase (that is, in a subject role). The result is a train that adds 1 to e-1 times the argument.

-
    Exp  
+↗️
    Lin  { v0𝕏0  v0+((𝕏1)-v0)×⊢ }
+    Exp  
     Lin exp
-(1 + (1.71828182845905 × ))
+1+1.718281828459045×⊢
 

As with all functions, the result of Lin has a subject role. To use it as a function, we give it a name and then use that name with an uppercase spelling.

-
    expLin  Lin exp
+↗️
    expLin  Lin exp
     ExpLin 5
-9.59140914229523
+9.591409142295225
 

A tricker but more compact method is to use the 1-modifier {𝔽}, as the input to a modifier can have a subject or function role but its output always has a function role.

-
    (Lin exp){𝔽} 5
-9.59140914229523
+↗️
    (Lin exp){𝔽} 5
+9.591409142295225
 

Not the most accurate approximation, though.

-
    Exp 5
-148.413159102577
+↗️
    Exp 5
+148.4131591025766
 

Note also in this case that we could have used a modifier with a very similar definition to Lin. The modifier is identical in definition except that 𝕏 is replaced with 𝔽.

_lin  {
@@ -100,13 +101,14 @@
 }
 

Its call syntax is simpler as well. In other cases, however, the function version might be preferable, for example when dealing with arrays of functions or many arguments including a function.

-
    Exp _lin 5
-9.59140914229523
+↗️
    _lin  { v0𝔽0  v0+((𝔽1)-v0)×⊢ }
+    Exp _lin 5
+9.591409142295225
 

Arrays of functions

It's very convenient to put a function in an array, which is fortunate because this is one of the most important uses of functions as subjects. Here's an example of an array of functions with a reduction applied to it, composing them together.

-
    {𝕎𝕏}´ -(ט)
-(-(ט))
+↗️
    {𝕎𝕏}´ -(ט)
+⋆∘(-∘(ט))
 

Like any function, this one can be given a name and then called. A quirk of this way of defining a function is that it has a subject role (it's the result of the function {𝕎𝕏}´) and so must be defined with a lowercase name.

↗️
    gauss  {𝕎𝕏}´ -(ט)
-- 
cgit v1.2.3