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
//https://ocharles.org.uk/blog/guest-posts/2013-12-22-24-days-of-hackage-profunctors.html | |
//http://blog.sigfpe.com/2011/07/profunctors-in-haskell.html | |
//https://www.schoolofhaskell.com/school/to-infinity-and-beyond/pick-of-the-week/profunctors | |
public interface Variant { } | |
public interface CoVariant { } | |
public interface Profunctor<P> | |
{ | |
P p { get; } |
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
//how to implement CRUD with F# and entityframework and TypeClasses | |
//transform this into an highorder type | |
type Customer with static member queryId = <@ fun ( λ : Customer ) -> λ.Id @> | |
//just a helper | |
type entity<'T> = ('T -> int) | |
//our highorder context |
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.ComponentModel.DataAnnotations; | |
using System.ComponentModel.DataAnnotations.Schema; | |
using System.Data.Entity; | |
using System.Data.Entity.Core; | |
using System.Data.Entity.Core.Mapping; | |
using System.Data.Entity.Core.Metadata.Edm; | |
using System.Data.Entity.Core.Objects; | |
using System.Data.Entity.Core.Objects.DataClasses; | |
using System.Data.Entity.Infrastructure; | |
using System.Data.Linq; |
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
function x($i) { $i.Replace("`r", '').Replace("`n", '').Replace(" ",'').Replace("'", '"') } | |
$f = join-path (get-location) 'screen' | |
$l = join-path (get-location) 'log.txt' | |
pushd 'C:\Program Files\VideoLAN\VLC' | |
./vlc.exe ` | |
-I dummy ` | |
(x "screen://") ` | |
(x @" | |
--sout=#transcode{ |
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 "cv.h" | |
#include "highgui.h" | |
#include <iostream> | |
#include <string> | |
using namespace std; | |
void help(const string& exec_name) { | |
cout << exec_name << " src tgt w h" << endl; |
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 static class ParallelExtensions | |
{ | |
/// <summary> | |
/// Enumerates through each item in a list in parallel | |
/// </summary> | |
public static void ForEachParallel<T>(this IEnumerable<T> list, Func<T, int, AsyncCallback, IAsyncResult> beginAction, Action<T, int, object, IAsyncResult> endAction, int parallelization = 0) | |
{ | |
if (list == null) { | |
return; |
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
https://teachyourselfcs.com/ | |
http://steshaw.org/plt/ | |
https://github.com/open-source-society/computer-science | |
PLT: advanced | |
textbooks | |
http://cs.brown.edu/~sk/Publications/Books/ProgLangs/ | |
http://www.cis.upenn.edu/~bcpierce/tapl/main.html | |
http://highered.mheducation.com/sites/0070131511/index.html |
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
let rec y f x = f (y f) x | |
let memoize (d:System.Collections.Generic.Dictionary<_,_>) f n = | |
if d.ContainsKey n then d.[n] | |
else d.Add(n, f n);d.[n] | |
let rec factorialucps factorial' n cont = | |
if n = 0I then cont(1I) else factorial' (n-1I) (fun k -> cont (n*k)) | |
let factorialdpcps = |
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
////////////////////////////////////////////////////////////////////////////////////////// | |
// first try, trying to generalize over overloading, nope, cant generalize over | |
// two overloads | |
let inline backend<'M, 'C, 'VM when 'C : (new : unit -> 'C) | |
and 'C : (member Get : unit -> 'M seq) | |
and 'C : (member Get : int Nullable -> 'M seq) | |
and 'C : (member Get :'M Selector -> 'M seq)> () = | |
let getGet0 ( controller : ^C ) () = |
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
class Random | |
{ | |
private: | |
function<int(void)> rnd; | |
public: | |
Random() { | |
auto rnde = default_random_engine(); | |
auto rndd = uniform_int_distribution<int>( | |
numeric_limits<char>::min(), |