This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Functional Bowling Kata solution in F# | |
// | |
// uses recursive determination of the score starting with a certain frame number | |
// and lookahead for the bonus roll scores | |
// | |
let private frames_in_game = 10 | |
type FrameType = Strike | Spare | Normal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Event-sourced solution to the Bowling Kata | |
// This is obviously neither a 'simple' solution for the Kata, nor an infrastructure focussed event sourcing demo, | |
// but rather intended to demonstrate event sourcing *principles* in a minimalistic domain. | |
// Philip Jander, 2019 | |
// (thanks to Ralf Westphal (@ralfw) for posing the challenge) | |
// ATTN: functional code, read from the end of the file :) | |
/// Computation Expression Builder for functional event sourcing | |
module EventSourced = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
namespace Sandbox | |
{ | |
class Program | |
{ | |
public Program() | |
{ | |
Readonly_mit_Field = 5; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
The goal in this exercise is to create a model to predict | |
how many bicycles will be used in a day, given the | |
available information. | |
Data source: UC Irvine Machine Learning dataset, "bike sharing": | |
https://archive.ics.uci.edu/ml/datasets/Bike+Sharing+Dataset | |
We will first explore the data, using the CSV type provider | |
and fsharp.Charting to visualize it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// adapted from : http://stackoverflow.com/questions/3151702/discriminated-union-in-c-sharp by Juliet | |
public abstract class Union<TA, TB, TC> | |
{ | |
public static Case1 Create(TA x) { return new Case1(x);} | |
public static Case2 Create(TB x) { return new Case2(x);} | |
public static Case3 Create(TC x) { return new Case3(x);} | |
public abstract T Match<T>(Func<TA, T> f, Func<TB, T> g, Func<TC, T> h); | |
private Union() { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public sealed class DatabaseObserver : IDisposable | |
{ | |
private readonly string _connectionstring; | |
private readonly string _sqlcommand; | |
private readonly Action<Observation> _onChange; | |
private readonly Action<Exception> _onError; | |
private readonly Action<string> _onWarning; | |
private SqlConnection _connection; | |
private SqlCommand _cmd; | |
private SqlDependency _dependency; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type OptionDefault<'a> = | |
| Default of 'a | |
| Lazy of (unit->'a) | |
| Expected of reason:string | |
let (|.) (opt:'a option) (def:OptionDefault<'a>) : 'a = | |
match opt with | |
| Some (v) -> v | |
| None -> | |
match def with |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
F# Game of life | |
Philip Jander | |
@ph_j | |
2015 | |
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. | |
https://creativecommons.org/licenses/by-nc-sa/3.0/ | |
*) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########################################################################## | |
# RAKE BUILD SCRIPT # | |
# (c) Philip Jander 2012, 2013 # | |
# Jander.IT # | |
########################################################################## | |
RAKEFILE_REVISION = "2.3" | |
# | |
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public sealed class Host | |
{ | |
private readonly string _zmqEndpoint; | |
private readonly Action<Action> _dispatcher; | |
private static ZmqSocket _server; | |
private static readonly ConcurrentQueue<Action> WaitToSend = new ConcurrentQueue<Action>(); | |
public Host(string zmqEndpoint, Action<Action> dispatcher) | |
{ | |
_zmqEndpoint = zmqEndpoint; |
NewerOlder