« first day (1878 days earlier)      last day (199 days later) » 

7:29 AM
Hi, have a syntax question. In Dyalog, evaluating ⍴(+/⊢⌺3 3) 2 2 ⍴ 255 gives 2 2 3; the +/⊢ forms a two-element function train acting as the left operand of ⌺
But evaluating +/×⍤1¨1 0 ¯1 gives 0; the left operand of ⍤ is × rather than the train +/×
Why is this? What's the rule for tacit functions to the left of a pivotal operator?
 
@phantomics In that case +/(⊢⌺3 3) and (+/⊢)⌺3 3 happen to give the same result I think
Gramatically it's always operator binding first
 
Correct, but +/×⍤1¨1 0 ¯1 and (+/×)⍤1¨1 0 ¯1 give different results
 
I mean, your interpretation of your first result is incorrect
 
Wait
Ok you're right
Thanks, didn't realize those two do the same thing
 
 
5 hours later…
12:15 PM
@phantomics Pro-tip:
      ]box on -t=parens
Was OFF -trains=parens
      +/⊢⌺3 3
(+/)(⊢⌺(2⍴3))
 
1:06 PM
I am trying to write a radix sort that shows intermediate steps.
This is what I can think of: {⍪¨⊃¨{⍵+.×⍨(⍋((d⍴10)⊤⍵)[⍺;])∘.=⍳≢⍵}/¨(⌽¨,\⌽⍳d←⍺),¨⊂⊂⍵}
May I ask how it can be improved, or if there is any better approach?
⍺ is the number of digits
 
@MMisaki Can you give an example of usage?
 
      3 {⍪¨⊃¨{⍵+.×⍨(⍋((d⍴10)⊤⍵)[⍺;])∘.=⍳≢⍵}/¨(⌽¨,\⌽⍳d←⍺),¨⊂⊂⍵} 261 327 31 114
 261  114   31
  31  327  114
 114   31  261
 327  261  327
Something like this. The first column sort the numbers by the last digit. Then, base on that result, the second column sort them by the second last digit, etc.
 
I see. You might like the result of ⍉↑ instead of ⍪¨ better.
Maybe inject the original input as a column on the left?
 
here's my recursive solution {⍺←⎕IO ⋄ ⍵≡⍵[⍋⍵]:⊂⍪⍵ ⋄ (⊂⍪w),(⍺+1)∇w←⍵[⍋⍺⌷⊖10⊥⍣¯1⊢⍵]} it doesn't take a left arg, just gives all steps
 
@MMisaki I'd prefer an explicit passing of rather than giving it a name: {⍉↑⊃¨⍺{⍵+.×⍨(⍋((⍺⍺⍴10)⊤⍵)[⍺;])∘.=⍳≢⍵}/¨(⌽¨,\⌽⍳⍺),¨⊂⊂⍵}
@rak1507 What's up with the ⍺←⎕IO business?
 
1:18 PM
@Adám so it starts at ⎕IO
and uses ⍺ for the digit index
 
Sure, but why not just use ⎕IO?
 
because of recursively passing ⍺+1
 
Oh, I see.
 
really this isn't 'true' radix sort anyway, ⌸ would be more like it
{⍺←⎕IO ⋄ ∧/2≤/⍵:⊂⍪⍵ ⋄ (⊂⍪w),(⍺+1)∇w←∊(i,⍺⌷⊖10⊥⍣¯1⊢⍵){⊂1↓⍵}⌸(i←⍳10),⍵}
(oops not ⎕IO independent now)
 
@Adám Thanks. I did not know I can do this. It looks better.
And I suddenly find that I can write {⍵[⍋((⍺⍺⍴10)⊤⍵)[⍺;]]} in the inner dfns. I forget why I am using inner product in the very beginning.
 
1:36 PM
you can do 10⊥⍣¯1⊢⍵ instead of (⍺⍺⍴10)⊤⍵ I think
 
1:56 PM
Yes, I think I can remove the left argument using ⊥⍣¯1.
 
@rak1507 Oh, yes. Counting sort should be used actually.
 
@Adám did you get pinged around the 1:11 minute mark?
caused i thought i got pinged lol
 
@PyGamer0 Huh, yes. I thought that wouldn't go into the video. Oh well.
 
2:21 PM
oh lol me too
 
2:34 PM
I found the setting for excluding desktop audio. For next time, then.
 
2:50 PM
Gosh... it's already friday?
 
it is
 
@FawnLocke ⎕←⊃'Dddd'(1200⌶)1⎕DT'Z'
@hyper-neutrino Uh, were is the bot?
 
oh, I forgot to restart it after my server rebooted
 
I thought you had automated that.
 
well it restarts if it crashes
i haven't set stuff up to automatically start up if my server randomly crashes
⎕←42
 
2:56 PM
@hyper-neutrino 42
 
Welcome to the APL Quest! This weeks quest is Float Your Boat:
> Write a dfn which selects the floating point (non-integer) numbers from a numeric vector.
Who wants to present a solution?
 
Operators galore: /⍨∘(≠∘⌊⍨)⍨
 
Whoa.
Maybe the dfn version is easier on the eye? {⍵/⍨⍵≠⌊⍵}
 
