For me, this looks MUCH more like Haskell than Python and I think that this is symptomatic of an erroneous claim that some functional programming proponents seem to constantly make: That declarative, "mathy","deconstructive" programming is somehow easier to learn than imperative, "algorithmic", step-by-step constructive programming. In reality, most people in the world struggle with abstract mathematics and find it m…
Pyret – A language exploring scripting and functional programming
61–70 of 272 posts
Re: Pyret – A language exploring scripting and functional programming
#62I've never understood the idea of a 'teaching' programming language. (Modulo examples like Logo and Scratch, which offer much more than a language as part of a wider teaching/computing system.) You spend all this time ramping up on a language, toolchain, library, etc, that you will eventually be unable to leverage beyond a certain point since it is not one used by everyday programmers. The delta in "quality learning"…
Even Pascal grew up into Object Pascal. Yes, it is still used in production.
Re: Pyret – A language exploring scripting and functional programming
#63As someone who teaches coding to beginners for a living (I founded One Month and I teach Python to business students at Columbia University), this language looks really intimidating to beginners. Maybe Pyret isn't for beginners, and it's intended to teach people who already have some basic knowledge more advanced concepts like functional programming. That's fine. But to a total beginner, the syntax of Pyret is defini…
Annotations are optional. This is equally valid: fun square(n): n * n end Not that different after all! And I say this as a lover of python and significant whitespace, but not having it at first would be easier.
Re: Pyret – A language exploring scripting and functional programming
#64Don't get me wrong, I love learning new languages and every language does give me a slightly different perspective when it comes to programming. It sometimes change how I think in my mind to code.
But do we need a new language just for the sake of someone wants to write a new language?
Re: Pyret – A language exploring scripting and functional programming
#65Unexplained important things: * concurrency, is there any nice built in syntax like Python async? Any kind of threading? Multiprocessing support? * error handling, how is it done? Where are exceptions? * standard and file io, string operations, serialisation? * no builtin higher math types (matrix etc.), is math done on decimal floating point numbers? * foreign functions, interfacing with other languages, embedding?
Pyret's number representation is one consequence of this: Pyret numbers are stored as either exact rational numbers:
> num-sqrt(4.41)
21/10
or, when an exact representation isn't possible, as "roughnums" (which are backed by a Javascript floating-point number: > num-sqrt(2)
~1.4142135623730951
Pyret's users overwhelmingly use Code.Pyret.Org, an in-browser development environment. Unfortunately, Javascript is a very hostile compilation target. For the time being, this rules out support for threading.Pyret does not have FFI from an end-user perspective, but several of the standard library modules are implemented in hand-written Javascript.
Pyret has file I/O, but not in its online development environment, since the web page does not have filesystem access.
(Disclosure: I am a developer of Pyret!)
Re: Pyret – A language exploring scripting and functional programming
#66Example from the OP: fun to-celsius(f): (f - 32) * (5 / 9) end What's the justification for allowing the use of hyphens/dashes in reference names, when underscores would seemingly provide the same purpose? One of the most common problems I notice in newbie code is inconsistency in using whitespace, e.g. `a-b` vs `a - b`, though in that situation, for Python and virtually every other language I've used, those both res…
As a Clojure programmer, I learned to love hyphens, so much more readable. But since Clojure is a Lisp, is does not suffer this whitespace problem/confusion. (- a b)
I have spent quite some time chasing bugs of the type (- a -1) where the second minus ended up there because of either a copy/paste-error or a brain fart due to the original expression was a - 1...
Re: Pyret – A language exploring scripting and functional programming
#67Yet another language - excuse for my lack of context/background, but why? If you go into a job now, how many will expect you to code in Pyret? Don't get me wrong, I love learning new languages and every language does give me a slightly different perspective when it comes to programming. It sometimes change how I think in my mind to code. But do we need a new language just for the sake of someone wants to write a new…
Re: Pyret – A language exploring scripting and functional programming
#68As someone who teaches coding to beginners for a living (I founded One Month and I teach Python to business students at Columbia University), this language looks really intimidating to beginners. Maybe Pyret isn't for beginners, and it's intended to teach people who already have some basic knowledge more advanced concepts like functional programming. That's fine. But to a total beginner, the syntax of Pyret is defini…
In the same world is easier to understand for advanced developers. You know n is a number and the result is a number. You don't need to "type check in your head". Remember Pascal? Being explicit is good for education and for regular sanity. P.D: I like python very much, but all the time I'm wondering "ok, what is the meaning of this code, let's find elsewhere so I can remember what is supposed this return" This also…
Re: Pyret – A language exploring scripting and functional programming
#69Example from the OP: fun to-celsius(f): (f - 32) * (5 / 9) end What's the justification for allowing the use of hyphens/dashes in reference names, when underscores would seemingly provide the same purpose? One of the most common problems I notice in newbie code is inconsistency in using whitespace, e.g. `a-b` vs `a - b`, though in that situation, for Python and virtually every other language I've used, those both res…
As a Clojure programmer, I learned to love hyphens, so much more readable. But since Clojure is a Lisp, is does not suffer this whitespace problem/confusion. (- a b)
Like in a Lisp infix macro: (infix (a + b * c) / d).
This kind of thing is quite habitable: we hardly lose sleep over (3.4) the list of one float versus (3 . 4) the dotted pair of integers.
Re: Pyret – A language exploring scripting and functional programming
#70I really like the idea of tests right beside the code. I don't like how it's code though. Muddles what the actual implementation is a bit. Maybe with more usage the where statements start to blur and you don't notice them as much. I like Elixir's approach better where your test cases live as documentation examples in comment form, right above the function declaration. It's fantastic and free. Your mix test command ru…
Cannot do that with elixir style tests easily.