The APL Orchard

apl.chat ― Learn, teach, ask, code, golf, & discuss usage. See ...
Jan 28, 2022 12:50
@AndréLeria …only if you get something in return for the performance that you leave on the table. Programmers’ productivity is a good reason, sloppiness is not a good reason. Alas, many programmers don’t know or don’t care enough about what’s going on in the actual hardware machine. (Not talking about this group, obviously.)
Jan 28, 2022 12:42
@xpqz I agree. Even though Python is not perfect, it has a fairly clean syntax with less syntactic overhead than other C-like languages. It can be compiled (with some restrictions). APL could also be compiled in a similar way, if it had even a fraction of the Python market share. It’s all a matter of having enough smart people investing enough time on it. APLers strike me as a smart, but very small, bunch.
Jan 28, 2022 12:36
@KamilaSzewczyk that would be easily treated as an exception by the compiler and passed to an interpreter or JIT compiler. eval alone doesn’t sound a convincing reason for not compiling.
Jan 28, 2022 12:31
@KamilaSzewczyk not sure about this. Programming “to the metal” has the great advantage of forcing you to be frugal. Today’s overbloated, overlarge, overfat, overslow application are a direct result of HLL’s and many layers of libs and frameworks.
Jan 27, 2022 16:22
@rak1507 They're also recording it.
Jan 27, 2022 16:22
@rak1507 Hasn't really started yet. They're having tech problems with screen sharing.
Jan 27, 2022 11:48
@Adám Yes, that works. In a JupyBook transcript the statement of the problem and the examples could be added, so that it can be read without following the hyperlink.
Jan 27, 2022 11:46
@Adám OK, then our Jupyter-book-expert-in-residence @xpqz will have to transcribe... ha ha
Jan 27, 2022 11:45
@Adám ah, you're thinking Github?
Jan 27, 2022 11:45
Would a Jupyter Book work as a repo? @xpqz? @Adám?
Jan 27, 2022 11:43
@Adám It'd be nice if the repo of solutions had some structure to it, e.g. rating for speed, conciseness, elegance, handling of corner cases, etc.
Jan 27, 2022 11:42
@Adám I see that @Adám prefers a planned season. That works as well, but it may be a bit rigid.
Jan 27, 2022 11:41
So, this week the problem for next week is announced, and at the end of a session a new problem is announced for the following week?
Jan 27, 2022 09:57
So, aren't we glad that programming languages are a bit human after all?
Jan 27, 2022 09:56
Cool
Jan 27, 2022 09:56
@xpqz Yes, I just found it... :)
Jan 27, 2022 09:55
@xpqz Huh? This? lagomframework.com
Jan 27, 2022 09:54
@user17925981 Comparison tolerance is about 100 times higher than the residual imaginary part.
Jan 27, 2022 09:53
⋄ ⎕CT
Jan 27, 2022 09:53
@user17925981 Here:
Jan 27, 2022 09:52
Jan 27, 2022 09:50
@xpqz ...which is a bit unfair to APL-ers, but OTOH it's not different than with natural languages. As everyone who speaks 2+ languages knows (probably everyone in this chat) there are concepts that are easily expressed in one language and untranslatable to another language.
Jan 27, 2022 09:47
⋄ ¯1 = *0J1×○1
Jan 27, 2022 09:46
⋄ *0J1×○1
Jan 27, 2022 09:46
@user17925981 you should get ¯1J1.224646799E¯16, which is substantially -1
Jan 25, 2022 12:57
@Adám FWIW, I like Dyalog APL’s glyphs. Haven’t used J, but I read some of R. Hui and K. Iverson’s papers about J, and I find it difficult to associate in my mind functions to pairs of ASCII chars. OTH, I perceive APL’s unique glyphs as strongly associated with their respective functions.
Jan 24, 2022 19:53
@xpqz a local var entangled with a glob... ha ha
Jan 23, 2022 13:26
@Adám if the result is not representable, it should be a RANGE ERROR, rather than a DOMAIN ERROR... shouldn't it?
Jan 22, 2022 23:43
@Adám Good to know. Thanks, @Adám!
Jan 22, 2022 22:06
@KamilaSzewczyk TBH, I didn't put much thought into this. I was thinking that, if the factorial function of your example were downstream several other functions, the domains and ranges of the chain of functions would be all interrelated. However, upon further consideration, the domain could be checked for each function as a standalone, once it is about to be executed, rather than upfront before the whole expression is executed.
Jan 22, 2022 22:03
Perhaps there could be a verbose mode to print errors, or more information could be stored in a system variable that can be queried on demand. To expand on the RANK ERROR message, I would want to know which function or operator caused the error and print the array that had a rank mismatch. I speculate that probably it would not be too complicated to add this functionality to the interpreter.
Jan 22, 2022 22:00
I agree that the Dyalog error messages are a bit cryptic. I often struggle trying to understand where the problem is. It would be helpful if more information were printed out. To make a trivial example, even printing RANK ERROR: EXPECTED: 2, ACTUAL: 3, rather than just RANK ERROR.
Jan 22, 2022 19:14
@KamilaSzewczyk Probably the parser detect the error...?
Jan 22, 2022 19:13
it kind of depends on how you look at the function. Is it the mathematical factorial? (probably not) or the Dyalog APL factorial? (probably yes)
I suppose it would be very difficult for the interpreter — probably impossible in the general case — to return a DOMAIN ERROR for domain violations of the mathematical function and a LIMIT ERROR for violations of the *implemented* function. The interpreter would have to do (a lot of) symbolic function calculations before performing the numeric calculation, or perhaps *after* the numeric calculation fails. Either way, very costly and error prone. Is
Jan 20, 2022 18:15
@Adám I will concede that it would look much better.
Jan 20, 2022 18:07
@FawnLocke thanks. Read it. I'm glad that it's possible but TBH it's really ugly.
Jan 20, 2022 18:01
@FawnLocke thanks, I didn't know. I will look into this.
Jan 20, 2022 17:58
@Adám yes please! the fact that functions are not first-class citizens in APL bothers me, because you can have arrays everywhere and functions everywhere, except that you cannot have arrays of functions (which are very useful).
Jan 20, 2022 17:55
@Adám ha! I am soooo clever that I even imagined something that is a thing! ha ha ha
Jan 20, 2022 17:54
@Adám this is what a repeat...until typically do in Pascal and other languages. Condition is checked at the end. Those languages also offer while... constructs for this reason, but it is clearly a duplication.
Jan 20, 2022 17:51
(in case we want to create meta-operators)
Jan 20, 2022 17:51
@Adám maybe we need to indicate operator arguments with ⍺⍺⍺ :-)
Jan 20, 2022 17:44
@FawnLocke isn't this an unintended consequence of the / glyph also being used for a function? I tried a few times with other operators whose glyphs are not overloaded and they are not being substituted to ⍺⍺. I get syntax error. @Adám, what do you say?
Jan 20, 2022 17:32
@Adám yes, of course — but I have a demanding day job and I started looking into APL for the first time only about 3 weeks ago... :-)
Jan 20, 2022 17:31
@FawnLocke not with fixed number of iterations, but used as a repeat...until. It can be more readable (and probably more efficient) than recursion.
Jan 20, 2022 17:30
@Adám I haven't tried writing tradfns, yet...
Jan 20, 2022 17:29
@FawnLocke ...and power operator in general, not just inverses.
Jan 20, 2022 17:27
@Adám What's a mistake? I am talking about the aesthetic impression I get when I look at code.
Jan 20, 2022 17:24
@Adám I always get the impression that tradfn's look like imperative language, whereas dfn's (and even more so tacit) look like functional language. I think there's a beauty to behold in arrays+pure functions.
Jan 20, 2022 17:21
@Adám not only because it's regular, but also because it has almost no syntax and no glue between language elements; some of the problems appear more strikingly visible because of APL's terseness. In other languages, you add a bit more glue (another function call) that hides problems under the rug.