« first day (1404 days earlier)      last day (1236 days later) » 

1:45 PM
Is there a reason APLcart uses ⍋/⍒ for testing if something is sorted rather than n wise reduction? O(n log n) vs O(n) right?
 
@rak1507 works with TAO
 
Ah
 
Why subtract rather than use < or > directly?
∧/2≤/a or something
 
@rak1507 ಠ_ಠ
 
1:56 PM
Is that a stupid question
 
@rak1507 no, this is a stupid me
 
Oh
is ¯2f/a = 2f⍨/a?
 
so that's a 3x speedup for the non-grade version
@rak1507 yeah, but iirc in 17.0 the version performed worse so i still use ¯2
 
Ah interesting, I don't think I've seen that before
 
2:38 PM
Maybe I should add a simple numeric vector version?
 
Maybe, although the only benefit is performance, and if you're actively thinking about performance you're probably good enough to come up with the solution yourself
 
@Marshall BQN ftw.
 
Blog post on sortedness checking. has a fast checker but it's not easy to use since it errors if the left argument isn't sorted.
 
@Adám I saw that, was really cool to see a BQN answer
Thanks marshall will have a read
 
@Adám Is that the first one? Seems pretty appropriate I guess.
 
2:43 PM
It is. I love BQN's way of characters.
I've been toying with such a notion for years, but didn't know enough of the theory to put it into practice.
@Marshall So something like {11::0 ⋄ 1⊣⍵⍸⍬}
 
@Adám This tutorial section gives more examples of affine characters, by the way.
 
It seems nice, although going with the C style way of having characters just be ints, seems like it might only be slightly more complicated but add a lot more options
 
@rak1507 The magic of affine characters is that it automatically knows the result type. Characters as ints is untyped programming: you have to specify at each step whether you want to treat a value as a character or integer. I'm not always against untyped programming but for characters it seems like BQN's model is just always right, and saves you a lot of casts.
 
That makes sense
 
And you can do explicit casts by adding or subtracting the null character, for example c-@ to convert characters to code point values. So it's just as capable as C with a tiny bit of extra code at worst.
 
2:52 PM
Ok, that's cool, you've convinced me, I didn't know about @
 
3:11 PM
topanswers.xyz/apl is now live. This community is for APL, mainly Dyalog APL, and APL-like languages (e.g. J, K and Q). However, array programming in any language (e.g. NumPy, Julia, and MatLab) is on topic, especially if in comparison to APLs.
4
 
3:40 PM
@Marshall Shouldn't and work on characters?
 
@Adám As a no-op, I guess? Doesn't seem particularly important.
Currently + and - are the only kinds of arithmetic extended to characters, which is simple to remember.
 
how do you upper and lower case a string in BQN?
 
@Marshall Monadic would make integers out of any non-integers and leave characters alone. Dyadic would be AND/OR on characterness and value.
@rak1507 That was going to be my next question. BQNcrate seems silent on that.
 
'A'≡⌈'a' seems sensible to me
 
@rak1507 That will be a library function, once there's a library. Depending on what characters you expect to be in the input string and how you want to handle them, it might be feasible to write it out.
@rak1507 It loses all sorts of arithmetic properties that has. I'd like to keep things more consistent than that.
 
3:46 PM
@rak1507 ^'s problem is that (⌊⌈x)≡⌈x for numeric x but wouldn't be so for characters.
 
Fair enough
 
@Marshall You might want to generalise all such stuff into a "get Unicode property" utility.
 
@rak1507 Here's an ASCII uppercasing function in BQN. Not too bad, although you have to know { comes after z. Could also replace 'A'-'a' with ¯32, of course.
 
4:04 PM
not sure if you can get more than 2, but cmc: write code that doesn't error with the longest number of consecutive /s possible
 
@rak1507 ///////…////////0
 
oh well that's boring
Didn't consider that
 
@Adám Do you need the 0?
 
Not really.
 
/////..../// doesn't count
 
4:09 PM
@rak1507 I think we can even prove that 2 is the maximum on a right argument that has a trailing axis of length>1 with no or a left argument>1
 
@Adám I added the ASCII case-changing functions to bqncrate.
 
@Adám hmm maybe, I thought there might be something longer, but I doubt it
When you do ///1 2 what causes the error?
 
Reduction using a non-scalar function (e.g. a reduction) encloses its result, and a nested array isn't a valid left argument to /
 
Ah yeah
 
Iterated monadic / in BQN ( in Dyalog) is fairly interesting as well. Some patterns die out to give the empty list, while others grow very quickly (superexponentially?). I don't yet know a criterion to tell which is which.
 
4:22 PM
⍸3 1 is 1 1 1 2, but in BQN it looks like the equivalent is 0 0 0 1?
Oh, ⎕IO
This is interesting, ⍸⍸⍸...⍸1 2 is a 2 cycle
I wonder if there are 3+ cycles
I can't find any pattern that dies out that isn't of the form b a where b > a
Actually, I think anything n 1 dies out, where n > 1, and anything else grows, but I could be wrong.
 
