« first day (1266 days earlier)      last day (430 days later) » 
01:00 - 16:0016:00 - 00:00

1:24 AM
@Marshall managed to convert the reference implementation into java. Still not quite sure what it's doing, but it passes the tests so i'm happy enough
1:41 AM
@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.
1:59 AM
@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.
@Marshall i guess that's a slightly more logical way to think about it
1 hour later…
3:20 AM
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.
7 hours later…
9:55 AM
@AviFS What is the shortest non-erroring array-expression you can come up with that uses that phrase?
Haven't been active lately, but has that topic for Cultivation today been decided on? Last I was here, no one had any more ideas!
@AviFS Oh, we have a few new language features to go through.
@Adám Interesting...
@Adám Ah. Are we covering multiple, or is there a specific topic?
Also, @Adám, how did you see my message so immediately?
@AviFS I guess multiple, like in the old days.
9:58 AM
You weren't in the room at the time I sent it
Do you really Cmd-1/Ctrl-1 that often? Or just coincide?
@Adám '⍤/'
@Bubbler Hahahahaha
@Bubbler Ha, nice.
That's not what you were looking for, was it...
@AviFS Are you sure I wasn't just faded? I have the tab pinned and it lights up with a blue blob upon any message written.
10:00 AM
@Adám That's what I meant. Yes. As opposed to being lit up which is what I think of as 'in the room'
@AviFS No. I think 5 is the minimum.
@Adám Ah, the blue blob! I always forget
@Adám Hmm
For more serious, ⊢⍤/⍨1 should do, using the ⊢⍤/ brand-new idiom.
Looks really good with the yellow blob in the favicon.
@Adám Haha, that's too cool! Which browser is that again?
10:04 AM
@Bubbler Doesn't anything of the style work: 7+⍤/8
@AviFS Sure, that's the conjugate of 7 8s.
Or more generally af⍤/b
@Adám But is that what you were looking for?
Because it seems pretty trivial
10:05 AM
I wasn't looking for any particular answer.
@Adám Sure. But re: that
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 ).
@Bubbler True
Btw, did people know that hovering over a message highlights the message it's replying to ⍤⍥⍤
And I intentionally wrote "array-expression" since ⍤/ is a valid expression (which returns a monadic operator).
@AviFS Uh, yes.
I can't believe I never noticed. It's seriously inconspicuous...
I didn't say it wasn't silly, but with the default CSS it doesn't pop out all that much. Only noticed when I changed it
(I used to click the replying icon to have it highlight in yellow. Didn't realize simply hovering ⍥ the message was sufficient)
Which is better:
To hover ⍤ a message
To hover ⍥ a message
Never noticed how similar those two prepositions are...
10:12 AM
@AviFS To replace 😮︎? Either works, but I personally like ⍥ better.
@Adám <3
@Adám That's even better 😮︎
@Adám Wait no, I see what you were thinking
⍤ would be 😯︎.
I meant 'to hover ⍥ a message' should be read 'to hover over a message'
Vs. 'to hover ⍤ a message' → 'to hover atop a message'
Guess it depend whether you're Shakespeare or not...
Oh, I didn't catch that. Yeah, I was wondering why the "APLoji" wasn't at the end of the sentence. Then definitely .
To hover @ a message (which works outside APL too)
10:15 AM
You can't hover at something!
@Bubbler To hover at a message?
Just kidding.
@Adám How could you miss my puns ;(
Funny how the mind auto-corrects sentences. I imagine you just read it as though 'over' was already in it and didn't notice the missing word?
I was perched ⍤ the tower, giving my un÷d @tention 2 the ⌷ re∪ @ the ⌊ of the ⊂d ○ below me and ↑ing note of ¨ ⍨r's arrival time in my ⍟ ~ ⎕DL
@Adám that gives a whole new meaning to the "this code reads like plain English" phrase...
10:29 AM
@Adám THE most favoritest-est phrase I've read in ages!!!
@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
@Adám In looking up the symbols, I noticed that selfie's name, ⍨, seems to have been changed to 'constant'?
@RGS circle
@AviFS No. It is still called commute.
@Adám Oh it was commuter, nice @RGS. I thought it had to do with selfie. Is it just unofficial lingo then?
@Adám ahhhhhhh, thanks
@AviFS "selfie" I think is unofficial lingo, "commute" is what you see if you hover ⍥ ⍨ in the Dyalog interpreter
10:33 AM
@AviFS Self[ie] is unofficial, when you need to distinguish self (f⍨Y) from swap (X f⍨Y). Constant is a new overload in 18.0.
@Adám @RGS Ah, I see. Thanks for clarifying!
10:46 AM
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
@YuliiaSerhiienko Anything in particular? The language is obviously the same, so do you mean how to install it or how to use it?
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 Does this help?
We will appreciate knowledge sharing video
@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
11:02 AM
yes, OLKL is going to try and we want somehow quick start with video
but manual is a bit long:)
@YuliiaSerhiienko Do you want a quick intro over Zoom?
@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?
@YuliiaSerhiienko Of course. We're always here for you.
@Adám thank you a lot
11:46 AM
@Adám i'm kritixi btw
@user41805 Oops. I confused the two userNs.
Sorry to disturb you. No harm was done, since Yuliia confirmed the identity of the OLKL and I've asked mods for access for the correct account.
no worries, i wasn't disturbed
12:04 PM
@dzaima (for reference, that arbitrary number is down to ~2100ms now, with integer division;) i guess about time to pull the latest reference/compiler
it's around 3680 now, so i have work to do
12:44 PM
@dzaima That's with different dzref code, right? The changes to the parser shouldn't add that much time.
@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:)
@dzaima By my timings reverting DParse only takes it from 2.7 to 2.2 ms over 1e3 runs. A lot of the added code is just more boolean arithmetic.
@dzaima TBH, I like your pastebin aesthetic and syntax highlighting so much I always click on all the links without knowing what anything means!
So congratulations, I guess! Or is that a thank you? Whatever it is, it it's a compliment :)
@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 hm. Don't have any non-pure stuff using pervasion currently, and probably very much worth it to keep it that way for things like that
1:00 PM
@AviFS Being nicely highlightable is a huge perk of BQN.
@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:)
1:30 PM
I'll try to get test/testref.bqn to compile as one unit so we can get a larger test.
@dzaima wait what is doing there‽
1:47 PM
@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
2:19 PM
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.
got ./bt -ref working (my local modifications included a couple stupid untested checks), and now i see why isn't yet completely correct
@user812380 By the way, you should now have full access to participate in this room. Welcome!
@Marshall in the REPL first execution was 262ms, down to ~60ms after a couple re-executions with local changes that still include native
Is it time?!
Welcome to APL Cultivation! Today's lesson will be a continuation of the first season in that we'll catch up on new things added since then.
2:30 PM
@Adám How does that make it more first than second season?
@AviFS Because the first season was on core language features and usage, while the second went into depth on specific subjects.
@Adám I see!
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.
How many of these do you expect to do?
It's taking 4 webinars. How much of it are we doing today?
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:
1 1 1 0 0 0 0 0 1 0 0
Why would we want such a function?
2:39 PM
If you could start all over with backward compatibility being a non-issue, would you replace both ∩∪ with their nub-seive style equivalents?
@AviFS The dyadic functions?
@Adám Sorry, was midway typing about something else
@Adám No, monadic
@AviFS What is monadic ?
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 ⍋⍒
@Adám True...
Sorry, I meant dyadic \embarassment
Hold on, no I really confused myself
Forget ∩
@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.
2:44 PM
Let me retry: If you could restart, would you replace monadic ∪'s functionality with monadic ≠
Maybe. ≠Y gives you the necessary information to compute ∪Y just like ⍋Y gives you the necessary information to sort Y.
Aka forcing the new union to be something like {⍵/⍨≠⍵} equivalent to sorting being {⍵[⍋⍵]} so as to extend ⍒⍋ functionality
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.
@AviFS Union x∪y is a different thing from Unique ∪y.
@Adám Exactly, that was what I meant. Sorry for the confusion. And it's not even a new idea; you mentioned the analogy in the webinar.
Just curious if you wouldn't make monadic union, unique, into nubsieve, if you could. Doing away entirely with the current one
2:47 PM
@Bubbler Sure, but one could define a function X$Y such that (X$Y)⌿X⍪Y would match X∪Y. Same goes for
@Bubbler I know, I know. Sorry I screwed up badly... And put future readers of this Cultivation at bad risk of being confused...
Was meant to be a simple question
@AviFS One could argue that set functions are entirely superfluous if hadn't ravelled its right argument.
@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
I was specifically asking if the current unique operator was sort of extraneous now, or if you'd cling onto it
But maybe that's also a non-straightforward question for another time
Terribly sorry for all the confusion, though!
2:51 PM
Well, it is a handy thing to have, and I wouldn't be opposed to two Sort functions, even though we have the grades.
More than happy to let you go on!
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 Happy to leave it at that. Though it does feel incongruent to not have the same equivalents for the two function
Esp. since sort is probably used far more often than unique, I imagine
Well, there's another difference. returns a mask, while returns indices.
@Adám Very good point. Hadn't occurred to me
2:53 PM
One could have defined to return indices of course.
@Adám True, but they feel very similar, no?
In that they give you the "background information", yes.
They're both an extendable skeleton of something more specific
@Adám 'Xactly
But seriously, I'll let you get on now for the benefit of future readers!
And I guess that'd be the more APLy way. Generalising at the cost of a little brevity. APL is plenty terse anyway.
@Adám Elegance vs. usabilitiy
@Adám I think that's the way you put it!
So what else about the nub sieve should we know?
Perhaps more examples of use?
2:57 PM
@AviFS I have used ≠ to filter data for recursive calls of functions
+/≠Y can be a much more efficient way than ≢∪Y for counting how many unique elements there are:
      ]runtime -c ≢∪n +/≠n

  ≢∪n  → 4.9E¯3 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  +/≠n → 3.1E¯3 | -38% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
