How do you encode Algebraic Data Types in a C#- or Java-like language?
There are some problems which are easily solved by Algebraic Data Types, for example a List type can be very succinctly expressed as:
Matrix Pattern Recognition Algorithm
I am designing a logic analyzer and I would like to implement some Matrix Algorithm.
I have several channels each one represented by a row in the matrix and every element in the column would be the state, for example:
Performance of single-assignment ADT oriented code on modern CPUs
Working in immutable data with single assignments has the obvious effect of requiring more memory, one would presume, because you’re constantly creating new values (though compilers under the covers do pointer tricks to make this less of an issue).
I’m being warned that the Monoid I’m creating is an Orphan Instance. Is there a better way to write this functionality in?
type PromptSegment = IO (Maybe String) instance Monoid a => Monoid (IO a) where mempty = return mempty mappend = liftA2 (<>) This behaves exactly how I want for my purposes. For example: ghci> let a = return $ Just “hello” :: IO Maybe String ghci> let b = return $ Just ” world” :: […]
What do I use for a variant in a UML class diagram?
Does standard UML specify how a variant (aka tagged union, discriminated union, sum type, etc) should be depicted in a class diagram?
ADT design choices
How do you go about deciding which of the following two representations (in F# syntax) is the right choice in a particular situation?
ADT design choices
How do you go about deciding which of the following two representations (in F# syntax) is the right choice in a particular situation?
ADT design choices
How do you go about deciding which of the following two representations (in F# syntax) is the right choice in a particular situation?