

Start Coding in Pyret - michaelsbradley
https://code.pyret.org/

======
mgraczyk

      "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
    

wat

How 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?"

~~~
fineIllregister
In Pyret, (1 / 3) resolves to (1 / 3), not 0.3333333333333333 or some
equivalent, like it does in many other languages. (0.3333333333333333 * 3) is
0.999999999999999, not 1.

~~~
mgraczyk
That makes sense, but unfortunately the Pyret page says nothing to indicate
that arithmetic is done in the rational field.

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 // False

~~~
shriramkmurthi
Sure. In general there are lots of examples that illustrate the ugliness of
using floating points _unnecessarily_.

------
passive
Hmm, this looks like a language I would design if I ever got around to it. If
they have a good distribution system, could be awesome.

------
vijucat
Why are all "learning to program" languages these days duck typed /
dynamically typed? Has it always been this way? Has SML, for example, been a
first language of choice in Programming 101 in earlier decades?

Personal bias : I think there is a definite loss in not teaching about the
power of static typing in a first language.

~~~
noelwelsh
Beginners have very incomplete mental models of programming languages (if they
didn't, they wouldn't be beginners...) I believe the experience of the PLT
group, who have been teaching introductory programming for some 20 years and
definitely understand type systems, is that static types can get in the way of
learning. There are two reasons:

\- 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.

~~~
vijucat
> located on the actual error location in Hindley-Milner style type inference

Very interesting, thanks for the insight + reference to the PLT group.

------
doug1001
this looks really interesting

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)

~~~
edmccard
>...your logo, which seems to have been inspired by malware and perhaps labels
required for industrial 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.

~~~
desdiv
And the color scheme is paying homage to Scheme's logo.

~~~
shriramkmurthi
To _Racket's_ logo.

------
japaget
See previous HN discussion at
[https://news.ycombinator.com/item?id=6701688](https://news.ycombinator.com/item?id=6701688)
and GitHub repository at [https://github.com/brownplt/pyret-
lang](https://github.com/brownplt/pyret-lang) .

------
tetron
This looks more or less like a reskinned Standard ML. Which is cool, because
SML is awesome :-)

~~~
zem
it's dynamically typed, though!

~~~
shriramkmurthi
The static type system is under development, but it will never be _required_.

