Skip to content

Instantly share code, notes, and snippets.

View MikeMKH's full-sized avatar
:shipit:
Learning about logic programming with Prolog

Mike Harris MikeMKH

:shipit:
Learning about logic programming with Prolog
  • Milwaukee, WI
  • 04:01 (UTC -05:00)
View GitHub Profile
@MikeMKH
MikeMKH / FizzBuzzerTests.cs
Created November 21, 2014 13:04
FizzBuzz kata in C# using LINQ and "infinite" list.
using System;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace FizzBuzz
{
[TestClass]
public class FizzBuzzerTests
{
private static void AssertThat(string expected, int value)
@MikeMKH
MikeMKH / CoinChangerTests.cs
Created December 1, 2014 12:59
Coin Changer kata with Map in C# using MS Test
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace CoinChanger
{
[TestClass]
public class CoinChangerTests
{
[TestMethod]
public void GivenZeroWithNoCoins_ItMustReturnEmptyArry()
@MikeMKH
MikeMKH / CoinChangerTests.cs
Created December 2, 2014 13:10
Coin Changer kata with Reduce using C# with MS Test
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace CoinChangerKata
{
[TestClass]
public class CoinChangerTests
{
@MikeMKH
MikeMKH / CoinChangerTests.cs
Created December 3, 2014 13:06
Coin Changer kata with Map in C# using MS Test
using System;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace CoinChanger
{
[TestClass]
public class CoinChangerTests
{
[TestMethod]
@MikeMKH
MikeMKH / CoinChangerTests.cs
Created December 4, 2014 13:07
Coin Changer kata with Reduce in C# using MS Tests
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace CoinChanger
{
[TestClass]
public class CoinChangerTests
{
@MikeMKH
MikeMKH / RomanNumeralTests.cs
Created December 5, 2014 13:03
Roman Numeral kata with Reduce in C# using MS Tests
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace RomanNumerals
{
[TestClass]
public class RomanNumeralTests
{
[TestMethod]
@MikeMKH
MikeMKH / repl.cs
Last active August 29, 2015 14:12
FizzBuzz kata in C# using LINQ and "infinite" list. **NOTE** This was done using Mono's C# REPL, just throw this in a Console Application to try it out in Visual Studio.
var inf = Enumerable.Range(0, int.MaxValue);
var fizzes = inf.Select(x => x%3 == 0 ? “Fizz” : “”);
var buzzes = inf.Select(x => x%5 == 0 ? “Buzz” : “”);
var numbers = inf.Select(x => x.ToString());
var fizzbuzzer =
fizzes
.Zip(buzzes, (f, b) => f + b)
.Zip(numbers, (fb, s) => fb == “” ? s : fb);
@MikeMKH
MikeMKH / repl.clj
Created January 3, 2015 17:22
Very simple examples of Zip in LINQ in C#, Map in Clojure, and ZipWith in Haskell
(map + [1 2 3] [10 20 30])
;;(11 22 33)
(map + [1 2] [10 20 30])
;;(11 22)
(map + [1 2 3] [10 20])
;;(11 22)
@MikeMKH
MikeMKH / repl.clj
Created January 11, 2015 17:23
Mapcat with the identity function in C# and Clojure.
(mapcat identity [[1 2 3 4] [20 10]])
;;(1 2 3 4 20 10)
@MikeMKH
MikeMKH / repl.clj
Created January 11, 2015 17:33
Very simple example of Mapcat in C# and Clojure
(mapcat #(map inc %) [[1 2 3 4] [20 10]])
;; (2 3 4 5 21 11)
(map inc
(mapcat identity [[1 2 3 4] [20 10]]))
;;(2 3 4 5 21 11)
(->>