Hacker News Comments on
Persistent Data Structures and Managed References
Rich Hickey
·
InfoQ
·
38
HN points
·
14
HN comments
- This course is unranked · view top recommended courses
Hacker News Stories and Comments
All the comments and stories posted to Hacker News that reference this video.Immutable data does not necessitate copying the entire structure when it is shared or changed. I encourage you to take a look at persistent data structures[0]. Okasaki's "Purely Functional Data Structures"[1] is a good resource if you'd like to look at this in more depth. Rich Hickey's talk about the implementation of persistent data structures in Clojure is also a nice introduction[2].[0]: https://en.wikipedia.org/wiki/Persistent_data_structure
[1]: http://www.cs.cmu.edu/~rwh/theses/okasaki.pdf
[2]: https://www.infoq.com/presentations/Value-Identity-State-Ric...
⬐ 3chelonOnly skim-read so far but that's interesting stuff. I had no idea FP data structures were implemented like this: I consider myself duly educated, thanks!
Aren't these the same ideas that Rich Hickey has been talking about since his seminal 2009 talk about values, identity and state? http://www.infoq.com/presentations/Value-Identity-State-Rich...Joe Armstrong's proposal seems to boil down to this:
- Identities as UUIDs
- State as the payload of UUID URIs
- Values as SHA-1 URIs
Fast persistent data structures, combined with the idea of "reference types" that encapsulate mutation points when you really need them.http://www.infoq.com/presentations/Value-Identity-State-Rich...
So yes in Om there is a single mutable point which then points to the current immutable tree to be used for rendering.
This is very fast. Clojurescript performance is not a bottleneck, most of the time is spent within React.
It makes a lot of sense in the context of programming when you look at the big picture. I think Rich Hickey articulates it best: http://www.infoq.com/presentations/Value-Identity-State-Rich...
Well, I'm used to developing multi-MLOC projects in large teams; they don't switch a language so easily...As for Clojure, I mean this: http://www.infoq.com/presentations/Value-Identity-State-Rich... (basically: immutability, controlled state transitions via agents/atomic/STM)
Summary of the links shared here:http://blip.tv/clojure/michael-fogus-the-macronomicon-597023...
http://blog.fogus.me/2011/11/15/the-macronomicon-slides/
http://boingboing.net/2011/12/28/linguistics-turing-complete...
http://businessofsoftware.org/2010/06/don-norman-at-business...
http://channel9.msdn.com/Events/GoingNative/GoingNative-2012...
http://channel9.msdn.com/Shows/Going+Deep/Expert-to-Expert-R...
http://en.wikipedia.org/wiki/Leonard_Susskind
http://en.wikipedia.org/wiki/Sketchpad
http://en.wikipedia.org/wiki/The_Mother_of_All_Demos
http://io9.com/watch-a-series-of-seven-brilliant-lectures-by...
https://github.com/PharkMillups/killer-talks
http://skillsmatter.com/podcast/java-jee/radical-simplicity/...
http://stufftohelpyouout.blogspot.com/2009/07/great-talk-on-...
https://www.destroyallsoftware.com/talks/wat
https://www.youtube.com/watch?v=0JXhJyTo5V8
https://www.youtube.com/watch?v=0SARbwvhupQ
https://www.youtube.com/watch?v=3kEfedtQVOY
https://www.youtube.com/watch?v=bx3KuE7UjGA
https://www.youtube.com/watch?v=EGeN2IC7N0Q
https://www.youtube.com/watch?v=o9pEzgHorH0
https://www.youtube.com/watch?v=oKg1hTOQXoY
https://www.youtube.com/watch?v=RlkCdM_f3p4
https://www.youtube.com/watch?v=TgmA48fILq8
https://www.youtube.com/watch?v=yL_-1d9OSdk
https://www.youtube.com/watch?v=ZTC_RxWN_xo
http://vpri.org/html/writings.php
http://www.confreaks.com/videos/1071-cascadiaruby2012-therap...
http://www.confreaks.com/videos/759-rubymidwest2011-keynote-...
http://www.dailymotion.com/video/xf88b5_jean-pierre-serre-wr...
http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hic...
http://www.infoq.com/presentations/click-crash-course-modern...
http://www.infoq.com/presentations/miniKanren
http://www.infoq.com/presentations/Simple-Made-Easy
http://www.infoq.com/presentations/Thinking-Parallel-Program...
http://www.infoq.com/presentations/Value-Identity-State-Rich...
http://www.infoq.com/presentations/We-Really-Dont-Know-How-T...
http://www.slideshare.net/fogus/the-macronomicon-10171952
http://www.slideshare.net/sriprasanna/introduction-to-cluste...
http://www.tele-task.de/archive/lecture/overview/5819/
http://www.tele-task.de/archive/video/flash/14029/
http://www.w3.org/DesignIssues/Principles.html
http://www.youtube.com/watch?v=4LG-RtcSYUQ
http://www.youtube.com/watch?v=4XpnKHJAok8
http://www.youtube.com/watch?v=5WXYw4J4QOU
http://www.youtube.com/watch?v=a1zDuOPkMSw
http://www.youtube.com/watch?v=aAb7hSCtvGw
http://www.youtube.com/watch?v=agw-wlHGi0E
http://www.youtube.com/watch?v=_ahvzDzKdB0
http://www.youtube.com/watch?v=at7viw2KXak
http://www.youtube.com/watch?v=bx3KuE7UjGA
http://www.youtube.com/watch?v=cidchWg74Y4
http://www.youtube.com/watch?v=EjaGktVQdNg
http://www.youtube.com/watch?v=et8xNAc2ic8
http://www.youtube.com/watch?v=hQVTIJBZook
http://www.youtube.com/watch?v=HxaD_trXwRE
http://www.youtube.com/watch?v=j3mhkYbznBk
http://www.youtube.com/watch?v=KTJs-0EInW8
http://www.youtube.com/watch?v=kXEgk1Hdze0
http://www.youtube.com/watch?v=M7kEpw1tn50
http://www.youtube.com/watch?v=mOZqRJzE8xg
http://www.youtube.com/watch?v=neI_Pj558CY
http://www.youtube.com/watch?v=nG66hIhUdEU
http://www.youtube.com/watch?v=NGFhc8R_uO4
http://www.youtube.com/watch?v=Nii1n8PYLrc
http://www.youtube.com/watch?v=NP9AIUT9nos
http://www.youtube.com/watch?v=OB-bdWKwXsU&playnext=...
http://www.youtube.com/watch?v=oCZMoY3q2uM
http://www.youtube.com/watch?v=oKg1hTOQXoY
http://www.youtube.com/watch?v=Own-89vxYF8
http://www.youtube.com/watch?v=PUv66718DII
http://www.youtube.com/watch?v=qlzM3zcd-lk
http://www.youtube.com/watch?v=tx082gDwGcM
http://www.youtube.com/watch?v=v7nfN4bOOQI
http://www.youtube.com/watch?v=Vt8jyPqsmxE
http://www.youtube.com/watch?v=vUf75_MlOnw
http://www.youtube.com/watch?v=yJDv-zdhzMY
http://www.youtube.com/watch?v=yjPBkvYh-ss
http://www.youtube.com/watch?v=YX3iRjKj7C0
http://www.youtube.com/watch?v=ZAf9HK16F-A
⬐ ricardobeatAnd here are them with titles + thumbnails:⬐ waqas-how awesome are you? thanks⬐ ExpezThank you so much for this!⬐ X4This is cool :) Btw. the first link was somehow (re)moved. The blip.tv link is now: http://www.youtube.com/watch?v=0JXhJyTo5V8
I agree – anything from Rich Hickey. Especially "Persistent Data Structures"[1] and "Are We There Yet?"[2].Though related to Clojure, they make you think about development in different ways.
[1]: http://www.infoq.com/presentations/Value-Identity-State-Rich...
[2]: http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hic...
⬐ adams601'Simple Made Easy'[1] is one of my favorite Hickey talks.
One of Clojure's main selling points is that its vectors, maps and sets are persistent data structures with near-constant time operations (log32N).http://www.infoq.com/presentations/Value-Identity-State-Rich...
This is basically a desciption of Clojure, in particular:- Explicit model of time (http://www.infoq.com/presentations/Value-Identity-State-Rich...) - Homoiconic / Extensible syntax (shared by most Lisps) - Math-oriented numeric types (Clojure maths is arbitrary precision by default, and it has nice things like rational types) - Immutable (Clojure data structures are all immutable) - Garbage collection (inherited from the JVM) - String manipulation (Regular expressions are a built-in type)
Most of the other features actually seem more like libraries than language features, but given that Clojure can access the entire Java ecosystem I think you can do all of it from Clojure with relatively little pain.
⬐ jsankeyClojure is awesome, but does struggle on the "Good error messages" requirement, which is a problem when you're starting out.⬐ michaelochurchI find it interesting that two of the most exciting languages that exist right now are built on top of the VM for one of the worst ones.⬐ jsankeyThe strength of Java for many years has been the platform, and indeed the surrounding ecosystem, not the language. In that sense it's no surprise that there is a lot of effort going in to providing better languages on that platform.⬐ exDM69The reason I'm not using Clojure is that it's based on the Java platform. I keep hearing that JVM is nice because there are good libraries, but I haven't figured out what the good libraries are. Sure, there are some nice platform independent abstractions for common operating system interfaces like file and network I/O, but it still lacks lots of stuff.The problem with Java libraries w.r.t. modern high level languages is that Java libraries are built on Java abstractions. It doesn't matter how high level the new language is, but when interfacing with Java libs, you have to stick to single dispatch object oriented programming. So in the end, there are many cases where you use the Java library through some wrapper layer written in Clojure or your Clojure code ends up looking a lot like Java.
Once you add a wrapper layer shim between your preferred language and the platform, it doesn't matter what's underneath. That's why I like to stick to languages that are built on native code and libraries, C and Posix and Unix API's with some Linux and/or BSD additions. Of course, if you want to run on Windows, all the code has to be duplicated since Win API's are different.
I don't know about 15-30 minutes, but for anyone interested in learning Clojure, I have collected these links that I found interesting:http://www.youtube.com/watch?v=Aoeav_T1ARU
http://blip.tv/clojure/clojure-for-java-programmers-1-of-2-9...
http://www.ibm.com/developerworks/podcast/ag/gloverseries-ha...
http://www.infoq.com/presentations/Value-Identity-State-Rich...
http://clojure.blip.tv/file/4824610/
http://clojure.blip.tv/file/4457042/
http://www.infoq.com/presentations/Clojure-in-the-Field
Visit them roughly in order.
As for books, there are a few good ones, but I acutally recommend the documentation on clojure.org more than any book. It's clear and compact.
The talk of Rich Hickey (Clojure) on Persistent Data Structures and Managed References gives a very interesting view on programming in general.http://www.infoq.com/presentations/Value-Identity-State-Rich...
Last year Rich gave a great talk about Clojure's approach to persistent data structures (but really identity and state): http://www.infoq.com/presentations/Value-Identity-State-Rich...
⬐ jemfinchEveryone should watch that talk. It's the most compelling I've yet seen for the relevance of applicative programming. I was not convinced, but I was closer than I've ever been to being convinced.
> Java is pass-by-reference. Pass in object foo, call smash_with_hammer on foo in the called function, and the caller finds that his foo was smashed by a hammer when control returns to himIn agreement here, the state of the object changes according to a message passed to the object. In this case, the value we passed is a pointer to the object. We can't, however, change what object the pointer points to in Java, which is why I call it "pass by value". E.g., I can't do equiv of this Perl code.
sub bar { my $foo = Foo->new(a => "a"); foo(\$foo); }
sub foo { my $arg = shift; $$arg = Foo->new(a => "b"); }
On the other hand, in Perl even though I am passing a reference by value, I can still mutate the state of the object:
sub bar { my $foo = Foo->new(a => "a"); bar($foo); }
sub foo { my $foo = shift; $foo->set_a("b"); }
(Please excuse my Perl, I haven't written OO Perl in over a year now).
In any case, I think this is a pedantic point. Both of us agree that other than in few cases (algorithms/data structures that are difficult to express in a functional way), objects shouldn't be smashed by hammers: whether internal or external.
I also don't understand why Java's standard library authors didn't do what Scala did and provide both mutable and immutable versions of collections. Java 5+ added great lock free data, concurrent data structures, but much like they have a ConcurrentMap, they could have added a "ImmutableMap"/"ImmutableList" interfaces (especially given the fact that some data structures e.g., CopyOnWriteArrayList behave like this internally). I really like Scala's "functional objects": objects that upon receiving a messages, create new objects. In Java, an object may be final, but it will still (as you put it) "be smashed by a hammer" as long as the hammer smashing was invoked by a message. Same thing happens in C++ with const methods, in objects passed as const& references which contain objects that mutate their state upon a message being passed. Rich Hickey discusses this much better than I do in his famous talk: http://www.infoq.com/presentations/Value-Identity-State-Rich... (although I may not agree with all of his conclusions)
> seems like everything useful takes a StringBuffer instead of a String
That's a textbook example of premature optimization :-) The compiler will convert string concatenation to StringBuilder. See: https://gist.github.com/670577 It does makes sense to use a StringBuilder when you are doing concatenation inside a loop (and don't want the overhead of allocating a new StringBuilder inside), but otherwise there's no advantage to it.
(Oddly enough, in this example the default optimization level did not unroll the loop itself. OCaml, on the other hand, despite having a much more compiler-friendly type system than Java, doesn't perform the equivalent optimization on string concatenations with the '^' operator. I am pretty sure g++ will do both, despite C++ being lower-level and having weaker typing than OCaml and Java).
For another example of this kind of premature optimization, see people using inline in C++ code when the gcc/clang will have a much better idea than the developer on when to inline a function call and when not to :-)
Here's a very quick dump of some things waiting to be read/digested/whatever in my Firefox tabs and other notes:Learning Clojure:
The best concise intro I've come across: http://en.wikibooks.org/wiki/Learning_Clojure
You can't go wrong starting with the introductory stuff on the site: http://clojure.org/rationale
This looks like a good longer intro, but I haven't more than glanced at it: http://java.ociweb.com/mark/clojure/article.html
A longer Wikibook: http://en.wikibooks.org/wiki/Clojure_Programming
Monad tutorial (site currently broken): http://onclojure.com/2009/03/05/a-monad-tutorial-for-clojure...
And there's one Clojure v 1.0 book out, only $20 for the ebook version: http://www.pragprog.com/titles/shcloj/programming-clojure
(Note that a whole lot of learning material assumes you're coming from a Java background ... which I'm not (in fact, I learned MACLISP before C and never had a chance to go beyond C++ to C# or Java).)
Setting up your EMACS Clojure development environment (VIM and various IDEs are also supported): http://incanter-blog.org/2009/12/20/getting-started/ and http://lisp-book.org/contents/ch18.html
And there are a bunch of videos, Rich Hickey does them well; note that most of the quotes below are from someone else that I then cut and pasted into my TODO file for future reference:
Clojure for Lisp Programmers Part 1 of 2: http://blip.tv/file/1313398
Part 1 of a presentation by Rich Hickey at the Boston Lisp meeting. A fairly extensive introduction to Clojure, with a presumption of prior knowledge of Lisp. Transcript available at: http://clojure.googlegroups.com/web/clojure-for-lispers-tran...
Clojure for Java Programmers - 1 of 2: http://blip.tv/file/982823
Part 1 of a presentation by Rich Hickey to the NYC Java Study Group. A gentle introduction to Clojure, part 1 focuses on reader syntax, core data structures, code-as-data, evaluation, special operators, functions, macros and sequences. No prior exposure to Lisp is presumed.
Persistent Data Structures and Managed References: http://www.infoq.com/presentations/Value-Identity-State-Rich... (very good).
Clojure Concurrency: http://blip.tv/file/812787
A presentation by Rich Hickey to the Western Mass. Developers Group on Clojure and concurrency. Brief overview of Clojure, discussion of concurrency issues, locking, and immutabiity. In-depth look at Clojure's refs, transactions and agents. Demonstration and review of code for a multithreaded ant colony simulation.
Clojure Sequences: http://blip.tv/file/734409
An informal introductory talk/screencast covering Clojure's sequences by Rich Hickey, the author of Clojure. Covers the motivation behind sequences, their relationship to cons, iterators/enumerators and collections, the sequence library, and laziness.
Clojure Data Structures - Part 1: http://blip.tv/file/707974
Part 1 of an informal introductory talk/screencast covering Clojure's data structures by Rich Hickey, the author of Clojure. Covers numbers, symbols, keywords, lists, vectors and maps.
At the 2008 JVM Language Summit he gave a talk, at the 2009 a keynote, "Are We There Yet?": http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hic...
Check Infoq for other items as well.
The Full Disclojure videos have helped [ the author if this note ] understand some of the features new to clojure in 1.1: http://www.vimeo.com/channels/fulldisclojure
⬐ alttabHoly crap thank you.⬐ evangineerThanks, this should help in figuring out if Clojure is the way forward for me!⬐ jacquesmI've bookmarked your comment, thanks a ton.