@Zacharý dfns are just dfns, that syntax shouldn't interfere. Except if the dfn is preceded by ←, a {…} at a lines end will never be utilized in any way ever, so I'm using that for more syntax
and does RAD even have (or is planned to have) while/for/if statements?
@dzaima Then I can see how those operands need access to their caller's arguments. Wouldn't ifElse←{⍺⍺:⍺ ⋄ ⍵} make more sense, so you can write 2 (1 ifElse) 3?
@dzaima Ah, I see what you mean. And guards are unpleasant because it is awkward to merge back the two paths. How about a way to make non-terminating guards?
{
v←1+⍵
5>v:v+←1
:2|v:v+←1
,⍨v
}
@dzaima ^ A leading : means under the same condition as above.
And of course you need the (already proposed) multiple guards being "AndIf"
@dzaima As long as you stay functional, having absence of assignment indicate termination is adequate, imho. But how would you guard multiple expressions under one condition?
@Adám that ← is a waste of precious typing time. It's completely pointless as without it the next line would literally never be called, so either it should error, or go forward
@dzaima Oh right, I forgot that dfns should just keep going if there are more code lines. But with non-terminating guards, you do need a way to say :Return. Still, you didn't answer how to do multiple things under a single condition.
@dzaima Ah, the multi-line is almost like the current technique of guard:⍺{code ⋄ code}⍵. Trailing ; just seems un-APL-like somehow. Maybe a leading ← instead? And if you really want trailing, maybe →?
@dzaima Good (I agree) so then you don't need a shying feature, and leading ← is available to terminate, as if result← but dfns' results are never named.
if the only use for shyness is whether or not a REPL should output a thing, it'd probably be worth it removing it and just making …← not implicitly output in the REPL
@Adám making class functions have to worry about shyness feels pointless. not printing the result only for setting globals feels understandable because they're always readable afterwards whereas functions could have important output inaccessible after discarding the result (e.g. arrObj.pop)
@ngn I'd rather that nothing in functions print unless explicit. But in REPL, everything prints except assignments. It is really annoying to have to hunt down the statement which generates rogue output.
@ngn my example would be a pop function. Sometimes you want to just remove a value off the top of a stack, sometimes you actually care what the result is.
another example would be a success boolean. If you know that a thing is gonna succeed you don't care that it gives 1, but if you don't, the result can be useful
not even a stupid copyright notice, not even a one-space prompt
I have a separate repl.k wrapper script that prints a one-space prompt; if rlwrap weren't so buggy I wouldn't even have that
rlwrap has an -S option to give you a prompt, but when your interpreter doesn't respond within a certain timeout, it assumes it should print a prompt already, and when the result arrives it gets printed after the prompt...
@Skidsdev OK. It is much easier to learn APL if you forget what the three letters stand for. Instead. Look at APL as a competitor to traditional mathematical notation. (I'll explain why it is better momentarily.) The fact that APL happens to also be machine executable is just a bonus.
@Skidsdev So, traditional mathematical notation grew over centuries without overall planning, and accreted all kinds of notations with no discernible system. It is even ambiguous (want examples?) and so not directly machine executable. Not to mention that typesetting math is a nightmare.
@Skidsdev Ken Iverson (a mathematician and the inventor of APL) realised some patterns where math could be generalised and harmonised, which makes Iverson's notation much more streamlined and powerful. Oh, and it fits neatly on a single line — and is machine executable.
@Skidsdev Yes. The idea to make it into a programming language only came later. No, Mathematica tries to formalise existing maths so it can be machine executed.
E.g. Iverson realised that ∑ and ∏ really are two instances of a general concept, namely reducing with a two-argument function, for instance + or ×.
So he (based on work by Oliver Heaviside) established two categories. Functions which take data and return data, and operators which take operands (they may be functions or data) and return (or "derive") functions.
Thus, the concept of reduction got its own symbol, / and sum in APL is +/ while product is ×/. (Yes, as a proper mathematical notation, APL uses × and ÷.)
Anyway, APLers call them functions and operators or, if they are linguisticly minded, verbs and adverbs/conjunctions.
Similarly, he recognised that dot, inner, cross, and matrix product really are the same operation, just applied to varying types of arguments (we'll get back to what those types are), but that is is not a single operation, but rather a composition of two two-argument functions; summation and multiplication. Thus he generalised the concept of dot-application with the symbol . and dot/inner/cross/matrix product are all +.× in APL.
Therefore, in APL, if you just use a plain × between two vectors, it means element-by-element multiplication, just as if you used +. No need to remember any special cases there.
@Skidsdev Understand the basic philosophy behind APL's functions/operators now?
Indeed, if you use the index or the pick function on a scalar, and use the empty list as indexer, you will get that sole element.
Of course, any element of an array may itself be an N-dimensional array.
Btw, APL doesn't have strings. We just use character vectors. In every regard, characters and numbers are equivalent as data. (Well, you can't do arithmetic on characters, but other than that.)
@Skidsdev Understand the basic philosophy behind APL arrays now?
@Skidsdev I'm not sure what exactly you mean? You can always reference any array without indexing it, but of course, indexing into a scalar is a no-op.
@Skidsdev A little bit about values: Just like in mathematics, a number is a number is a number. You don't have to worry about type conversions or floating point inaccuracies. APL will handle those for you. Same thing goes for characters. A character is a character, no matter how many bits are needed to represent it. And those are the only two basic data types in APL. (There are a couple of other ones, but they are not for now. They still behave according to the same principles, though.)
@H.PWiz Yeah, you have to manually activate 128 bit decimal floats, as it does have performance impact. Also, complex floats are limited to 2×64 bits of precision.
@Skidsdev But again, don't worry about the innards!
@Skidsdev OK, APL uses ← for assignment so that = always can be equality, and all comparison functions are just normal arithmetic functions returning 0s or 1s.
The box (i.e. the computer/console) is appropriately designated with a box symbol ⎕ and assignment to that writes to stdout:
In mathematics (and, in particular, functional analysis) convolution is a mathematical operation on two functions (f and g) to produce a third function that expresses how the shape of one is modified by the other. The term convolution refers to both the result function and to the process of computing it. Convolution is similar to cross-correlation. For discrete, real-valued functions, they differ only in a time reversal in one of the functions. For continuous functions, the cross-correlation operator is the adjoint of the convolution operator.
It has applications that include probability,...
Stencil codes are a class of iterative kernels
which update array elements according to some fixed pattern, called a stencil.
They are most commonly found in the codes of computer simulations, e.g. for computational fluid dynamics in the context of scientific and engineering applications.
Other notable examples include solving partial differential equations, the Jacobi kernel, the Gauss–Seidel method, image processing and cellular automata.
The regular structure of the arrays sets stencil codes apart from other modeling methods such as the Finite element method. Most finite difference codes...
CMQ: are there any better APL interpreter/keyboard apps for Android than GEMESYS's? I don't mind that much regarding the variant, as long as there's a keyboard for it
the ones I've linked (including the one I've installed, sAPL) are borderline sub-par
@Adám putting that sentence on Google, I can see that "Once your app is removed, the published version of your app won't be available on Google Play until a compliant updated [sic] is submitted."
so it probably has to do with being sure he still wants the app in a public state
@Adám not sure, probably the "[sic]" I included myself ;)...hm, did Gil suddenly violate some policy though? I don't think so, since the app is there since September 21, 2014
@Adám I just installed the keyboard, since I figured out 0.1.3 is indeed the latest version. unfortunately, it doesn't work for GEMESYS's sAPL, but it still looks useful. thanks
GEMESYS's is a DOS console and probably wants its own bytes :P
@EriktheOutgolfer If you just want a little bit of APL on the phone, TryAPL may be best. I've updated the front end to be slightly responsive. The APL Keyboard won't work on mobile, but my language bar may just.