« first day (2298 days earlier)      last day (368 days later) » 

4:11 AM
@B.Wilson Yes. Every array pocket has a flag bit indicating if it was already squeezed ("the squoze bit"). ⎕DR will not bother to check for squeezability if a pocket is has that bit set.
 
 
4 hours later…
8:09 AM
@Adám Neat. Is there some writeup somewhere about the pocket jazz and Dyalog's memory manager in general?
 
9:06 AM
@B.Wilson I don't think so. These are internal technical details, which, besides for being closed source, are subject to change without notice.
 
 
6 hours later…
3:00 PM
Welcome to APL Quest 2019-6! Today's quest is In the Center of it All:
> Given a right argument of a list of words (or possibly a single word) and a left argument of a width, return a character matrix that has width columns and one row per word, where each word is centered within the row. If width is smaller than the length of a word, truncate the word from the right. If there are an odd number of spaces to center within, leave the extra space on the right.
      10 (your_function) 'APL' 'Problem' 'Solving' 'Competition'
   APL
 Problem
 Solving
Competitio
      3 (your_function) 0⍴⊂''   ⍝ result should be 0-row, 3-column matrix
I basically have one overall strategy which can be coded a couple different ways - let's see what you've got
 
(↑¨⌽∘↑⍨∘⌈¯2÷⍨0⌈-∘≢¨)∘⊆
 
@rabbitgrowth nice, pushing it for a train for my taste - I'll have to take a second to grok
it's a fork, ok
(↑¨)(⌽∘↑⍨∘⌈)(¯2÷⍨0⌈-∘≢¨)
with some beastly tines
 
the middle one's confusing at the moment, but the right one's not too bad
 
((⌈⍵)⌽↑⍺)
 
Maybe I'm trying too hard to avoid parens?
Still not too sure what's considered readable
 
3:12 PM
@rabbitgrowth Maybe, maybe not - for me, in this case, there are 3 distinct steps to the solution
was gonna ask if anyone wanted to describe them in English, but should I?
in the case of tacit, for me, here I'm having to parse both train syntax and function composition operators, which makes it a bit harder to parse
took me a minute to realise it was a fork and not an atop with a confusing use of each
 
Am I too late?
 
the other thing to think about, after we look at code structure now, is the performance of your solution compared to another very similar solution
@Richard not at all, only @rabbitgrowth submitted so far
 
Haven't read back so maybe already posted
{↑⍺{(⍺⌊⌈2÷⍨⍺+≢⍵)⌽⍺↑⍵}¨⊆⍵}
I do not like it particulary, because of all the {}'s
 
I think I went for an in-line assignment in that case
The way I think of it, the three steps are:
- compute the rotations
- do the rotations
- stack the strings
 
Tried to convert this one
↑10{(⍺⌊⌈2÷⍨⍺+≢⍵)⌽⍺↑⍵}¨
to a general one
 
3:18 PM
you can just pop the ↑⍵ on the inside
and you're missing ?
 
yes indeed
 
both of you computed the rotations in a nice way I think
but there's one thing you can do to make it a bit faster, what's that?
 
@RikedyP how can you rotate before enlarging the vector?
 
ah ok, so maybe there are more steps :P
but you can stack the vectors into a matrix before doing the rotations
 
or I misuntderstood.
 
3:22 PM
no you're right, I kind of embedded "enlarge the vectors" into the "do the rotations" part, but it could be done in a couple of places
 
@RikedyP I also tried something with @. But only one character can be inserted at a time?
 
@Richard maybe with a strand or enclose?
but you'd have to compute the number of spaces to insert anyway, so might as well use take ⍺↑⍵
no I don't see how you can expand the vectors with @
 
@RikedyP not expanding, but inserting the complete vector at once, after expanding the destination vector
 
@Richard you mean computing the indices that would put the text in the middle of each line?
 
    something like 'APL'@2⊢'       '
 
3:27 PM
@Richard Yeah that would need to be 'APL'@2 3 4⊢
then something mildly horrific to map between values and indices
 
@RikedyP don't know, whithout rotating?
@rabbitgrowth nice, took me some time to figure it out
 
@Richard No, still rotating
 
why'd you need to rotate with @ - can't you place where want inside spaces?
 
@RikedyP I believe mine does that already, but maybe it's not expressed very clearly. Here's a dfn version: {(⌈¯2÷⍨0⌈⍺-≢¨⍵)⌽↑⍺↑¨⍵}∘⊆
 