@RGS Oh?
@Adám Interesting!
@Adám Is there an efficient algorithm that counts the number of 1s in a binary number?
Or does it really sum up the list? I can't imagine it would...
@Adám Also though, the latter is more expressive... kind of a shame
@AviFS Summing bit Booleans is super efficient. Implemented in the CPU!
Remember that Dyalog only uses one bit per bit (as opposed to most other languages' normal behaviour/usage).
@Adám ooooooor you could do ≢⍸≠n which surprisingly is still faster ahaha
@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
3:00 PM
      ]runtime -c ≢∪n ≢⍸≠n

  ≢∪n  → 6.2E¯3 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  ≢⍸≠n → 2.6E¯3 | -58% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
@AviFS It could. Would need Marshall's thunks (or an idiom or composition).
@Adám Isn't it a reasonable idea?
@Adám Yeah, I mean the optimized idioms that get highlighted a different color
@RGS Are you sure?
Like sorting
      ]runtime -c ≢∪n +/≠n ≢⍸≠n

  ≢∪n  → 4.9E¯3 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  +/≠n → 3.3E¯3 | -34% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  ≢⍸≠n → 3.6E¯3 | -27% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
3:01 PM
@Adám Interesting!
≢∘∪ has special code (which may or may not be faster).
@AviFS We put addition of more idioms on hold because we expected thunks to come along.
@Adám Oh? What's the difference?
@Adám not suggesting it is the fastest, just saying that it sounded like a dumb suggestion and turns out is still faster than ≢∪
And why didn't they?
3:03 PM
@AviFS See this
@RGS Wow! That really says something about efficiency/inefficiency...
@AviFS They were not due yet, but because Marshall was the one who was going to implement them…
Anyway, let's return to usage of ≠Y
@Adám :( I see
@Adám Will let you do that!
Another thing you can do with the mask is to combine it with other masks:
      ⎕←m←(≠∧∊∘'aeiou')t←'hello world'
0 1 0 0 1 0 0 0 0 0 0
These are the unique vowels. Clear how this works?
Of course, in this case, you could as well write 'aeiou'∩'hello world' but this example is to illustrate the concept.
@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
3:09 PM
@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
Of course.
@Adám ok ○/
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":
      Fn 'mississippi'
¯¯¯     ¯
      Fn 'Hello world'
Hello world
¯¯¯ ¯¯¯ ¯ ¯
@Adám I have one with @, ⍸ and ≠ but it is not tacit (not sharing yet so as not to spoil the exercise)
@RGS I never said it had to be tacit.
3:16 PM
@Adám I know :P I will be glad to share if/when you ask
I have 14 char dfn and 11 char tacit, not counting Fn← part.
@Bubbler my dfn is 23 bytes BUT it is perfectly acceptable and understandable code
This isn't code golf.
I've stupidly forgotten to how to catenate underneath so mine is 16 bytes...
I generated the underneath and then did ⍉⍵,⍪...
How silly is that?!
@AviFS That's perfectly fine. ↑top bottom works too, and so does ,[0.5].
3:20 PM
I guess it's about time to reveal the code?
Yeah, go ahead all 3 of you!
@Bubbler {↑⍵('-'@(⍸≠⍵)⊢' '↑⍨≢⍵)}
No hold on!
Fn←{↑⍵((≠⍵)\'-')} and, for early birds, Fn←↑⊢,⍥⊂'-'\⍨≠
@Adám How to do this with take
3:20 PM
@AviFS Mix, not take.
@Adám Yeah, that :p was about to say...
Well anyway, here's what I have
{⍉⍵,⍪' _'[(≠⍵)]}
@Bubbler ah the (≠⍵)\'-' is nice
@AviFS {⍉⍵,⍪' _'[≠⍵]}
@RGS Yeah, I just saw that...
So I guess it's also 14 bytes even with the stupid bit?
With mix, it could be:
{↑⍵{⍺⍵}' _'[≠⍵]}
But isn't there a better way?
@AviFS {↑⍵(' _'[≠⍵])}
@RGS I realize I still don't know well in my head all the APL primitives
3:23 PM
@AviFS Yes, now we have ,⍥⊂ which is what Bubbler used.
@Adám Ah, thanks, still worrying about my own and hadn't had a chance to review the others
@Adám Except that's not any shorter than the original because it still requires mix
@Bubbler Is that the golfiest way possible?
@AviFS Sure, but ,⍥⊂ is shorter than {⍺⍵}.
@Adám True, but that's not saying much :p
7 mins ago, by Adám
This isn't code golf.
@Bubbler's parens is even shorter
@Adám Yes, except I'm curious now
3:26 PM
Do you want another exercise or shall we continue with something else?
@Adám both sound fine and fun; something else if there's an exercise on that at the end?
@Adám Another exercise?
@Bubbler This is my final answer :)
@AviFS ↑⊢⍮' _'⊇⍨⍧ in Extended… ( is the we are studying now).
Random question for later: Is it at all worth adding $ to APL as used in Haskell. One of the extended, dzaima, ngn or bqn type dialects
Eg. {↑⍵(' _'[≠⍵])} → `{↑⍵$' _'[≠⍵]}
It's a byte shorter, but more importantly I personally find it much easier to read!
@AviFS aplwiki.com/wiki/Pair (BQN has which is {↑⍺ ⍵} in APL)
3:30 PM
@AviFS that's not really what $ does in Haskell, is it? with that I'd expect ↑⍵ to be computed and then stranded with what is to its right
(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
OK, so here's another one: Given a vector, return the set of elements which have duplicates.
@AviFS haskell binds left 2 right so $ is used to bind things to its right and then keep binding ltr. Using $ in APL I'd expect things to be reversed
@dzaima @Adám That's tremendous and super useful! Thanks a bunch
3:33 PM
@RGS True. Anyway, it was inspired by the Haskell...
@Bubbler @AviFS But Link has issues, as discussed there.
@Adám done ○/ not golfed :P
@Bubbler Super interesting!
@Adám Keep the duplicates or not?
@Bubbler No, hence "set".
3:35 PM
So Fn 'mississippi' should be 'isp'?
@Bubbler yes, or any permutation thereof.
@Bubbler +←1
@Adám Ah, I see. In that case got it
9 byte dfn
Me too.
Uh my dfn is 10 bytes long ⍥
nvm, forgot that exists
@RGS Maybe parens vs ⍨
@RGS :)
3:38 PM
CMC: the same but preserving original order
@RGS Hmm, doesn't the 9 byte solution already do that?
@AviFS mine {∪⍵/⍨~≠⍵} doesn't
@RGS Doesn't it?
{∪⍵/⍨~≠⍵} 'mississippi' gave sip instead of isp
@RGS 've got dfn at 11.
3:41 PM
@Adám ???
What does that mean?
@Bubbler and @AviFS found the same as RGS for the any-order challenge?
@AviFS I have an 11-character dfn solution to that CMC.
@Adám Yup!
@RGS I see what you mean
@Adám Yes.
@RGS It is in the original order of the duplicates
Just not the original order of the letters
Right. I opted for any order because both of those orders would make sense.
3:43 PM
(s appears before i because s is duplicated first even though i appears first)
@Adám I see
Anyone wants more time for RGS's CMC?
@Adám feel free to proceed :)
Quite a hack: ∪∩{⍵/⍨~≠⍵}
@Adám I got a long one at who-knows-how-many-bytes
Mine is {∪⍵∩⍵/⍨~≠⍵}. Same idea as Bubblers, really.
3:45 PM
a (longer) different idea {s/⍨(s←m/⍵)∊⍵/⍨~m←≠⍵}
@RGS Ooh, old school.
@Bubbler Doesn't seem to work for me...
@AviFS Parenthesis?
@AviFS it is a fork so you have to use it inline inside ()
3:46 PM
      Fn 'mississippi'
OK, Let's see if we can do the new constant operator in the remaining 15 mins. It is really simple.
@RGS Duh... Thanks
Was doing ∪∩{⍵/⍨~≠⍵}'mississippi'
@Adám ...Nothing in the world is simpler than this though, and it took 1hr15 ⍤
has been overloaded (or extended, if you want) to handle an array as operand, in addition to a function.
It derives a constant function, i.e. a function which always returns that array, no matter what argument(s) you feed it.
@Adám Your use of links really impresses me! Must be a fair bit of work to find...
@Adám Mind going over the uses again?
@AviFS Of course not. Maybe the best one is to preserve order in a train.
3:51 PM
@Adám Mind showing how? Can't remember
Let's say you want to define a function which computes the cube of the absolute value.
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⍨
So you can roll the dice for each player:
      ?6 6⍨¨'Abe' 'Bob' 'Carl'
│6 6│4 1│1 5│
(Abe is clearly cheating!)
@Adám Super neat! That makes a lot of sense
@Adám Confused about this one, though
Basically it is a replacement for {x} hack (and various workarounds), right?
Although I noticed f←|*{3} is the same!
3:56 PM
@Bubbler Yes, with {x} have the issue of computing the result repeatedly. E.g. (÷3)⍨ is much better than {÷3}
       ?6 6⍨¨'Abe' 'Bob' 'Carl'
│6 6│5 0│3 2│
@RGS That's amazing!!
@Adám But again with the idioms/thunk. If two things do the same thing and one is much better, why not make the worse one act like the better?
@AviFS (I just quote that xkcd comic whenever I have the chance, sometimes even when not appropriate)
Wait nvm, that's intended behavior, isn't it.
@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…
3:58 PM
@Adám It's intended to re-evaluate though, right?
Or at least I hope so
@Adám couldn't one generalize the pattern, though? Assuming we are talking about constant arrays
@AviFS in general, making {÷3}¨⍳10 calculate ÷3 only once would require making a check for whether a dfn is pure, which might be non-trivial
I use it with the intention that it should re-evaluate every now and then
@AviFS Sure, there's a need for both.
The real equivalent of A⍨ is (A⊣⊢) which is frankly obscure.
01:00 - 16:0016:00 - 00:00

« first day (1266 days earlier)      last day (430 days later) »