F# is a succinct, expressive and efficient functional and object-oriented language for .NET, which helps you write simple code to solve complex problems. It is a descendant from the ML family of programming languages. For more information about F#, visit the F# homepage at MSDN. See also Getting ...
2
votes
1answer
360 views
Symbolic derivative in C#
I have translated the following F# code to C# and would appreciate constructive criticism. This code computes the symbolic derivative of the expression f(x)=x³-x-1:
type Expr =
| Int of int
| Var ...
0
votes
0answers
32 views
Lots of similar classes F#
Ok
I have a game that has a board,
as some IMoves which are applies to the board to turn it into a new one.
there are two placement moves
Raise - remove one piece, and place another
Place - just ...
5
votes
1answer
107 views
F# Djikstras shortest path implementation
I'm just getting my feet wet with F#, by implementing some simple algorithms. First up: Djikstras shortest path.
There is one piece I've written in this code which confuses me as to why it works: the ...
2
votes
2answers
164 views
How can this functional implementation of Kadane's algorithm be improved?
Some time ago I posted on Stack Overflow an imperative C# implementation of Kadane's algorithm for finding a subarray with maximum sum. Then I considered implementing the same functionally in F# and ...
2
votes
1answer
112 views
F# basic neural network
I just programmed a basic neural network in F# to learn the logical OR function. As I am very new to F# and especially functional programming, I did it the imperative way. And even tho it works, I ...
2
votes
1answer
75 views
F# String Calculator - I am just Learning F#
This is some of my first real F# code ever. I have done a bit of reading and watched a few videos however. I chose to do a code kata for string calculator to try it out.
I am pretty happy with this, ...
3
votes
1answer
245 views
Review an asynchronous/message-oriented library actor
I'd like to get input on a F# actor that coordinates receives around a blocking message buffer. The actor is a piece of code that continuously tries to fetch messages from Azure Service Bus.
(*
...
3
votes
2answers
149 views
Immutable pure data classes with public setters on properties
I'm putting together some classes as a model for some information (that I'm currently pulling from a website).
The classes are implemented in C# - because in the current version of F# there are no ...
2
votes
2answers
160 views
Using a Function to emulate F# Match in C#
So this was inspired by:
this question
But doesn't actually answer it:
What do you think of:
public class Case<TRes>
{
public Case(bool condition, Func<TRes> result)
{
...
7
votes
1answer
241 views
Deleting from Red Black Tree in F#
Yes I'm very slowly making my way through Purely Functional Data Structures. So I went through the section on Red Black Trees. What he presents is amazingly concise, except for the fact that he didn't ...
4
votes
3answers
288 views
Is there any way to improve (shorten) this F# code?
I have a very good grasp of the syntax and features of F# as well as some of the concepts that mesh well with the language. However, I do not have enough experience writing it to feel comfortable that ...
6
votes
1answer
427 views
Approach to programmatically building hierarchical GUI components
At work I am developing an application using hand-coded Swing, and I've found that I have an easier time reading, writing, and maintaining hierarchical component creation using code blocks like:
...
4
votes
1answer
215 views
Can anyone offer tips on making code more performant and more functional
The following block of code needs to be as fast as possible as it likely to be called many 1000s of times in a run. I am also conscious that my thinking style is leaning towards a more procedural ...
4
votes
1answer
334 views
What do you think of my Map implementation?
Just as a refresher I put together a simple Map implementation and I would love to get some feedback on it.
open System
open System.Collections.Generic
type Node<'a, 'b when 'a : comparison> = ...
3
votes
1answer
196 views
How can I make this F# more functional?
I am currently learning myself a little F# and have written the following code to practice.
The code uses the Mono.Cecil library to inject some IL at the start of every method in each .net assembly ...