Very abstract java example (as concise as possible):
List<Object> processList(List<Object> oldObjects)
{
List<Object> newObjects = ArrayList<Object>;
for(Object object : oldObjects)
{
newObjects.add(manipulate(object));
}
return newObjects;
}
Clojure equivalent:
(defn processList [#^Object list]
(for [object list] (manipulate object)))
I realize this is a very pedestrian example, but a couple things to note (and
I'm sure mentioned previously):
- Lisps are much more expressive, in general
- Compared to most languages there is significantly less syntactic noise-
There is "just enough" syntax to delimit the code.
- The code is a data-structure (homoiconicity), and it is very easy to see
where the expression begins and ends (this is good for readability, code
formatters, etc)
- Lisps are very consistent- no special code formatting rules to remember.
Despite what seems like a large number of parentheses there are far less
'control' characters.
I.e. instead of : . ; ( ) { } you have ( ), and usually fewer of them.
- Most programmers rely on their IDE/Editor or indentation to make sure they
are matching curly-braces correctly,
which is made harder by blocks of code that frequently extend beyond the
height of your screen.
IDEs/editors can match parentheses as well. :)
- The parentheses make the code sleek and aerodynamic
---
Joseph Smith
[email protected]
(402)601-5443
On Dec 19, 2009, at 11:21 AM, David Nolen wrote:
> On Sat, Dec 19, 2009 at 8:25 AM, Martin Coxall <[email protected]> wrote:
> >
> > I guess it's mostly a matter of judging a language by its long-term
> > merits instead of initial appearance -- just like with so many other
> > things in life.
> >
>
> That - right there - is a tacit admission that the Clojure community will
> find it actively desirable that it remain a minority language, so we can all
> feel smug that we understand something those poor average programmers were
> too simple to see.
>
> I don't think anybody in the Clojure community wants to Clojure to be a
> fringe language. Considering the ML now has about 3K subscribers (up 2500
> from 14 months ago) I think Rich Hickey and the community have done a fair
> job touting it's advantages.
>
> However, there are somethings about every language that you just have to
> accept. Lisp's parentheses are one of those things. For example, it's really
> not worth complaining about Python's enforcement of significant whitespace.
> Sure people sing it praises now, but to this day there still fruitless
> discussions about the matter mostly initiated by people with only a passing
> familiarity of the language.
>
> You know there's nothing wrong with allowing Clojure to display its elegance
> upfront, rather than making programmers work for it like it's some
> Presbytarian admission exam.
>
> You are not the first to bring up the concern about parentheses and you will
> certainly not be the last. My advice would be to let the matter drop. People
> who aren't going to learn Lisp just because it has parentheses aren't going
> to be converted. But from the variety of programmers on this list, parens are
> not a significant deterrant for programmers coming from the background of
> Java, Scala, JavaScript, C, C++, Objective-C, OCaml, Haskell, Prolog, Erlang,
> PHP, Perl, Python, Ruby, etc.
>
>
> Martin
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with your
> first post.
> 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
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with your
> first post.
> 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
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
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