Rich Hickey: Geek of the Week

  • (2 Pages)
  • +
  • 1
  • 2

29 Replies - 4082 Views - Last Post: 22 January 2011 - 03:23 AM

#1 Raynes  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 611
  • View blog
  • Posts: 2,815
  • Joined: 05-January 09

Rich Hickey: Geek of the Week

Post icon  Posted 06 March 2010 - 12:42 PM

"With Clojure soon to be ported to the .NET framework, as ClojureCLR, we felt that the time had come to see what the fuss was all about amongst the Java Geeks. We sent Richard Morris to find out from the creator of Clojure, Rich Hickey."

http://www.simple-ta...ek-of-the-week/
Is This A Good Question/Topic? 0
  • +

Replies To: Rich Hickey: Geek of the Week

#2 Locke  Icon User is offline

  • Sarcasm Extraordinaire!
  • member icon

Reputation: 520
  • View blog
  • Posts: 5,596
  • Joined: 20-March 08

Re: Rich Hickey: Geek of the Week

Posted 06 March 2010 - 01:28 PM

I think this could prompt some interesting discussion.

Featured. :)

In my opinion, porting Clojure over to the .NET Framework could be an interesting thing to try out. Since I've started with Scheme, functional programming has seemed so much less bastardized, now that I've been given a proper introduction to it.

Clojure has been something on my list ever since. :D
Was This Post Helpful? 0
  • +
  • -

#3 TriggaMike  Icon User is offline

  • Using up all your 1's and 0's
  • member icon

Reputation: 85
  • View blog
  • Posts: 1,103
  • Joined: 26-September 08

Re: Rich Hickey: Geek of the Week

Posted 06 March 2010 - 07:02 PM

Interesting to hear exactly how he developed the idea to develop Closure, and it's core values.
Was This Post Helpful? 0
  • +
  • -

#4 Raynes  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 611
  • View blog
  • Posts: 2,815
  • Joined: 05-January 09

Re: Rich Hickey: Geek of the Week

Posted 06 March 2010 - 07:54 PM

View PostLocke, on 06 March 2010 - 12:28 PM, said:

I think this could prompt some interesting discussion.

Featured. :)

In my opinion, porting Clojure over to the .NET Framework could be an interesting thing to try out. Since I've started with Scheme, functional programming has seemed so much less bastardized, now that I've been given a proper introduction to it.

Clojure has been something on my list ever since. :D


ClojureCLR has been around for a long time, actually. I'm not sure why they acted like it was a new thing. Maybe the .NET port is catching up with the main implementation?

Rich doesn't work on ClojureCLR, but works on the JVM implementation full time. I forget who maintains ClojureCLR. Activity in Clojure-world is primarily directed towards writing the Clojure compiler in Clojure, or "Clojure in Clojure", or cinc these days. Some of the heavy lifting towards that direction has already been done with the recent inclusions of deftype, defprotocol, and reify to the Clojure toolbox
Was This Post Helpful? 0
  • +
  • -

#5 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4316
  • View blog
  • Posts: 12,096
  • Joined: 18-April 07

Re: Rich Hickey: Geek of the Week

Posted 07 March 2010 - 06:44 PM

Ok I am sorry and don't mean to be too harsh towards Rich, but it is languages just like this which is going the opposite direction to where we need to go with programming languages. From what I have seen of Clojure, it is just another one of those languages that fall into the category of "small, compact but a excessively cryptic". We should be moving towards languages that are easily readable, maintainable and really doesn't need to be something overly abusing shorthand. I want to see "print" not "prn". I mean do we really need things like "doseq"?

