5SpeedDeasil@lemmy.world to Memes · 1 year agoRandom internet people explaining math better then math teacheri.imgur.comexternal-linkmessage-square197fedilinkarrow-up11.75Karrow-down162cross-posted to: math@lemmy.world
arrow-up11.68Karrow-down1external-linkRandom internet people explaining math better then math teacheri.imgur.com5SpeedDeasil@lemmy.world to Memes · 1 year agomessage-square197fedilinkcross-posted to: math@lemmy.world
minus-squareFareshlinkfedilinkarrow-up4·1 year agoI think this is pretty much the imperative equivalent of foldl (\acc i -> acc + 3*i) 0 [1..4].
minus-squarebasketsandhoeslinkfedilinkarrow-up3·1 year agoCan you explain this out a bit more? I’m a self-taught programmer, of sorts, and I’m not quite getting this…
minus-squarenicolairathjen@lemmy.worldlinkfedilinkarrow-up3·1 year agoA reducer “reduces” a list of values to one value with some function by applying it to 2 values at the time. For instance if you reduce the list [1, 2, 3] with the sum function you get (1 + (2 + 3)) = 6.
minus-squarenicolairathjen@lemmy.worldlinkfedilinkarrow-up1·1 year agoDefinitely, although I’m sure that under the hood it’s all the same. Some (albeit high-level) languages also support a sum function that takes a generator as an input, which seems pretty close to this math notation.
Wouldn’t reducer be more precise?
I think this is pretty much the imperative equivalent of
foldl (\acc i -> acc + 3*i) 0 [1..4]
.Can you explain this out a bit more? I’m a self-taught programmer, of sorts, and I’m not quite getting this…
A reducer “reduces” a list of values to one value with some function by applying it to 2 values at the time.
For instance if you reduce the list [1, 2, 3] with the sum function you get (1 + (2 + 3)) = 6.
Definitely, although I’m sure that under the hood it’s all the same. Some (albeit high-level) languages also support a sum function that takes a generator as an input, which seems pretty close to this math notation.