@dzaima Congratulations on being a Chinese room then. test/bt -ref is under 2 seconds for me now!
@dzaima Here's the TAO paper in case you haven't seen it before. BQN is the same as Dyalog but ignores prototypes and stops at non-arrays instead of simple scalars.
@Marshall hadn't seen that. the whole padding thing is strange, but i guess there isn't anything better if you're forcing yourself into having ordering for all arrays
@dzaima You don't really have to describe it as padding. I prefer to think of it as comparing as far as you can, but if one array "runs out", then it comes early. Adam uses the phrase "nothing comes before something" for the guiding principle.
Started translating Hui's History of APL in 50 Functions to BQN. Seems they're usually cleaner than the APL (SymmetricArray is awesome), although inner product is a sticking point since I switched to vector reduce.
The lack of ⊥ and ⊤ can also be annoying, but they're not too hard to implement and many of the 50 functions seem to be chosen to showcase these, so I don't think this is too important.
5 is the minimum because ⍤ is a dop which requires something on both sides, and with / on the right, it always results in a dyad which requires something again on both sides (or ⍨).
@Adám I parsed it as I was perched atop the tower, giving my undivided attention to the squad reunion at the floor of the enclosed ??? below me and taking note of each commuter's arrival time in my log without delay. but in the middle of the sentence I get lost... And I can't fill it in because I also don't understand what the middle of the sentence should mean :P
Hello guys, we want to understand how RIDE works. Could you please give us link on video where it is described how RIDE works on some examples(Preferably as for beginners). Thank you
1. As I understand - install is from here https://github.com/Dyalog/ride/releases/tag/v4.3.3453 (we need for windows) 2. Yes, and how to use RIDE (for beginners)
@YuliiaSerhiienko Right. We don't have one at the moment, but rest assured that it is planned. Let me know if you get stuck, and we can screen share to guide you through it.
@user41805 Hi OLKL. If you want to participate here, simply email adam@ with the domain name of www.dyalog.com
@Adam, thank you a lot for your help. I talked to OLKL and we decided that now we will install RIDE, read manual and in 2 days contact you again. Is that fine?
@Marshall i do have (and did have) local ∊⊔∾ changes; DParse did grow (at least vertically) almost 2x, and there now are more double usages (most importantly, ⋆)
(my current random statistics i'm looking at:) https://dzaima.github.io/paste/#0jVZLbtswEN3zFFpkHYhfkdrFThukSNQiTrwtWIeIBaiSIUtoll31AD1ED5aTlKRkWiSFKCvL9JvhzHtvRk6SZFV2V22b5y@qAwwneXK3al6fVqu@rLqyzlGavP35m2xl1ascpwAxDfkkd3sHwADCKIwIQKJDmvm5QHK@Xh5va/MEMOE68L6vTlFsqODt9z/7WRSoyDkCBGnYppJHVwmEECChT6/q59MZZnGwIEB3pe8o6/7oaiOzQJgtF2NgptnNTtau/3Rg5WsbNB9FplEbnAM2cnc6E9QefavOBWMxmy9mnSELuK2f1atqcziCvjSlq5ZhYJTf7OVBufx0IlaGLGDpfi2LUeXu0YG4B9pu0Ur3N6AWWM00gxp143IJNp/LuEgb53LXKtmp0VCAmivWzc@DtgUHEEW0aBpYIFombLLBiONEZJoH3/AkA4jiQKCx0fOYWPXDOeFG7Ef5o3Is88lIXMBcCO8rTCGAFC0OkkgX55ajsFkOyOzcYtPbgzpoNh2WA…
@dzaima A nice general technique for a scalar function with one scalar and one boolean argument (like ¯1⋆) is to precompute the two answers and use them as a lookup table.
@Marshall 2.7ms for 1e3 runs doesn't sound correct (still for b←3⋄⊢d←(b×b)-4×2×1⋄((-b)+√d)÷2×2) - first 2 lines of DGenFn take avg .26ms and tokenize alone takes 0.08; assuming the difference is from local dzref changes, it'd kind of make sense for that to drown out the actual slowdown
@dzaima Too fast or too slow? All I'm doing is adding •←1e3•Time"DGenFn""b←3⋄⊢d←(b×b)-4×2×1⋄((-b)+√d)÷2×2""" to the bottom of dc.bqn and running it. No local alterations; everything's the same as the current Github head.
I'm on a 3 year old i5 so timings being a little slower would be normal.
@Marshall ah, i get 2ms on first run with no local changes on that too. Running a couple times brings it down to 0.83ms because Java™ (and all my timings is the best of maybe 10 runs of 1e4)
local changes bring that down to 1.38 on first run, 0.34 on the 10th
@Marshall 6 year old i3 :p
@dzaima oh, that's up to 2.66ms if added to dc.bqn and executed with ./dc.bqn instead of going trough a REPL
(more random statistics:) https://dzaima.github.io/paste/#0zZm7jhRHFIZzP0XnFkWdS51TJdkOCHmLFWuhlXYAmTVyQGA5QDPDgrmMZQcO8BoEAaElEuwA3mSexNU9TFV3yY1ns9OaoLvUo/nm11/nVtvN@Xbz4/993l5y/cB3nnyx3fz07Q93vut2V366cXR6ene4O7t9dnTaLe7u1o/u3Rzu823@0u8H/O77S64f@M7Lnnn76HFXrvzcdeDzle8CSXTBxxhDv@5dvxDMUC9mqcVBSClJfhqgBaxQr38@nlCHPXUn5B2zD8gDtfeAJFa0fjjVeoAeqBHJcRKm9Ik6L7AVrZ9MtSYu1IBOGCPvtfaCRhzy5ZRZZc/cKTtC8FH3zD6pEaVXLyb@yPJWanSAKAiF2ow/VhcTaqCY6WCgznEvYkDEQs3JCPXyn8bVWrQWcOQDY3EIiBFXfzVlTqky5wANSaG6WsAG89dT5khj5t7iWt0x3BpgvtJ4o@oc1KVslZSKNzjaYP746xQaY4UGh4mVi9AQyQb01VlmVgdJSKFuQiNCb8@XTfExovYuCsegu0Jv8L…
@dzaima pushed down to 97ms.. 1) depth 1 𝕨 didn't use MutVal (depth 2 did), 2) it used > to merge everything together, 3) now it also has special code for IntArrs & DoubleArrs. Still seems way too much, but i guess it's only 10x the average time of the extremely trivial monadic ≠
With the latest compiler you can use this code to time a portion of reftest.bqn. ~300ms for me. Using more lines gives errors, maybe because of missing LEB128 handling.
Much of this will be repeating things I've said in my webinar series, "Language Features of Dyalog version 18.0 in Depth", but this format gives people a text to search and reference, while at the same time being more interactive for those that are here.
We'll see how much ground we can cover. The webinars are only 30-45 mins each, while this is 90. On the other hand, questions and discussions are more likely here.
So, without further ado. Let's have a second look at ≠ which is now monadic as well as dyadic.
The monadic function, which is called Unique Mask or Nub Sieve, isn't very connected to the dyadic form (unequal).
In the first season, we covered Unique, to which this very much relates.
Unique returns a subset of the major cells of its argument.
Unique mask returns a Boolean vector which, when used as left argument to ⌿ and with the original argument as right argument, returns the same as Unique would on the original argument:
What I was typing: Just like with sorting, one has to do the whole {⍵[⍋⍵]} idiom, which is then optimized of course, just to keep the larger more general functionality of ⍋⍒
@AviFS There's no such thing as a mask replacement for the dyadic set functions, unless the mask would apply to the concatenation of the arguments. I guess that'd work.
But yes, you're alluding to a very important point.
However, you can also use this information to filter/sort other arrays, or indeed to do other computations.
It is as if ∪Y and and a potential Sort function already applied their implied information before you had a chance to use that info for what you wanted.
@Adám That's true. Hadn't even thought of that yet.
Which raises a much larger philosophical question that I think was mentioned in the first 8v8-Zoom thing about how 'extensible' vs 'user-friendly' to make a language. I forget the words used; was more eloquent. But something along those lines
So the larger question is definitely a much larger question with no straightforward answer, for another time
It is worth noting that the result of ≠Y is much more light-weight than ∪Y, in that it only ever has one bit per major cell, while ∪Y could end up duplicating a lot of data.
@Adám I wonder if ≢∪Y couldn't be optimized to perform the same exact thing as +/≠Y under the hood. Because it's definitely the more intuitive one to write and the easier one to read
@Adám yup and sprinters will object that it's faster because you're doing the second search in a smaller set, whereas the first formula does the two search operations on the original set
@Adám Yes; if asked to perform the task "get unique vowels" I think I'd do m←≠v←t/⍨∊∘'aeiou' ⊢ t←'hello world' ⋄ m/v
So the combining masks is a powerful concept but often one would rather make the search space smaller in each step, no? At least I feel it is more intuitive
OK, here's an exercise for you. Given a text (simple character vector) t, return a matrix so that the first instance of each occurring character is "underlined":
(And also to add in after having written a bunch of code, rather than having to hunt for the end to add another parenthesis and delete the autocompleted one)
@RGS You're right. I'm not sure exactly how that'd translate. But definitely the same basic idea of grouping everything after the $ in some sort of way
Let's say you want to define a function which computes the cube of the absolute value.
QA←3*⍨|
But really, the natural way to think of this is (|Y)*3 only that you can't have an array as the right tine of a fork.
By converting the constant 3 into a function, 3⍨ it works: |*3⍨
It also allows you to easily write a tacit function that ignores its argument(s), e.g. let's say you want to add a dice roll. {?6} can be written as ?6⍨
@AviFS Indeed. {0} is an idiom which dates before this operator, but how many such idioms should one implement? There are a lot of possible arrays out there…