What is the correct name for non-list parenthesized forms?

26 views
Skip to first unread message

David Storrs

unread,
Sep 24, 2021, 1:25:12 PMSep 24
to Racket Users
Racket has a number of forms that include what look like lists of lists but are not.  For example:  (let ((foo 7) (bar 8)) ...)

What would the '(foo 7)' and '(bar 8)' elements be called?  Groups, maybe?

Sorawee Porncharoenwase

unread,
Sep 24, 2021, 1:40:06 PMSep 24
to David Storrs, Racket Users
It's usually called "binding pair". See also https://docs.racket-lang.org/syntax/stxparse-intro.html which defines a syntax class describing the said structure.

On Fri, Sep 24, 2021 at 10:25 AM David Storrs <david....@gmail.com> wrote:
Racket has a number of forms that include what look like lists of lists but are not.  For example:  (let ((foo 7) (bar 8)) ...)

What would the '(foo 7)' and '(bar 8)' elements be called?  Groups, maybe?

--
You received this message because you are subscribed to the Google Groups "Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to racket-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CAE8gKodX800fK45c_dyVFCNB-AKmYmK26DxC42ZRDVHdzJ2Q7g%40mail.gmail.com.

Jay McCarthy

unread,
Sep 24, 2021, 1:50:00 PMSep 24
to David Storrs, Racket Users
I think the word you're looking for is "syntax". Many people think that languages like Racket "don't have syntax" or "have uniform syntax", but this is an example of how that is incorrect. Each macro has its own unique syntax and this is an example of how `let` has a unique syntax where `(` does _not_ mean "apply a function" or "apply a macro".

As a poor analogy, many human languages have a wide set of phonemes and you combine those in certain rules (like you can't have 27 consonant sounds in a row) and then use them in wider situations that we call grammar. I like to think that languages like C has lots of phonemes and little grammar, because there are lots of rules about how to form "C words" but basically no rules for how to form "C sentences", because there's a lot of uniformity in how expressions and statements combine. In contrast, languages like Racket have very few phonemes (this is what I think people mean why they say "there is no syntax") but many varied rules (in fact, arbitrary, because macros can customize them) for combining those smaller units.

Jay

--
Jay McCarthy
Associate Professor @ CS @ UMass Lowell
http://jeapostrophe.github.io
Vincit qui se vincit.


On Fri, Sep 24, 2021 at 1:25 PM David Storrs <david....@gmail.com> wrote:
Racket has a number of forms that include what look like lists of lists but are not.  For example:  (let ((foo 7) (bar 8)) ...)

What would the '(foo 7)' and '(bar 8)' elements be called?  Groups, maybe?

--

Robby Findler

unread,
Sep 24, 2021, 1:56:30 PMSep 24
to Jay McCarthy, David Storrs, Racket Users
An answer to a third question that might also have been the one that was asked :)

You might call it a "sequence".

Robby


David Storrs

unread,
Sep 24, 2021, 2:23:43 PMSep 24
to Sorawee Porncharoenwase, Racket Users
On Fri, Sep 24, 2021 at 1:40 PM Sorawee Porncharoenwase <sorawe...@gmail.com> wrote:
It's usually called "binding pair". See also https://docs.racket-lang.org/syntax/stxparse-intro.html which defines a syntax class describing the said structure.

Okay, but what about in (with-handlers ((symbol? (lambda (e) (displayln e))))  ...)?  That's an association between two things but not a binding pair.  Also, sorry, I should have been clearer up front by giving more than the one example.

David Storrs

unread,
Sep 24, 2021, 2:29:02 PMSep 24
to Jay McCarthy, Racket Users
On Fri, Sep 24, 2021 at 1:49 PM Jay McCarthy <jay.mc...@gmail.com> wrote:
I think the word you're looking for is "syntax". Many people think that languages like Racket "don't have syntax" or "have uniform syntax", but this is an example of how that is incorrect. Each macro has its own unique syntax and this is an example of how `let` has a unique syntax where `(` does _not_ mean "apply a function" or "apply a macro".

As a poor analogy, many human languages have a wide set of phonemes and you combine those in certain rules (like you can't have 27 consonant sounds in a row) and then use them in wider situations that we call grammar. I like to think that languages like C has lots of phonemes and little grammar, because there are lots of rules about how to form "C words" but basically no rules for how to form "C sentences", because there's a lot of uniformity in how expressions and statements combine. In contrast, languages like Racket have very few phonemes (this is what I think people mean why they say "there is no syntax") but many varied rules (in fact, arbitrary, because macros can customize them) for combining those smaller units.

So there's no specific term for this structure?  I was looking for a standardized way to say something like "with-handlers accepts a group of two-element groups where each subgroup consists of a predicate and an action."

John Clements

unread,
Sep 24, 2021, 2:37:45 PMSep 24
to David Storrs, Jay McCarthy, Racket Users
I think I wouldn’t say “accepts”; I usually reserve this term for functions, but that’s a minor quibble.

I think I would call these “clauses”, as in

“With-handlers allows the user to specify exception-handling clauses. Each one includes two parts: a predicate, indicating whether blah blah blah, and a handler, which is called blah blah blah.”

No?

John
> To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CAE8gKoeM6YYgpj-4Ey%2BoSSKRS%2BfMch3d0GDu85f9mwHmtxwVig%40mail.gmail.com.

David Storrs

unread,
Sep 24, 2021, 2:45:05 PMSep 24
to John Clements, Jay McCarthy, Racket Users
On Fri, Sep 24, 2021 at 2:37 PM John Clements <clem...@brinckerhoff.org> wrote:
I think I wouldn’t say “accepts”; I usually reserve this term for functions, but that’s a minor quibble.

I think I would call these “clauses”, as in

“With-handlers allows the user to specify exception-handling clauses. Each one includes two parts: a predicate, indicating whether blah blah blah, and a handler, which is called blah blah blah.”

No?

John

That seems reasonable.  Thanks, John.



Offtopic question for someone else:  Jay, are you related to Lisp-inventory John McCarthy?

Jay McCarthy

unread,
Sep 24, 2021, 2:48:38 PMSep 24
to David Storrs, John Clements, Racket Users
On Fri, Sep 24, 2021 at 2:45 PM David Storrs <david....@gmail.com> wrote:
Offtopic question for someone else:  Jay, are you related to Lisp-inventory John McCarthy?

Nope, although we have the same name and nickname

Robby Findler

unread,
Sep 24, 2021, 9:54:27 PMSep 24
to John Clements, David Storrs, Jay McCarthy, Racket Users
Another approach is to give it a name in the documentation and use that name (following Jay's earlier message).

Robby


Reply all
Reply to author
Forward
0 new messages