Aye. With before it's quite pretty: ≠∘⌊⍨⍛/
 
@FawnLocke ≠∘⌊⍨ could also just be ⊢≠⌊
 
3:02 PM
I added this comparison tolerance setting, but I can't really explain why :)
{⎕CT←0 ⋄ ⍵/⍨(⌊≠⊢)⍵}
 
Good point !
 
Agreed.
Btw, when comparing 0, ⎕CT isn't a factor. How might we exploit that?
 
maybe subtract the number from it's floor, and compare with zero?
 
Yes.
 
∊{0::⍵⋄⍬⊣⍵/⍵}¨
⊢~⌊ is probably shortest
 
3:09 PM
@Adám i had a similar answer....
 
@rak1507 Yup, I was waiting for that one!
 
:)
 
@rak1507 That's just silly.
I found it interesting that the problem text uses the phrase "floating point" as in the internal representation.
 
∊{0::⍵⋄⍵/⍬}¨ is shorter
 
How might we use that? (It would take care of the comparison tolerance issue too.)
 
3:12 PM
⎕DR¨
 
⋄ {⍵/⍨645=⎕DR¨⍵} 14.2 9 ¯3 3.1 0 ¯1.1
 
@FawnLocke 14.2 3.1 ¯1.1
 
Ninja'd...
 
@rak1507 You can use too.
@FawnLocke ⋄ {⍵/⍨645=⎕DR¨⍵} 3.1 3e4000
 
@Adám Response looks like a 1-by-0 matrix.
 
3:15 PM
You wanna check for 1287 too, ∊ should do it.
 
Exactly.
 
I'm not proud of this one :)
{⍎¨z/⍨'.'∊¨z←' '(≠⊆⊢)⍵}
 
There are probably a handful of silly solutions with (×|⊢) & 0 1∘⊤
 
oh, i forgot to format the argument
 
⋄ {⍵/⍨645 1287=⎕DR¨⍵} 3.1 2.7j18
 
3:17 PM
@Adám 3.1
 
{⍎¨z/⍨'.'∊¨z←' '(≠⊆⊢)⍕⍵} there
yes, i forgot to format it, it was outside the dfn in my repl
 
You could just do it on each: ⋄ {⍵/⍨'.'∊∘⍕¨⍵}3.1 4 1 5.9
 
@Adám 3.1 5.9
 
@Adám Oh, yes, makes much more sense
 
doesn't work for exponentials
 
3:19 PM
Neither does
 
oh, true
 
But that's the question; are we talking internal representation, or actual non-integers?
 
I reckon non integers
 
The '.'∊⍕ method fails on 10000000000.2 with default ⎕PP
 
i know this is the apl quest but here is the k version: {~x=_x}# :)
 
3:22 PM
@PyGamer0 What does # do here?
 
filter
 
⋄181⌶.5*⍨1234*2
 
@rak1507
DOMAIN ERROR: ⌶ is limited to case conversion (819⌶) and date formatting (1200⌶)
      181⌶0.5*⍨1234*2
          ∧
 
@PyGamer0 So it is an adverb?
 
It's f⍛/ ≡ f#
 
3:23 PM
^
 
Functions are first class, not sure what definition of adverb they use given that
 
But # is also a verb, as in 2#"abc" so it is kinda like a hybrid?
 
Rak is probably the expert here :)
 
@Adám yeah
k has a lot of overloads
 
@FawnLocke ⊢⊢⍤/⍨0≠×|⊢
 
3:26 PM
:)
 
@FawnLocke {⍵/⍨∧⌿0≠0 1⊤⍵}
No, wait.
There's really no need for the integer part.
 
Right !
 
So just {⍵/⍨0≠1⊤⍵} which takes care of the ⎕CT problem.
Hm, this means that there is a use case for scalar⊤ meaning that it isn't so obvious to re-purpose it for scalar⊥⍣¯1
Still, I'd argue that {⎕CT←0 ⋄ ⍵/⍨0≠1|⍵} is much clearer than {⍵/⍨0≠1⊤⍵}
But if you're already localising ⎕CT, you might as well do {⎕CT←0 ⋄ ⍵≠⌊⍵}
Once we get array notation, we'll be able to write ⊢(⎕CT:0).≠⌊ or with before: ⌊⍛(⎕CT:0).≠
Is this it, or does anyone have any other solution they'd want to bring up?
OK, see you next week for the (admittedly trivial) Go Forth And Multiply!
 
Looks like the final stretch, those were some good finalizing notes :)
 
@Adám - Isn't FORTH sorta backwards from APL?
 
3:41 PM
;-)
 
@Adám that is very similar to the identity matrix problem....
 
4:36 PM
@Adám won't just ∘.×⍨⍳ do it
this problem seems too simple
alternatively as it could be argued ⍨ didn't exist back then, a surprised face with a shiner could do: ⍳∘.×⍳
 
There are a handful of solutions, but, yes it's simple.
 
 
2 hours later…
6:16 PM
@Adám no, it's still a regular verb there, just with a function left argument
 

« first day (1878 days earlier)      last day (199 days later) »