(doseq [ item '((1 2) [3 4] "D")] (prn item))... I mean seriously. To see you are looping through a sequence of values should not be so cut down that it looks garbled. There are a dozen languages out there these days that do this and they all have so specialized niches that they become a waste of time for everyone to learn and use.

Again, no disrespect to Rich and his efforts. I just think that we need to focus on getting code to flow, be readable, not bloated and expressive (but not overly expressive).

:rolleyes2:
Was This Post Helpful? 0
  • +
  • -

#6 Raynes  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 611
  • View blog
  • Posts: 2,815
  • Joined: 05-January 09

Re: Rich Hickey: Geek of the Week

Posted 07 March 2010 - 07:10 PM

One of the focuses of Clojure /is/ readable code. Clojure even throws away some of the unnecessary uses of parentheses in place of square brackets and such. Clojure is easy to read after you've used it for a while, but I understand how people coming from other languages to a Lisp can find it cryptic and unreadable. I ensure you that with a decent editor and a couple of weeks of experience, those parentheses disappear.

I'll point out that your example can be (and most of the time, will be) written like this: (doseq [item ['(1 2) [3 4] "D"]] (println item)).

Doseq is basically just a 'for' loop on steroids. I'm not sure what your beef with it is at this point. Clojure also uses more readable names in place of the cryptic ones other Lisps tend to use. I'm not sure why you used 'prn' over 'println' in your example, and I'm definitely not sure what's so 'unreadable' about it.

I'm not sure how much time you've spent with Clojure or Lisp in general, but I encourage you to spend a little more time with it. I think you might just change your mind.

This post has been edited by Raynes: 07 March 2010 - 07:28 PM

Was This Post Helpful? 1
  • +
  • -

#7 programble  Icon User is offline

  • (cons :dic :head)

Reputation: 49
  • View blog
  • Posts: 1,315
  • Joined: 21-February 09

Re: Rich Hickey: Geek of the Week

Posted 08 March 2010 - 02:31 PM

You seem to be confusing the words "cryptic" and "unfamiliar".

doseq is like a for loop. But what if you had started in Clojure and then got to C and said "wtf is this for thing?". The problem here is that you have not taken the time to familiarize yourself with the language as you have with C.
Was This Post Helpful? 1
  • +
  • -

#8 Raynes  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 611
  • View blog
  • Posts: 2,815
  • Joined: 05-January 09

Re: Rich Hickey: Geek of the Week

Posted 09 March 2010 - 12:38 AM

View PostMartyr2, on 07 March 2010 - 05:44 PM, said:

Ok I am sorry and don't mean to be too harsh towards Rich, but it is languages just like this which is going the opposite direction to where we need to go with programming languages. From what I have seen of Clojure, it is just another one of those languages that fall into the category of "small, compact but a excessively cryptic". We should be moving towards languages that are easily readable, maintainable and really doesn't need to be something overly abusing shorthand. I want to see "print" not "prn". I mean do we really need things like "doseq"?

