News for hackers. Stuff that matters.
Re:Carp – A statically typed Lisp, without a GC, for real-ti... by jbjohns on Friday October 15, 2021 @09:45AM (#28877617)
Why would immutability guarantee no cycles? Here is a line of valid haskell:

        star e = let (sp, a) = (Split a e, atom sp) in sp
EDIT: I guess I should probably explain it: star is a function that takes an expression "e" and returns the value "sp" which is "Split a e" where "a" is the results of calling the "atom" function on "sp". This is creating a representation of a regex star operator. Note that the tuple defined in the let definition is only to define a name for the two values of the tuple so that they can refer to each other.
Re:Carp – A statically typed Lisp, without a GC, for real-ti... by JoelMcCracken on Friday October 15, 2021 @01:55PM (#28880796)
I mean generally tying the knot is a useful technique, but I think these scenarios all require/exploit non-strict, which is in itself not really immutable in the sense most people use it.

But yes, such code is often useful so that e.g. a parent xml node can refer to its childen nodes while also children nodes can refer to their parents.

Anyway, I'm not sure about this, but I think you can't have circular data structures in the context of strict evaluation (or can you? maybe by defering execution via anonymous functions? I wonder....)

Re:Carp – A statically typed Lisp, without a GC, for real-ti... by jbjohns on Saturday October 23, 2021 @04:21PM (#28971877)
I'm fairly certain I've done similar things in Ocaml (in fact, I think it's where I learned this technique).