Live data from Hacker News

Pyret – A language exploring scripting and functional programming

pyret.org

71–80 of 272 posts

Re: Pyret – A language exploring scripting and functional programming

#71

Earlier quoted context omitted.

Judging from the red/blue colors in the logo and that the website was generated with Frog, I assume that once you feel too big for Pyret's shoes you'll discover that you've actually been using Racket all along and will start using the Racket language directly.

But why? Best languages are truly general. This should aim to replace Racket, not be bait for a switch.

Racket is both a programming language and a framework for building programming languages.

http://queue.acm.org/detail.cfm?id=2068896

Racket is the most fun I have had in Programming and the more I "get it" the more I enjoy it. I can't say that for any other language.

Re: Pyret – A language exploring scripting and functional programming

#72

Earlier quoted context omitted.

Judging from the red/blue colors in the logo and that the website was generated with Frog, I assume that once you feel too big for Pyret's shoes you'll discover that you've actually been using Racket all along and will start using the Racket language directly.

But why? Best languages are truly general. This should aim to replace Racket, not be bait for a switch.

Racket is a platform for running many languages. It's different than the usual "one language for everything!" mantra. You can Pyret for one part of a program, Racket for another, Typed Racket for another, etc.

Re: Pyret – A language exploring scripting and functional programming

#73

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?

Judging from the red/blue colors in the logo and that the website was generated with Frog, I assume that once you feel too big for Pyret's shoes you'll discover that you've actually been using Racket all along and will start using the Racket language directly.

http://www.pyret.org/pyret-code/

> One of the enduring lessons from the Racket project is that no full-blown, general-purpose programming language is particularly appropriate for introductory education. By the time a language grows to be useful for building large-scale systems, it tends to have accumulated too many warts, odd corners, and complex features, all of which trip up students. The journal paper for DrScheme (the old name for DrRacket) explains this in some detail.

In that respect, the closest fellow travelers of us Pyreteers are the Racketeers (see how that works?). In fact, the first version of Pyret was merely a #lang in Racket. Nevertheless, Pyret represents a departure from Racket (for now and for the near future, at least) for several reasons:

Re: Pyret – A language exploring scripting and functional programming

#74
post #42

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…

Pyret is inspired from Racket, which starts at step 1 with functional programming. It's not about readability or getting people to learn as fast as possible to write basic code, but to try and teach core program design principles easily and build a solid base within a single semester. The syntax is not as clean as Python, but it offers much more clarity in terms of testing, signatures, and offers a very interesting m…

If the goal is to teach functional programming with testing and signatures, is the awkward syntax (that isn't really very close to C#, Java, or Python) better than a set of macros on top of typed Racket?

It seems like it'd be easy to define a typedracket-derived #lang where you had to write:

    (define (sum a b) : [-> Integer Integer Integer]
      (where (= (sum 0 1) 1)
             (= (sum 2 2) 4))
      (+ a b))
And make the type signature and where clause non-optional with at least a single test.

Re: Pyret – A language exploring scripting and functional programming

#75
post #63

Earlier quoted context omitted.

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

But that's no fun. ;-)

Seriously, fun is obvious for function to anyone. (also, defun in some other languages fits the bill) In contrast, def doesn't explain what is defined. (See Groovy where it is a real problem or JavaScript where you can use var for everything.)

Re: Pyret – A language exploring scripting and functional programming

#76

I strongly believe that people who are learning to program should learn in a language that can actually be used to make things. This may run counter to the 'work smarter, not harder' ethos I see here but I feel that programming competency in practice is much more a function of literal hours writing code than any other factor.* *with the caveat that competency tends to follow a sub-linear growth curve and people vary…

I responded to a similar comment in another thread from a pedagogic perspective, I hope this answer gives some perspective on how we approach this point:

https://news.ycombinator.com/item?id=13186216

Also, Pyret can be used to make things – Pyret's compiler is written in Pyret!

As the language matures, the experience of writing small Pyret programs that grow into real applications will only get more authentic.

Re: Pyret – A language exploring scripting and functional programming

#77
post #66
post #26

Earlier quoted context omitted.

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

I'm not sure how (- a - 1) would work, unless you've named something "-"?

Re: Pyret – A language exploring scripting and functional programming

#78

Earlier quoted context omitted.

I was also surprised. The syntax they use is basically Standard ML. Also I'd really like to see a paper on their static type checking, because they mix objects and algebraic data types, which is not trivial at all.

Hi, I'm actually the person who wrote the static type checker. Essentially we get around the difficulties of mixing objects and ADTs by having very limited support for subtyping. This way we can still carry out unification-based inference. The subtyping bounds are not propagated during unification so we don't need to worry about calculating closures. This does mean that type inference is incomplete with respect to su…

Hi, thanks. Primarily I wondered about actual mixing of ADTs and objects, which is limited even in OCaml, see e.g.:

http://caml.inria.fr/pub/ml-archives/caml-list/2003/06/bed28...

But does Pyret always translate an ADT to a class hierarchy behind the scenes? This example sure looks like it does:

  data Animal:
    | elephant(name, weight)
    | tiger(name, stripes)
    | horse(name, races-won)
    ...
  end

  fun animal-name(a :: Animal):
    a.name
  end

Re: Pyret – A language exploring scripting and functional programming

#79

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…

> Programming beginners want to draw nice pictures on their computer, not struggle with understanding and implementing some recursive function.

One of the links under "set sail": https://code.pyret.org/editor#share=0B32bNEogmncOMTg5T2plV19...

Re: Pyret – A language exploring scripting and functional programming

#80
post #60

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 what world is: def square(n): return n * n ... easier for a beginner to understand than: square n = n * n

Is square a function or object/data structure result of operation?

Welcome to the Real World. Please make different entities look different.

Post reply on HN