Closed shriram closed 6 years ago
Do you mean it doesn't parse at all, or it doesn't parse as you expect? I think the former will parse as two statements that each are parenthesized lambda expressions, while the latter (with no space before the paren where you think the application is happening) parses as a function application.
Well, simply trying it out would have confirmed that I meant what I said, which is that it doesn't parse at all:
Pyret didn't understand your program around definitions: line 6, column 6
where line 6, column 6 is the (
of (lam(l-v):
.
This isn't a parsing bug so much as a criticism of Pyret's syntax, and motivation for a new well-formedness warning.
Both programs have this pattern:
(lam(x): ... end)
(lam(x): ... end)
In the first, it appears in the context of a function argument. That context can't have multiple expressions in a row, so it's a parsing error.
In the second, it appears in the context of a block, which can have multiple (newline-separated per the WF checker) expressions in a row.
A new warning could be "useless lambda expression on its own line, which means it will not be used".
Refining that: "useless lambda expression on its own line, and not the last expression of a block, which means it will not be used"
Now I get a block error. I can't even tell whether this is an improvement. (-:
Closing as effectively a duplicate of https://github.com/brownplt/pyret-lang/issues/383
@jpolitz says he closed it in July...but it's still open?
This program doesn't parse:
I need to make clear to Pyret that I mean a function call:
But what I don' t understand is why I didn't need to do the same for the
(lam (r-v)
part.