@Riker I do all kinds of stuff. Lately, I've been doing a lot of maintenance on our User Commands and their documentation. Do you know about APL at all?
like are there prefix characters that represent math funcs, string funcs, i/o, etc. or are there just a bajillion different commands each with a single char
Just as math has Capital-Pi and Capital+Sigma for Product and Sum, so has APL the "Capital" part as a separate entity, i.e. a higher-level function ("operator") which modifies one or two functions and spits out a new custom function.
Just like math has - B, so has APL many functions of the form f B
All of APL is then built from such constructs.
Back to the "Capital" part: / in APL is that, so +/ is sum, and ×/ is product.
But any function can be to the left of the slash: MyFn/a b c d is the same as a MyFn b MyFn c MyFn d
And there are many other operators which modify functions, besides, the user can define custom operators, just like custom functions.
E.g. Twice←{⍺ ⍺⍺ ⍺ ⍺⍺ ⍵} then 2+Twice 5 gives 9
where ⍺ stands for the 2, and ⍺⍺ stands for the + and ⍵ stands for the 5.
@betseg So, just like maths use the left curly brace for cases, so does APL (but includes a right brace to indicate the end of the function:
Spell←{1=⍵: 'true'
0=⍵: 'false'}
@betseg Not exactly. The curly braces denote a function. Functions have arguments. ⍵ is the right argument, like 5 is the argument to - in -5.
There can also be an optional left argument, denoted by ⍺. as in 2+3
Arguments are not the same as input. There are two (simple) ways to get real interactive input from the user: ⎕ (yes, that's a box) lets the user enter any APL expression, and returns the result. ⍞ lets the user enter a simple string.
So ⎕ represents the box (i.e. the computer/user/input device...) and ⍞ is the same, but with a superimposed quote character (the APL delimiter for strings).
@betseg The problem is probably with order of evaluation.
While math has an intricate order of evaluation, extending this to an unlimited number of functions is just not viable. Therefore APL has one simple rule (actually a few, but we can get back to that): Just like -, everything takes whatever is on the right as its right argument.
So ⍵,2*⍵+⍳6 is the same as ⍵,(2*(⍵+(⍳6)))
, is concatenation, so you are building a two-element list of ⍵ and the expression which is similar to your original one.
The ⍵ is the argument of the entire function (in braces)
This leads us to more about order of evaluation.
An operator (higher-order function) returns a function as result. For practical purposes, they work mirrored from functions. So if an operator (like slash) takes one "operand" (plus), it goes on the left.
So +/ returns a new function (summation) which did not exist previously. That function is then applied like any other function, namely on whatever is to its right.
When I tried to execute APL it said 2 files didn't end with a newline (I don't remember exactly which) and APL didn't open. I filled those files with a single newline, then APL opened and stuck with a cursor