« first day (1503 days earlier)      last day (1144 days later) » 

10:00 PM
{1} 1 2 3 4 5
1
looks right
 
One 1 per element.
 
ohhhhhhhhhhhhhhh
 
well it's not 3 but =⍨≡¨ is fun using monadic ≡
×≢¨
oops no that doesn't work for length 0 things
 
Hint: This CMC is connected to the lesson learned from the "decrement first" CMC.
 
well there's ≡⍨¨ but that's not particularly interesting
 
10:03 PM
Should I give it away? Or do you want more hints?
 
I don't mind it being given away, but if others want to try and get it that's fine
 
OK, here's another hint: It uses two functions, of which one is an arithmetic function.
Oh well, here goes…
3
2
1
!⍷⍨
 
anyone ready for nother one?
 
I'm going to bed soon, but sure, feel free to post it. You may want to start with **CMC:** so it is easier to spot.
 
10:22 PM
@Adám using ⍷⍨! nice
 
**CMC:** Modified shuffle sort (part 1) Shuffle a and b such that elements of a are "nested" between elements of b. For the simple case:
a
1 1 1 1
2 2 2 2
3 3 3 3
4 4 4 4
b
AAAA
BBBB
CCCC
DDDD


and should work for all a if the elements in a are grouped evenly
      a
1 1 1 1
1 1 1 1
1 1 1 1
2 2 2 2
2 2 2 2
2 2 2 2
3 3 3 3
3 3 3 3
3 3 3 3
4 4 4 4
4 4 4 4
4 4 4 4

A A A A
1 1 1 1
1 1 1 1
1 1 1 1
B B B B
2 2 2 2
2 2 2 2
2 2 2 2
C C C C
3 3 3 3
3 3 3 3
3 3 3 3
 
@nathanrogers What is the expected result for those a and b?
@nathanrogers What is b here?
 
b is 4 4⍴4/⎕A
a in the base case is 4 4⍴4/⍳4
and you can increase the size of a for part 1 with {(⍵,4)⍴⍵/⍳4} where ⍵ is divisible by 4
all the 1's are "nested between rows A and B, all 2's nested between rows B and C... etc
 
Ah, so instead of a simple perfect shuffle, it is a distributed perfect shuffle.
 
Right
Think about ⎕XML arguments
 
10:32 PM
@nathanrogers by elements you mean major cells?
 
Sure, too late to edit
 
@nathanrogers Will a always be the shorter one?
 
should have given better names... bleh, B is the groups, A is the nested values, so for part 1 A will always be of equal length for each row of B
A←{(⍵,4)⍴⍵/⍳4}
B←4 4⍴4/⍳4
Must work for any A where ⍵ is divisible by 4, and constant B
      B Solution A 4
A A A A
1 1 1 1
B B B B
2 2 2 2
C C C C
3 3 3 3
D D D D
4 4 4 4
So 1's are grouped with A, 2's are grouped with B, 3's with C, etc
      B Solution A 8
A A A A
1 1 1 1
1 1 1 1
B B B B
2 2 2 2
2 2 2 2
C C C C
3 3 3 3
3 3 3 3
D D D D
4 4 4 4
4 4 4 4
etc for all A (4×⍳∞) with ⎕IO←1
 
@nathanrogers Where did the letters come from?
 
B←4 4⍴4/⎕A
X( I'm not good at this
Should have typed it out first
 
10:47 PM
Yes.
@nathanrogers Only matrices or any rank arrays?
 
only matrices
 
@nathanrogers I think {c[⍋⍋×(1+⍵÷⍥≢⍺)|⍳≢c←⍺⍪⍵;]} does it.
 
your ⎕IO?
yep, works for ⎕IO←0
 
⎕IO←0
@nathanrogers {c⌷⍨⊂⍋⍋×(1+⍵÷⍥≢⍺)|⍳≢c←⍺⍪⍵} for arbitrary rank arrays.
 
sol←{(⍺⍪⍵)[⍋n,((≢⍵)÷≢⍺)/(n←⍳≢⍺);]}
this is my solution for ⎕IO independent
 
10:58 PM
Hold on, I have an idea for a neater solution.
@nathanrogers {,[⍳2]⍺⍪⍤1 2⊢4(⍵÷⍥≢⍺)4⍴⍵} any ⎕IO
 
whoah, I'm gonna have to look at these
 
Hold on, I have an idea for a neater solution.
 
Nah, turned out ugly: {⊃⍪/(↓⍺)⍪¨⍵⊂[0]⍨⍵(⊣⍴1↑⍨÷)⍥≢⍺}
@nathanrogers Tacit version of my second solution, but with swapped arguments: ,[⍳2]⊢⍪⍤1 2⊣⍴⍨4,÷⍥≢,4⍨
 
11:16 PM
wow neat
 
Costs one byte to swap args.
 
11:35 PM
@Adám part two was going to be this
unvn ← {((+/ug),TD)⍴((ug←?UG⍴⍵)×TD)/1+⍳UG}
RNDM ← 10
A ← unvn RNDM
- Nested rows in ONE one were guaranteed to be even in length.
i.e. 3 rows of 1, 3 rows of 2, 3 rows of 3, 3 rows of 4 ...
Now you don't know how many rows there are per group
A may have any number of rows less than RNDM (including NONE)
for each group
TD←5 ⍝ Trailing Dimension
UG←4 ⍝ Unique Groups
Write a solution that zips these 2 matrices together for any RNDM / TD / UG
 
I'm sure you can modify my solution to handle that.
 
min you just modify the replicate of the rightmost ⍳
sol←{(⍺⍪⍵)[⍋n,((MODIFY THIS PART)/(n←⍳≢⍺);]}
is basically the solution
      xmlInput←(rowxml⍪cellsxml)[⍋(⍳≢rn),(2×rcc)/⍳≢rn;]         ⍝ multiply the row cell count by 2, this accounts for both cell tags and value tags to be passed to ⎕XML
This line in APL2XL was written by Morten, and I thought it was pretty dope. The 2× is because cells xml has 2 nested elements per row (values inside cells inside row), and you count up the cells in each row, you have how many pairs will exist inside that row
 

« first day (1503 days earlier)      last day (1144 days later) »