(doseq [ item '((1 2) [3 4] "D")] (prn item))... I mean seriously. To see you are looping through a sequence of values should not be so cut down that it looks garbled. There are a dozen languages out there these days that do this and they all have so specialized niches that they become a waste of time for everyone to learn and use.

Again, no disrespect to Rich and his efforts. I just think that we need to focus on getting code to flow, be readable, not bloated and expressive (but not overly expressive).

:rolleyes2:


I'd like to make one final post to express my feelings about your post, and where I fall as far as opinions go.

Clojure is not going in the direction opposite of where we need to go. Though you definitely have the right to think so, in my experience, the majority of people who have come into contact with Clojure, tried it out, or even just read about it, strongly disagree. At least two or three hundred people come to mind that would disagree in a poll. Albeit people who use Clojure and love it.

Clojure makes a huge step towards the future, and it's goals reflect that it is indeed a language for the future. With it's powerful support for concurrency, polymorphism, and functional programming, Clojure goes where no language (or Lisp dialect) has gone before. Clojure doesn't cure cancer, and it's not the only player in the game, but it's certainly a viable competitor.

Rich has been very explicit about why he chose to make Clojure a Lisp, and I believe he's iterated that rationale in quite a few presentations and videos. There are many benefits to being a Lisp, and few bad consequences. There is really only one bad consequence to Clojure being a Lisp that I've heard people complain about (if there are more, please correct me), and that is the parentheses. I could tell you that the power of Lisp comes from the s-expressions, but I feel it would fall on deaf ears. Few people quite understand 'said' power and how useful it is without actually using a Lisp for a while. I'll point you to this article: http://www.defmacro....lings/lisp.html

Clojure is not an old fashioned Lisp like Common Lisp. It tries to take the good things from CL and Scheme but throw the bad things way. One of your primary arguments makes absolutely no sense to me, and that is garbled names. Clojure doesn't take the horrible names from CL or Scheme. There is no car or cdr or any other unreadable non-sense Common Lispers hold dear. Where are these (commonly) used names that are problematic? Much effort was put into good naming in Clojure, and there have been many mailing list discussions where the community helped to choose names for certain functions. I'm going to need a few examples.

Quote

(doseq [ item '((1 2) [3 4] "D")] (prn item))... I mean seriously. To see you are looping through a sequence of values should not be so cut down that it looks garbled. There are a dozen languages out there these days that do this and they all have so specialized niches that they become a waste of time for everyone to learn and use.


I showed in my previous post that that example looks like it was made to purposely be confusing. The naming is obvious and makes sense to any person familiar with Clojure. Macros that produce side effects are typically named with a 'do' in them because they 'do' things that 'do' side effects and don't necessarily return a meaningful value. Now, if it looks small and garbled, how about this?
(doseq [item '[(1 2) [3 4] "D"]] 
  (println item))


Body is on a second line, prn wasn't doing anything special here so I replaced it with println (which is a completely different function, as prn is a special-case function). You could go a step further and put the actual sequence you want to iterate through in a variable, you could put each element on a different line, or you could show me an example that makes sense rather than one where you're printing a list literal, a vector literal, and a string literal on separate lines. :P

How much time have you spent with Clojure? Have you done any reading about it? Seen what it's accomplished so far, and what it wants to accomplish? It looks to me that you've seen some horrible code or something, or you believe that any language that doesn't look like C or VB.NET is inherently bad. Maybe Lisp is not for everybody, but I do encourage you to spend some more time with Clojure before you make your final judgment on the language, because you might just be surprised at how much you enjoy coding in this 'cryptic' little language.

Finally, I'd like to point out that Clojure does part ways with mainstream languages, as all Lisps tend to do. It's syntax is not something most people are used to, but does that really make it bad? It allows for a powerful macro system and a simple syntax that anybody can learn, and s-expressions were actually chosen over adding syntax to Lisp, as was originally planned. Clojure is not trying to be every other language over again, which is why Clojure isn't a Common Lisp or Scheme implementation. Clojure is something new and something unfamiliar to most people. Unfamiliar things aren't always bad, and because it's unfamiliar and because you've apparently seen or written a few bad examples, doesn't mean the language is cryptic and useless. Just as hundreds of VB users are perfectly willing to testify that it is indeed not a bad language when a person heartily insults the language, there are hundreds of Clojure users and admirers who are willing to testify that you've got it all wrong.

<3
Was This Post Helpful? 0
  • +
  • -

#9 Locke  Icon User is offline

  • Sarcasm Extraordinaire!
  • member icon

Reputation: 520
  • View blog
  • Posts: 5,596
  • Joined: 20-March 08

Re: Rich Hickey: Geek of the Week

Posted 09 March 2010 - 11:42 AM

View PostRaynes, on 09 March 2010 - 01:38 AM, said:

Clojure doesn't take the horrible names from CL or Scheme.


It may not take them, but apparently it makes its own. WTF is doseq supposed to stand for? Do sequence? Dos Equis (lol)? That's clear compared to saying for? (as in, for this value to this value.)

Not to dis on Clojure, but the fact that you're saying it's clear isn't very clear. ;)

Just from me reading over the example that Martyr2 posted and the way you modified it...it looks like a for each loop. As in:

for each item in '[(1 2) [3 4] "D"], do this with it.

AMIRITE? :D
Was This Post Helpful? 0
  • +
  • -

#10 Raynes  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 611
  • View blog
  • Posts: 2,815
  • Joined: 05-January 09

Re: Rich Hickey: Geek of the Week

Posted 09 March 2010 - 11:47 AM

Clojure uses 'for' for the more commonly used list comprehensions. Like I said, macros that produce side effects are typically named with a 'do' in them. The name is reasonably clear to Clojure users, but I don't think anyone will argue that doseq is probably an unfortunate name. Does it really matter that much?

It pretty much /is/ a foreach loop. But it isn't named as so because it's not a traditional foreach loop, and it takes the Scala route by using 'for' for list comprehensions

Also, to be a smartass: (defmacro foreach [args body] `(doseq ~args ~body))

:D

This post has been edited by Raynes: 09 March 2010 - 11:57 AM

Was This Post Helpful? 0
  • +
  • -

#11 Locke  Icon User is offline

  • Sarcasm Extraordinaire!
  • member icon

Reputation: 520
  • View blog
  • Posts: 5,596
  • Joined: 20-March 08

Re: Rich Hickey: Geek of the Week

Posted 09 March 2010 - 11:53 AM

View PostRaynes, on 09 March 2010 - 12:47 PM, said:

I don't think anyone will argue that doseq is probably an unfortunate name. Does it really matter that much?


It does when we're discussing clarity and abstract names. :D
Was This Post Helpful? 0
  • +
  • -

#12 Raynes  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 611
  • View blog
  • Posts: 2,815
  • Joined: 05-January 09

Re: Rich Hickey: Geek of the Week

Posted 09 March 2010 - 12:09 PM

Quote

<Raynes> Why was doseq named doseq?
<hiredman> chouser: neat
<chouser> but by using :inline instead of a macro, they can transparenly fall back to the slower code and so users can still map, apply, etc. as needed.
* i_am_the_marfle1 (~alson@adsl-75-18-169-129.dsl.pltn13.sbcglobal.net) has left #clojure
<hiredman> Raynes: it does stuff to a seq
<chouser> I'd be happy to have it renamed to something like dofor
<rads> chouser: would you say it's in the same category as transients? something you don't use until you need the performance?
<Raynes> I'm in a bit of an argument with a couple of people who are saying Clojure has unclear naming and are using that as an example.
<chouser> rads: definitely
<Raynes> I'm not sure I can really argue with them on this bit.
<chouser> Raynes: 'do' takes a block of code and does it wonce
<chouser> once
<chouser> 'doseq' takes a block of code and does it once for each item in the seq
* alson_kemp (~alson@adsl-75-18-169-129.dsl.pltn13.sbcglobal.net) has joined #clojure
<technomancy> "do" also indicates side-effects
<technomancy> though I agree "dofor" might be clearer
<stuartsierra> But "do" doesn't support all the extra options of "for"
* dulanov has quit (Quit: dulanov)
<hiredman> if that is their only example, they are just arguing with you for arguments sake, since any language you care to name as an odd name or two
<stuartsierra> alson_kemp: *parts* of it are stable, most aren't
<brandonw> dofor would only be clearer if you come from a background with heavy use of for loops
<brandonw> it is externally consistent but not internally
* sthuebner (~sthuebner@p54BDFFAE.dip.t-dialin.net) has joined #clojure
<brandonw> you can't say dofor 'does something to a for loop'
<brandonw> it would have to be just called 'for'
<chouser> doseq supports a minilanguage nearly identical to for, so having them named similarly would be good I think


This is the take of the Clojure community. This is the rationale. As you can see, a few people (including Chris Houser, one of Clojures most active contributors) think that 'dofor' might be a better choice. If enough people think that, chances are, it will be renamed.

EDIT: Written after the fact, something relevant:

Quote

<brandonw> i'm still not sure there is even a problem. i came from a background in procedural oop and heavy use of for, and doseq made sense when i first read it
<brandonw> i read about the do function first, then read the name of the doseq function, and it was pretty clear what it did

This post has been edited by Raynes: 09 March 2010 - 12:16 PM

Was This Post Helpful? 0
  • +
  • -

#13 Locke  Icon User is offline

  • Sarcasm Extraordinaire!
  • member icon

Reputation: 520
  • View blog
  • Posts: 5,596
  • Joined: 20-March 08

Re: Rich Hickey: Geek of the Week

Posted 09 March 2010 - 12:31 PM

Let me redefine my point, then...

View PostRaynes, on 07 March 2010 - 08:10 PM, said:

One of the focuses of Clojure /is/ readable code.


If it's using abstract names for commands/structures comparable to commands/structures in other languages just to be different, then there's no point.

The issue with your quote right there is not whether Clojure-experienced people can read the code. That's a freaking no-brainer. It's readable...but readable implies understandable, as if it's not understandable, then why read it? It's understandable for someone with ample amount of programming experience, I suppose. But that falls through with people that are experienced, but not quite enough.
Was This Post Helpful? 0
  • +
  • -

#14 Raynes  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 611
  • View blog
  • Posts: 2,815
  • Joined: 05-January 09

Re: Rich Hickey: Geek of the Week

Posted 09 March 2010 - 12:49 PM

View PostLocke, on 09 March 2010 - 11:31 AM, said:

Let me redefine my point, then...

View PostRaynes, on 07 March 2010 - 08:10 PM, said:

One of the focuses of Clojure /is/ readable code.


If it's using abstract names for commands/structures comparable to commands/structures in other languages just to be different, then there's no point.

The issue with your quote right there is not whether Clojure-experienced people can read the code. That's a freaking no-brainer. It's readable...but readable implies understandable, as if it's not understandable, then why read it? It's understandable for someone with ample amount of programming experience, I suppose. But that falls through with people that are experienced, but not quite enough.


Well, the Clojure community just gave you the rationale for it's naming. The naming isn't that far off from what another functional language would do. They didn't use 'doseq' to be different, they used it because it seemed to make the most sense in that particular situation with 'for' already being used for list comprehensions. 'doseq' could be easily renamed to 'dofor', but it would be inconsistent with some of the other side-effecty macros, but if enough people are happy with it, it can be renamed.

The point that /I/ was trying to make is exactly this

View PostRaynes, on 07 March 2010 - 08:10 PM, said:

One of the focuses of Clojure /is/ readable code.
The Clojure community wants sane names, so any name being used is open to debate and will change, if for a very very good reason. It's not just 'one' person who chooses these names, it's an entire community of people.

Some Clojure code speaks for itself and is absolutely readable to the uninitiated. People who don't know Clojure or a Lisp and are just glancing at some code may not immediately be able to understand it, but such is the nature of a Lisp. When I first started programming, I couldn't understand what any code in any language was doing, and I still have trouble figuring out Java code sometimes. But I don't know Java. And a lot of people don't know a Lisp.

I'm not sure how anybody could expect a language to be readable to the point that any random programmer could instantly understand code written in that language, despite complexity. You don't have to be an expert to learn Clojure, and the purpose of code you don't understand can usually be revealed with a simple (doc name-of-var) in the REPL.

This post has been edited by Raynes: 09 March 2010 - 04:38 PM

Was This Post Helpful? 0
  • +
  • -

#15 programble  Icon User is offline

  • (cons :dic :head)

Reputation: 49
  • View blog
  • Posts: 1,315
  • Joined: 21-February 09

Re: Rich Hickey: Geek of the Week

Posted 09 March 2010 - 04:27 PM

What does for mean? It sounds to me like it is doing something for someone or for something?
Hm, doseq... Is it doing something with a sequence?

Also, about the parentheses...
void foo(int bar)
{
    printf("baz %d\n", bar);
}


If you count the braces as parens,
Paren count = 6
(defn foo [bar]
  (printf "baz %d\n" bar))


Counting brackets as parens,
Paren count = 6
There is also less other punctuation, like no ; and ,, so subtract 2, that gives you 4.

This post has been edited by programble: 09 March 2010 - 04:28 PM

Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2