« first day (1428 days earlier)      last day (1269 days later) » 
06:00 - 19:0019:00 - 00:00

6:01 AM
@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.
*lets me
4 hours later…
10:11 AM
everything will be rewritten in JS, eventually, and there's nothing to stop that
We are not down to three browser engines. The developers could get together and decide to support an additional language natively…
@AbhishekSingh Hi. Interested in APL?
10:38 AM
@Adám Hi Adam! I stumbled at this site from a link somebody posted in one of AOC's thread.
@AbhishekSingh Cool. So you've seen some APL code and now you're curious?
11:01 AM
@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.
@Adám So you mean I can replace ⌽[0] with ⊖? Because I think it's not working otherwise. {(⊖⍵)≡⌽[0]⍵}8 8⍴11⎕DR¯3 10 ⎕DT⊂2020 12 23 13 00 00 000000000
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.
@kimmolinna That gives 1 by me:
⋄ ⎕IO←0 ⋄ {(⊖⍵)≡⌽[0]⍵}8 8⍴11⎕DR¯3 10 ⎕DT⊂2020 12 23 13 00 00 000000000
@Adám 1
today's AOC was interesting
11:09 AM
@Adám For me too but I thougt you suggested first ⊖11 ⎕DR⍪⍵ and it's not working for me.
I need to get part 2 down now
@kimmolinna That should work if the argument consists of bytes, but not if it is a single float.
@AbhishekSingh Are you into mathematics?
@Adám OK. I have 64 bits and I have take care of Little Endian format...
@kimmolinna Sure, that's what the reversal is for, but if you give 11⎕DR a 1-column matrix of bytes, it will return an 8-column matrix of bits.
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
11:18 AM
You want to just iterate through all integers until the Nth is found?
@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.
@kimmolinna Right, so how are you reading the 64-bit integers in?
@KamilaSzewczyk Maybe something like ⋄ IsPrime←2=0+.=⍳|⊢ ⋄ X←5 ⋄ N←0 ⋄ {n←1+⍵ ⋄ N+←IsPrime n ⋄ n}⍣{N=X} 0
@Adám 11
Alternatively, you could accumulate numbers until you have X of them: ⋄ IsPrime←2=0+.=⍳|⊢ ⋄ X←5 ⋄ r←⍬ ⋄ {r,←⍵/⍨IsPrime ⍵ ⋄ 1+⍵}⍣{X=≢r} 0 ⋄ ⊃⌽r
11:28 AM
Oh, the bot doesn't respect shyness, it seem. ⋄ test←42
@Adám (no output)
Never mind. My bad. That function isn't shy.
i was thinking what are the job opportunities of APL
if so many people find it a practical language
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.
@Adám Using Conga with KDB+/IPC I will get bytes and after that it's like this {{⊃⍵:-2⊥~⍵⋄2⊥⍵},⊖11 ⎕DR⍪⍵}⎕ucs bytes
11:31 AM
@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.
why don't the companies just use SO Jobs, linkedin or something
@Adám And export from integer to bytes is now 2⊥⍉8 8⍴11 ⎕DR ¯3 10 ⎕DT⊂2020 12 23 13 0 0 0
What are the rules about referrals in the competition? I can't quite remember them and also they might change I suppose
11:49 AM
@Adám Exporting 64-bit integer I will do it like {⎕FR←1287 ⋄ ,↓⍉⌽[0](8⍴256)⊤(×⍵)×9223372036854776000⌊|⍵}⍵. My previous export was for TimeStamp.
@Adám And using what I just learned ... ↓⍉⊖(8⍴256)⊤
1 hour later…
1:07 PM
@Adám ultimately I came up with this horrible thing: {x←⍵⋄n←0⋄{y←1+⍵⋄n+←{0=+/(+/x)(×/x←⍎¨⍕⍵)|⍵ ⍵}y⋄y}⍣{n=x}0}
i'll now spend some time trying to golf it
I made it into an operator: {x←⍵⋄n←0⋄⍺⍺{y←1+⍵⋄n+←⍺⍺y⋄y}⍣{n=x}0}
1:37 PM
@rak1507 You can read about them on the competition site, under "Referral awards".
@KamilaSzewczyk I don't know. Maybe they expect APLers there, so there's no reason for APLers to go there, etc.…
1:52 PM
{x←⍵⋄n←0⋄{y←1+⍵⋄n+←0=+/((1∘⊥,×/)⍎¨⍕y)|y y⋄y}⍣{n=x}0}
seems a tiny bit smaller
@KamilaSzewczyk Would a recursive solution be better?
2:20 PM
@KamilaSzewczyk maybe see this code: github.com/abrudz/dyalog-apl-extended/blob/master/…
@Adám good question, I'll check that
@Razetime I don't think it's of much use
it's got an isprime function idk
i'm not interested in primes
also this isprime function seems to be tuned for performance
look at this giant lookup table on the bottom, even if i did primes, no way i include it in my program
@Razetime I was just using IsPrime since "the property is a bit complex" wasn't specified.
2:48 PM
@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.
@Marshall that is a good question. The affine definition gives it a clear definition, but I don't see it ever being useful
@Marshall Is characterness higher than noncharacterness, so 'A'⌊66 gives 65 while 'A'⌈66 gives 'B'?
@Adám Aside from the off-by-ones (???), yes, that's right.
2:58 PM
@Marshall Off-by-ones?
@Adám oh, that clears it up for me - dyadic ⌊⌈ should definitely only work on numbers.
@Adám 65 ≡ 'A'⌊66 doesn't make sense in any context
@Adám You subtracted one in the first result and added one in the second. 'A'⌊66 is 66 and 'A'⌈66 is 'A'.
No no, I meant that if we look at 'A' as a (value,characterness) tuple, (65,1) then 66 is (66,0).
@dzaima I don't follow. Is there a reason that makes the extension to ⌊⌈ worse than the one for ≤≥?
@Adám 'A' is a sum of 65 and (1×characterness) not a tuple
3:02 PM
Isn't that parallel to 65j1 except with limits to what constitutes valid values?
@Adám it is, I was just about to write that 65j1⌈66j0 isn't 66j1
@dzaima No, because there are other arithmetic rules for characters than complex numbers. For characters, the two parts are computed separately.
Making pervasive doesn't have any linear algebra basis; it's just an array programming thing.
@Adám alternatively, (65+x)⌈66 (with x being a symbolic value) isn't 66+x
@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.
3:06 PM
@dzaima Yes, all you really need is the axiom @>∞.
Ah, then my understanding of these affine characters was wrong all along.
I thought that 'A'<66 just like 65j1<66 with a TAO-enabled <.
what does TAO mean?
@KamilaSzewczyk Total Array Ordering
@KamilaSzewczyk See here.
@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
3:09 PM
@Adám Yes, there's a difference in that i (0j1) is considered smaller than any positive real number, while @ is considered larger.
@dzaima It also seems pointless to me, but I see the question as whether it's simpler to allow it or forbid it.
@Marshall "simpler" depends pretty much only on the impl and its performance goals
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.
that's reasonable
@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.
3:20 PM
@dzaima pushed
@Marshall Ah, I see. I would probably have put characterness after real to allow various useful comparisons.
@dzaima The other thing that failed in my tests was that @-1 wrapped around instead of giving an error. So (@-1)-@ isn't -1.
@Marshall I don't see that as an issue. The origin is obviously @. It would just be nice to be able to write things like 10c instead of (@+10).
@KamilaSzewczyk for that i would try the pattern: 1+⍣{prop⍺}⍣X⊢init
@ngn Ooh, nice.
I'll add {1+⍣(⍺⍺⊣)⍣⍵⊢0} to APLcart.
3:27 PM
@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?
@Marshall i kind of intentionally ignored that problem. erroring makes sense, but then i'd also need to error on @+2*16 for now
@Adám the 10c notation makes sense pretty much only for the newline character, for everything else it's pretty pointless
@dzaima I would have thought any of the commonly escaped characters make sense to escape.
@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
@Marshall What? Isn't 6<'3' in your common scheme? I was suggesting (51<'3')∧52>'3'
@dzaima It may not be a good idea to have 27s and 0s and 8s etc. in your source code.
3:33 PM
@Adám Yes, because 6 is less than any character. Doesn't '3' being between 51 and 52 seem kind of artificial?
@kimmolinna why not export 64bit floats as what they are and let kdb+ do the conversion to ints?
@Adám @ is already the null char constant. And how often are you going to want to have actual non-printable characters?
@Marshall Doesn't 51j1 being between 51 and 52 seem odd?
@Adám No, since it's clearly related to 51, which is only one off from 52.
And '3' is related to 51 too.
3:36 PM
@Adám No it isn't!
@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)
@Marshall I think it is, closer than 51j1 even.
@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.
@Adám I think you understand it; you just think there is something special about @ other than it being the smallest character.
@Adám '3' is 51 + (characterness of origin "\0"). It could also be 3 + (characterness of origin ASCII"0")
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.
3:41 PM
@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
@dzaima Well, slightly more than that.
@Marshall OK, I think I get it, but I do think "being smallest" is a pretty important and special thing.
Maybe a better notation would be 'A'=65@ where @ can be any scalar character literal and 65 can be negative when appropriate.
Then @ would even be be a special short form of 0@.
@Adám Isn't 65+@ a pretty good notation?
@Marshall Sure, about as good as 65+i
@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.
3:49 PM
@Marshall (@+10) is quite outside of what i would call "reasonably convenient"
@dzaima (actually adding •nl for (@+10) would be reasonable. at least now i wouldn't need to start any code dealing with newlines with nl←@+10)
@dzaima It's also not a literal. I meant putting a newline in single quotes.
@Marshall that's even more not "reasonably convenient"
@dzaima Instead of adding •nl and then •cr and •ht and a bunch of others, why not a simple scheme like 10@ ?
@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).
@Adám i'd probably prefer '\n' '\x0D' to that (which i'm also somewhat considering)
3:55 PM
is •esc 'n' acceptable?
or •esc 'escaped\nstring'?
@Wezl not much better than @+10, namely still needs parentheses around it in many cases
@Wezl No, that's just as awkward to work with as (10+@).
@dzaima Ah, sure, that makes sense.
@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.
@Marshall over the variable, not really, but having to create a boilerplate variable any time dealing with newlines is kind of pretty stupid
(i don't have nl defined as a global variable as that'd be just stupid)
4:05 PM
@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?
@Marshall it would be if literally every other chemistry constant was already a builtin in the language
'why_does⋄this_error' # in BQN
@Wezl Use double quotes.
@dzaima I'd disagree that BQN has all the useful string/file utilities built in.
@Marshall but it does have pretty much all other useful character constants built-in with the '_'-syntax in a single line
@dzaima (exception being (@+13), but that's quite less useful than newline)
4:25 PM
@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.
and as I think requiring nl←@+10 is just a stupid conclusion to end up on, i think i'll just add •nl and be done with the issue
@dzaima Isn't •lf or even •n more precise?
@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)
4:38 PM
@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.
@dzaima fwiw, APLX has ⎕B (backspace) ⎕L (line feed) ⎕N (null) ⎕R (carriage return) ⎕T (tab).
@dzaima How about 'lf' and 'cr' and 'ht' etc.?
@Adám that feels too abusive of the notation
@Marshall well, i still have •d •a •l
I like \n, everyone knows what it means, it works, why not go with that?
Backslash is awkward to type on a BQN keyboard.
@dzaima Oh, I'd assumed you'd get rid of those eventually.
4:42 PM
@dzaima Without needing compatibility with APL, why isn't •a •u?
@Adám why should it be?
@Marshall they're still quite useful
@dzaima Isn't •l the lowercase alphabet?
@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)
Is there a reason BQN's string literals don't have escapes?
@dzaima But totally opaque. 'a'+↕26 is a little longer, but it's clear what it is and it can be split up to allow simplifications.
@Adám I don't think having another character that you can't put in a string literal normally is worth it.
4:46 PM
@Marshall "simplifying" something using the alphabet seems like would often be a big regression in clarity
\n seems reasonable, everyone knows what it does, it's simple, I don't see any problems
@rak1507 Other than the keyboarding issue, right. I don't really buy the argument that 'multichar' abuse of notation.
@Marshall Another? You mean other than "? But people are quite used to escaping quotes with \", no?
@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
Since BQN isn't afraid of non-ASCII, an unusual escape character could be chose instead.
@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)
4:51 PM
@rak1507 just ignore them, they're gonna do their own thing and who cares anyway
What would you prefer? @ngn
@rak1507 k obviously
K has backslash escapes, no?
I don't know how k does string formatting
@rak1507 i don't either :)
@rak1507 (to be clear, I also like it. me arguing against it is mostly devil's advocacy)
4:53 PM
@rak1507 whatever most people are most familiar with. @dzaima k just copied c in this respect
some lisps allow backslash-escaping in identifiers
How about ⎋n or ␛n?
different for the sake of being different
looks like newline and looks like tab, but using them would make it harder to represent BQN source as strings
@rak1507 Different for the sake of minimising clashes.
4:55 PM
seems like a very minor issue to me
@Wezl I'm not following what you're proposing.
@rak1507 Backslash is quite a common character these days, no?
@Wezl however, they might look better after an escape character, like "newline: \↩" rather than "\n"
Typing backslashes wouldn't get any more difficult
@rak1507 BQN uses \ as the prefix character (like ` in RIDE)
@rak1507 Yeah, you'd have to hit the key 4 times instead of 2.
4:58 PM
At least you'd know what key to hit
@Wezl •↩ instead of •nl?
@dzaima At least \\ gives \ while in ride you need backtick-space for a backtick.
Novel idea: how about \n etc?
I.e. not '\n' which is abusing the notation, nor "\n" which complicates plain text. Just \n.
\n ≡ @+10
@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.
@Marshall that's like completely unreadable for such a simple idea
(•a •d are mostly there for simplifying other constants, but not having newlines is just stupid)
(gtg for ~15min)
More readable maybe: "0A"(∾⊣+↕¨∘¬˜)"9F"
@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.
I personally find "0123456789ABCDEF" easiest to read.
probably fastest too
@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.
@Marshall Was missing a ˜. Here's an example.
@Marshall just "0123456789ABCDEF". It's not that error prone and is like 1000x more understandable than any of the ones generating from scratch
5:24 PM
how is "0123456789ABCDEF" at all error prone
@rak1507 one could theoretically typo writing it by hand and that can easily go unnoticed
Could typo writing anything
ok then do one of the fail-proof ways, copy-paste
this unfortunately counts multiple occurrences in the same repo as multiple times, but 19.4k occurrences is quite a big regardless
@rak1507 yay
To be fair, it seems to be randomly generating them
5:29 PM
seems it picks randomly of the list though, so probably acceptable if not intentionally left there
Is there a way to use that grep app to search for similar off by one errors?
this though
@rak1507 i'm just swapping random characters manually
ah fair enough
!(res = (char *)malloc(sizeof(char) * 8))) idk what this does but I hate it
@rak1507 that's quite acceptable code actually
Ah, C just looks grim to people who don't know C
5:32 PM
if there's an error allocating 8 bytes to res
but yes
maybe they just don't like the number 8
it's random again
@rak1507 oof
this time it's worse
@rak1507 too similar to B
5:34 PM
interestingly, they did it the same time in some different code
I doubt the character restriction makes cracking their secret keys or whatever any easier though
@rak1507 it's copy-pasted
lesson learnt: in future use NPM!
situation's worse for the alphabet, where most letters removed give some occurrences. I'll leave •a in.
they should've used sprintf() with %02x
@ngn woah ngn suggesting using the standard library
5:48 PM
@dzaima i didn't say which spritnf() :D
@ngn quite a verbose name for a custom function, no?
they would have to #include tho
@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.
@dzaima but yeah, if someone can't even type 16 hex digits without a mistake..
@Marshall I'd assume quite a few people would prefer hardcoding the alphabet over 'A'+↕26
5:51 PM
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.
@Marshall I definitely would never ever ever ever ever import a library for an alphabet constant
@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)
@dzaima The benefit is that it's an order of magnitude easier to check that the first version has no errors.
5:57 PM
@Marshall Sure, but that doesn't really concern one when needing to choose which to use without having participated in a discussion like this one
'Α'+↕26 can you spot the error here? :)
@dzaima It should. Knowing which decisions will cause you less trouble in the long term is part of being a good programmer.
@Marshall one could also copy the alphabet from Some Saner Language which provides a simple alphabet constant
(or write the code to generate it and copy-paste the result; i've certainly done that before, even in Java)
@dzaima Like a library?
@rak1507 tilting
sizeof(char) is always 1
and you don't cast the result of malloc
!(res=malloc(8)) is the one for me
although depending on the context I'd probably move that constant out of this expression
6:00 PM
@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")
@ngn Yes, the 26 should be 25.
from string import ascii_uppercase, digits
@Adám well done :) 24 i think?
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.
@ngn There's an unallocated point after Ρ.
6:04 PM
@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)
@Adám ah.. right. TIL. that must be to put upper and lower case in exact correspondence. there are two lowercase sigmas.
@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?)
@dzaima You think •a is sufficient but 'A'+↕26 isn't, right? I don't see why the line has to end up there.
6:09 PM
@ngn That makes sense. Maybe one day people will want a final uppercase sigma, just like an uppercase double-S was added in German.
@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.
6:25 PM
@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?
@dzaima Why not the whole lot? Doesn't occupy any system names.
@rak1507 huh, constant vs library
wow, interesting, did not expect that, I find it a lot easier to just type out the constants
Hello all, (and thank you @Adám for access)
6:41 PM
@user446322 Hi Russtopia, and welcome. So you're an APLer already, or just interested?
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 ...
Cool. Well, you've definitely found the right place to hang out. Any APL question is on-topic. I don't know GNU very well, but I'll do my best.
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?
6:45 PM
What's the code?
fyi, there's a "mini-tryapl" right here in the room: ⋄ ⍳10
│1 2 3 4 5 6 7 8 9 10│
The snippet there on the main page is: {⍺,≢⍵}⌸'Mississippi' ⍝ The Key ⌸ op here isn't supported by gnu APL but I came up with ...
(use backticks ` around code for clarity, and to make the bot react to code that begins with ⋄)
⋄ {u,⍪+⌿⍵∘.=u←∪⍵}'Mississippi'
↓M 1│
│i 4│
│s 4│
│p 2│
⋄ {(≢∪⍵) 1⍴(∪⍵),¨{{+/(∪⍵)∘.{+/⍵{⍺=⍵}⍺}⍵}⍵}⍵} 'Mississippi'
6:51 PM
↓ ┌→──┐ │
│ │M 1│ │
│ └+──┘ │
│ ┌→──┐ │
│ │i 4│ │
│ └+──┘ │
│ ┌→──┐ │
│ │s 4│ │
│ └+──┘ │
│ ┌→──┐ │
│ │p 2│ │
│ └+──┘ │
@user446322 You don't need braces every time you apply a function. ⍵{⍺=⍵}⍺ is the same as ⍵=⍺.
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
@user446322 You can fix the boxing by replacing (≢∪⍵) 1⍴ with
@user446322 you seem to have gone a bit crazy with the nested dfns :)
Ah yes
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)
6:56 PM
@user446322 ah, that kind of explains it. Either way, by just removing dfns (and also removing one pointless +/) to 19 characters
5 mins ago, by Adám
⋄ {u,⍪+⌿⍵∘.=u←∪⍵}'Mississippi'
↓M 1│
│i 4│
│s 4│
│p 2│
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.
Wow. OK, I will study that! Thank you so much.
06:00 - 19:0019:00 - 00:00

« first day (1428 days earlier)      last day (1269 days later) »