Live data from Hacker News

Purely Functional Data Structures (1996) [pdf]

cs.cmu.edu

21–30 of 98 posts

Re: Purely Functional Data Structures (1996) [pdf]

#21

is this being upvoted onto the homepage based on upvoters actually understanding that this paper from 1996 is of contemporary relevance and interest or more due to keywords like "pure", "functional", "data" and "structure"?

The book is on Amazon, but this submission had those keywords, plus it's a PDF.

Of course it is of contemporary relevance; functional programming (FP) is all the rage.

The tricky bit are questions like

How does this jive with existing JS functional constructs like "fantasy land," for example.

How to "recruit" more folks to FP, or even a hybrid approach of objects interacting functionally

Game jams using more FP-like data structures? Or more HN submissions like that.

The harder things to evaluate are a lot of other topics, news-like but investigative and curious, or sites that are essentially selling a service (versus teaching the mechanism behind it).

For SaaS stuff, since HN is about startups, I have to let it slide. But the hacking piece is when one person accomplishes something with persistent decomposition of sequential problems, or does something clever using tools or ideas from a different context.

Re: Purely Functional Data Structures (1996) [pdf]

#24
post #11

I'm reading this book right now. It's really great so far! I've been working a lot with Trees in Clojure, and have been hitting serious limitations of my understanding. I also found this YouTube video from a Clojure conference that reviews some different strategies for tree traversal in Clojure: https://youtu.be/YgvJqWiyMRY I thought that learning a Functional Lisp would make it really easy to traverse trees, since t…

This has been a topic I've wanted to get into for a few years now, specifically because of Clojure! So if you have any additional recommendations I'd appreciate it.

I really enjoyed Friedman's book `Scheme and the Art of Programming` because it filled in some pieces missing from "The Little Schemer" (and "Seasoned Schemer"). Building stuff like `kons`, `map` and all that `letrec` stuff.

But the big difference between Scheme and Clojure is that in Scheme, while it's "functional by concept," you get to escape with `(set! ...)` whenever you want to have a more traditional ds/algo (like say doing the n queens problem).

In Clojure you can kind of do that by either escaping to Java, using protocols (with atoms), or using transients, but I often feel like there's a "more functional way to do stuff that hasn't been taught to me."

I've opened up either the Okasaki dissertation or book or both, but I've always had trouble reading it, and then sticking with it. And some stuff like looking at Rosetta code and saying "to reverse a linked list in a lisp is easy... because it's a cons cell" seems like cheating. Almost like showing up to an interview, saying your "linked list" is implemented in an array structure and then calling `reverse()` on it.

Will watch that talk from 2014, must not have seen it before.

I guess, conceptually, day to day things in Clojure does feel pretty natural, even easier, and I think I have a decent understanding of it. But then when I look at leetcode type problems, or something more involved, it takes a lot of mental effort to translate to it. Especially things like `big O` gets thrown away in my mental model. I get it, persistent data structures and all that, but there's still a mystery there.

Re: Purely Functional Data Structures (1996) [pdf]

#25

is this being upvoted onto the homepage based on upvoters actually understanding that this paper from 1996 is of contemporary relevance and interest or more due to keywords like "pure", "functional", "data" and "structure"?

The book is on Amazon, but this submission had those keywords, plus it's a PDF. Of course it is of contemporary relevance; functional programming (FP) is all the rage. The tricky bit are questions like How does this jive with existing JS functional constructs like "fantasy land," for example. How to "recruit" more folks to FP, or even a hybrid approach of objects interacting functionally Game jams using more FP-like…

My understanding is that the book is based on this PhD dissertation.

Re: Purely Functional Data Structures (1996) [pdf]

#26
What are software bugs that can be avoided by choosing data structures like these?

I'm making a broad, high-level presentation about immutability in technology. At my company we have folks who have heard of it in the context of ransomware-resilient backups, others who have heard of it in the context of infrastructure as code, and very few who have heard of it in terms of data structures (distributed and non-distributed). My goal is to showcase the concept in various contexts so that people can better understand its role as a key design choice in technology.

Personally I have no experience working on software that utilizes these, so if others here do, I would appreciate your input on how these make your software more reliable.

The emphasis on software reliability and bugs-avoided is because the audience works under the company's risk-management division.

Re: Purely Functional Data Structures (1996) [pdf]

#27
post #22

It would be cool if someone could translate this into Typescript or the like, I think it would make it a lot more readable.

TypeScript is much less readable than Haskell and OCaml, but you can easily find translations to TypeScript such as https://github.com/skeate/lambdata.

Re: Purely Functional Data Structures (1996) [pdf]

#28

Earlier quoted context omitted.

The book is on Amazon, but this submission had those keywords, plus it's a PDF. Of course it is of contemporary relevance; functional programming (FP) is all the rage. The tricky bit are questions like How does this jive with existing JS functional constructs like "fantasy land," for example. How to "recruit" more folks to FP, or even a hybrid approach of objects interacting functionally Game jams using more FP-like…

My understanding is that the book is based on this PhD dissertation.

Oh.. then, yes--this was unabashedly a (positively) triggered reaction (fortunately or unfortunately).

Re: Purely Functional Data Structures (1996) [pdf]

#29
post #22

It would be cool if someone could translate this into Typescript or the like, I think it would make it a lot more readable.

TypeScript is much less readable than Haskell and OCaml, but you can easily find translations to TypeScript such as https://github.com/skeate/lambdata .

> TypeScript is much less readable than Haskell and OCaml

That's like saying that Norwegian is much less readable than Italian. It is in the eye of the beholder. They can both express the same concepts but which one is more readable depends on which one you already know.

Re: Purely Functional Data Structures (1996) [pdf]

#30

What are software bugs that can be avoided by choosing data structures like these? I'm making a broad, high-level presentation about immutability in technology. At my company we have folks who have heard of it in the context of ransomware-resilient backups, others who have heard of it in the context of infrastructure as code, and very few who have heard of it in terms of data structures (distributed and non-distribut…

Purely functional data structures are very common in purely functional languages like Haskell but are also used in non functional languages via libraries like immutable.js.

At a high level, immutability forces you to be extremely deliberate about state changes in your application. This improves reasoning/understanding, reduces bugs, and eases debugging.

An example of immutability that you might be familiar with would be react props/state. You don’t modify your state. This makes reasoning about state much more simple.

Post reply on HN