<p>Well, natural languages usually don't have much need to distinguish between &quot;the object X&quot; and &quot;the sequence containing only the object X&quot;, so there's not a lot of precedent there to work with. We'll have to look elsewhere for inspiration.</p>
<p>In Python, a multi-element tuple is <code>A, B, C</code>, a one-element tuple is <code>A,</code>, and a zero-element tuple is <code>()</code>. So that's one way to do it: have a multi-element sequence be <code>A conj B conj C</code>, a one-element sequence be <code>A conj</code>, and a zero-element sequence be <code>null</code> (a separate marker of some sort).</p>
<p>In Lisp (and various languages inspired by it), there are exactly two types of lists: <code>nil</code>, and <code>X . rest</code>, where <code>X</code> is an element and <code>rest</code> is a list. A three-element list would be <code>A . B . C . nil</code>. So this gives us another way to do it: have a multi-element sequence be <code>A conj B conj C conj end</code>, a one-element sequence be <code>A conj end</code>, and a zero-element sequence be <code>end</code>. (Parentheses omitted for simplicity.)</p>

CC BY-SA 4.0
2024-05-16T01:26:57.327Z
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
CC BY-SA 4.0
2024-05-16T02:37:09.580Z
@Corbin Well, you need parentheses any time you're nesting sequences, no?
Draconis
CC BY-SA 4.0
2024-05-16T00:59:09.043Z
2024-05-16T00:59:09.043Z
Draconis
<p>Suppose we have a language containing an <a href="https://en.wikipedia.org/wiki/Infix_notation" rel="nofollow noreferrer">infix</a> connective for building some sort of sequence. For example, perhaps our terminals are natural numbers and commas, and we are considering fragments like &quot;0,1&quot; or &quot;2,3,5&quot;. How might we express a sequence of zero or one item?</p>
<p>In the abstract, it's kind of an easy question, so let's use a real grammar. In Lojban, <code>{ce'o}</code> builds a sequence. Instead of &quot;0,1&quot; we might say <code>{li no ce'o li pa}</code>. 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 <code>{ce}</code>, which builds an unordered set. How can we work around or fix this deficit?</p>

CC BY-SA 4.0
2024-05-16T00:23:13.510Z
I'm not quite seeing how this is an infix: it's a separate word, no?
Draconis
CC BY-SA 4.0
2024-05-16T01:00:28.790Z
@Draconis It's an infix the way "+" is an infix in "3+2". The mathematical sense, not the linguistic one
No Name
<grammar><lojban><semantics>
With infix connectives, how to handle edge cases?
# With infix connectives, how to handle edge cases?

(Asked by: username_0 on 2024-05-15)

Suppose we have a language containing an [infix](https://en.wikipedia.org/wiki/Infix_notation) 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?

**Tags:** grammar, lojban, semantics
> **Comments:**
> **username_1**: I'm not quite seeing how this is an infix: it's a separate word, no?  
> **username_2**: @Draconis It's an infix the way "+" is an infix in "3+2". The mathematical sense, not the linguistic one  

---

## 1 answers

### Answer by username_1 on 2024-05-16. Score: 2

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.)

> **Comments:**
> **username_0**: 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?  
> **username_1**: @Corbin Well, you need parentheses any time you're nesting sequences, no?  

---

