summarize this

AUG. 7, 2023, 3:32 P.M.
NAME_1: A Language for NAME_2
By NAME_2, For NAME_2™
Computer Things
I just added a big new section to learntla: Optimizing TLA+ Model Checking. I take a spec and then show 15 different optimizations, many of them getting a 10x runtime improvement. NAME_3 notes here. Besides that I've done very little writing the last couple weeks. I'm just in a slump: I sit down to write and the words all come out wrong. It happens sometimes and there's nothing to do about it but wait it out.

So instead of working I've been learning NAME_1.1 It originally got on my radar after I ranted about dynamic languages and a couple of users told me I'd like NAME_1. I finally checked it out last week to see if it'd make a good "calculator language". I use a hodgepodge of Python, J, Frink, and Excel to do math and they all have their own big drawbacks, so it'd be nice if NAME_1 could round them out.

After several days of experiments, I'm at a loss of how to describe NAME_1. The best I can come up with is that the language was designed by a bunch of really intelligent NAME_2. NAME_2 who spent a lot of time gathering feedback from other NAME_2.

Weird Operators
NAME_1 has no qualms about using Unicode operators. You check set membership with ∈. There's also ∉, ∋, and ∌. It's also fine with alphanumeric infix operators. String repetition op is x. Function composition is o.

> "a" x 3
aaa
> my &f = &sqrt o &abs
{noise}
> f -3
1.7320508075688772
X gives you the cross product of a list, Xf applies f to each element of the cross product, Zf does the same with zip.

> <a b c> X <1 2 3>
((a 1) (a 2) (a 3) (b 1) (b 2) (b 3) (c 1) (c 2) (c 3))
> <a b c> Xx <1 2 3>
(a aa aaa b bb bbb c cc ccc)
> <a b c> Zx <1 2 3>
(a bb ccc)
If f is an infix operator, then [f] reduces a list and [\f] accumulates it:

> [+] <1 2 3 4 5>
15
> [\+] <1 2 3 4 5>
(1 3 6 10 15)
~~ is the "anything goes" matcher.

> "abc" ~~ "abc" # do the strings match?
True
> "abc" ~~ Str # is abc a string?
True
> "abc" ~~ {.chars == 3} # is abc length 3?
True
> so "abc" ~~ /^b/ #does abc start with b?
False
Finally, there's ....

> 0,1,2...10
(0 1 2 3 4 5 6 7 8 9 10)

> 0,2,4...10
(0 2 4 6 8 10)

> 1,2,4...10
(1 2 4 8)
Defining operators
So you know how some languages let you define infix operators? NAME_1 lets you also define new circumfix and postcircumfix operators.

# circumfix
sub circumfix:<[∀ zz>($inner){sum($inner)}
> [∀ 1,3,5...10 zz
25

# vector inner product!
sub postcircumfix:<| ⟩>(@left, @inside){[+] (@left Z* @inside)}
> <1 2 3>|<4 5 6>⟩
3 There should be exactly 5 paragraphs separated by the markdown divider: ***.
user