@Silas two different topics simultaneously
@rabbitgrowth ah yes it does, my bad
rotate after mix
@Silas so no rotation for the @ version, but I think the required mapping might look ugly
@rabbitgrowth Also might be a little faster to do a 2D take after mix rather than a take-each then mix
{(⍺,⍨≢⍵)↑↑⍵}
 
3:33 PM
@RikedyP So you are hinting at calculating the amount of roatations then?
@Silas that's why I suggested @, skipping the rotate
 
@Richard For my performance comment, I was talking about doing mix first to get a matrix and then using ⍺⌽⍵
For @, we don't need to do rotate
but still need to do a similar (or the same) calculation
because it's really a "how many spaces" calculation, the use of rotate is an implementation detail
 
@RikedyP How do I reason about which is faster? "Flatten as soon as possible"?
 
@rabbitgrowth basically
 
idea is to place the data contiguously in memory, rather than needing to follow pointers in array of arrays form
 
@RikedyP ah, so not each vector get's already the same length
 
3:42 PM
@Richard not sure I understand - at some point they need the same length
 
If you first use mix, all the vectors get the same length, and then only one 'take' is needed for the complete matrix to get the right size
 
@Richard Right
Okay last one, anyone help me get rid of this LENGTH ERROR?
{i←(⍳¨⍺⌊≢¨⍵)+(l←⍺)-(⍺⌊⌈2÷⍨⍺+≢¨s←⍵) ⋄ i{⍵@⍺⊢l↑''}¨s}∘,∘⊆
it's a bit annoying because 'Comp'@1 2 3 4⊢4↑'' seems to work
Note: there are obviously umpteen ways to do the "rotation" - we could do takes and drops as well
and a few ways to compute the necessary spaces / to compute the rotation
{-⌊0.5×⍺-+/¨' '≠⍵}
 
huh, I'd done ↑10{⍵@((⌊2÷⍨⍺-≢⍵)+⍳≢⍵)⊢⍺↑' '}¨⊆'APL' 'Problem' but not sure how to improve it
 
yeah I just figured it out, I think yours @Silas will fail too for 'competition'
need to trim it
 
yeah, hadn't tried the whole string yet :)
so need to clamp with ⌊ somehow
 
3:50 PM
ew:
{i←(⍳¨⍺⌊≢¨⍵)+(l←⍺)-(⍺⌊⌈2÷⍨⍺+≢¨s←⍵) ⋄ ↑i{((l⌊≢⍵)↑⍵)@⍺⊢l↑''}¨s}∘,∘⊆
 
@RikedyP why 0.5× not 2÷⍨ ?
 
@Silas cos I like 0.5×
I'm not swap-crazy like Adam
 
solutions longer than the problem description are wrong by default ;)
 
@Richard +←1
right I guess this horse has been flogged
any more for any more?
 
but the ¨ has to be done first.
{↑⍺((⍺⌊⌈2÷⍨⍺+≢⍵)⌽⍺↑⍵)}¨⊆
is not working
 
3:56 PM
there you go @Silas:
      ↑10{((⍺⌊≢⍵)↑⍵)@((⌊2÷⍨|⍺-≢⍵)+⍳⍺⌊≢⍵)⊢⍺↑''}¨⊆'APL' 'Problem' 'Solving' 'Competition'
   APL
 Problem
 Solving
Competitio
 
ah! Was getting there
 
@Richard you gotta get rid of the loop
@Silas ah sorry spoilers
 
@RikedyP yes, but how?
 
@Richard oh wait, you're trying to function-ify your original solution, sorry
can make it an atop 2-train
F ← ↑{((⍺⌊⌈2÷⍨⍺+≢⍵)⌽⍺↑⍵)}¨∘⊆
and remove outer parens
↑{(⍺⌊⌈2÷⍨⍺+≢⍵)⌽⍺↑⍵}¨∘⊆
right I gotta go
thanks everyone
 
ah, that is nice, thanks all
 
4:00 PM
Next week will be 2019-8: Going the Distance
 
So, flat arrays are represented as contiguous blocks of memory? Sorry I'm on mobile and couldn't respond quickly
 
yes, and enclosed elements as pointer to an array holding that element
 
4:19 PM
Ah I see, I think I understand why (⍺,⍨≢⍵)↑↑⍵ is faster than ↑⍺↑¨⍵ now
Also the former mixes once and takes once, while the latter takes ≢⍵ times
Thanks everyone!
 
 
3 hours later…
7:09 PM
@RikedyP is there some way to like schedule a message? I have a sol but I can't be there (in fact, I can very rarely, but would be interested in at least proposing something to be maybe worked on without me)
 

« first day (2298 days earlier)      last day (368 days later) »