News for hackers. Stuff that matters.
Re:Ante: A low-level functional language by louthy on Friday June 17, 2022 @07:10AM (#31776520)
> Is there a reason why you would make fn(1) and fn 1 equivalent?

1 and (1) are isomorphic. A single term tuple can be converted to the single term, and vice versa. Having an implicit conversion doesn't seem too crazy.

The biggest issue I suspect would be confusion about the most idiomatic way, or a mix of styles in real-world code bases, that causes confusion or inconsistencies (increases cognitive load for the reader).

Re:Ante: A low-level functional language by derriz on Friday June 17, 2022 @07:57AM (#31776848)
I don't think this applies in this case. The brackets here are used for resolving precedence only. They are a syntactic feature which are not represented in the language semantics.

Where brackets are used in some languages to construct tuples, you generally need special syntax to represent the case for 1-tuples, like Python where "(1)" is equivalent to "1" but "(1,)" is a 1-tuple containing a single 1 value.

Also in most FP semantics, x and the 1-tuple containing x are not equivalent so the mathematical isomorphism doesn't hold. The tuple itself could be undefined (bottom/unterminating or null, if the language has such a concept), or could contain an undefined value or could be completely well-defined. These three cases are not represented in the semantics of the unbundled value.

Re:Ante: A low-level functional language by IanCal on Friday June 17, 2022 @07:13AM (#31776537)
I'm not sure I like a single item tuple being equivalent to just the item. Can you ask for the length of a tuple? The length of a tuple with two 100 element lists would be 2, and if you looked at the tail the length would be 100.
Re:Ante: A low-level functional language by dannymi on Friday June 17, 2022 @07:36AM (#31776695)
I agree. It's better to have single-item tuples still require a comma.

(1) - the number 1

1 - the number 1

(1,) - a tuple with one item, which is the number 1

1, - a tuple with one item, which is the number 1

Re:Ante: A low-level functional language by layer8 on Friday June 17, 2022 @08:02AM (#31776893)
Right. In particular if you identify tuples with lists (which seems reasonable), you run into typing problems, because singleton lists/tuples suddenly have to be unified with the element type.
Re:Ante: A low-level functional language by louthy on Friday June 17, 2022 @10:30AM (#31778771)
To be clear, I didn't say they were equivalent. They're equivalent up to isomorphism, not equal.