@Konrad'Unrooted'Klawikowski I share your reservations about the js language but I love RIDE. I'm also a big fan of the Dyalog-jupyter bridge which lets write jupyter notebooks with APL code.
@Adám Yeah, I'm actually quite amazed that such a language exists. Do you happen to know the motivation behind creating APL? Or maybe this isn't a place to ask such questions?
@AbhishekSingh Absolutely on topic. APL was created by a mathematician, not a computer scientist. He was frustrated with various issues in Traditional Mathematical Notation (let's call it TMN) and its inability to describe processes. So he took the best of TMN and harmonised it and generalised it. It was then used to describe a major computer system that IBM made. Iverson wrote a paper and book titled "A Programming Language" about how it could be used even to instruct a computer.
Then some people around him decided to implement it, and adapted his notation so it could be typed on a single line, using a type writer. It was then named A.P.L.
i'm struggling a bit with "find Xth number that satisfies the property [...]", the property is a bit complex so I wrote a dfn to check if a number satisfies it, but i can't figure out a way to find the Xth number, specifically. I thought about using the power operator (somehow?) but I'm not seeing it
I'd also like to avoid traditional control structures
@Adám That's true. Thanks. And it's working nicely for import (bytes to nanoseconds) but the other way I have to deal with 64-bit integers which I can't change to bytes with ⎕DR.
Very good question. I have been thinking for a few years about how to facilitate APLers and APL-using companies finding each other. Maybe we can have a Jobs page on APL Wiki.
@KamilaSzewczyk Dyalog has been helping some customers find people. Being among the top (not necessarily winning, but getting one's name published) in the competition has also secured some a job. Interning at Dyalog is also a way to make some contacts.
@dzaima Been working on making my BQN primitive tests more complete, and adding some cases that should fail. Did you mean to keep the dzaima/BQN definitions for monadic -⌊⌈| after adding affine characters? I'm okay with ⌊⌈| even though I don't think the analogy is very accurate, but - with affine characters is just too confusing.
@Marshall I had forgotten - exists, it probably is worth removing. (i don't have | for characters, and IMO ⌈⌊ for chars is about as related to them for numbers as the monadic and dyadic versions are related)
A different issue is that I'm not sure whether dyadic ⌊⌈ should be defined on characters. My implementation allows it just because it uses ≤≥, but it's kind of a weird extension.
@dzaima True about ⌈⌊, but it's usually easy to distinguish monadic and dyadic cases of a function and not so easy to separate different argument types. The thing I would be concerned about is something like replacing (⌊=⌈) with ⌊⊸= because they're the same for numbers, and breaking code intended for characters.
@rak1507 Not sure I fall into either category but, aged 73 notwithstanding, I hope I'd feel at home in the group. I've been thinking solitary thoughts about similar aims for about three decades.
@Marshall the only reason I "accept" ≤≥ is because of TAO, otherwise I'd happily forbid mixing argument types. Making ⌈⌊ use TAO is just pointless as far as I care
I think I'll leave it out of the tests at least; I might also add a line to the spec to say that it's not required, since the reference implementations imply that it is.
@Marshall Why is that? Why not just consider characterness another dimension? You could even allow something like 10c1 (or just 10c as a scalar character, like how 10j1 is a convenient way to avoid (10+i).
@Adám I do consider it another dimension. Under TAO, the dimensions for ordering are characterness, then real, then imaginary. It just doesn't need a tuple notation.
Tuple notation would also mean that I have to choose an origin for the characters (@ I guess), where addition lets the programmer use whatever origin is convenient.
@Adám I'm much more likely to use an origin of '0' or 'a'. An origin of @ only makes sense if you think characters are secretly just numbers, in which case, why not just use numbers?
@Adám Putting characterness after realness also requires you to choose an origin, and I don't think the resulting comparisons are useful. Why should 6 be less than '3'?
@Adám BQN character literals allow any character without any escaping, newlines being the most annoying one as it isn't too pretty to have a multiline single character literal
@Adám not in the affine world. There's literally no relation between '3' and 51 (besides implementation details and the fact that '3'-n is not a valid character for any n>51)
@dzaima Clearly, I don't understand the affine char system, though I thought I did. I'll be quiet then, instead of speaking of things I don't understand.
The relation between '3' and 51 is @, which is just some random character.
Now @ is a keyword because being the smallest character makes it convenient to use as an origin, and a lot of programmers use it that way, but that doesn't mean it's the origin or anything. It's just useful.
@Adám that would imply that the "value"/importance in comparison of characterness is infinitesimally small (while it's obviously pretty important), whereas the current BQN definiton makes the "value" of characterness >infinity
@Adám Better, because you will never need to multiply @ by a coefficient.
Keep in mind that I'm a literal notation minimalist. If there's a reasonably convenient way to encode any atom as a literal, then I don't see any need to go further. Complex computation is for functions.
@dzaima Probably the only things you want to do with newlines are joining lines and splitting lines though. Seems better to have a library that gives you those text manipulation functions (I guess it might define nl as well).
@Marshall i have a simple custom assembly parser i wrote in BQN, which uses the nl constant 5 times in the main function (creating multiple masks, and also in nl¨⌾…), plus 3 times in an another function
@dzaima But would 10@ or '\n' (which I guess does seem reasonable) actually be an improvement there? Writing nl←@+10 once is hardly a lot of boilerplate.
@dzaima Why? That's what I did in md.bqn (I called it lf). Isn't it basically the same as defining Avogadro's number or whatever at the top of your chemistry library as a global constant?
@dzaima I don't think this line of argument makes sense. BQN has exactly two ways to write characters: single quotes and the special literal @. Any argument from consistency should end up concluding that it's less reasonable to add some special extra notation to cover a specific case, because the language clearly doesn't make character input a priority.
@Marshall my argument is that the single quote literal notation is, inconsistently compared to every other character, incredibly awful at representing newline literals (and that the @+ notation is a bad replacement)
Personally, I'd hope that parsing and formatting text is usually handled by having a library that works with the format you care about, so that the average BQN progammer doesn't have to deal with it. Even if that's not the case, it's probably better to separate the string-based code from the actual logic. So files that deal with newlines shouldn't be too common, and putting nl←@+10 at the top of each of those would be fine.
@Adám •lf is probably better. •n feels too non-descriptive
@dzaima (or maybe '\n', who knows. either way, i believe having a non-stupid newline literal is quite important as it's, imo, in the top 5 of the most useful character literals)
@dzaima I like '\n' a lot more as • tends to be an indication that the code in question is doing something "special" and I wouldn't want to weaken that pattern.
@Adám ah, that. I do also have •la as an alternative for •l, •l was mostly just for golfing
@rak1507 it's still kind of abusive of the character literal notation (in it, ''' is a valid literal of the single quote, and '\' is a valid backslash literal)
@Marshall you already can't "normally" put double quotes in string literals, and, if you want to keep the string to a single line, you can't at all put newlines in the string, adding such an escape character would add newlines to the trivial list
@Marshall •d∾6↑•a vs ('0'+↕10)∾'A'+↕6 is a bigger difference. Of course, hex base en/decoding library, but that doesn't yet exist (and it'd have to be as a part of some other bigger library to not end up with npm's problem of thousands of libraries per project)
@dzaima ∾"0A"+⟜↕¨10‿6 is a bit shorter. And you only have to define it once if you're working with hex. I still don't get why you're so averse to defining your own constants.
@dzaima How would you do it in a non-array language? I agree that •d in particular makes this use case simpler (and it's only •d: •d∾'A'+↕6 is hardly worse than •d∾6↑•a), but treating this as some ultra-simple idea just seems like privileging the APL way of doing things excessively.
@Wezl It's error-prone though. I used it in J and I wouldn't want to go back to it.
@Adám See also Ranges in md.bqn, which I think reduces to ∾ ·(⊣+↕∘¬)¨˝˘ ∘‿2⊸⥊ if you write it more compactly. I used Ranges "AZaz09++//" to get all the Base64 characters.
@dzaima 'A'+↕26 is undeniably easy to understand though. And it's obvious how one would get the lowercase alphabet or other language alphabets, as long as they're grouped together in Unicode.
I think it's wrong to use • for trivial convenience, because the language developer can't do as good of a job as library authors. If it's too much trouble to use a library then we need to look into ways of making libraries more convenient.
@dzaima If you're going to use an array language and not actually use its capabilities, that's not my problem. The point of an array language is to accomplish significant functionality using short combinations from a small number of generally useful symbols. 'A'+↕26 is succeeding at that task perfectly. If someone can't be bothered to understand it or write it then they should use a different language.
(also imo there's like no benefit of 'A'+↕26 over "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - the former takes time reading the separate builtins and joining them together (especially in a longer expression), whereas the latter is immediately clearly an alphabet)
@Marshall that requires importing the library always, polluting the import list, whereas copy-pasting leaves no marks and has the benefit of being clearer at a glance.
(imagine reading code starting with ⟨alphabet⟩←•Import"alphabet" ⋄ ⟨digits⟩←•Import"digits")
Given that so many languages don't have a built-in alphabet constant, even though they don't have a convenient way to generate the alphabet, I feel pretty strongly that the reason we're having this debate is that APL has them and you're being loss-averse. The amount of effort saved is really miniscule, and I don't think it's anywhere near worth having to remember another three system constants.
@dzaima (obviously i'm over-exaggerating there, but even just the alphabet import plus using it is longer than the string literal constant, and shortening names is hard in a library)
@Marshall in those languages that don't have a built-in alphabet constant, everyone just uses the literal, which you've established is error-prone. I don't think BQN people would stop hardcoding just because it's shorter instead of longer.
@dzaima Honestly, fine with me. Presumably they'd be grouped together in a string constants library though. I don't think a long list of imports is a problem, since you can just skim past it and search it when you see a variable you don't recognize.
@Marshall point being, it's more effort than a hardcoded constant ⇒ people will just hard-code the constant (and, if it's a library, surely it's not simple to do in code, right?)
@Marshall •a clearly shows that it is supposed to be used as the alphabet constant. 'A'+↕26 is just a random assortment of builtins that just happen to give an alphabet that you have to put in effort to write
people would obviously maybe use 'A'+↕26 if they knew about it, but the chance that one figures out that before finishing writing the alphabet manually is quite low
@dzaima 'A'+↕26 is idiomatic usage. I've shown examples like that several times in the docs. It takes about as much time to learn as the names •a, •l, and •d if you understand array programming, and it's more general.
@Marshall if you define 'A'+↕26 to a variable, it's simple enough to just have a hardcoded constant. If you don't and use it inline, you break the ability to interpret surrounding code as nested idioms don't really work
@Adám back to that, that seems like a nice idea. Would \x0D be allowed? \u000D?
Technically I guess I am :) I installed both Dyalog and GNU APL a month or so ago, with the intent to start learning. I'm finding it very interesting!
Is it generally considered OK to ask questions about both implementations, and their differences here? I couldn't find anything else online other than the GNU bug-apl mailing list ...
I'm actually finding it useful to use GNU APL to try examples while reading "Mastering..." from Dyalog; when something doesn't work, I then stop and check out why. :)
Btw, asking APL questions on Stack Overflow is perfectly alright too. They are usually answered very quickly, and you tend to get more varied answers there than here.
OK. I currently have a question about an example on tryapl.org, which didn't work in GNU -- but I came up with my own solution using its supported operators.. and wondering if I'm on the right track, or is there a more efficient (and/or clear) way to do it?
Aha.. I see my solution is boxed differently. Of course it's much more verbose as well, due to my limited vocabulary so far; and I assume the main reason for the Key ⌸ op is that it simplifies a lot of this :)
OK, yes I am still learning how/where to simplify terms on this too
Indeed :). I built up this solution in steps, then composing them together I wasn't sure of the best way to 'lift' the literal (I had assigned M ← 'Mississippi' for testing and was using in each term as I worked toward the solution).
I guess my question really is: without using the ⌸ op, is it possible to significantly simplify and get the same result (at least for a flat vector such as this string)
I of course would make something using sub-dfns if I were making something re-usable, it was an exercise in trying to understand how to use the ⍺ ⍵ in scope and so on.