The Pyret Programming Language
pyret.org
The Pyret Programming Language
1–10 of 138 posts
Re: The Pyret Programming Language
#2Re: The Pyret Programming Language
#3> # 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
#4I 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.
> Pyret has numbers, because we believe an 8GB machine should not limit students to using just 32 bits.
Emphasis mine. WTF, author.
But the Java sample below saying "this is false" implies that floats are a problem that is being avoided. The only reasonable solution is rationals... right?
Re: The Pyret Programming Language
#5I 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
#6I 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.
The article doesn't really say what's going on under the hood but I'd guess that division of integers makes rationals... > Pyret has numbers , because we believe an 8GB machine should not limit students to using just 32 bits. Emphasis mine. WTF, author. But the Java sample below saying "this is false" implies that floats are a problem that is being avoided. The only reasonable solution is rationals... right?
If you go into the editor/REPL (https://code.pyret.org/editor) and enter 1/3, you'll see that it gets rendered as 0.3 repeating (with a bar, not some arbitrary rounding) or if you click on it, directly as 1/3.
Re: The Pyret Programming Language
#7Re: The Pyret Programming Language
#8Pyret – A language exploring scripting and functional programming - https://news.ycombinator.com/item?id=13185759 - Dec 2016 (267 comments)
A Case for the Pyret Programming Language - https://news.ycombinator.com/item?id=11986977 - June 2016 (37 comments)
Start Coding in Pyret - https://news.ycombinator.com/item?id=9070834 - Feb 2015 (22 comments)
Pyret: A new programming language from the creators of Racket - https://news.ycombinator.com/item?id=6701688 - Nov 2013 (283 comments)
Re: The Pyret Programming Language
#9Are these types checked anywhere? I think they should be checked at compile-time wherever possible, and optionally at run time too (I say optionally as the checks might make it slow, so they could be checked in development but perhaps not in production).
Re: The Pyret Programming Language
#10I 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.