# [racket-dev] P4P: A Syntax Proposal

 From: Barland, Ian (ibarland at RADFORD.EDU) Date: Wed Jul 28 21:49:48 EDT 2010 Previous message: [racket-dev] P4P: A Syntax Proposal Next message: [racket-dev] P4P: A Syntax Proposal Messages sorted by: [date] [thread] [subject] [author]

```>>   - The whole distinction between operators and functions is a lie!
>>
> Except it's not.  I've run into educators who taught Scheme who
> thought this way, and the accounts of Scheme they gave were nonsense.
>
Perhaps I overspoke; it was the idea that I didn't need *two* syntaxes for
calling (arithmetic) functions that impressed me.  I was easily impressed,
in my youth :-)

>> * Are the brackets around expressions-in-function-position required, or
>> optional?
>
> Essential.  That's how parsing stays unambiguous.  (That's why I have
> a do: keyword, not just {...}, as Everett proposed.)
>
Whoops, I see that now; "fun: (x) in identity(x)(3)" would be ambiguous.
Amazing how actually writing down an example can help :-)

>> I ¹d prefer optional, again just for pedagogical elegance when
>> introducing anonymous functions
>
> Not true at all.  Here are two examples:
>
Yeah, most examples work fine; it's just that a very-first example of fun:
might just be an application; I present "{fun: (x) in +(x,x)}(3)" and that
example would likely be the first and last time I type curly-brackets in
class.  Also, if stepping, they can appear:

defvar: double = fun: (x) in +(x,x)
double(3)

A hand-eval begins by substituting the identifier (`double`), but we need to
add curly-braces even though there weren't any up in the text of the def'n:

double(3)
= {fun: (x) in (+x,x)}(3)  ;Where'd the curly-braces appear from, prof?

(Not a biggie, and moot now that I agree that the curly-brace can¹t be made
optional.)

"P4P" -- a palliative for parentheses?

--Ian

```

 Posted on the dev mailing list. Previous message: [racket-dev] P4P: A Syntax Proposal Next message: [racket-dev] P4P: A Syntax Proposal Messages sorted by: [date] [thread] [subject] [author]