Martin Coxall <pseudo.m...@me.com> writes:

> For each line that is not within a vector, and does not have an
> opening parenthesis, infer an opening parenthesis at the start of the
> line. Remember the level of indentation, and infer a closing
> parenthesis at the end of the line *before* the next line whose
> indentation is the same as or less than the remembered one. 
>
> My question is: why would such a scheme work/not work, and why
> would/would not it be desirable? 

I've just realized there's a really obvious problem with this scheme,
which shows it's not really so easy.  What if you don't want parens on a
line?  What if we try to write the identity function?

defn identity [x]
  x

This is interpreted as:

(defn identity [x]
  (x))

Whoops!

Python and sweet-expressions avoid this by adding () everywhere you want
an actual function call.

defn my-rand [x]
  rand()

Yuck!

Ruby and Perl, which allow paren-less calls do so by basically being the
equivalent of a Lisp 2.  Haskell deals with it by currying.

Maybe use the infix notation to work around it?

defn identity [x]
  |x|

This is already getting bothersomely complicated.

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

Reply via email to