so you look up a-law and mu-law, and they are upselling them so freakin hard, with all the terminology and the sophistication of the study of the human hearing, and nature of audio signals, and speech in particular, and then follow up with formulas so backwards and mathy you have to wonder if logs are base 2 or base e... and of cource you have classic "you don't need to understand this stupid programmer, just use this lookup table" scaremongering
then you read up on the actual standard codec spec
https://en.wikipedia.org/wiki/G.711
and it turns out it's basically just
float compress(long long value)
{ return value; }
except smaller and simpler
what if the operand names for addition and subtraction were consistent with multiplication and division though?
addend + adder = sum
subtrand - subtractor = difference
programmified?
to + adder = sum
from - subtractor = difference
but then
to + added = sum
from - subtracted = difference
and it's not at all consistent anymore, unless
by * multiplied = product
by / divided = quotent
which seems bleh
how it seems:
- gimme human mod twiyoufacetubeterbook!
- no, i control the means of production, you don't get to demand nothin, algo will do for you, keep working, pleb!
- yesh milord
how it actually is:
- maybe gimme human mod sometimes faceyoutwibooktertube, huh?
- omg, i can't, am so sorry, i really can't, plz don't leave me, i improve algo, i achieve sentient AI soon, promise, plz, so sorry
- mkay, as long as you sorry, i see no problem with this, i actually hate dealing with humans if we're being honest here...
- frens? ^_^
- frens ^_^
- i protec your brand ^-^
- thonk ^-^
also noticed that it loops infinitely if the needle is empty, but the only meaningful thing to do here is to assert it being not empty as a precondition. You could maybe split character by character in that case, however that would be inconsistent with the overall behaviour of this split, as it does not ignore consecutive separators (it's a feature not a bug) and there are infinity consecutive empty strings between any two characters, or at the beginning of any string. You could also detect it and return some sentinel value, but to me that's an optional accessory that should go outside the main algorithm, because it can.
why the hell is set_difference not allowed to be in-place?
abcdxyz123 bah!
augend + addend = sum
minuend - subtrahend = difference
multiplier * multiplicand = product
dividend / divisor = quotient
dividend % divisor = reminder
Well, at least std::ranges::search returns a subrange, I guess it might not be the worst thing that happened to standard library since iostreams after all.
But why doesn't it return the end iterators for both sentinels used huh, you niebloid?! Oh, perhaps because it doesn't freaking matter? Is is possible that every algorithm doesn't also need to be a find_if? OMG could it be that if I want/need an end iterator, I just wouldn't use/setup a sentinel in the first place??
Sad c++ programmers are so afraid to write new algorithms, that they have to resort to generators.
Instead of writing
transform(begin, end, dest, f);
ima write
copy(begin, end, tranformer(dest, f));
or
copy(transformed(begin, end, f), dest);
or instead of
copy_until(begin, dest, condition);
ima write
copy(begin, sentinel(condition), dest);
where the opertor != of begin and sentinel is overloaded to be the condition
look ma, I reuse copy, am galaxy brain, let me also overload another stupid operator so that this whole mess looks like this
copy( range | trasnform(f) | filter(f2), dest );
this is so readable, ma role model is haskell, the most bestest readable and not at all cryptic language.
oh no, wait, because of filter, transform is done twice for some elements... I mean, oh yeah, this is a feature!
opinion on vector/container type deduction
https://git.sr.ht/~namark/cpp_musings/tree/master/item/vector_of_vector.cpp
#cpp
galaxy brain move
https://github.com/telegramdesktop/tdesktop/commit/69b70cda542c631c5413ae1c1fb799ed9b604a6b
I thought you can't be this smart and code in c++, but guess that's what Qt does to you.
the gibberish generator of
the happy c++98er without a supporting library: http://ix.io/3inZ/cpp
the troubled c++17er with a supporting library: http://ix.io/3ivL/cpp
random number generators take seeding object by lvalue reference, brilliant. I get it, the library was written for c++98, but someone fix it already -_-