Can someone confirm that this question would be on-topic for langdev? There was a request to migrate it which seems reasonable, but wanted a second opinion/some confirmation.
In Haskell, you can define algorithms by equations that pattern-match on left-hand side constructors. For example:
data Nat = S Nat | Z
double :: Nat -> Nat
double Z = Z
double (S x) = S (S (double x))
Now, for a moment, imagine that the constructor restriction was lifted, and we allowed ar...
I can't explain the reason why too well, but that is the more common use in everyday English. Like, you might freeze some food for long term storage. And then later, you would thaw it. It would sound more unusual to say "I need to melt that first" than "I need to thaw that first." I think it's because you're doing it to the thing, but I'm not sure
@DannyuNDos melting usually means taking something frozen and turning it back into a liquid (like frozen ice); thaw implies taking something frozen and making it less cold (like frozen chicken)
you wouldn't usually think of a variable as a liquid, but it's not unreasonable to think of a variable as a chicken ;)
another way to think about it is you freeze your variable in a block of ice (so you can't mutate it anymore) and then thaw it out of the ice when you want to mutate it again melt would refer to the ice itself, which isn't the important bit - the variable is
@DannyuNDos what you're using there is called a VLA
or variable length array
note that this is no fault of yours, this comes up quite often
but they suck
they're stack allocated, not heap allocated, so you can stack overflow real easily when using them
they're also hard to reason about and bad for compiler implementors, bad for optimisations, etc
C should not allow arrays to be dynamically sized, because nothing should ever allow them to be dynamically sized, because they should not be dynamically sized
Some languages (C, C++, JavaScript, Python) allow one to use integers as booleans and vice versa:
int x;
if (x) // Equivalent to: x != 0
y();
Or:
int x = 10 + (y > 10); // Equivalent to: y > 10 ? 11 : 10
However, other languages such as Java, C#, and Swift disallow this. They do not even al...
Hypercomputation or super-Turing computation is a set of models of computation that can provide outputs that are not Turing-computable. For example, a machine that could solve the halting problem would be a hypercomputer; so too would one that can correctly evaluate every statement in Peano arithmetic.
The Church–Turing thesis states that any "computable" function that can be computed by a mathematician with a pen and paper using a finite set of simple algorithms, can be computed by a Turing machine. Hypercomputers compute functions that a Turing machine cannot and which are, hence, not computable...
Even if hypercomputation would become reality, there cannot exist a programming language compatible with it... or can there be?
After all, this would require an infinite set as the alphabet.
A hypercomputer would be able to tell if a "standard" program terminates or not. You could expose this in a programming language by having two "levels": one where you can "only" write normal programs and a second level where you can write normal programs but also you get a primitive which will tell you whether an arbitrary program written in the first level halts or not
perfectly finite language
and not implementable unless it's possible to have a hypercomputer