@Adám Right, I'd forgotten about using a full program. Glad to know how the train could work though. Was having a devil of time trying to figure out where parens were needed and how forks worked and so on
@chrispsn that occurs sometimes for some reason. try clearing cookies/opening in private window/whatever other ways there are to disassociate previous state there is in browsers
cool; those are pairs of 2-digit numbers (10-99), where the sum adds up to a 2-digit number. I first wrote it with an outer-product which worked fine but generates a lot of numbers to get a small result. This attempt is to write it in a loop, generating random pairs over and over until there are five pairs
except, the first pair doesn't fit the criteria, and gets included regardless
and I can't see why; trying to use (100>+/⊃p) as a conditional-append if the sum of the pairs is less than 100, trying to start with Zilde as an empty vector to catenate onto, but the first pair gets into it always
hmmm, is it conditionally prepended Because of the right to left execution order? Should I generally think of catenate as a prepend rather than an append? or is that unrelated?
that's not inserting "nulls". Cool. Thank you Adám :)
from http://help.dyalog.com/14.0/Content/Language/Primitive%20Operators/Power%20Operator.htm > In particular, g may be Boolean 0 or 1 for conditional function application.
But before we even get there: The first thing you need to realise is that APL is different. Don't think of it as a programming language (yeah, no pun intended), but rather as a better maths.
Most primitive (that means built-in) functions (that's what we call then, not operators, which in APL is something else), can be used in two ways, like -.
TMN has a complicated (and at times ambiguous/undetermined) order of execution. Programming languages tend to have deterministic order of execution, but the rules can be very long.
Right, but APL simplifies f(g(h(x))) to f g h x and draws the conclusion that a function's right argument is the entire sub-expression on its right, until the end of the statement.
Exactly. It may seem strange at first when it comes to familiar thinks like + vs ×, but you get used to it quickly, and begin to appreciate the simplicity.
The simplest to use function is simple enclosing an expression in curly braces and using ⍵ to mean the right argument. ⍵ is the rightmost letter in the Greek alphabet.
APL operators take one or two operands (not arguments) and use them to derive a new function. In the simplest case, a so-called monadic operator takes a single function as operand and derives a related function.
E.g. + is plus. / is an operator that makes a dyadic function into a monadic fold. Also, monadic operators are post-fix to their operand: