Daniel

Texas

1d
comment F# equivalent of `is` keyword in C#?
@sacha: Given that there's a built-in type test operator (:?), is<'T> doesn't provide much value. Compare cat is<Animal> to cat :? Animal.
Dec
12
answered How to compare individual values in f# matrices?
Dec
12
comment F# "Stateful" Computation Expression
Since you're apparently doing black magic you're on your own. :)
Dec
12
comment F# "Stateful" Computation Expression
In that case, a simpler option might be defining an ofList function for your type.
Dec
12
answered F# "Stateful" Computation Expression
Dec
12
awarded Notable Question
Dec
10
comment Struct in NXC and F#
You want to create a zeroed array of structs?
Dec
10
comment Reflection.Emit unsafe code
Ah, too easy. Glad you figured it out.
Dec
10
comment How can I Implement my own List.partition using tail-recursion?
@user2023861: That was a mistake. I copied/tweaked the code from the referenced answer and missed that. It's fixed. Good catch.
Dec
10
revised How can I Implement my own List.partition using tail-recursion?
deleted 50 characters in body
Dec
10
answered Reflection.Emit unsafe code
Dec
10
answered How can I Implement my own List.partition using tail-recursion?
Dec
10
comment How can I Implement my own List.partition using tail-recursion?
It's best to just call List.rev before returning the accumulator. CPS will perform much worse.
Dec
10
answered Read list of int from Console
Dec
9
comment F# wrapping statements in a do block
While a standalone method call appears the same in C# and F#, F# asserts that such calls return unit, which makes do superfluous in many cases.
Dec
8
comment How do I Override GetHashCode and CompareTo for a Discriminated Union in F#?
Up-casting syntax is b :> IComparable.
Dec
8
comment How do I Override GetHashCode and CompareTo for a Discriminated Union in F#?
@user2023861: Replace box with a cast to IComparable.
Dec
8
comment Convert Tuple to Array in F# and Xamarin
F# always does what you want. :-)
Dec
4
comment Ordering a sequence of objects
Right. You can think of the lambda as a "mapping" from input element to key. Or, as the docs explain: Applies a key-generating function to each element of a sequence and yields a sequence ordered by keys
Dec
4
comment Ordering a sequence of objects
Yes, the inner lambda returns an int (via findIndex), and int is comparable. You pass sortBy a function that returns a comparable value. It's like input |> Seq.map lambda |> Seq.sort, except the type of the input is preserved.
1 2 3 4 5