Re:Functional programming is finally going mainstream
by nyanpasu64 on Wednesday July 13, 2022 @01:43AM
(#32079348)
Does Perceus differ substantially from using https://lib.rs/crates/im and writing code which looks identical to imperative code, but cloning is faster and mutations are slower (and copy internal structures as necessary)?
Re:Functional programming is finally going mainstream
by miloignis on Wednesday July 13, 2022 @02:22AM
(#32079563)
It does the same mutate-if-unique optimization as im, but it does so automatically and more broadly as a part of its optimized reference counting. Perceus can go beyond what im can do by re-using allocations between static types - one of their examples involves doing a tree traversal with O(1) extra space by using a zipper which gets optimized by Perceus into a Morris traversal - and the programmer doesn't have to do anything special to get the benefit! (of course, writing code in such a way that you know it will be optimized has performance benefits if you do know how it works) This sets up this wonderful situation where you can write easier-to-maintain and easier-to-verify-correct algorithms that get optimized into very efficient versions that would be hard to write by hand even in a mutable/imperative language.
Their papers and online docs are very good, I highly recommend them for more information!
Re:Functional programming is finally going mainstream
by pyuser583 on Tuesday July 12, 2022 @06:17PM
(#32076409)
Koka-lang and Roc-lang? What are those?
Re:Functional programming is finally going mainstream
by miloignis on Tuesday July 12, 2022 @06:26PM
(#32076524)
https://koka-lang.github.io/koka/doc/index.html
Both working on making functional programming practical and very fast. Koka is more of a research language, also developing Algebraic Effects and making them practical, which is very cool.
So it seems we can have out cake and eat it too!
[0] - https://www.microsoft.com/en-us/research/uploads/prod/2021/1...