News for hackers. Stuff that matters.
Re:Clojure core.async and Go: A Code Comparison by nickik on Thursday July 04, 2013 @05:42PM (#5992576)
This is very cool and intressting. I have to think about something to do with core.async.

This is also a good example why macros are just awesome. Go is a language design to work well with goroutins and channels, but the clojure code looks just as good and readable. You could simply not have such idiomatic use of these concepts without macros.

Or am I wrong, can a flexible language like scala or python be extended to look as good for that usecase? I dont know enougth of the tricks scala people use, I cant juge if it is possible.

Re:Clojure core.async and Go: A Code Comparison by voidlogic on Friday July 05, 2013 @01:06AM (#5993517)
>but the clojure code looks just as good and readable.

But don't mistake this for having the same runtime characteristics- For what its worth the Computer Language Benchmarks Game shows Go as generally being faster, using much less memory and less code.

http://benchmarksgame.alioth.debian.org/u64q/benchmark.php?t...

Re:Clojure core.async and Go: A Code Comparison by nickik on Friday July 05, 2013 @04:42AM (#5993961)
That is true. I have not looked at the much of the clojure code and non of the go code but both probebly are written in a very unidiomitic style that one does normally not use.

Also with clojure, the actual timeconsuming calculations can be made with java and that should be at least as fast as go (with a bit more memory).

So all in all I value the architectural things much more then pure speed. Go simply has a diffrent target then Clojure.

Re:Clojure core.async and Go: A Code Comparison by igouy on Friday July 05, 2013 @12:03PM (#5995450)
> I have not looked at the much of the clojure code and non of the go code

:-)

> can be made with java

Would that be idiomatic Clojure? :-)

Re:Clojure core.async and Go: A Code Comparison by nickik on Monday July 08, 2013 @01:44PM (#6007997)
> Would that be idiomatic Clojure? :-)

Yes it would. Clojure is design with that idea in mind, make it connect really closly to java so that you can interop with no overhead.

Re:Clojure core.async and Go: A Code Comparison by erichmond on Friday July 05, 2013 @07:21AM (#5994388)
Agreed on go being faster and using less memory, however, in practice, I think idiomatic clojure would have less code then compared idiomatic go, when writing similar programs.
Re:Clojure core.async and Go: A Code Comparison by igouy on Friday July 05, 2013 @11:54AM (#5995399)
> would have less code

Based on what?

Re:Clojure core.async and Go: A Code Comparison by stuglaser on Thursday July 04, 2013 @08:34PM (#5993017)
I've implemented Go-style channels in Python, and it turned out pretty well. The 'select' statement is a bit verbose, but still pretty readable.

You can find the code here: http://github.com/stuglaser/pychan

And documentation here: https://chan.readthedocs.org/en/latest/