Show newer

@aescling oh i guess there is an Array::entries() method which i could be using instead of Object.entries(…).values() but same thing

@aescling (pipes here is an array, if that helps)

@aescling

const pipesIterator = Object.entries(pipes).values();

for (const [pipeNº, index] of pipesIterator) {
/* … */
let nextPipeNº = pipeNº;
while (pipes[++nextPipeNº] < lastIndex) {
// skip pipes which precede lastIndex
if (pipesIterator.next().done) {
break;
} else {
continue;
}
}
}

@aescling because i needed to skip some iterations in a for…of loop?

“interesting” here is acting as a shorthand for “actually interesting”, not “having rare or unexpected qualities”, which would render this statement paradoxical

Show thread

there are some people on this website who you would expect to be interesting and really aren’t, and there are some people on this website who you would not expect to be interesting who really are

just legitimately had to use this technique; a·m·a

Show thread

; {
const values = [1, 2, 3, 4, 5].values()
for (const value of values) {
if (value % 2) values.next()
console.log(value)
}
}

Array.prototype.push.apply(parents, current == null ? [] : [current])

they’re very handy, even when you don’t need them, just for clarity of code

Show thread

using a lot of labelled blocks in this javascript which is not something you see often

i’m not watching the game actively but it’s on in the other room and every time i pop in it’s like, oh look, he stepped out of bounds early; oh look, there was defensive holding on that play which would have been a sack; oh look, he threw an interception

Show thread

i have nothing against the ravens but it is fun to watch them footgun

@CobaltVelvet@octodon.social you’re reading “losing a son” as “losing a male (child)” but i think many people who use this phase intend it equally as “losing a (male) child”; it’s a disowning statement or performs as one

@nleigh oh yeah i hope you like hot fire nation assassin women because let me tell you kyoshi does

@craigmaloney@octodon.social @noelle if you're curious about this decision, it comes from how python rounds //

many languages drop the fractional part, so -6 // 8 is 0. you then need a -6 to get back to your original value.

8*0 + (-6) == -6

python always rounds down, so -6 // 8 is -1. so you need a 2:

8*(-1) + 2 == -6

@nleigh good; it's a lot of political drama and actual death from the perspective of someone who was raised a poor servant orphan in the Earth Kingdom, which is definitely a different vibe from the shows but i appreciate it

also it’s gay

@noelle @craigmaloney@octodon.social oh, hm, not sure if i agree with that definition of remainder

technically speaking, it's a standardized 'remainder-near' function, so my only real issue with it is the name :P

anyway it's easy enough to

a%b - b if a < 0 else a%b

so there's no real issue

@craigmaloney@octodon.social @noelle mod is NOT the same as remainder and this is the difference :). the problem (from this person's point of view, anyway, likely) is that most programming languages use % to mean remainder, and python (apparently) uses it to mean modulus.

@noelle does this person know about math.remainder() because that sounds like what they want

Show older
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.