Live data from Hacker News

The Pyret Programming Language

pyret.org

41–50 of 138 posts

Re: The Pyret Programming Language

#41
I like the idea of attaching tests to the function itself - oftentimes I'm finding myself combing through the unit tests for various components to understand the expectations around how they are meant to be used (especially when they are not documented well enough), I feel this approach could help in this aspect (and also with adding new test cases that could have been missed).

Re: The Pyret Programming Language

#42
post #41

I like the idea of attaching tests to the function itself - oftentimes I'm finding myself combing through the unit tests for various components to understand the expectations around how they are meant to be used (especially when they are not documented well enough), I feel this approach could help in this aspect (and also with adding new test cases that could have been missed).

Elixir (Rust too IIRC) check code in doccomments for correctness.

Re: The Pyret Programming Language

#44

It seems pretty bad to have kebab-case identifiers in a language that also has an infix subtraction operator -. The only languages I know that allow kebab-case idents are lisps, where subtraction is (- prefix notation). From the examples: lam(actual): num-abs(actual - target) This is a new, even worse kind of "whitespace significance" than indentation. Is it a function called `num-abs` or a variable `num` minus `abs(…

Always requiring whitespace around infix operators is, in my opinion, easier to explain to people than "you can do whatever you want with the whitespace." It's consistent and regular. I don't think it's as much of an issue as you're making it out. Pyret is the result of decades of research in computer science education, helmed by Shriram Krishnamurthi, who was one of the original members of the Racket project (itself…

> In any case, I trust their decisions better than those of someone who glanced at the website only long enough to inform a condescending (and highly superficial) comment on Hacker News.

I didn't interpret it as condescending.

> (and highly superficial)

I didn't interpret it as highly superficial. Comments about the appearance (including whitespace, kebab-case, and infix operators) of a language are fair game, particularly if it is intended for teaching.

Re: The Pyret Programming Language

#45
post #32

Earlier quoted context omitted.

It is used to to teach children. Spoken the name sounds like pirate. No snark intended.

I'm not sure if this was intended as a reply to my comment. In any case, I would suggest that a language be powerful and simple enough that it can do a wide range of tasks including teaching children, GUI apps, web apps, AI research, scripting, etc. Python does this and Pyret should aspire to do it too.

It totally was. Type checking is being worked on, they were not happy with the performance of their first implementation.

Re: The Pyret Programming Language

#46
post #11

I really like the in-function documentation and unit like testing in the where clause. > # this is true > ((1 / 3) * 3) == 1 This worries me. I know it is true mathamatically, but experience tells me trusting floats is a recipe for disaster. A approximate equal operator is safer. Floats are such a leaky abstraction it is in my opinion better students know this early on.

Many languages treat the construction 1/3 As a rational type, and do not convert to float unless you cast. Common Lisp comes immediately to mind. Evidently pyret is another.

Haskell supports rationals with module Data.Ratio, but uses a slightly different syntax: 1 % 3

Re: The Pyret Programming Language

#47
post #34

Earlier quoted context omitted.

Beauty lies in the eye of the beholder, ie aesthetics are subjective. For me, using proximity instead of parentheses to signify grouping would raise an eyebrow. I'd make an exception for cases of base*exponent, i think Python has it?

> Beauty lies in the eye of the beholder, ie aesthetics are subjective. Then allow everyone to do things according to their own aesthetics.

Sure. In math education i learned to signify grouping with parens and in this case i would favour function/consistency over form/typing efficiency.

Re: The Pyret Programming Language

#48

It seems pretty bad to have kebab-case identifiers in a language that also has an infix subtraction operator -. The only languages I know that allow kebab-case idents are lisps, where subtraction is (- prefix notation). From the examples: lam(actual): num-abs(actual - target) This is a new, even worse kind of "whitespace significance" than indentation. Is it a function called `num-abs` or a variable `num` minus `abs(…

Always requiring whitespace around infix operators is, in my opinion, easier to explain to people than "you can do whatever you want with the whitespace." It's consistent and regular. I don't think it's as much of an issue as you're making it out. Pyret is the result of decades of research in computer science education, helmed by Shriram Krishnamurthi, who was one of the original members of the Racket project (itself…

> Pyret is the result of decades of research in computer science education, helmed by Shriram Krishnamurthi, who was one of the original members of the Racket project (itself a language designed for CS education in the '90s, a descendant of Scheme with kebab case and prefix notation). The full list of authors of Pyret is lengthy, but includes a number of well-established researchers in the PL and CSed communities.

On one hand, this historical context is relevant. Thanks for sharing it.

On the other hand, when this section is taken in context with with the following sentence...

> Knowing who they are, I would happily assume that they spent plenty of time debating this exact issue of mixing kebab case with infix subtraction, and either decided the benefits were worth the cost or else decided that the cost was practically nonexistent.

...it looks the fallacy of appealing to authority.

Many people like to debate the ideas and tradeoffs, not the credentials of people involved.

Re: The Pyret Programming Language

#49

It seems pretty bad to have kebab-case identifiers in a language that also has an infix subtraction operator -. The only languages I know that allow kebab-case idents are lisps, where subtraction is (- prefix notation). From the examples: lam(actual): num-abs(actual - target) This is a new, even worse kind of "whitespace significance" than indentation. Is it a function called `num-abs` or a variable `num` minus `abs(…

Always requiring whitespace around infix operators is, in my opinion, easier to explain to people than "you can do whatever you want with the whitespace." It's consistent and regular. I don't think it's as much of an issue as you're making it out. Pyret is the result of decades of research in computer science education, helmed by Shriram Krishnamurthi, who was one of the original members of the Racket project (itself…

> Knowing who they are, I would happily assume that they spent plenty of time debating this exact issue of mixing kebab case with infix subtraction, and either decided the benefits were worth the cost or else decided that the cost was practically nonexistent.

We don't need to assume when we can search. I did a few minutes of searching and found the following:

https://groups.google.com/g/pyret-discuss/c/rPe7gYBLdPs/m/3O...

Shiriam K. wrote in 2013:

> I have tried just about every possible experiment to stay closer to Lisp, including even the one you have in Wart. None of them scaled well for me. Ultimately, also, I am totally unconvinced about the idea of having an identifier named e^ipi-1 for anything other than cute illustration purposes. Since surface* syntax is designed for humans, I think a compromise between expressiveness, readability, and predictability is a good way to go.

(This is just one comment, I'm not saying that is captures the full thinking and discussion around these syntax decisions.)

Re: The Pyret Programming Language

#50
> # this is true > ((1 / 3) * 3) == 1

This is a slippery slope. Early versions of Dart tried to use rational numbers by default, but then it was cancelled because denominator size can grow exponentially.

Also, I seriously doubt you can make a language that will correctly resolve checks like this one:

sin(pi / 6) == 1 / 2

Post reply on HN