« first day (1579 days earlier)      last day (3385 days later) » 

user1804599
6:00 PM
@FredOverflow I prefer != over ^!
 
user1804599
@R.MartinhoFernandes In PHP it's done the way it's done because you can leave out the true branch and then it will behave similar to ?? in C#.
 
user1804599
I prefer having || for that.
 
user1804599
Or better yet, Option and flatMap.
 
@R.MartinhoFernandes An IO function (x -> IO y) doesn't seem referential transparent to me.
 
user1804599
Why not?
 
user1804599
6:09 PM
For the same input it always returns the same I/O action.
 
user1804599
Also, you mean pure not referentially transparent.
 
The input is not explicitly given to the function.
There's no input for said function.
Take getChar, it doesn't have any input.
 
user1804599
A lambda expression and a name expression are obviously referentially transparent.
 
okay so how does Microsoft even HOPE that anyone will use windows server as a professional OS if it can't even update itself without restart and is pushing updates every freaking day
 
user1804599
@Jefffrey indeed, since it's a constant I/O action.
 
user1804599
6:11 PM
It's a constant of type IO Char.
 
@райтфолд Hm, that's something to think about... anyway, more tests:
$ true == true
true

$ true && false
false

$ a == true
a

$ a ? true : b
a || b

$ (a || b) && !(a && b)
a ^ b

$ a ? b ? false : true : false
a && !b
 
user1804599
I prefer if a then if b then false else true else false.
 
$ (a || b) && !(a && b)
a ^ b
what wonder produces such simplifications ;o
 
Sure, but this is a boolean expression simplifier for Java expressions :)
 
user1804599
Oh. :P
 
6:12 PM
gi?
 
@FredOverflow link?
 
hi?
Gizmo are you good with swept collisions?
 
user1804599
@FredOverflow Do you also support indexing literal Boolean arrays?
 
Anyone good with swept test collisions?
 
@LightnessRacesinOrbit is this a proper fit for SO, or does it belong to CodeReview?
 
user1804599
6:13 PM
Like new bool[] { true, false || true }[(int)(true && !false)].
 
@Murplyx maybe I can learn to be good with it, explain what it is xD
 
Thanks :D
 
user1804599
@FredOverflow jar warning please
 
java -jar boolsimp.jar
@райтфолд Why? It's only 4kb.
 
6:14 PM
@Gizmo It's when moving objects move so fast they miss collision Check this out:gamedev.net/page/resources/_/technical/game-programming/…
@FredOverflow Are you good with swept collisions?
 
@Murplyx I have no idea what you're talking about.
 
@райтфолд How would you index them without integer indexes? :)
 
DOES ANYONE KNOW WHAT SWEPT COLLISIONS ARE!?!!?
 
user1804599
@FredOverflow cast Booleans from integers.
 
6:16 PM
@Murplyx I know GRID 2 fixed the problem by moving the physics to a separate thread running @ 1000 fps
 
user1804599
Or can you not do that in Java?
 
nope
 
@Murplyx ofcourse someone knows
I did scratch the surface of 3d stuff
 
@Murplyx Do you want us to define a term you are unfamiliar with?
 
It's interesting
 
6:16 PM
who has 1000fps -.-
 
@Murplyx that's actually very slow compared to what processors are capable
 
@FredOverflow No I am not unfamiliar with it, I have a problem _about it
 
user1804599
@FredOverflow meh
 
@Gizmo Does it work?
 
user1804599
I mean Booleans to integers.
 
