Re: [q-lang-users] A proposal to adopt Python tuple syntax
Brought to you by:
agraef
From: Albert G. <Dr....@t-...> - 2005-06-24 10:30:12
|
Hi, Tim, > I've not really been bitten by it except as a result of programmer error - > I might get temporarily confused whether I want to write > map (lambda (N) (N+1)) [1..10] > ^ ^ > or not (and in this case, not), but that's it. Yup, that's actually the foo(99) thing in disguise. In my experience that's actually the most common source of confusion. So that speaks in favour of John's argument. I agree that if you really have to constantly think about those situations, then it should be changed. > Not awake yet: would (-1,) be well-defined this way? What about ((-1),) and > ((-1,),) ? Would I want to remember all these permutations? Yes, (-1,) = ((-1),) = (((-1)),) = a 1-tuple with member -1, whereas ((-1,),) is a 1-tuple of a 1-tuple of -1. The only thing to remember would be that (X,) is always a 1-tuple, while (X) is always just X. When a tuple has more than one member, you could leave away the trailing comma, there is no ambiguity (and never has been) in that case. However, admitting a trailing comma in _all_ tuples (and lists) might be a good thing, for consistency, and for the same reasons that it is allowed in C's array constants. > At first blush, I don't mind (and might even favour) having a different > syntax for forcing something to be a tuple - say use [] for lists, () for > parenthetical purposes *only*, which leaves <> or {} for tuples? <...> doesn't work, e.g., how should something like < 5 > 3 > 1 be parsed, is it ((< 5 >) 3) > 1 or (< (5 > 3) >) 1 ? Concerning the curly braces, it might be a good idea to keep {...} for possible future extensions (Haskell-style records come to my mind). So I'd actually prefer to keep using the parentheses for tuples, John and I even agree on that point. ;-) Tim, if I understood you correctly, you don't really have any objections against the current notation, but wouldn't mind a change either. Is that correct? Could you live with that "trailing comma" thingie? Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikwissenschaft.uni-mainz.de/~ag |