2

Suppose we have a language containing an infix connective for building some sort of sequence. For example, perhaps our terminals are natural numbers and commas, and we are considering fragments like "0,1" or "2,3,5". How might we express a sequence of zero or one item?

In the abstract, it's kind of an easy question, so let's use a real grammar. In Lojban, {ce'o} builds a sequence. Instead of "0,1" we might say {li no ce'o li pa}. However, when we want to indicate that a sequence has zero items or one item, there is no (baseline) syntax for it. A similar issue arises for {ce}, which builds an unordered set. How can we work around or fix this deficit?

2
  • 1
    I'm not quite seeing how this is an infix: it's a separate word, no?
    – Draconis
    Commented May 16 at 0:23
  • 1
    @Draconis It's an infix the way "+" is an infix in "3+2". The mathematical sense, not the linguistic one
    – No Name
    Commented May 16 at 1:00

1 Answer 1

1

Well, natural languages usually don't have much need to distinguish between "the object X" and "the sequence containing only the object X", so there's not a lot of precedent there to work with. We'll have to look elsewhere for inspiration.

In Python, a multi-element tuple is A, B, C, a one-element tuple is A,, and a zero-element tuple is (). So that's one way to do it: have a multi-element sequence be A conj B conj C, a one-element sequence be A conj, and a zero-element sequence be null (a separate marker of some sort).

In Lisp (and various languages inspired by it), there are exactly two types of lists: nil, and X . rest, where X is an element and rest is a list. A three-element list would be A . B . C . nil. So this gives us another way to do it: have a multi-element sequence be A conj B conj C conj end, a one-element sequence be A conj end, and a zero-element sequence be end. (Parentheses omitted for simplicity.)

2
  • I was hoping for answers that don't modify the grammar, but this is still a good overview for language designers that have the luxury of fixing mistakes. Here's a motivating question: how does Python represent a singleton tuple containing a singleton tuple?
    – Corbin
    Commented May 16 at 1:26
  • @Corbin Well, you need parentheses any time you're nesting sequences, no?
    – Draconis
    Commented May 16 at 2:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.