- Install dotnet: https://dotnet.microsoft.com/en-us/download
- Create a folder named for example:
CsDymamic
- Create file in the folder named:
CsDyamic.csproj
and copy the content of1_CsDyamic.csproj
into that file - Create file in the folder named:
Program.cs
and copy the content of2_Program.cs
below into that file - Launch the application in Visual Studio or through the command line
dotnet run
from the folderCsDymamic
type 'T PushStream = ('T -> bool) -> bool | |
// I wrote a blog about PushStream for F# advent 2022 | |
// https://github.com/mrange/PushStream6 | |
// I am appealed to them both because of their simplicity and performance | |
// When generating values I need a place to my values after creation | |
// PushStreams turn out to be very convenient | |
module PushStream = | |
[<GeneralizableValue>] | |
let empty<'T> : 'T PushStream = fun r -> true |
using System.Collections; | |
using System.Text; | |
using System.Text.Json; | |
using System.Text.Json.Serialization; | |
namespace Shared | |
{ | |
partial class RecordArrayConverter<T> : JsonConverter<RecordArray<T>> | |
{ | |
public RecordArrayConverter() {} |
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<OutputType>Exe</OutputType> | |
<TargetFramework>net6.0</TargetFramework> | |
</PropertyGroup> | |
<ItemGroup> | |
<Compile Include="Program.fs" /> | |
</ItemGroup> |
- WPF requires a Windows box
- Install dotnet: https://dotnet.microsoft.com/en-us/download
- Create a folder named for example:
FsLanding
- Create file in the folder named:
FsLanding.fsproj
and copy the content of1_FsLanding.fsproj
below into that file - Create file in the folder named:
Program.fs
and copy the content of2_Program.fs
below into that file - Launch the application in Visual Studio or through the command line
dotnet run
from the folderFsLanding
This is an example on how to use WPF and F# to do a simple physics game using Verlet Integration.
The program creates a system of particles and constraints. Particles have inertia and is affected by gravity but their motion is also contrained by the constraints.
You control the ship by firing rockets attached to the ship. Use the arrow keys to fire the rockets.
I tried to annotate the source code to help guide a developer familiar with languages like C#. If you have suggestions for how to improve it please leave a comment below.
When trying out VB + ImageSharp I run into strange compiler errors.
1_ImageSharp.cs
works fine in C# but the same program in VB 2_ImageSharp.vb
produces the errors:
2>C:\code\2_ImageSharp.vb(7,34): error BC32044: Type argument 'Rgba32' does not inherit from or implement the constraint type '?'.
2>C:\code\2_ImageSharp.vb(7,34): error BC30649: '' is an unsupported type.
using System.Runtime.InteropServices; | |
using System.Text; | |
static class Program | |
{ | |
// Using MCI Win32 API | |
[DllImport("winmm.dll")] | |
static extern Int32 mciSendString(string command, StringBuilder? buffer, int bufferSize, IntPtr hwndCallback); | |
// This is needed for MCI from my testing, it does makes sense |
This is an example on how to use WPF and F# to do some simple physics using Verlet Integration.
The program creates a system of particles and constraints. Particles have inertia and is affected by gravity but their motion is also contrained by the constraints.
I tried to annotate the source code to help guide a developer familiar with languages like C#. If you have suggestions for how to improve it please leave a comment below.
This is an example on how to use WPF and F# to draw simple graphics intended to help devs interested in F# to experiment with a simple yet not trivial app.
I tried to annotate the source code to help guide a developer familiar with languages like C#. If you have suggestions for how to improve it please leave a comment below.
- WPF requires a Windows box, maybe I get around to do a Avalonia demo later.
- Install dotnet: https://dotnet.microsoft.com/en-us/download