« first day (2376 days earlier)      last day (285 days later) » 

12:09 AM
alright, comp over so I can share my hideous 1.10
{¯1↓¨1↓(⍺+1)↑(2,2≠/⍺⌊+\(1,¯1↓' '=⍵))⊂(⊢,' '⍴⍨' '≠⊃⍤⌽)⍵}
I believe it deserves a category of its own, lower than 1.8
 
 
1 hour later…
1:29 AM
This is mine: 1↓(1+⊣)(⊣↑1↓¨⊢⊂⍨⊣(×≥+⍀⍤⊢)' '=⊢)(' ',⊢)
It basically counts the spaces and splits on those which are less than the target.
I stick an extra space on the front so that the prototype is a space when I overtake at the end.
Or rather the prototype is an empty list.
 
2:01 AM
@RubenVerg I think one big difference between yours and mine is that we both start with a Boolean mask of where the spaces are and we both use plus scan to count those spaces, but I multiply by the mask to find the counts at the ones where it seems you use windowed ≠ to filter out counts at the zeros.
 
 
1 hour later…
3:08 AM
@Adám Here's my contribution to the foray: (∧/0>2×/⊢)∘(2-/10⊥⍣¯1⊢).
@RubenVerg You got me to think about this again, and I realized I was being really dumb.
       cmpx 'euro makeChange 200'
 5.5E¯2
That problem gave me way more grief than it should have. I got lost thinking about how the power series coefficients of ÷×/1-x*D for denominations in D. The coefficient of x*n counts the number of ways to make change for n with D.
It did lead me to thinking up a recursive solution, and writing that down ended up simplifying the approach further. Then you pushed me over the edge just in time to realize that my recursion actually had the structure of a simple reduction.
 
3:30 AM
@B.Wilson - Whoa! I thought mine was pretty quick at about a second.
Mine uses a recursion which can probably be a reduction.
 
 
1 hour later…
4:55 AM
For 1:10 {1↓¨1↓(1+⍺)↑' '(⊣,,⊂⍨⍺⍸⍣¯1⍤∪⍤⍴⊣⍸⍤=,)⍵}
 
5:17 AM
I remembered in previous competitions adam showed us some ridiculous machine generated tacit phase 1 answer
For my phase 2 problem 2 ldbeth.sdf.org/pot.html
What do your get for 3 7 9 11 12 makeChange 40?
 
 
2 hours later…
6:59 AM
oh that partition is so much nicer than mine
I couldn't get Stencil to work
so I basically calculate the indices from which I should do a shape take
oh and makechange is quite nice too, I have a straightforward recursive solution
my only optimization is reversing α to vastly reduce the search space
 
7:22 AM
I get the following:

