News for hackers. Stuff that matters.
Re:Advanced programming languages by KirinDave on Monday May 24, 2010 @01:45PM (#1375199)
No. All that work predates both, in some cases by several years.

In fact, a good friend of mine is working to put scala bindings over all the clojure data structures so they can be used transparently in scala. They're that good.

Re:Advanced programming languages by Artemidoros on Monday May 24, 2010 @04:00PM (#1375539)
Your friend might be wasting a lot of effort (apart from his personal learning experience), as Phil Bagwell is working on Scala's collection library.
Re:Advanced programming languages by arohner on Monday May 24, 2010 @04:14PM (#1375564)
For context to "outsiders": Bagwell wrote the papers that the Clojure datastructures are based on.
Re:Advanced programming languages by KirinDave on Monday May 24, 2010 @05:56PM (#1375794)
“A lot of effort?”

Wrapping the PersistentMaps took like less than 200 lines of code: http://github.com/codahale/yoink

Re:Advanced programming languages by Artemidoros on Monday May 24, 2010 @07:37PM (#1375976)
Yes, 'a lot' is quite relative. :-)

From my point of view 200 LoC giving me something I already have is a lot. From the point of view of your friend 200 LoC might be a very small price to pay for a good learning experience.

Re:Advanced programming languages by codahale on Monday May 24, 2010 @08:42PM (#1376097)
I invite you to benchmark the two.

I'm also slightly confused as to why you think reusing stable, proven, and reviewed data structure implementations is a "good learning experience" as opposed to being SOP.

Re:Advanced programming languages by Artemidoros on Tuesday May 25, 2010 @02:17AM (#1376686)
scala.collection.immutable is/will not be stable, proven and reviewed?
Re:Advanced programming languages by codahale on Tuesday May 25, 2010 @11:03AM (#1377585)
The hash array mapped trie was committed to trunk 3 months ago and was first released in 2.8.0.RC1 (which no one uses due to various bugs) and is now available in 2.8.0.RC2 (which very few people are using due to binary incompatibility).

In contrast, Clojure's PersistentHashMap dates back to 2007 and was in both the 1.0 and 1.1.0 releases.

Re:Advanced programming languages by Artemidoros on Tuesday May 25, 2010 @12:32PM (#1377834)
Is it unreasonable to expect that Scala's persistent collections will work comparably to Closure's when 2.8 final is released?
Re:Advanced programming languages by codahale on Tuesday May 25, 2010 @04:34PM (#1378510)
That doesn't sound unreasonable, no -- at some point in the future, Scala's hash array mapped trie will be robust and highly optimized. If your plan is to wait until then, you might be able to speed things up by helping them out yourself.

In the meantime, I benchmarked Yoink's PeristentHashMap against 2.8.0.RC2's immutable.HashMap by a) creating a map of 100,000 sequential keys and then removing them all, and b) creating a map of 100,000 random keys and then removing 100,000 random keys. In the first case, Yoink was 20.7041% (±1.83693%) faster. In the second case, Yoink was 24.7834% (±4.17055%) faster. (Student's t distribution, 95% confidence interval, source is in src/test on the GitHub project and I used ministat for the statistical analysis [a cross-platform port of which is also available on my GitHub page].)

So to summarize, I have a provably faster hash array mapped trie at almost zero cost right now because I spent a few hours with a "good learning experience."

Re:Advanced programming languages by Artemidoros on Tuesday May 25, 2010 @08:17PM (#1379099)
I'm not disputing that Clojure's data structures right now are more performant than Scala's or that your project was worthless. I even apologized in case my original post was badly worded.

What I wanted to confer was that, you _might_ have been wasting a lot of effort because I assumed that you might not have been informed about work of the Scala team that has a high likelihood of obsoleting your project in the near future. Obviously you were informed and my notice was inappropriate. Be assured it won't happen again.

If increasing the performance by about 1/4 for your use cases - compared to the current beta - is valuable for you, great! For me it wouldn't have been worth a few hours. 'A good learning experience' would have. But obviously your values are different.

Re:Advanced programming languages by KirinDave on Monday May 24, 2010 @07:48PM (#1376000)
The back of your hand is going to get sore with all those compliments.
Re:Advanced programming languages by Artemidoros on Tuesday May 25, 2010 @10:43AM (#1377534)
I did not have the intention of backhanding you or your friend. If my post had the appearance of doing so, I apologize.

I just wanted to point out the (for me at least) non obvious fact that the mind behind the theory of Clojure's persistent datastructures is working on Scala's collection library and that Scala's hash maps are already backed by hash tries - http://www.scala-lang.org/archives/downloads/distrib/files/n...

Re:Advanced programming languages by KirinDave on Tuesday May 25, 2010 @01:39PM (#1378020)
Good for Scala. When it's ready, people can use that. Until then, there are interim solutions.

And it's pretty neat to see a scala proponent call a scala project a "waste of time." Way to represent for your community, bro.