6:17 PM
@FredOverflow I do have the shell xD
$ a && b && c
expected constant, variable, ! or (
 
You can only use a and b as variables.
 
oh :P
 
> Geben Sie boolesche Formeln mit den Variablen a und b ein.
 
$ a & b ^ b
expected &
;o
 
Yeah, single & is not supported, you have to use &&.
 
6:19 PM
okay :P
 
Trying to break my software, I like it!
 
does it work like.. making carnough diagrams then making it as simple as possible or how? :P
 
I was so stumped about why my function wasn't giving the output I wanted. Then I finally realized I was comparing std::mismatch(...).first == range.begin()
 
user1804599
@FredOverflow make it generate Venn diagrams as well.
 
@caps have a cookie (?) :P
 
6:21 PM
@Gizmo No, I just calculate the truth table and then do a table lookup. There are only 16 different binary boolean functions after all:
private String[] formulae = {
    "false", "!(a || b)", "!a && b", "!a", "a && !b", "!b", "a ^ b", "!(a && b)",
    "a && b", "a == b", "b", "!a || b", "a", "a || !b", "a || b", "true"
};
 
@Murplyx also, you are probably doing point-by=point physics
I clearly suggest going to 'path-to-path- physics where you can trace back any missed collisions and still apply them
 
should I expect locking/unlocking a mutex to be an expensive operation in case of no contention?
 
@FredOverflow you .. I don't know, I wanted to call you lazy but you are doing too much work actually
 
@AndyProwl At least in Java, contentionless locking is very cheap.
 
user1804599
What is contention?
 
6:23 PM
YOU OVERWORKER!!
xD
 
@райтфолд Other threads trying to acquire the same mutex
 
@Gizmo Too much work? Elaborate!
 
user1804599
@AndyProwl OIC.
 
@FredOverflow All right, thanks
 
user1804599
Benchmark it.
 
6:24 PM
According to Brian Goetz's book.
 
Yeah
I know it's the "measure it" kind of question
 
@FredOverflow uhm, well you probably ca automate the process of making a simplification, even thoug you might end up writing more code and a few more hours, it will save time in the long run
and will allow unlimited variables
 
Sure, going beyond two variables is not feasable with my approach.
Maybe I could do 3 variables, but there are already 256 ternary boolean functions :)
It's highly unlikely I would get the lookup table correct for 3 variables.
Writing the lookup table for 4 variables by hand would probably be a lifetime achivement :)
 
@Murplyx or just don't apply the new position directly, you know the velocity then calculate the damn path to destination before applying it!
@FredOverflow I bet 10 human lifetimes! xD
 
@Gizmo How do you propose implementing simplifications such as (a || b) && !(a && b) -> a ^ b? Just hardcode that specific pattern and look for it?
@Gizmo That table is 65,536 entries long. If I write 100 entries per day, I'd be done in two years!
 
6:28 PM
@FredOverflow nono, I had electrical engineering, we did go on the subject "fundamental basics" and working with bits, bytes, how a bit is saved, flip flops, RAM, eventually some simple maths
 
user1804599
@FredOverflow Generate it.
 
user1804599
But you can do it much more simply.
 
there are algorithms to simplify output tables
 
user1804599
First calculate the shortest form for every possible truth table.
 
eg.. carnough diagrams, in computers you can do it perfectly fine for 4,5,6 variables
 
user1804599
6:29 PM
Then at runtime calculate the truth table for the given form.
 
user1804599
And look it up.
 
on paper you are kinda limited to max 4 variables
with carnough
5,6 etc & beyond would need a third dimension
 
Ah, KV diagrams, I remember studying those in 2001 :)
 
user1804599
Calculating the truth table is just evaluating it four times.
 
Which is more powerful: method or function?
 
6:30 PM
@райтфолд ...if there are only two variables, yes.
 
feel like posting a bold question
 
user1804599
@FredOverflow Yes. And there are only two variables in your program.
 
@StackedCrooked depends on their firepower
 
@StackedCrooked Depends on your definition of "function".
 
good one
 
user1804599
6:31 PM
@StackedCrooked Methods can be overloaded on the dynamic type of this.
 
user1804599
Whereas functions can't, at least in most languages.
 
@райтфолд But we are talking about going beyond 2 variables.
 
user1804599
That's about the only difference.
 
user1804599
@FredOverflow Then you can still do it, although it'd take more time.
 
user1804599
The way I'd do it is by having LLVM optimise it for me.
 
user1804599
6:32 PM
No need to reinvent the wheel.
 
Where would be the fun in that?
@райтфолд Actually, I only do it one time, with bit twiddling :)
 
user1804599
Nice.
 
user1804599
Parallelised truth table generation.
 
@райтфолд trying to emulate this for free functions seems like a tough task. Would require lookup of fptr using typeid(arg) as a key.
 
private static final int FALSE = 0;
private static final int TRUE = 15;
private static final int A = 12;
private static final int B = 10;
 
6:34 PM
Which would be so slow.
 
user1804599
@StackedCrooked It's not tough at all.
 
user1804599
Perl 6 does it just fine.
 
user1804599
As does Clojure.
 
I mean tough to make it as fast as a vtable dispatch.
 
user1804599
You can implement it with a weak map extremely easily.
 
6:35 PM
Oh, wait. It might be easy.
 
user1804599
In JavaScript it's about five lines of code.
 
@Gizmo It seems the input needs to be in DNF?
 
@FredOverflow What's DNF? :P
 
disjunctive normal form
 
googling
 
6:36 PM
But that can easily be generated from any formula, I guess.
 
ooh
well you have the AND OR XOR NOT operations in there
should cover almost everything
I mean.. everything
 