3 7 9 11 12 makeChange 40
0 1 1 0 2
3 1 0 0 2
2 0 0 2 1
1 2 0 1 1
1 1 2 0 1
4 1 1 0 1
0 4 0 0 1
7 1 0 0 1
0 1 0 3 0
0 0 2 2 0
3 0 1 2 0
6 0 0 2 0
2 2 1 1 0
5 2 0 1 0
2 1 3 0 0
5 1 2 0 0
1 4 1 0 0
8 1 1 0 0
4 4 0 0 0
11 1 0 0 0
I also didn't use Stencil, FWIW.
My makeChange is just straight forward dynamic programming. The only optimization was to pack the partitions into integers base (1+goal).
cmpx '≢euro makeChange 200'
2.5E¯1
Thinking about it now there might be one or two small optimizations still possible.
(I still don't understand how to do code formatting here...)
 
On a standalone message, paste the code and then hit "fixed font" or Ctrl-K
alternatively, on a message with just one line, you can use backticks for inline code. it doesn't work on multiline tho
 
7:59 AM
Thanks
 
 
1 hour later…
9:09 AM
@LdBeth I get the same as @doug, modulo first-axis permutation.
Ah, this is a nice tactic: _←⍎'←,⍺',⍨⊃(≢,⍺)⌷'S' '(S M)' '(S M C)'. I end up bending over backwards to support the defaults for M and C: p m s←3↑⊆⍺,⌽(0⌈3-≢⍺)↑(0⍴⍨≢⍴⍵)(1⍴⍨≢⊃⍺). Using ⎕IO←0.
@LdBeth BTW, this page is so pleasant to look at. How are you generating the html with embedded styling?
 
@B.Wilson i just made a helper function, I think ease of understanding here is more important than brevity
partition←{
  fixSpec←{                  ⍝  Fix the left argument to comply with the task specification
                             ⍝  ⍺ is spec, ⍵ is ⍴⍴arr
    0=≡⍺:(,⍺)(,1)(⍵⍴1)       ⍝  simple scalar → shape = ,⍺, default spec & start
    1=≡⍺:(⍺)(1⍴⍨⍴⍺)(⍵⍴1)     ⍝  simple vector → shape = ⍺, default spec & start
    1=≢⍺:(⊃⍺)(1⍴⍨⍴⊃⍺)(⍵⍴1)   ⍝  1-element box vector → shape = ⊃⍺, default spec & shape
    2=≢⍺:⍺,⊂⍵⍴1              ⍝  2-element box vector → shape = 1⌷⍺, spec = 2⌷⍺, default shape
 
9:32 AM
Oh nice! Copying this somewhere that avoids the text wrapping, this super easy to read. :D
 
ye as soon as I have time I'll post my solutions somewhere better
alongside all my notes, I think some are slightly interesting
I kinda dislike the expandShapes hack but couldn't find a way around it
 
Can definitely tell you take pride in your work on these. Can also see that you've read some dfns workspace code.
Personally, I took a slightly different design route. My crackpot desire is to train my brain into "APL fluency" enough such that there's no impedance mismatch between compact code and readable code. I'm definitely on the side of compact in my solutions.
 
by what? :p
 
@RubenVerg Oh, the coding style totally has dfns written all over it!
 
I suppose I may have internalized that from reading though half dfns:))
it has lots of great learning opportunities throughout the code
one thing dfns does and I definitely don't is having actually helpful comments, half of mine are just restating what the code does
the apl version of x += 1; // Add 1 to x
 
9:40 AM
Yeah, your comments do have a procedural bent. dfns is more declarative IMO. Have you read the Scholes paper about this? dyalog.com/uploads/documents/Papers/declarative_prog.pdf
 
yeah, but I've been somewhat struggling to implement it's suggestions
apl feels inherently imperative to me
I sketched out the solutions for 2.2 in Haskell and they're definitely more declarative
I find that I intuitively think of tacit functions as declarative and dfns as imperative, even if the dfn is just the same code with an omega slapped at the end
I read ⌈⌿⌊⊢-¯1*⊢ as "the list minus alternating ±1, bounded by it's maximum" and {(⌈⌿⍵)⌊⍵-¯1*⍵} as "take the list, subtract alternating copies of ±1, bound it by the maximum value, return that"
(alternating because the function here is called on an iota, it's for generating the indices for 1.9)
 
10:05 AM
@RubenVerg You think so? This is one way to read your code: ix.io/4BLF
 
10:16 AM
@B.Wilson I know, but it's an active effort for me to do that
my brain is wired to read {d,trad}fns as imperative unless there are declarative comments next to every line
idk why
 
@RubenVerg Totally feel you on that one. The struggle is real.
 
 
6 hours later…
3:52 PM
@B.Wilson I use pygments.org to generate HTML and copied the CSS into it
 
4:22 PM
@RubenVerg I think my brain is more weird because I think every dfns is equivalent to monadic do block in Haskell (or nested let s in Clean which does the same thing)
Well in certain way do block is "imperative"
 
 
2 hours later…
6:39 PM
@LdBeth it's surely closer to imperative than traditional FAM are
in my mind, do is to dfns as traditional monads are to tacit fns
 

« first day (2376 days earlier)      last day (285 days later) »