This file contains hidden or 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 interface IMaybe<T> | |
{ | |
IMaybe<U> Fmap<U>(Func<T,U> apply); | |
IMaybe<U> Bind<U>(Func<T,IMaybe<U>> apply); | |
IMaybe<V> Bind<U, V>(Func<T, IMaybe<U>> func, Func< U, V> map); | |
void Foreach(Action<T> action); | |
U Fold<T,U> (Func<T,U> some, Func<U> none); | |
} | |
public static class MaybeExtensions |
This file contains hidden or 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; | |
using System.Collections.ObjectModel; | |
using System.Linq; | |
using System.IO; | |
using System.Reactive.Linq; | |
using System.Reactive.Concurrency; | |
namespace Alchemy.Framework | |
{ |
This file contains hidden or 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; | |
using System.Linq; | |
using System.Collections; | |
using System.Text; | |
namespace CSharpPermutations | |
{ | |
public interface IPermutable<T> |
This file contains hidden or 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
#include <iostream> | |
namespace stdextensions | |
{ | |
template<class T, size_t N> | |
class array_rep{ | |
public: | |
array_rep() = default; | |
array_rep(array_rep const& ) = default; |
This file contains hidden or 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
module Main where | |
data List a = Nil | Cons a (List a) | |
deriving (Show) | |
data Tree a = Empty | Node a (Tree a) (Tree a) | |
deriving (Show) | |
append :: (Ord a) => Tree a -> a -> Tree a | |
append Empty a = Node a (Empty) (Empty) |
This file contains hidden or 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
module Main where | |
appendSwapped :: [(a,a)] -> [(a,a)] | |
appendSwapped [] = [] | |
appendSwapped xs = xs ++ (flipped xs) | |
where flipped li = foldr (\c d -> swaptuple c : d ) [] li | |
swaptuple (a,b) = (b,a) | |
main :: IO () | |
main = print $ appendSwapped [(1,2), (3,4)] |
This file contains hidden or 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
seperateAt :: Int -> [a] -> ([a],[a]) | |
seperateAt 0 [] = ([], []) | |
seperateAt 0 xs = ([], xs) | |
seperateAt n (x: []) = (x : [], []) | |
seperateAt n (x:xs) = | |
let result = (seperateAt (n - 1) xs) | |
in (x : fst result, snd result) |
This file contains hidden or 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
#include <iostream> | |
#include <memory> | |
template<class T> | |
class Option{ | |
public: | |
Option() : value_(nullptr){ | |
} | |
Option(T const& value) : value_(std::move(value)){ | |
This file contains hidden or 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
#ifndef DRAWING | |
#define DRAWING | |
#include <memory> | |
#include <iostream> | |
namespace concepts{ | |
namespace drawing{ | |
struct concept_t{ | |
concept_t() = default; |
This file contains hidden or 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
#include <iostream> | |
#include <vector> | |
#include <memory> | |
#include <algorithm> | |
class drawable_concept{ | |
public: | |
drawable_concept() = default; | |
virtual ~drawable_concept() = default; | |
drawable_concept(drawable_concept const&) = delete; |