user1804599
In Clojure and Perl 6 you can overload on arbitrary predicates. xD
 
you could see a && b & c ^ d as DNF already
 
user1804599
multi sub f(Int $x where is-even *) { say "$x is even" }
multi sub f(Int $x where is-odd *) { say "$x is odd" }
 
the meaning is the same, representation different
 
user1804599
6:39 PM
Go has bitwise NAND for some reason.
 
@райтфолд !(a && b)
seems to be the equivalent for me
 
bitwise
only one &
 
oh :P
ye indeed
I suck at details
 
Anyway, I doubt having more than 2 boolean variables would have any educational merit worth changing my implementation.
It already works for all the cases I find interesting.
 
user1804599
Remove all operators except NAND.
 
6:41 PM
Why? :)
 
user1804599
Then implement a Turing machine in it.
 
Java has no NAND.
 
user1804599
There is a Turing-complete language with only one instruction.
 
user1804599
But I forgot what it was called.
 
Subtract and branch if not zero
 
user1804599
6:43 PM
I don't think Turing completeness is very useful if you can have infinite loops externally.
 
user1804599
Infinite loops are always bugs except when they have side-effects.
 
20
Q: What makes a language Turing-complete?

Curious CatWhat is the minimal set of language features/structures that make it Turing-complete?

Where you thinking of OISC?
 
user1804599
Yes.
 
@AndyProwl 100% code review
 
Thought so
 
user1804599
6:45 PM
I'd like to see a language where you can annotate whether your function needs Turing-completeness, similar to how you can annotate I/O actions in Haskell through the type system.
 
user1804599
And if they don't require Turing-completeness that you can prove they always terminate.
 
Without lookup into std::map or anything.
 
user1804599
And possibly prove they terminate with the correct result.
 
How important are those proofs in practice?
 
user1804599
6:46 PM
I don't know.
 
Wait, I have an awesome idea for a boolean expression simplifier.
 
user1804599
But they would be a nice substitute for unit tests since they cover all cases.
 
Just enumerate all possible boolean expressions in ascending order of complexity and check the truth tables until you find a match!
 
user1804599
@FredOverflow That's easy to parallelise as well. :P
 
Probably implementable in a couple dozen lines of Haskell.
 
user1804599
6:48 PM
Six lines of Haskell.
 
I'm so excited I'm almost not yawning.
 
user1804599
@StackedCrooked that's not dynamic.
 
user1804599
It's static.
 
user1804599
// you want to do this:
struct A { virtual ~A() = default; };
struct B : A { };
void f(A& x) { printf("A\n"); }
void f(B& x) { printf("B\n"); }
f(static_cast<A&>(*new B));
// to print B
 
How would you measure the complecity of a boolean expression? Number of operators?
 
6:50 PM
Hm..
I did not use typeid indeed.
 
user1804599
It's impossible to solve this problem unless you add one of the following restrictions:
1) dynamic linking is illegal
2) runtime error instead of compile-time error if no match found
 
user1804599
If you apply option 1) then this is my favourite way of solving the expression problem.
 
user1804599
Option 2) is very useful in dynamically typed languages (since type errors are always at runtime), and is applied in Perl 6, Clojure and Elixir.
 
The length will sometimes be irrelevant.
@FredOverflow I wonder how it would compare to multidimensional array.
 
user1804599
C# is the only language I know that gets multidimensional arrays right.
 
6:54 PM
@StackedCrooked How would a multi-dimensional array be helpful here?
 
Ah. Not.
 
user1804599
As in the multidimensionality. It gets other aspects horribly wrong, such as variance.
 
@райтфолд what kind of variance?
 
user1804599
Arrays in C# are both mutable and covariant.
 
user1804599
object[] a = new string[1]; // allowed lol
a[0] = 42; // runtime error lol
2
 
user1804599
6:57 PM
Even worse: in Eiffel you can make a parameter of an override of a more specific type than the parameter of the overridee, and getting it wrong isn't a runtime error but UB. XD
 
user1804599
Such shenanigans violate LSP.
 
All shenanigans violate LSP.
 
Xeo
> What does “custom” mean?

I am not 100% sure about what is meant by “custom” Big Five in the Rule of Zero. It might either mean manually implemented or not implicitly generated. That means, it is unclear to me whether virtual or nonpublic, but defaulted Big Five are included in that rule.
@ArneMertz You could've just asked @R.MartinhoFernandes :P
 
that's a fair question
"custom" might mean "user-defined" but then, unintuitively, it includes the defaulted special member functions :)
 

« first day (1579 days earlier)      last day (3385 days later) »