« first day (2291 days earlier)      last day (374 days later) » 

4:16 AM
Back after a 3 week hiatus of family visits, R&R, and lots of interpreter work :P
@Adám Just checked this out. Looks like a fun hangout session! I am definitely of the side that wants to commute the arguments for - and ÷.
Anyway, how's everyone's Friday?
 
5:00 AM
Okay, so I have a depth vector dp, but it's not normalized. I.e. children can have depths arbitrarily greater than their parent. For example, 0 3 2 3 normalizes to 0 1 1 2. Notice how right-siblings can be lower than left-siblings.
Anyway, I want to turn dp into a parent vector. This is what I have |(-p)⌈⌈/∘⍸⍤1⊢(∘.>⍨p←⍳≢dp)∧∘.>⍨dp
In words, what I'm trying to say is that a node's parent is the rightmost node of lesser depth, otherwise it's self (root nodes self-loop).
I think the code above pretty much reads like that, but I suspect it has room for improvement. Any suggestions welcome!
 
 
10 hours later…
2:56 PM
@Adám which problem are we on today?
 
Welcome to APL Quest 2019-6! Today's quest is Telephone Names:
> Write an APL function that takes a character vector right argument that consists of digits and uppercase letters and returns an integer vector of the corresponding digits on the keypad:
  	ABC	DEF
 1	 2	 3
GHI	JKL	MNO
 4	 5	 6
PQRS	TUV	XYZ
 7	 8	 9

 *	 0	 #
I'm actually interested in seeing a solution with the hinted-at since I didn't see a need for it at all.
 
@Adám It;s called Telephoner numbers btw
 
{⍵∊⎕D:⍎⍵ ⋄ 1+⌈3÷⍨i-19 26⍸i←⎕A⍳⍵}¨
 
nice
 
3:01 PM
ah :)
⍎⍕{n,⍵/⍨~⍴n←1+⍸⍵∊¨'ABC' 'DEF' 'GHI' 'JKL' 'MNO' 'PQRS' 'TUV' 'WXYZ'}¨
 
@rabbitgrowth Whoa, what?
 
I think we're done :)
Works, too.
 
@rabbitgrowth does this work? 7 is a group of 4 letters. Or please explain me
 
@xpqz I had 10|(1↓⎕D,'@@ADGJMPTW')∘⍸
 
Not a in sight.
 
3:05 PM
Right, not even an uppercase
 
I understand @Adám's version. Not @rabbitgrowth's, at a glance.
 
@Richard That's what the ⍸ is for - whether or not you need to adjust once you've gone beyond O
 
@Richard Ah, I get it now. Right that ↑
 
I didn't know worked with letters :(
 
it doesn't you've done ⎕a⍳ first
 
3:07 PM
⍸⍒⍋ use Total Array Ordering.
@Silas Sure it does. I used that in my solution.
 
oh sorry
was just focused on fact you've done the dyadic ⍳
 
@Silas right :) I used ⍸ just like that but didn't succeed because of 7(PQRS). This solves it nice!
 
@Richard The i-19 26⍸i part adjusts for the extra letters S and Z, which are the 19th and 26th letters. I'm basically subtracting 1 from the indices of STUVWXY and 2 from the index of Z.
 
@rabbitgrowth yes, nice!
 
My solution also gives 10 for invalid characters, which is kind of consistent with the behaviour of I guess?
 
3:12 PM
Yup.
We should be able to make one using just and arithmetic.
 
And no guard too?
 
by dividing by almost 3 and rounding up?
 
@rabbitgrowth Yes.
@Richard I was thinking of using the Iverson Bracket.
 
almost 3?
 
dividing by something like 2.8 which will round up one higher at the PQRS group
 
3:19 PM
ah, was confused by how that'd affect the ABC group
 
I'm almost there.
 
👀
 
Got it! Now for a bit of cleanup…
 
{9⌊(⌊(i-27<i)÷1+2×9<i)-2×10<i←¯1+⍵⍳⍨⎕D,' ',⎕A}
We can probably train this.
 
3:26 PM
{⌈3.17÷⍨⎕A⍳⍵}¨
like this, Only the Z falls in another group now
 
@Richard That's easy to fix: ¯2↓⎕A
 
not quite another instance of a last primative being nice
 
{8⌊⌈3.17÷⍨⎕A⍳⍵}¨
 
Yes, or that. Btw, no need for ¨
@Richard This is amazing: {(¯1+⎕D⍳⍵)⌊1+8⌊⌈3.17÷⍨⎕A⍳⍵}
 
yes , was working on that. Combining the solutions of everybody
 
3:32 PM
Oof:
      n←(⎕D,⎕A)[?1e6⍴36]
      RS←{(¯1+⎕D⍳⍵)⌊1+8⌊⌈3.17÷⍨⎕A⍳⍵}
      Arith←{9⌊(⌊(i-27<i)÷1+2×9<i)-2×10<i←¯1+⍵⍳⍨⎕D,'  ',⎕A}
      AB←10|(1↓⎕D,'@@ADGJMPTW')∘⍸
      cmpx 'RS n' 'Arith n' 'AB n'
  RS n    → 1.8E¯1 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  Arith n → 1.7E¯1 |  -6% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  AB n    → 1.0E¯2 | -95% ⎕⎕
 
Congrats at @xpqz
 
Is the cat out of the bag?
 
was a really nice one, thanks!
 
Wouldn't have been enjoyable without everyone's contributions. Next week will be 2019-6: In the Center of It All.
 
3:38 PM
{2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 7 8 8 8 9 9 9 9 0 1 2 3 4 5 6 7 8 9[⍵⍳⍨⎕A,⎕D]}
:)
 
Oh, that's probably going to be the fastest.
  AB n → 1.1E¯2 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  RG n → 4.4E¯3 | -58% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
 
Arguably also the most clear (imho)
 
I'd put ⎕D before ⎕A, but yes.
I want '012ABC3DEF4GHI5JKL6MNO7PQRS8TUV9WXYZ'∘⍳⊇0 1 2 3 4 5 6 7 8 9 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 7 8 8 8 9 9 9 9⍨
 
ASCII order?
 
No, keypad order with digits before letters.
 
3:44 PM
I see
 
@xpqz seems slightly faster too
 
Slightly‽
 
58%
 
oh, sorry was looking at another modification. Was trying to see how much the ⍨ would take
 
Not significant, since it only happens once.
 
3:48 PM
@Richard Thank you. One week in. It'll be a blast.
 
@Adám what's the ⍨ for there?
 
The rightmost tine of a fork must be a function, but we want an array, so we make the array into a constant function.
 
@Adám in a class with a keyed property (e.g. xpqz.github.io/cultivations/AdvancedOO.html), can I call the keyed setter inside a method somehow using the obj[...]←... syntax?
 
4:12 PM
@xpqz yes: :Property default Keyed K
 
4:22 PM
Of course. Note to self: the property is keyed. It's not overloading [] on the object itself.
 
 
4 hours later…
7:56 PM
so sad nobody did the dumb yet fun solution
{A B C D E F G H I J K L M N O P Q R S T U V W X Y Z←2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 7 8 8 8 9 9 9 9 ⋄ ∊⍎'⍬',∊'⍬',⍪⍵}
 
 
4 hours later…
11:49 PM
Hmm, given your ⎕A←... can't you just then do {⍎¨⍵}?
 

« first day (2291 days earlier)      last day (374 days later) »