4:52 PM
enumeration of possible answers; ⍸⍸⍸⍸⍸⍸1 0 1 is the longest chain of ⍸s that ends in ⍬
https://dzaima.github.io/paste/#0XVG7TsMwFN3zFUddaCWGJDwG5yOQ@AO3vQGLYBfbUYCJiS0LOxMSExJrZ/gTfwm@JUqc2pKHc67Pw15TbSxhEV7fFlAOO@OcWjcEpXetryBrTxbSWtMx7W9pGrHk2sbD1JAa9Eib1tM2y0ZeateRdTywDP0@9B/Ln@@71Qqh/xKZisLSK6ORC0YSoBDIhx1ePhOiFAwMVDGNIMafMaF/hzbwVqpG6Rs8kzXkIP8bmNbHcpwrxuJasunkk4MzlhtMfmcCmtWiOqteXcejSPhzwcBRjmLwr62552sV6KGVDbxBohzNQHqbYVxRPUd5JMbIKDY3vxAH62I2/7tPvcsKTulN/E1/4uKD@KHiKT@DpQOWhLr8Aw#APL
@dzaima (first line of paste should have an at the end) of course ⍸⍸⍸⍸⍸⍸1 0 1 0 0 0 0 … also works
 
Might be an interesting code golf problem, determine if it will die out or not
 
 
2 hours later…
7:07 PM
Hey all, thought you might enjoy my recent post about calculating which of my parents' anniversaries have landed on Thanksgiving: 5ab5traction5.bearblog.dev/wedding-thanksgiving-versary
I'll be AFK for a bit but of course I'm quite curious to read alternative/better solutions :D
 
@ab5tract yr[⍸ {⍵>1977} yr]yr/⍨yr>1977
 
or 1977+⍳how ever many years you want
 
@ab5tract Years ∘., ⊂(11 26)Years,¨⊂11 26
 
He mentions that at the end
 
@Adám That's in a footnote :)
@rak1507 You are a fast reader! :D
 
7:10 PM
Oh, I didn't finish reading yet.
@ab5tract You see, the clever thing about Dyalog Day Numbers is that 7|ddn is the day of week!
 
oh, that's very cool! I will mention that in a follow up
 
So AnnDates/⍨5=7|1⎕DT AnnDates will do to find those.
 
@rak1507 ah! I hadn't thought of that, but it's obvious when you point it out! I guess I was stuck thinking in range-y terms of start point and endpoint
 
@ab5tract dfns.to is good for generating ranges too.
 
noted!
I need to get used to using dyadic / ... it flew completely under the radar for me when writing this post
 
7:16 PM
Also, you may want to use monadic instead of so you get a proper flat 4-column matrix instead of a 1-column matrix of 4-element vectors.
 
Thanks for the suggestions and thanks for reading! I think a follow-up post will be the best way to address the feedback.
 
Sure thing. Thank you for the post. I should get around to working on the searchable APL publication collection, and add yours.
 
7:55 PM
CMC: Given a ref to a namespace or the name of a namespace, return a ref to the namespace. (You must be able to accept both types of argument.) E.g.:
      ⎕SE ≡ YourFn ⎕SE
1
      ⎕SE ≡ YourFn '⎕SE'
1
 
Unrelated: how come 0÷0 is 1 in dyalog
 
@rak1507 The argument was, iirc, that that makes it consistent: 1=x÷x for all x.
 
Hmmm
 
But, did you know that you can make it (and all divisions by 0) be 0 instead by setting ⎕DIV←1?
 
No I didn't, that's interesting
 
8:03 PM
Is there a way to make it NaN?
 
No, no NaNs in Dyalog APL, but if you leave ⎕DIV←0, you can force an error with ×∘÷
 
{0::⍵ ⋄ ⍎⍵} how's this for the CMC lol
 
@rak1507 That's only 9 bytes (without spaces) and matches my (different) best.
Why didn't I think of that?
 
That one does seem sorta obvious...
 
Wait, does ⍎⍕ work?
 
8:06 PM
Btw, someone should extend https:/aplwiki.com/wiki/Divide with info about division by zero, including history etc.
@rak1507 Hm, if we restrict ourselves to named namespaces with unaltered display form, then yes!
 
Are there others? I don't really know much about namespaces
 
@Adám - Aren't you more-or-less in the best position to be 'Someone'?
 
@JeffZeitlin Other than being limited with time. I think most of what one would need to write it all up is here.
 
@Adám - I hear you on the 'limited with time' thing... I've long asserted that I need something like Microsoft's "DriveSpace" that works on time...
 
I currently have 186 items on my work to-do list.
 

« first day (1404 days earlier)      last day (1236 days later) »