Questions tagged [f#]
F# is a succinct, expressive, and efficient functional and object-oriented language for .NET
33
questions
6
votes
1
answer
546
views
Blockchain implementation in F#: Block and Blockchain
Some time ago I started writing a blockchain implementation for learning purposes. I used this article as reference. Originally I wrote the code in C# but recently I have rewritten everything to F#. ...
5
votes
2
answers
231
views
Constructing a simple tree with ASCII in F#
This is just a basic HackerRank challenge I was working on to better understand F#. Its purpose is just to print a tree that has a straight 'trunk' of \$n\$, splits into 2 branches which diverge to \$...
3
votes
1
answer
321
views
F# implementation of the A* algorithm
This is my first attempt at writing something useful in F# and in a functional way in general. I would appreciate if you could point out any issue, even details, as I'd like to put all the bad habits ...
25
votes
2
answers
2k
views
First real-world F# application - how "good"/idiomatic is it? (long!)
After reading/watching various introductions and blog posts and some code here and there, doing a bit of the Try F# tutorial and starting to read "Real World Functional Programming", I felt I should ...
11
votes
1
answer
492
views
American Checkers
I am implementing the logic for a Checkers game in F#. I am writing my code in a library so it can be called from any UI provider, and am trying to do it in good FP style. I currently have the ...
10
votes
2
answers
394
views
You can't sink me
Here is a Battlehips game in F#. Now, before you start jumping up and down on my code, please understand that, for all its awesomeness, F# has a serious limitation: Its compilation is linear, and the ...
8
votes
2
answers
732
views
Caesar cipher in F#
I'm trying to broaden my horizon by learning functional programming (coming from OO, specficially C#). For this, I'm implementing some small problems to get a feeling for the language. One of my first ...
7
votes
0
answers
116
views
Agent-based Immutable Map
I am in the process of removing the last few pieces of mutable state from an F#-based distributed system. Some of the remaining mutable state is a ...
7
votes
1
answer
122
views
World's worst Christmas tree
Inspired by this question, I decided to grow my own fractal tree.
The problem is: given an integer \$n\$, \$0 \leq n \leq 5\$, print the \$n\$th iteration of the fractal tree. The tree is probably ...
7
votes
1
answer
580
views
F# inventory system
To learn F#, I've implemented this very simple inventory system. While I'm proud that that it's my first program, and that it works, there are still a few areas that I'd like tips on, namely these:
I ...
7
votes
1
answer
107
views
Streaming a Pin functionally(ish)
Earlier today I wrote a question (Validating a StreamingPin) and I thought it was a good idea (apparently I was the only one who thought so, but whatever), so I proceeded further with it and developed ...
6
votes
1
answer
70
views
Analyzing spoke overlaps during rotation
For a personal project that I've recently started I have to analyze the rotation of two shapes with sets of spokes, where the spokes are evenly-spaced, and split into a given number.
That is, if I ...
6
votes
1
answer
433
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 ...
5
votes
1
answer
454
views
RSS Parser for Blog Feed
I'm building an RSS feed parser so, later, I can retrieve recent blog posts on my word press blog and display recent posts on my other website. This code isn't intended to implement the full RSS spec. ...
5
votes
1
answer
339
views
The Functional FizzBuzz Kata
I run a coding dojo at work. For one session I'm to showing that you can use a kata to get into a new language.
I'm using the FizzBuzz Kata to to show F# (and JavaScript) because it is short. The ...
5
votes
2
answers
379
views
Project Euler 3: Getting the largest prime factor of a number
I'm looking for some general feedback on my solution to Project Euler challenge 3
The prime factors of 13195 are 5, 7, 13 and 29. What is the largest
prime factor of the number 600851475143 ?
<...
5
votes
3
answers
1k
views
Partitioning a list in F# based on whole group characteristics
I only started programming in F# yesterday, so I've not yet discovered what idiomatic F# actually looks like.
The first task I set myself required partitioning a list into smaller lists but where the ...
5
votes
1
answer
148
views
Tally Calculator for Baloot in F#
This is a tally calculator for the Saudi card game Baloot. As in, they're a set of functions so that the user would provide their winnings at the end of a round (card captured, projects declared, etc) ...
5
votes
1
answer
2k
views
Battleship Game
Inspired by this question, I went on with the following version. My goal was to focus on pure functions, to avoid mutable variables and to be strictly functional.
I have ignored the computer player ...
4
votes
1
answer
190
views
Transform Bitmap object into jagged array of RGB tuple values
I've been working on this module with the assistance of codereview, and based on the responses and my own research, this is my project so far. The goal behind the code is that it starts with a .NET ...
4
votes
1
answer
1k
views
Conway's Game of Life in F#
Since I'm learning F# along with functional programming, I managed to implement the rules for Conway's Game of Life. I'm not sure if I can improve some of its parts, though. For example, the ...
4
votes
2
answers
634
views
Reverse Polish Notation in F#
In my question to learn F#, I've decided to get one step closer to creating a programming language, and implement this simple Reverse Polish Notation "interpreter" of sorts.
It does not allow for ...
4
votes
1
answer
315
views
Reporting the highest satisfied poker hand in F#
I'm learning F# by doing various small projects. One of them is a problem where the program reads Poker hands and rates them. It's Texas Hold'Em, so for each player it tries every five card selection ...
4
votes
2
answers
210
views
Compact game of life implementation
I am learning F# and implemented Conway's Game of Life as an exercise (There are also other implementations on CodeReview). I have tried to forget all my object-oriented background and practice "...
3
votes
1
answer
302
views
Euler 2 : Simple Fibonacci
I'm just starting to experiment with F# (from a C# background). I think I'm starting to get into the right way of thinking, but this code still seems pretty awkward. Is there a better (more terse) ...
3
votes
2
answers
521
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:
...
3
votes
1
answer
205
views
Refactoring while-do into tail recursion with F#
I have a while-do loop nested inside a while-do loop in my program, due to it needing to iterate in two dimensions through an array of arrays, and originally my loop looked like this:
...
3
votes
1
answer
487
views
Transforming a byte array into an array of byte arrays with F#
This code is intended to be used with an image manipulation library that I'm working on, and the goal is to take the raw byte[] data from an image, and transform it into a 2D array where each position ...
3
votes
1
answer
191
views
Locating a bitmap inside another (larger) bitmap with F#
This is my firstish (heavily rewritten) go at the completed project that I've been working on with CodeReview assistance, so further advice is appreciated! See here, here and here for the past history ...
2
votes
1
answer
321
views
Summations and products in F#
I was bored, and looking to do something that involved anonymous functions, and it was suggested by @Quill, that I create a summation function. I decided to also include a product function as well to ...
2
votes
1
answer
50
views
Connect elements of a list to elements of an other list using a two-dim array
Story:
I build a kind of labyrinth. This labyrinth is divided in seven steps. You start with the first, then second, and so on to the seventh. You cannot go back to a previous step. Each step ...
1
vote
1
answer
219
views
Load bitmap object data into array of byte values
I'm building this as part of a larger class to rapidly search for smaller images inside larger images. This is my first serious F# project so comments especially concerning style and organization are ...
1
vote
1
answer
154
views
SalesTax challenge
This is the same problem, but I decided to do it using F#. I'm just interested in how I can improve it.
...