I'm not sure if map and filter would be adequate without laziness though. I feel like laziness shouldn't matter but it's more a gut feeling than something I can prove
Last year I had PE, and for the final half hour or so we could just sit around on our laptops/phones (it was officially for "studying"). Sometimes people would keep playing basketball or whatever we were doing that day, and they weren't very good at not hitting people.
@RedwolfPrograms (it progressively gets more difficult as it continues. The 20 meter pacer test will begin in 30 seconds. Line up at the start. The running speed starts slowly, but gets faster each minute after you hear this signal.)
@user I had a dislike for PE when it was sports such as volleyball/football because those were the sports where I had to be in a team and actually socialise with people outside my friend group
@lyxal I like that because I let other people carry me. You don't have to socialize with people at all, just stand there and when everyone's done picking teams, the teacher's forced to assign you to someone. Once there, stand at the back and occasionally jump or something to show that you're participating. Gets you an A every time
Even sum subarrays code-golf array integer subsequence
Given an array of integers, count the number of contiguous subarrays with an even sum. You may assume that the array is non-empty, and contains only non-negative integers.
This is code-golf, so the shortest code in bytes wins.
Test Cases
Input -
Supposedly everyone has easy access to drugs but never once have I been able to get any (not that I want any, of course)
@lyxal Especially when you're with a bunch of sports tryhards. First participate and mess up horribly, then they'll be forced to let you sit the game out :P
This was literally my strategy at a basketball camp my parents made me go to
tfw you're too lazy to hunt down a link to the posted challenge, so in the sandbox post you just delete it and link to the wikipedia disambiguation page for "pancake"
@user (also, if you try too hard, you might end up falling flat on your face, but the opposite might also happen: you might not be trying hard enough but when you chuck the ball randomly to make like you're passing to a teammate, you might make a 3-pointer shot with 4 seconds left on the clock)
@Fmbalbuena (if you're asking me because I have 10k rep, I think it took me over a year for that, and I posted tons of kinda uninteresting answers during the first few months of the pandemic because I was bored. I wouldn't recommend doing that)
What general tips do you have for golfing in Chef? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Chef (e.g. "remove unnecessary whitespace" is not an answer).
Please post one tip per answer.
Introduction
A code page maps integer values to a specific character. We can visualize a code page like this:
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
+---+---+---+---+---+---+---+---+---+---+---+-...
@emanresuA python doesn't actually implement @ for any of its types, it just defines @ as the operator you should use if you're going to use something for matrix multiplication
In conclusion, I've written my own matrix multiplication function that doesn't actually care about size because it's just dot product (vectorised multiplication and sum) for each row for each column or something like that
Based on your Schools Recommendation Scheme (SRS) application, you are eligible for admission to the Bachelor of Software Engineering (Honours) at the <University>.
Like, all of the other mail-mail spam I get is for smaller, in-state schools. It's a bit surprising to me that well known colleges on the other side of the US would think they need to do that.
I'd mostly just be going for a piece of paper to get jobs with, and for the social aspects (new friends, getting the farthest possible from my family, that sort of thing)
I had for po intended to fill it as for position in ... but it gave me a for pon loop
different question: does anyone know how one might implement: Fill by coordinates - Given function + list, call with each (potentially multidimensional) coordinate of list, as list of integers, and insert result into corresponding location
if you have a list of lists map maps over the lists but deepmap maps over the elements of the lists (unless those elements are lists in which case you get the idea)
for operator in [">", "<", ">=", "<="]:
Function(operator, 2, ...)((lambda f: lambda *x: all(f(a, b) for a, b in zip(x, x[1:])))((lambda o: eval(f"lambda x, y: x {o} y"))(operator)))