Re: , is REAL whitespace...
try this one: (list,1,2,3) :) Per: I'd say it's also weird if you're coming from a Lisp background - just weird in the opposite direction. But not so weird that it's not useful, mostly for separating key/value pairs from other key/value pairs in a map. It's like Perl's fat comma arrow operator in that sense - syntactically no different from comma, but stylistically helpful. On Fri, Apr 2, 2010 at 1:52 AM, Per Vognsen per.vogn...@gmail.com wrote: It doesn't feel right only if you still think you are programming in an Algol-style language where , is a separator token. I can't imagine this is going to change. -Per On Fri, Apr 2, 2010 at 12:37 PM, Frank Siebenlist frank.siebenl...@gmail.com wrote: Even though the specs clearly say that commas are whitespace, the following repl session doesn't feel intuitively right: ... user (list 1 2 3) (1 2 3) user (list 1, 2, 3) (1 2 3) user (list 1, 2, , 3) (1 2 3) user (list 1, 2, nil , 3) (1 2 nil 3) ... , is same as , , is same as ... big gotcha for beginning clojurians... Enjoy, Frank. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en To unsubscribe, reply using remove me as the subject. -- Mark J. Reed markjr...@gmail.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: , is REAL whitespace...
Well, for the comma to be useful, it cannot require whitespace separation on either side. It would be weird if you had to write [1 , 2 , 3]. So, it shouldn't be surprising that 'list,' is read as 'list' when '123,' is read as '123'. Regarding the strangeness of comma-as-whitespace if you're coming from a Lisp background, I admit I initially disliked it but have grown fonder of it over time. That was a little surprising to me. I generally don't favor syntactic distinctions without a difference, e.g. case-insensitive symbol reading in Common Lisp, PLT Scheme's [ and ] as synonyms for ( and ), etc. -Per On Fri, Apr 2, 2010 at 6:10 PM, Mark J. Reed markjr...@gmail.com wrote: try this one: (list,1,2,3) :) Per: I'd say it's also weird if you're coming from a Lisp background - just weird in the opposite direction. But not so weird that it's not useful, mostly for separating key/value pairs from other key/value pairs in a map. It's like Perl's fat comma arrow operator in that sense - syntactically no different from comma, but stylistically helpful. On Fri, Apr 2, 2010 at 1:52 AM, Per Vognsen per.vogn...@gmail.com wrote: It doesn't feel right only if you still think you are programming in an Algol-style language where , is a separator token. I can't imagine this is going to change. -Per On Fri, Apr 2, 2010 at 12:37 PM, Frank Siebenlist frank.siebenl...@gmail.com wrote: Even though the specs clearly say that commas are whitespace, the following repl session doesn't feel intuitively right: ... user (list 1 2 3) (1 2 3) user (list 1, 2, 3) (1 2 3) user (list 1, 2, , 3) (1 2 3) user (list 1, 2, nil , 3) (1 2 nil 3) ... , is same as , , is same as ... big gotcha for beginning clojurians... Enjoy, Frank. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en To unsubscribe, reply using remove me as the subject. -- Mark J. Reed markjr...@gmail.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: , is REAL whitespace...
I did not want to argue for or against the , as whitespace feature, but just wanted to point out the possible gotchas that we probably should warn novice clojure programmers for. I actually hit my head when I was trying to initialize a map with some nil value for :b, like: user {:a, a, :b,, :c, c} ; Evaluation aborted. user which yields some ArrayIndexOutOfBoundsException that I guess somehow tries to tell you that there is an odd number of entries for the map... and indirectly made me remember about those commas whitespace. It would have been a nasty bug if I would have tried to initialize an even number of nil values, like: user {:a,, :b,, :c, c} {:a :b, :c c} instead of user {:a, nil,:b, nil, :c, c} {:a nil, :b nil, :c c} as the former expression doesn't barf but simply yields the wrong result... So, it's all some form of RTFM... but one could argue that this novel use of commas in the syntax results in adding a little incidental complexity to the language ;-) -Frank. On Apr 2, 2010, at 7:39 AM, Per Vognsen wrote: Well, for the comma to be useful, it cannot require whitespace separation on either side. It would be weird if you had to write [1 , 2 , 3]. So, it shouldn't be surprising that 'list,' is read as 'list' when '123,' is read as '123'. Regarding the strangeness of comma-as-whitespace if you're coming from a Lisp background, I admit I initially disliked it but have grown fonder of it over time. That was a little surprising to me. I generally don't favor syntactic distinctions without a difference, e.g. case-insensitive symbol reading in Common Lisp, PLT Scheme's [ and ] as synonyms for ( and ), etc. -Per On Fri, Apr 2, 2010 at 6:10 PM, Mark J. Reed markjr...@gmail.com wrote: try this one: (list,1,2,3) :) Per: I'd say it's also weird if you're coming from a Lisp background - just weird in the opposite direction. But not so weird that it's not useful, mostly for separating key/value pairs from other key/value pairs in a map. It's like Perl's fat comma arrow operator in that sense - syntactically no different from comma, but stylistically helpful. On Fri, Apr 2, 2010 at 1:52 AM, Per Vognsen per.vogn...@gmail.com wrote: It doesn't feel right only if you still think you are programming in an Algol-style language where , is a separator token. I can't imagine this is going to change. -Per On Fri, Apr 2, 2010 at 12:37 PM, Frank Siebenlist frank.siebenl...@gmail.com wrote: Even though the specs clearly say that commas are whitespace, the following repl session doesn't feel intuitively right: ... user (list 1 2 3) (1 2 3) user (list 1, 2, 3) (1 2 3) user (list 1, 2, , 3) (1 2 3) user (list 1, 2, nil , 3) (1 2 nil 3) ... , is same as , , is same as ... big gotcha for beginning clojurians... Enjoy, Frank. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en To unsubscribe, reply using remove me as the subject. -- Mark J. Reed markjr...@gmail.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at
Re: , is REAL whitespace...
So, it's all some form of RTFM... but one could argue that this novel use of commas in the syntax results in adding a little incidental complexity to the language ;-) You put some pretty specific assumptions into your code: commas as separators, commas with a proper place in Clojure syntax, optional values in lists, nil for no-value, keys gotta be keywords (you don't get a wrong result, you get what you put in). No wonder it gets complex. A comma is whitespace and maps take pairs, that's the contrary of incidental complexity. BTW, I don't use commas and I make the odd count error often enough. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en To unsubscribe, reply using remove me as the subject.
Re: , is REAL whitespace...
On Apr 2, 2010, at 7:14 PM, Armando Blancas wrote: So, it's all some form of RTFM... but one could argue that this novel use of commas in the syntax results in adding a little incidental complexity to the language ;-) My wrong assumption was: whitespace and commas are separators instead of comma is whitespace and whitespace is separator right assumption is nil for no-value: (first ()) = nil and I got the wrong result not because you get what you put in, but because I had a bug in my program - my bad... ...but if I'm the only one who ever got bitten by clojure's commas that would be fantastic (and I guarantee you that it won't happen to me again ;-) ) -Frank. You put some pretty specific assumptions into your code: commas as separators, commas with a proper place in Clojure syntax, optional values in lists, nil for no-value, keys gotta be keywords (you don't get a wrong result, you get what you put in). No wonder it gets complex. A comma is whitespace and maps take pairs, that's the contrary of incidental complexity. BTW, I don't use commas and I make the odd count error often enough. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en To unsubscribe, reply using remove me as the subject. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
, is REAL whitespace...
Even though the specs clearly say that commas are whitespace, the following repl session doesn't feel intuitively right: ... user (list 1 2 3) (1 2 3) user (list 1, 2, 3) (1 2 3) user (list 1, 2, , 3) (1 2 3) user (list 1, 2, nil , 3) (1 2 nil 3) ... , is same as , , is same as ... big gotcha for beginning clojurians... Enjoy, Frank. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: , is REAL whitespace...
It doesn't feel right only if you still think you are programming in an Algol-style language where , is a separator token. I can't imagine this is going to change. -Per On Fri, Apr 2, 2010 at 12:37 PM, Frank Siebenlist frank.siebenl...@gmail.com wrote: Even though the specs clearly say that commas are whitespace, the following repl session doesn't feel intuitively right: ... user (list 1 2 3) (1 2 3) user (list 1, 2, 3) (1 2 3) user (list 1, 2, , 3) (1 2 3) user (list 1, 2, nil , 3) (1 2 nil 3) ... , is same as , , is same as ... big gotcha for beginning clojurians... Enjoy, Frank. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en To unsubscribe, reply using remove me as the subject.