3 ms·
I'm curious which parts look (more) complicated to you. For some perspective, when teaching Pyret to total beginners, we start with arithmetic and calls to lib
by jpolitz 10y ago
I'm curious which parts look (more) complicated to you.
For some perspective, when teaching Pyret to total beginners, we start with arithmetic and calls to library functions, then build up to function definitions and examples. At that point, there's just a handful of syntactic constructs to consider, and they are nearly identical to Python.
Things like "data" and "cases" don't come till later, and do come with more overhead, but also are introduced to students who already have some "finger-feel" with the language. Python has its own overhead with "class" for defining structured data at a similar point, including things like "self" and "__init__".
- tim333 10y agoI noted the in first example in the linked into - Python: def square(n): return n * n Pyret: fun square(n :: Number) -> Number: n * n end there's extra stuff. It also kind of loses the elegance of Python reading close to normal language - if you don't know programing but can do math you'd figure the first was define a function that gives a square but be confused what (n :: Number) -> Number: was about.
- jpolitz 10y agoThe type annotations are optional, so fun square(n): n * n end is a closer direct comparison to the Python program, for contexts that don't use annotations.