News for hackers. Stuff that matters.
Re:Thinking in Clojure for Java Programmers by InclinedPlane on Thursday December 16, 2010 @05:20PM (#2014046)
Indeed. For example, retaining a method name like "defn" seems more than a little suspect in an era of gigabyte memories, terabyte hard drives, and auto-complete IDEs.
Re:Thinking in Clojure for Java Programmers by zephjc on Thursday December 16, 2010 @05:35PM (#2014122)
'defn' is hardly old-school; Python uses 'def' to define functions. Now 'car' and 'cdr' on the other hand...

This is far preferable to typing e.g. "public static void ..." all the time

Re:Thinking in Clojure for Java Programmers by InclinedPlane on Thursday December 16, 2010 @07:12PM (#2014499)
defn harkens back to an era when using a computer meant using a teletype, putting an extreme premium on terseness in naming. And it's just an example, car, cdr, cons, etc. are just as bad. It's easy to memorize these but that doesn't mean they are the best choices for readability, writability, etc.

I have a hard time believing that the best choice of name for all of these operators just so happens to always be some 3 or 4 character string that's almost but not quite a word and seems to have dropped some vowels.

As for "public static void ...", that's a disease of another sort, equally as bad.

Re:Thinking in Clojure for Java Programmers by mquander on Thursday December 16, 2010 @07:30PM (#2014554)
I disagree. If car and cdr and cons are bad, it's because they don't look or sound like what they do, and they have good replacements, like first and rest. defn is a macro that makes it simpler to def, which sounds and looks like "define", a binding to a fn, which sounds and looks like "function". I don't think you get any clearer than that without writing "define-function" everywhere. And I don't want to write "define-function" everywhere.

Do you think that every index variable in a loop should be called "index"?

Re:Thinking in Clojure for Java Programmers by mikedouglas on Thursday December 16, 2010 @07:22PM (#2014528)
`defn' is a mnemonic for "define function". `cons' is a mnemonic for "construct".

`car', and `cdr' and replaced in clojure with `first' and `rest'.

Once you've spent ten minutes with the language, these names aren't going to trip you up.

Re:Thinking in Clojure for Java Programmers by mahmud on Friday December 17, 2010 @12:15AM (#2015279)
People want to learn "new languages" without having to learn anything new.
Re:Thinking in Clojure for Java Programmers by gruseom on Friday December 17, 2010 @12:55PM (#2017006)
Well put. There's also a tradeoff between learning-curve and proficiency in language design: many features that aid the one detract from the other. I think this causes much of the noise in programming language discussions, especially with Lisp.
Re:Thinking in Clojure for Java Programmers by brehaut on Thursday December 16, 2010 @07:36PM (#2014565)
I think using defn as an example here is a poor choice for this argument. defn is not an abbreviation of `define` or 'defun', instead it is a fusion of `def` and `fn`. fn is clojure's anonymous function form and def binds a var to a value. You can see this via macroexpand:

   user=> (macroexpand '(defn f [x] x))
   (def f (.withMeta (clojure.core/fn f ([x] x)) (.meta (var f))))
[edit: clarified an ambiguous initial statement]
Re:Thinking in Clojure for Java Programmers by weavejester on Thursday December 16, 2010 @05:36PM (#2014133)
But we still read with the Mark I Eyeball. A commonly-used keyword should be short, and in a functional language, using "fn" instead of "function" seems a perfectly sensible idea.

Mathematics and natural languages take the same approach, assigning the most commonly used bits of the language the smallest words/symbols. It makes the document easier to parse, when done within reason.

Re:Thinking in Clojure for Java Programmers by jmatt on Thursday December 16, 2010 @06:57PM (#2014447)
Autocomplete and debugging with clojure works. The problem is most clojure developers don't use common java IDEs. So it appears like it doesn't work or exist. But recently there has been an explosion of plugins to help everyone that isn't familiar with emacs & slime.

Autocomplete:

http://stackoverflow.com/questions/4289480/how-to-do-automat...

Debugging:

http://clojure.org/getting_started

Plugins:

https://github.com/swannodette/textmate-clojure

http://code.google.com/p/counterclockwise/

http://plugins.intellij.net/plugin/?id=4050

Options:

[emacs is too hard on windows] http://clojure.bighugh.com/

[but I use a mac] http://aquamacs.org/

[but I write ###.NET] https://github.com/richhickey/clojure-clr https://github.com/jmis/vsClojure

Re:Thinking in Clojure for Java Programmers by mquander on Thursday December 16, 2010 @05:34PM (#2014117)
defn is not retained from anywhere. It was coined by Clojure. I don't find it particularly shocking. I also consider the ability to write code effectively outside of an autocompleting IDE a feature, not a bug.
Re:Thinking in Clojure for Java Programmers by rbanffy on Thursday December 16, 2010 @05:37PM (#2014135)
That's the point: you need auto-complete IDEs, terabyte hard-drives and gigabyte memories to program in Java.

You don't need any of that to program with Lisp (although Emacs and SLIME can help)

Re:Thinking in Clojure for Java Programmers by cjenkins on Thursday December 16, 2010 @09:43PM (#2014924)
I like it for screen real estate purposes. The shorter stuff is, the more text I can view in a single window.

I wish monitor real estate progressed at the rate of Moore's law, but I suppose we'd need bigger rooms to put them in before too long.

Re:Thinking in Clojure for Java Programmers by cabalamat on Thursday December 16, 2010 @11:07PM (#2015121)
I quite agree. And we can extend this priciple, so that

  a * b
would be replaced by:

  multiply(a, b)
which is much more self-documenting :-)
Re:Thinking in Clojure for Java Programmers by jshen on Thursday December 16, 2010 @05:33PM (#2014102)
i prefer short names for methods you use so often that there is no chance of forgetting what it means.