cm0002@lemmy.world to Programmer Humor@programming.dev · 3 days agoJavaScriptlemmy.mlimagemessage-square159fedilinkarrow-up11.04Karrow-down115cross-posted to: [email protected]
arrow-up11.02Karrow-down1imageJavaScriptlemmy.mlcm0002@lemmy.world to Programmer Humor@programming.dev · 3 days agomessage-square159fedilinkcross-posted to: [email protected]
minus-squarekubica@fedia.iolinkfedilinkarrow-up24·3 days agoLets fix it. I think that since we are removing the ones, then “11” - 1 should be equal to “”.
minus-squarer00ty@kbin.lifelinkfedilinkarrow-up15·3 days agoShould it, or should it be “1”? (just removing one, one)
minus-squaregrue@lemmy.worldlinkfedilinkarrow-up4·3 days agoWhich “1” did it remove? And did it search the string to find a “1” to remove, or did it remove whichever character happened to be at array index 1?
minus-square⛓️💥@sh.itjust.workslinkfedilinkEnglisharrow-up12·3 days agoThe one at the end. Subtraction is the opposite of addition. If addition adds a character to the end of the string, it must follow that subtraction would remove a character from the end of the string.
minus-squareRevan343@lemmy.cacakelinkfedilinkarrow-up4·3 days agoThis is how we end up with an endian schism
minus-squareFooBarrington@lemmy.worldlinkfedilinkarrow-up4·3 days agoIt should just randomly pick any “1”. Add a bit of spice, you know
minus-squareanton@lemmy.blahaj.zonelinkfedilinkarrow-up3·3 days agomaybe we removed the last n characters
minus-squareShanmugha@lemmy.worldlinkfedilinkarrow-up2·edit-23 days agoHear me out: “11” - 1 = “11” - (-1) = “11” (did not find “-1” in "11) Or “11” - 1 = “11” - (-1) = “1” (removed first “1”)
Lets fix it. I think that since we are removing the ones, then “11” - 1 should be equal to “”.
Should it, or should it be “1”? (just removing one, one)
Which “1” did it remove? And did it search the string to find a “1” to remove, or did it remove whichever character happened to be at array index 1?
The one at the end. Subtraction is the opposite of addition. If addition adds a character to the end of the string, it must follow that subtraction would remove a character from the end of the string.
This is how we end up with an endian schism
It should just randomly pick any “1”. Add a bit of spice, you know
maybe we removed the last n characters
Hear me out:
“11” - 1 = “11” - (-1) = “11” (did not find “-1” in "11)
Or
“11” - 1 = “11” - (-1) = “1” (removed first “1”)