Start Coding in Pyret
code.pyret.org
code.pyret.org
"Pyret has numbers, because we believe an 8GB machine should not limit students to using just 32 bits."
Java Pyret
// this is not true # this is true
((1 / 3) * 3) == 1 ((1 / 3) * 3) == 1
watHow about ((1.0 / 3) * 3) == 1? Not sure what point they are trying to make here. Did somebody change the definition of "number" to mean "floating point type?"
For the record, 1.0 compares equal to (1.0 / 3) * 3 in IEEE 754 32-bit floating point arithmetic. You may want to consider a more compelling example, ie
float x = 1.0;
for (int i = 0; i < 10; ++i) {
x += 1.0 / 10;
}
x == 1.0 // FalsePersonal bias : I think there is a definite loss in not teaching about the power of static typing in a first language.
- Type errors for most type systems are very difficult to diagnose for beginners. They often aren't, for example, located on the actual error location in Hindley-Milner style type inference.
- Allowing students to run their code helps build a correct mental model. In particular it allows them to locate the errors in their code.
Note that Pyret does have a facility for dynamic checks that serves a similar purpose to static types.
Very interesting, thanks for the insight + reference to the PLT group.
love the where blocks and
the data declarations (remind me of scala's case classes) and
the "progressive" type annotation (which mimics the way i use cython + python)
(less appealing, and this is purely subjective of course, is your logo, which seems to have been inspired by malware or perhaps by labels required for toxic chemicals)
Or maybe "pyret" is pronounced like "pirate" and the logo was inspired by the skull-and-crossbones pirate flag. I especially like how the crossbones look like the letter lambda.