From 0ebe9ea698213413f2652ab587e3953e0206b356 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Sat, 9 Oct 2021 22:11:22 -0400 Subject: Point out use of immediate block with predicates --- docs/doc/block.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/doc/block.html b/docs/doc/block.html index 9ae75ef7..72aaecfd 100644 --- a/docs/doc/block.html +++ b/docs/doc/block.html @@ -228,7 +228,7 @@ ERROR ↗️
    { rβ†βŒ½π•© β‹„ 't'=βŠ‘r ? r ; 𝕩 }Β¨ "test"β€Ώ"this"
 ⟨ "tset" "this" ⟩
 
-

So r is the reversed argument, and if its first character (the last one in 𝕩) is 't' then it returns r, and otherwise we abandon that line of reasoning and return 𝕩. This sounds a lot like an if statement. And { a<b ? a ; b }, which computes a⌊b the hard way, shows how the syntax can be similar to a ternary operator. But ?; is more flexible than that. It can support any number of options, with multiple tests for each oneβ€”the structure below is "if _ and _ then _; else if _ then _; else _".

+

So r is the reversed argument, and if its first character (the last one in 𝕩) is 't' then it returns r, and otherwise we abandon that line of reasoning and return 𝕩. This sounds a lot like an if statement. And { a<b ? a ; b }, which computes a⌊b the hard way, shows how the syntax can be similar to a ternary operator. This is an immediate block with multiple bodies, something that makes sense with predicates but not headers. But ?; offers more possibilities. It can support any number of options, with multiple tests for each oneβ€”the structure below is "if _ and _ then _; else if _ then _; else _".

↗️
    Thing ← { 𝕩β‰₯3? 𝕩≀8? 2|𝕩 ; 𝕩=0? @ ; ∞ }
 
     (⊒ ≍ ThingΒ¨) ↕10  # Table of arguments and results
-- 
cgit v1.2.3