clr

Benjamin 2023-02-20T17:09:24.363279Z

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

dmiller 2023-02-24T19:02:26.586939Z

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?

Benjamin 2023-02-24T19:03:40.104999Z

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

Benjamin 2023-02-24T19:04:06.056989Z

ah F# would be cool, darn it

dmiller 2023-02-24T19:04:51.857729Z

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?

dmiller 2023-02-24T19:05:28.559219Z

I am enjoying F#.

😯 1
Benjamin 2023-02-24T19:05:34.708189Z

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)

dmiller 2023-02-24T19:07:03.695469Z

as one should.πŸ™‚

☺️ 1
Benjamin 2023-02-24T19:11:49.691369Z

forgot to link the code https://github.com/benjamin-asdf/ClojureAtomRefClr

dmiller 2023-02-24T19:14:42.689019Z

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

πŸ‘€ 1