blob: 199406fd2f67ac96fa9d32726d01d3822a478fcf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
<head>
<link href="../favicon.ico" rel="shortcut icon" type="image/x-icon"/>
<link href="../style.css" rel="stylesheet"/>
<title>BQN: Middle Dot (·)</title>
</head>
<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">help</a></div>
<h1 id="middle-dot-"><a class="header" href="#middle-dot-">Middle Dot (<code><span class='Nothing'>·</span></code>)</a></h1>
<h2 id="-nothing"><a class="header" href="#-nothing"><code><span class='Nothing'>·</span></code>: Nothing</a></h2>
<p><a class="fulldoc" href="../doc/expression.html#nothing">→full documentation</a></p>
<p>Indicates no value. If a left argument is Nothing, the function is called with no left argument, and if the right is Nothing, it's not called and "returns" Nothing.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=wrcg4oy9ICJhYmMiICAjIFJldmVyc2UgaW5zdGVhZCBvZiBSb3RhdGU=">↗️</a><pre> <span class='Nothing'>·</span> <span class='Function'>⌽</span> <span class='String'>"abc"</span> <span class='Comment'># Reverse instead of Rotate
</span>"cba"
</pre>
<h3 id="in-trains"><a class="header" href="#in-trains">In Trains</a></h3>
<p>Nothing can serve as a left argument in a train to string together multiple monadic functions.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=KC0rLSkgNQoKKC3CtystKSA1">↗️</a><pre> <span class='Paren'>(</span><span class='Function'>-+-</span><span class='Paren'>)</span> <span class='Number'>5</span>
¯10
<span class='Paren'>(</span><span class='Function'>-</span><span class='Nothing'>·</span><span class='Function'>+-</span><span class='Paren'>)</span> <span class='Number'>5</span>
5
</pre>
<h3 id="destructuring"><a class="header" href="#destructuring">Destructuring</a></h3>
<p><a class="fulldoc" href="../doc/expression.html#destructuring">→full documentation</a></p>
<p>For pattern matching in assignment or a block header, Nothing indicates an unused value.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=RiDihpAge/CdlYogYeKAv8K34oC/YjogYeKIvmJ9CgpGIDHigL8y4oC/Mw==">↗️</a><pre> <span class='Function'>F</span> <span class='Gets'>←</span> <span class='Brace'>{</span><span class='Function'>𝕊</span> <span class='Value'>a</span><span class='Ligature'>‿</span><span class='Nothing'>·</span><span class='Ligature'>‿</span><span class='Value'>b</span><span class='Head'>:</span> <span class='Value'>a</span><span class='Function'>∾</span><span class='Value'>b</span><span class='Brace'>}</span>
<span class='Function'>F</span> <span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>3</span>
⟨ 1 3 ⟩
</pre>
|