Live data from Hacker News

Pyret – A language exploring scripting and functional programming

pyret.org

61–70 of 272 posts

Re: Pyret – A language exploring scripting and functional programming

#61

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…

Do you have any measurable (preferably peer-reviewed) evidence that suggests imperative programming is inherently easier? That sounds like a challenging claim to make.

Re: Pyret – A language exploring scripting and functional programming

#62
post #52

I'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"…

Yes, this should not be one of those training wheels, but a fully fledged solution.

Even Pascal grew up into Object Pascal. Yes, it is still used in production.

Re: Pyret – A language exploring scripting and functional programming

#63

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

"def" is an abbreviation non-programmers are more likely to understand than "fun".

Re: Pyret – A language exploring scripting and functional programming

#64
Yet 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 language?

Re: Pyret – A language exploring scripting and functional programming

#65

Unexplained 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?

Great points! These are important things, but not necessarily important to Pyret. Pyret is not designed to be a general-purpose programming language, so the design of the language is directed and constrained by the needs of the teachers who use it.

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

#66
post #26
post #14

Example 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'd say there is some room for confusion, even if it's not in the grammar.

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

#67
post #64

Yet 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…

We do. I'd love a more readable variant of Rust for example, with built in testing and contract support.

Re: Pyret – A language exploring scripting and functional programming

#68
post #36

As 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…

Use IDE which runs type inference like the compiler when that's a problem. Can't do it in Python though.

Re: Pyret – A language exploring scripting and functional programming

#69
post #26
post #14

Example 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)

An infix language could also require whitespace around operators, so that a-b could be a an identifier.

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

#70

I 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…

Again, use IDE with code folding if that is ever a problem. At least it is in the same file.

Cannot do that with elixir style tests easily.

Post reply on HN