« first day (441 days earlier)      last day (1522 days later) » 

BMO
8:04 PM
0
A: Non-overlapping Matrix Sum

BMOHaskell, 65 bytes f(u:v)=maximum[e+f(take i<>drop(i+1)<$>v)|(i,e)<-zip[0..]u] f _=0 Try it online! Explanation & Ungolfed The function take i<>drop(i+1) takes a list and removes the element at position i. The function f gets each possible element e at position i, removes the elements at p...

It's pretty much the same as my initial (94) python solution
 
 
1 hour later…
9:24 PM
wow this looks so much simpler than what I've tried first
and I keep forgetting about <>
actually one probably doesn't have to use it a lot, except in combination with other infix operators
 
 
1 hour later…
BMO
10:33 PM
@xnor: Nice one!
I tried that approach but struggled with the all(/=i)p check :S
@flawr It came in useful a few times already, the quine is one really cool one
Also drop<>take to rotate or this one which I only just thought about today
This one could even be take<>drop.succ but since I had i already, this is shorter
 
11:07 PM
wait, functions are semigroups too?
@flawr no I don't even understand how this works :/
instance Semigroup b => Semigroup (a -> b) -- Defined in `GHC.Base'
ooooh
neat
 
11:35 PM
is there something similar where you can replace <> with some other function?
(a -> b) -> (a -> c) -> (b -> c -> d) -> a -> d
"put the same thing into two functions and combine their output using a third function"
 

« first day (441 days earlier)      last day (1522 days later) »