Fork me on GitHub
#clr
<
2023-02-20
>
Benjamin17:02:24

Jo what is a good way to have clojure (like) references (atoms) and immutable datastructures in a small dotnet project? I am thinking fsharp or clojure clr? I am thinking about copying the clojiure clr code currently

dmiller19:02:26

you could use ClojureCLR as a dependency. You'd need to use either the clojure functions or figure out all the internal interfaces to use the immutable collections. If you know F#, of course, that would be quick. If you are coming from C#, for the immutable collections, there is the System.Collections.Immutable namespace. Do you need something that isn't available there?

Benjamin19:02:40

I have copied Atom.cs and I am using it with System.Collections.Immutable πŸ™‚

Benjamin19:02:06

ah F# would be cool, darn it

dmiller19:02:51

I was going to suggest that if you needed Atom. Did you exchange the whole IFn interface piece needed for swap and watchers for a simple use of delegates?

dmiller19:02:28

I am enjoying F#.

😯 2
Benjamin19:02:34

ah yea I changed it to Func<T, T> (also making everything generic instead of object) (that seemed less surprising for a chsarp code base)

dmiller19:02:03

as one should.πŸ™‚

☺️ 2
dmiller19:02:42

Nice. You'd have to go the extra mile to get nullable back.

πŸ‘€ 2