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

Reply via email to