Running Goal (WIP)

💡 Review Reading Goal first.

⚠️ Then work through ⎘ Goal's official tutorial. Do not waste your time here until you've done that.

What follows is an extension and recapitulation of parts of the tutorial that didn't sink in for me until I'd written my own Goal programs.

Functions

—and all things invokable

Almost everything in Goal is invokable as a function at runtime (ordered here by subjective level of surprise):

Here, invokable means it can be called using either square bracket syntax [] or the @ verb (call, apply at) or . (apply) when nominalized:

  1+2 3 4
1+2 3 4
  +[1;2 3 4]
3 4 5
  abs -3
3
  (abs)@-3
3
  +[2;3;4]
9
  (+).2 3 4
9
  +/2 3 4
9
  (/)[+;2 3 4]
9
  (+/)~(/)[+]
1
  {x-y}[3;2]
1
  2*
*[2;]
  *[2;][3]
6
  (7 8 9 10)[2]
9
  ..[a:"alpha";b:"beta"]["a"]
"alpha"
  "goal"[1;2]
"oa"
  2[4 5 6]
4 5