« first day (2410 days earlier)      last day (237 days later) » 

9:53 AM
0
Q: Running a custom hook after fixing a function

August KarlstromUsing Dyalog APL 16, is it possible to define a function which is called directly after a function is fixed (with Ctrl+Down)?

 
 
5 hours later…
3:00 PM
Welcome to APL Quest 2021-3! Today's quest is Multiplicity:
> Write a function that:
• has a right argument `Y` which is an integer vector or scalar
• has a left argument `X` which is also an integer vector or scalar
• finds which elements of `Y` are multiples of each element of `X` and returns them as a vector (in the order of `X`) of vectors (in the order of `Y`).
 
{{⍵/W}¨↓0=⍺∘.|W←⍵}
But it is not fully correct
 
(⊢(/⍨)0=|)¨∘⊂
 
@Richard Right, it fails when the right argument is a scalar. Just ravel it!
 
nice!
 
@rabbitgrowth Ooh, fancy. But having the left side tacit doesn't gain you much here. Isn't {⍵/⍨0=⍺|⍵}¨∘⊂ easier on the eye?
 
3:02 PM
can mine be done without assigning a temporary variable?
 
Yes!
Let's look at that.
All {⍵/W} really does is derive a monadic function from / that has a constant right argument.
That's a job for Bind ()
 
@Adám Yes, I agree. That (/⍨) isn't very nice
 
@Richard Are you figuring it out?
 
I ended up with: ⊢,./⍨0=∘.|⍥,
 
Whoa.
 
3:06 PM
Yes, but didn’t succeed yet
 
@rabbitgrowth You could write ⊢⍤/⍨ instead. Although that is not so nice either.
 
@Richard The idea is simply that f∘B is {⍵ f B}
 
Yeah, I feel like ⊢⍤/ is even worse...
 
How do you like ⊢⊂⍤/⍤1⍨0=∘.|∘, then?
@Richard Need more help?
 
{omega jot /}?
 
3:11 PM
No, you want a constant right argument.
 
Sorry, on a phone
 
iOS or Android?
 
android
omega jot / right tack
 
No need for right tack.
 
then I am lost.
 
3:14 PM
{{⍵/W}¨↓0=⍺∘.|W←⍵}
{  /∘⍵¨↓0=⍺∘.|  ⍵}
No need for a variable when we remove the the inner dfn, since now refers to the outermost function's argument.
Instead of ∘. we can take advantage of the scalar nature of | with {/∘⍵¨0=⍺|⊂⍵}
 
Ah yes, I should have known. “ wants a monatic function on its left
 
Well, ¨ doesn't care, it can take a dyadic function too, but here we want a monadic one.
 
Took me a while to understand ,./
 
Yeah, that's just obscure.
 
Pretty satisfying to type on QWERTY though :)
 
3:22 PM
Oh, yeah!
 
@rabbitgrowth Originally it didn't feel like the shapes would align for the operations to process right.
 
Are we done with this one?
See you next week for 2021-4: Square Peg, Round Hole. Also note that beginning a month from now, we'll have these sessions two hours earlier (by absolute UTC time).
 
Thanks.
 
Thanks @Adám
 
Thanks Adám!
 

« first day (2410 days earlier)      last day (237 days later) »