TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Immutable Data Collections for Javascript

204 点作者 gagan2020将近 11 年前

15 条评论

leebyron将近 11 年前
Hey, I'm the author of this library. It's definitely inspired by mori (and clojure and Haskell) and the reason I ended up building something different was to present a more JavaScript friendly API (and academically, to learn about HAMT). I've built this over the last couple weeks, and we are not using it internally yet - but I wanted to ensure development of it happened in public.
评论 #8111090 未加载
评论 #8110031 未加载
评论 #8108806 未加载
评论 #8118513 未加载
评论 #8109451 未加载
评论 #8108984 未加载
falava将近 11 年前
There is also Mori[1], a JavaScript API for using ClojureScript&#x27;s persistent data structures:<p><pre><code> [1] http:&#x2F;&#x2F;swannodette.github.io&#x2F;mori&#x2F;</code></pre>
评论 #8108265 未加载
评论 #8108108 未加载
评论 #8108396 未加载
评论 #8108974 未加载
abaco将近 11 年前
Bit confused (ignorant actually) here. Can someone give a &#x27;real world&#x27; example of the benefits of immutabile objects in js?
评论 #8108394 未加载
评论 #8108553 未加载
评论 #8108038 未加载
dreamdu5t将近 11 年前
The original npm package &quot;immutable&quot; was <a href="https://github.com/hughfdjackson/immutable" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;hughfdjackson&#x2F;immutable</a> (npm install immutable@1.4)<p>Did Facebook buy the npm name from hughfdjackson, did he give it to them, or did NPM switch ownership?
评论 #8108933 未加载
vineet将近 11 年前
Sounds like more of the pieces of React&#x2F;Flux are being opensourced. :-)<p>Interesting to see references to TypeScript. Is it prevalent at FB?
评论 #8108977 未加载
评论 #8111977 未加载
ScottBurson将近 11 年前
If anyone is interested in functional collections for Common Lisp or Java, have a look at FSet: <a href="http://www.ergy.com/FSet.html" rel="nofollow">http:&#x2F;&#x2F;www.ergy.com&#x2F;FSet.html</a>
derengel将近 11 年前
So you can use the Clojurescript&#x2F;Om&#x2F;Reagent&#x2F;React model without Clojurescript, nice for people who don&#x27;t want or can&#x27;t jump into Clojurescript right now.
jannes将近 11 年前
I wish the README would tell us a little bit more about how to use it in conjunction with React. Especially the logic for shouldComponentUpdate() would be interesting.
评论 #8108255 未加载
Kiro将近 11 年前
I don&#x27;t understand this whole immutable thing... Why not just avoid changing the data once created? Why do you need a library?
评论 #8109051 未加载
评论 #8109078 未加载
Strilanc将近 11 年前
I have to admit, I find it odd that we name immutable data structures based on what they don&#x27;t do instead of what they do.<p>Of course, what they do is <i>efficient persistence</i>. You want a snapshot of the data? You want a non-volatile reference? You&#x27;ve already got one! <i>That&#x27;s</i> the feature. They should be called persistent data structures.
评论 #8111645 未加载
评论 #8111668 未加载
评论 #8111484 未加载
colinramsay将近 11 年前
React&#x27;s documentation also discuss their immutability helpers [1]. This new library looks like a better way of implementing this though. Will the documentation be amended to discuss use of immutable-js?<p>[1] <a href="http://facebook.github.io/react/docs/update.html" rel="nofollow">http:&#x2F;&#x2F;facebook.github.io&#x2F;react&#x2F;docs&#x2F;update.html</a>
评论 #8108887 未加载
33a将近 11 年前
Also relevant (and not included in this collection) is the following functional red-black tree implementation:<p><a href="https://github.com/mikolalysenko/functional-red-black-tree" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mikolalysenko&#x2F;functional-red-black-tree</a>
collyw将近 11 年前
Can someone give me a good example of where immutable data structures are better than mutable ones. I know that you are more likely to mess up and have side effects with mutable data structures, but so far all I have heard is theory.
评论 #8113689 未加载
评论 #8113646 未加载
boubiyeah将近 11 年前
What&#x27;s the use of immutable data collections if you have to constantly revert to mutable arrays to render anything? Any gain from the persistent collection is lost in wasteful Array creating (Poor gc)
nawitus将近 11 年前
Hmm, it seems to be written in TypeScript, but the source is only provided in JavaScript.
评论 #8108764 未加载
评论 #8108403 未加载