Earlier quoted context omitted.
The number stack goes like this: naturals -> integers -> rationals -> reals. Trying to simplify this by removing any stage doesn't really work. sin() over a rational should be a compile time error.
PI/6 is not rational.
The Pyret Programming Language
131–138 of 138 posts
Re: The Pyret Programming Language
#132I 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.
Re: The Pyret Programming Language
#133Re: The Pyret Programming Language
#134Earlier quoted context omitted.
I disagree that programs-as-text is bad idea for beginers. Anyone with a bit of abstract thinking can understand program as text just like how they can understand a multi step mathematical operation.
I'm no expert on education, but having been a TA and helped out a few people since, I repeatedly see text getting in the way of everything else. Beginners often find both the things you are saying some what hard. First, note that there is reading vs editing. Perhaps in grade school people learn to parse large expressions (though I find that people generally are not prepared well, because grade school expressions are…
Re: The Pyret Programming Language
#135I was excited that Pyret, which I was previously familiar with as a Racket #lang, had evidently gained enough independence to warrant its own website that does not even mention Racket. What a vindication of the #lang system! Then I read this: "Ultimately, Racket’s #lang facilities, though designed to create new languages—and a great prototyping ground for Pyret—proved to not be quite enough to support a language crea…
Re: The Pyret Programming Language
#136I was excited that Pyret, which I was previously familiar with as a Racket #lang, had evidently gained enough independence to warrant its own website that does not even mention Racket. What a vindication of the #lang system! Then I read this: "Ultimately, Racket’s #lang facilities, though designed to create new languages—and a great prototyping ground for Pyret—proved to not be quite enough to support a language crea…
If I understand correctly, the main problem was that the Pyret project wanted Pyret to run directly in the browser, so they needed a JavaScript-backend. Since Racket doesn't have a JavaScript-backend, they wrote a compiler in Pyret that compiles Pyret to JavaScript. I don't see the lack of a JavaScript-backend as failure of the language building facilities of Racket. In fact, the ability to quickly build a new langua…
Switching to Javascript has nothing to do with "scaling". They wanted to go to JS, and simply jettisoned their bootstrapping booster rocket once they got there, because they didn't want Pyret users (including maintainers) to have a dependency on a Racket installation that is otherwise irrelevant to the running code.
Re: The Pyret Programming Language
#137Earlier quoted context omitted.
I'm a bit dubious that magic stuff like this really makes anything easier. It's like JavaScript's truthiness and type coersion. It's trying to be friendly and work most of the time, but in reality it is more complex because now you have to remember a whole set of rules about how exactly the magic behaves.
My guess is that you didn't try @skrishnamurthi suggestion: > Did you try the `sin(pi / 6)` example? You'll find that Pyret produces a rather interesting result that is also instructive. The result of this doesn't feel like magic and doesn't resemble "JavaScript's truthiness and type coersion" at all IMO. Here's a live code editor where you can try it out: https://code.pyret.org/editor I found it to be a very refresh…
"grouping level" is a cringe-inducing dumbing down of proper terminology. It suggests associativity, but associativity does not have levels. It must be referring to "precedence".
= and / are not at the same level of precedence in basic mathematics!
In elementary school you learn
y = x / 2
without requiring parentheses.It makes sense to require parentheses when exotic, unfamiliar operators are involved for which the precedence and associativity would be hard to remember.
Not for operators drilled into your head by sixth grade.
Re: The Pyret Programming Language
#138A new book which serves as an introduction to CS in Brown university has been released just yesterday. It uses Pyret. https://dcic-world.org/2021-08-21/index.html PAPL - https://papl.cs.brown.edu/2020/ is an older version of the current book.
Tweet thread explainer: https://twitter.com/ShriramKMurthi/status/142918126348784435...