This is scary good. Well done. If your product have any frontend and you have the power to decide ensure at least one of your hires can write CSS at this level.
This is a fun proof of concept, but it isn't what CSS is used for. There's no conceivable reason you'd do this in practice.
Bubble sort in pure CSS
21–30 of 73 posts
Re: Bubble sort in pure CSS
#22> Editor’s Note: This article ends on a cliffhanger. The next part goes out in a week I stopped reading there. Let us know when the second part is out. Why write half an article?
Re: Bubble sort in pure CSS
#23> Editor’s Note: This article ends on a cliffhanger. The next part goes out in a week I stopped reading there. Let us know when the second part is out. Why write half an article?
Re: Bubble sort in pure CSS
#24Earlier quoted context omitted.
It's called logical addition which is different than arithmetic addition, so it's best to not conflate the two. It's called "addition" because you "add" another propostion, creating a disjunction. And by the rules of logic, as long as the original proposition was true, the truth value is preserved no matter how many propositions you introduce (or "add"). A ⊢ ((A ∨ B) ∨ C) ... ∨ n
> It's called "addition" because you "add" another propostion, creating a disjunction. By that argument, conjunction is also called "addition". Perhaps there's a different reason? The choice of terminology, contrasting "logical addition" with "logical multiplication", obviously indicates that logical addition is supposed to be analogous to addition. What is the analogy?
Actually, you can add 1 and -1 to get 0, which breaks the model... Hmm... Guess it only works on natural numbers / unsigned.
Re: Bubble sort in pure CSS
#25Re: Bubble sort in pure CSS
#26> (oneIsGreater * origArray[0]) + (twoIsGreater * origArray[1]) There is a reason why conjunction (AND) is also called logical multiplication, and disjunction (OR) logical addition. There is not much difference between this and: (oneIsGreater ? origArray[0] : 0) | (twoIsGreater ? origArray[1] : 0) This is often useful to think about when working on bitset or SIMD algorithms.
> There is a reason why conjunction (AND) is also called logical multiplication, and disjunction (OR) logical addition. Really? The connection between AND and multiplication is obvious, but disjunction doesn't behave like addition. (For one thing, just like AND, it destroys information, which multiplication does do and addition doesn't.) Addition would usually be XOR. In fact, AND and XOR are what you get when you ap…
Meaning, using only elementary arithmetic and modulo?
Seems like there should be either an obvious answer or an interesting one :)
Re: Bubble sort in pure CSS
#27Earlier quoted context omitted.
> There is a reason why conjunction (AND) is also called logical multiplication, and disjunction (OR) logical addition. Really? The connection between AND and multiplication is obvious, but disjunction doesn't behave like addition. (For one thing, just like AND, it destroys information, which multiplication does do and addition doesn't.) Addition would usually be XOR. In fact, AND and XOR are what you get when you ap…
Is there a way to express OR (not XOR) using integer arithmetic without case distinction or special functions in the natural numbers mod 2? Meaning, using only elementary arithmetic and modulo? Seems like there should be either an obvious answer or an interesting one :)
Re: Bubble sort in pure CSS
#28Earlier quoted context omitted.
Is there a way to express OR (not XOR) using integer arithmetic without case distinction or special functions in the natural numbers mod 2? Meaning, using only elementary arithmetic and modulo? Seems like there should be either an obvious answer or an interesting one :)
The maximum function.
Then the answer seems to be no, right?
Edit: The abs() function seems to be enough, awesome:
Re: Bubble sort in pure CSS
#29Earlier quoted context omitted.
Is there a way to express OR (not XOR) using integer arithmetic without case distinction or special functions in the natural numbers mod 2? Meaning, using only elementary arithmetic and modulo? Seems like there should be either an obvious answer or an interesting one :)
The maximum function.
Re: Bubble sort in pure CSS
#30Earlier quoted context omitted.
The maximum function.
Yeah that makes sense of course. Should have specified "special function", was aiming at "algebraic" or "polynomial" I guess. Then the answer seems to be no, right? Edit: The abs() function seems to be enough, awesome: https://math.stackexchange.com/a/1641271