On Mon, Dec 1, 2008 at 4:31 PM, André Thieme <[EMAIL PROTECTED]> wrote: > > On 30 Nov., 23:58, "Mark Volkmann" <[EMAIL PROTECTED]> wrote: > >> I think you misunderstood what I was suggesting. I was only referring >> to expressions entered in a REPL, not expressions in a file of Clojure >> code. > > I understood that part and explained why this wouldn't work. > Not in the REPL, not in a .clj file. > >> At the REPL it would be easy to check whether the single line >> entered is surrounded by parens and add them if they are missing. > > Not really easy. If you think it is, do it here: > > user> a b c d e > > Okay, before the a there must be one, and after the e. > But what if b is a function? > Will it then be (a (b) c d e)? > Or did the user want to say (a (b c d) e)? > Or some other combination? > It really is not obvious. > What is the result of > user> * + 1 2 3 4 5 > ? > Clojure could think it is 120, because > (* (+ 1 2 3) 4 5) ==> 120 > But damn, it may also be 50 <== (* (+ 1 2 3 4) 5). > > As I said in my previous posting, as soon functions > are in the game that take any number of arguments it > is not obvious anymore where to place the parens. > > Sure, we could add a shortcut to explain where a new > function call begins. Maybe with the $ sign, as our > function application symbol: > user> $a b $c d e > > But we still don't know where it ends. So we could > simply tell the repl how many args go into a function: > user> $3a b $1c d e > Now it is 100% clear how to set the parens: > (a b (c d) e) > a has three args: a, (c d) and e > c gets one: d > But it looks ugly as hell. And: it's two markers. > The function application operator $ and the second is > the count of args that we give. > Lisp already has that, in form of a "(" and also a > ")". This looks much better.
I only meant omitting the first and last parens, not ones in the middle of the expression. For example, if you meant (a b (c d) e) then you'd be able to enter it as a b (c d) e I thought that made sense because almost everything you enter in a REPL (except symbol evaluations) begin and end with parens. But symbol evaluations are important. I wouldn't want to mess that up, so this proposal seems like a no go. -- R. Mark Volkmann Object Computing, Inc. --~--~---------~--~----~------------~-------~--~----~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---